DEF CON CTF Qualifier 2023 Writeup

この大会は2023/5/27 9:00(JST)~2023/5/29 9:00(JST)に開催されました。
今回もチームで参戦。結果は202点で535チーム中55位でした。
自分で解けた問題をWriteupとして書いておきます。

LiveCTF Practice Challenge (LiveCTF)

"WIN"という文字列を送り込めばよい。あとは送信方法に従って、ファイルを準備する。

$ cat << EOF > Dockerfile
> FROM livectf/livectf:quals-exploit
> COPY solve.py /
> WORKDIR /
> CMD ["python3", "solve.py"]
> EOF

$ cat <<EOF > solve.py
> from pwn import *
> HOST = os.environ.get('HOST', 'localhost')
> PORT = 31337
> r = remote(HOST, int(PORT))
> r.recvline_contains(b'Give me input: ')
> r.sendline(b'WIN')
> r.recvline_contains(b'You sent: ')
> r.sendline(b'./submitter')
> flag = r.recvline_contains(b'LiveCTF{').decode().strip()
> log.info('Flag: %s', flag)
> EOF

$ tar czf solution.tar.gz Dockerfile solve.py
$ curl https://play.livectf.com/api/challenges/7 -F exploit=@solution.tar.gz -H "X-LiveCTF-Token: ticket{AddressOffer4319n23:Apt2hUc_-RmmJiWjViHpu056lSGSBzX1LLKxvFUpN8uCLFWD}"
{"exploit_id":"3e3ed7ea-b756-4eab-8763-91261cd6418b","team_id":352,"team_token":"ticket{AddressOffer4319n23:Apt2hUc_-RmmJiWjViHpu056lSGSBzX1LLKxvFUpN8uCLFWD}","challenge_id":7,"archive_id":"964b9c9f-7598-4060-9de3-4391348a5907","status":"Submitted","score_awarded":null,"submission_time":"2023-05-28T05:48:36.236031333","run_duration":null}

$ curl https://play.livectf.com/api/exploits/3e3ed7ea-b756-4eab-8763-91261cd6418b -H "X-LiveCTF-Token: ticket{AddressOffer4319n23:Apt2hUc_-RmmJiWjViHpu056lSGSBzX1LLKxvFUpN8uCLFWD}"
{"exploit_id":"3e3ed7ea-b756-4eab-8763-91261cd6418b","team_id":352,"team_token":"ticket{AddressOffer4319n23:Apt2hUc_-RmmJiWjViHpu056lSGSBzX1LLKxvFUpN8uCLFWD}","challenge_id":7,"archive_id":"964b9c9f-7598-4060-9de3-4391348a5907","status":"RunSolved","score_awarded":null,"submission_time":"2023-05-28T05:48:36.236031","run_duration":0}

RunSolvedとなり、この問題はクリアした。