SQL 注入 DROP TABLE 不起作用 [英] SQL Injection DROP TABLE not working
问题描述
我需要使用 PHP/MySQL 演示 SQL Inject.我想在登录表单中注入一个 DROP TABLE 查询,但它永远不起作用.(TRUNCATE 表工作正常 OTOH).在我输入 ';删除表用户;#
作为字段输入;查询结果是
I need to demonstrate SQL Inject using PHP/MySQL. I want to inject a DROP TABLE query in a login form but it never works. (TRUNCATE table works fine OTOH).
After I input '; drop table users; #
as field input; query turns out to be
SELECT * FROM `users` WHERE `email` = ''; DROP TABLE users; #' AND `password` LIKE '3232';
但它永远不会使用 mysql_query() 函数工作.当我直接在 PHPmyAdmin 中复制/粘贴此查询时,它可以完美运行并且表被删除.可能是什么问题?
But it never works using mysql_query() function. When I copy/paste this query in PHPmyAdmin directly, it works perfectly and table gets dropped. What can be the issue?
推荐答案
这在 php/MySQL 中是不可能的,因为 php 不支持堆叠查询.注入分号 (;) 的那一刻它就会失败.
This is not possible in php/MySQL as php does not support stacked queries. The moment you inject semicolon (;) it will fail.
不过,您可以在 php-mysql 应用程序中使用 sql 注入进行许多其他更有创意的攻击.</p>
You can do many other much more creative exploits using sql injection in a php-mysql application though.
- 枚举所有数据库
- 表名和列名
- 存储在表中的值
- 上传一个 php 后门
也请检查 SQL-Map.
Check Out for SQL-Map as well.
这篇关于SQL 注入 DROP TABLE 不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!