note 49972 deleted from security.database.sql-injection by bjori

From: Date: Wed, 12 Apr 2006 15:02:50 +0000
Subject: note 49972 deleted from security.database.sql-injection by bjori
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-107887@lists.php.net to get a copy of this message
Note Submitter: El Guapo ---- In reference to: Example 27-2. Splitting the result set into pages ... and making superusers (PostgreSQL and MySQL) This example seems to want to give an example of how someone can inject another SQL statement (rather than a subquery, or whatever other technique) into the intended SQL statement. I'm not sure about the PostgreSQL part, but the MySQL part is misleading. The 2nd grey box seems to say that if you put: 0; UPDATE user SET Password=PASSWORD('crack') WHERE user='root'; FLUSH PRIVILEGES; into $offset: $query = "SELECT id, name FROM products ORDER BY name LIMIT 20 OFFSET $offset;"; then mysql_query(); will execute it. But mysql_query() doesn't execute mulitiple statements. So, I think this is poor example and quite misleading -- causing someone not familiar with MySQL to believe mysql_query() executes mulitple SQL statements.

« previous php.notes (#107887) next »