-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Closed
Description
PHP-MySQLi-Database-Class/MysqliDb.php
Lines 969 to 983 in eaf1f6c
| public function where($whereProp, $whereValue = 'DBNULL', $operator = '=', $cond = 'AND') | |
| { | |
| // forkaround for an old operation api | |
| if (is_array($whereValue) && ($key = key($whereValue)) != "0") { | |
| $operator = $key; | |
| $whereValue = $whereValue[$key]; | |
| } | |
| if (count($this->_where) == 0) { | |
| $cond = ''; | |
| } | |
| $this->_where[] = array($cond, $whereProp, $operator, $whereValue); | |
| return $this; | |
| } |
Where() because of the special "forkaround".
If $whereValue happens to be an array, non parameterized $operator value is extracted from it.
However typical usage of the class looks like:
$db->where('ID', $_POST['id']);
$name = $db->getValue('USERS', 'name');The $whereValue is usually untrusted and if there are no additional checks like is_numeric($_POST['id']) an attacker may inject his statements. For example: id[= ? or 1=1 --]=0 (Url encoded version for HTTP POST: id%5B%3D%20%3F%20or%201%3D1%20--%5D=0)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels