-
Notifications
You must be signed in to change notification settings - Fork 2
fix: patch SQL injection, command injection, and config injection vul… #159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,8 +25,14 @@ | |
| $statement1 = $db_writable->prepare('DELETE FROM detections WHERE File_Name = :file_name LIMIT 1'); | ||
| ensure_db_ok($statement1); | ||
| $statement1->bindValue(':file_name', explode("/", $_GET['deletefile'])[2]); | ||
| $file_pointer = $home."/BirdSongs/Extracted/By_Date/".$_GET['deletefile']; | ||
| if (!exec("sudo rm $file_pointer 2>&1 && sudo rm $file_pointer.png 2>&1", $output)) { | ||
| $file_pointer = realpath($home."/BirdSongs/Extracted/By_Date/".$_GET['deletefile']); | ||
| $allowed_base = realpath($home."/BirdSongs/Extracted/By_Date/"); | ||
| if ($file_pointer === false || !str_starts_with($file_pointer, $allowed_base)) { | ||
| echo "Error - invalid file path"; | ||
| die(); | ||
| } | ||
| @unlink($file_pointer); | ||
| if (@unlink($file_pointer . ".png") || true) { | ||
|
Comment on lines
+34
to
+35
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
If PHP/caddy lacks write permission on a restored or externally mounted recordings directory, the audio Useful? React with 👍 / 👎. |
||
| echo "OK"; | ||
| } else { | ||
| echo "Error - file deletion failed : " . implode(", ", $output) . "<br>"; | ||
|
|
@@ -636,8 +642,9 @@ function changeDetection(filename,copylink=false) { | |
|
|
||
| if(isset($_GET['filename'])){ | ||
| $name = $_GET['filename']; | ||
| $statement2 = $db->prepare("SELECT * FROM detections where File_name == \"$name\" ORDER BY Date DESC, Time DESC"); | ||
| $statement2 = $db->prepare("SELECT * FROM detections WHERE File_name = :filename ORDER BY Date DESC, Time DESC"); | ||
| ensure_db_ok($statement2); | ||
| $statement2->bindValue(':filename', $name, SQLITE3_TEXT); | ||
| $result2 = $statement2->execute(); | ||
| $results = $result2->fetchArray(SQLITE3_ASSOC); | ||
| $sciname = $results['Sci_Name']; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When users follow the settings page guidance to put variables such as
$comnameor$confidencein the notification title, this whitelist removes the$before writingbirdnet.conf. The notification code later callsrender_template()on the title, so a title likeNew $comnameis saved asNew comnameand future alerts no longer include the detected species. Please preserve the supported$...tokens while still escaping the config value.Useful? React with 👍 / 👎.