-
Notifications
You must be signed in to change notification settings - Fork 42
CVE-2023-34600: add 'intval()' to parse ['id'] #104
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: master
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 | ||||
|---|---|---|---|---|---|---|
|
|
@@ -93,7 +93,7 @@ | |||||
| if ( isset($_GET['id']) ) | ||||||
| { | ||||||
| //PreInit these values | ||||||
| $content['FieldID'] = DB_RemoveBadChars($_GET['id']); | ||||||
| $content['FieldID'] = intval(DB_RemoveBadChars($_GET['id'])); | ||||||
|
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. P1: Forced Prompt for AI agents
Suggested change
|
||||||
|
|
||||||
| if ( isset($fields[$content['FieldID']]['FieldID']) ) | ||||||
| { | ||||||
|
|
@@ -139,7 +139,7 @@ | |||||
| if ( isset($_GET['id']) ) | ||||||
| { | ||||||
| //PreInit these values | ||||||
| $content['FieldID'] = DB_RemoveBadChars($_GET['id']); | ||||||
| $content['FieldID'] = intval(DB_RemoveBadChars($_GET['id'])); | ||||||
|
|
||||||
| // Get UserInfo | ||||||
| $result = DB_Query("SELECT FieldCaption FROM " . DB_FIELDS . " WHERE FieldID = '" . $content['FieldID'] . "'"); | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -186,7 +186,7 @@ | |
| if ( isset($_GET['id']) ) | ||
| { | ||
| //PreInit these values | ||
| $content['USERID'] = DB_RemoveBadChars($_GET['id']); | ||
| $content['USERID'] = intval(DB_RemoveBadChars($_GET['id'])); | ||
|
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. P1: Incomplete SQLi mitigation: the patch casts GET Prompt for AI agents |
||
|
|
||
| $sqlquery = "SELECT * " . | ||
| " FROM " . DB_USERS . | ||
|
|
@@ -228,7 +228,7 @@ | |
| if ( isset($_GET['id']) ) | ||
| { | ||
| //PreInit these values | ||
| $content['USERID'] = DB_RemoveBadChars($_GET['id']); | ||
| $content['USERID'] = intval(DB_RemoveBadChars($_GET['id'])); | ||
|
|
||
| if ( !isset($_SESSION['SESSION_USERNAME']) ) | ||
| { | ||
|
|
||
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.
This change incorrectly assumes that
FieldIDis always an integer. However,FieldIDcan be a string for both internal fields (e.g.,SYSLOG_HOST) and for user-defined fields.Using
intval()on a non-numeric stringFieldIDwill convert it to0, causing operations like 'edit' or 'delete' to target the wrong field. This is a significant bug.To fix the SQL injection vulnerability correctly for this string identifier, please use a proper database escaping function instead of
intval(). For example:If your database abstraction layer doesn't provide an escaping function, you should use one specific to your database driver (e.g.,
mysqli_real_escape_string()).This feedback also applies to the change at line 142.