是否有可能利用以下查询中的sql注入?
mysql_query("SELECT `one`, `two`, `three` FROM test LIMIT ".$vulnerablepost.",2;") or die(mysql_error());可能的查询类型有哪些?是否可以执行SELECT OUTFILE?谢谢
发布于 2017-01-07 19:27:56
是的。因为可以对输入进行操作或调整以注入错误的SQL。如果您的输入值如下所示
$vulnerablepost = "20;delete from student_table;select 1";您最终将得到如下所示的SQL查询,该查询在语法上是正确的,但会给您带来麻烦
SELECT `one`, `two`, `three` FROM test LIMIT 20;delete from student_table;select 1,2;发布于 2017-01-09 04:47:07
是的,你不应该使用它。使用PDO或Mysqli。http://php.net/manual/en/ref.pdo-mysql.php
因此,除非您使用的是非常旧的PHP版本,否则不应该使用该函数。您甚至还可以查看该页面的文档。http://php.net/manual/en/function.mysql-query.php
Warning
This extension was deprecated in PHP 5.5.0, and it was removed in PHP 7.0.0. Instead, the MySQLi or PDO_MySQL extension should be used. See also MySQL: choosing an API guide and related FAQ for more information. Alternatives to this function include:
mysqli_query()
PDO::query()https://stackoverflow.com/questions/41520887
复制相似问题