この大会は2022/6/6 19:00(JST)~2022/6/10 21:00(JST)に開催されました。
今回は一人チームで参戦。結果は300点で455チーム中158位でした。
自分で解けた問題をWriteupとして書いておきます。
Welcome (Welcome)
Discordに入り、#rulesチャネルのルールを見ると、例としてフラグが書いてあった。
grey{1_h4ve_read_da_rules_and_4gr33}
Ghost (Misc)
いろんなコードで書かれているので、デコード等を行う。
・base64(CyberChefで「From Base64」→「From Hex」) This is not it man, try harder! ・brainf*ck(https://sange.fi/esoteric/brainfuck/impl/interp/i.htmlで実行) This is it? nah ・Pikalang(brainf*ck言語に変換後、実行) brainf*ck言語に変換する。 ++++++++++[>+>+++>+++++++>++++++++++<<<<-]>>>>++++++++.+++.---.<<++.>>++.+. →lol no ・Whitespace部分 Whitespaceとしてはデコードできない。 ・base32(CyberChefで「From Base32」) This is not the flag man D: ・rot13(CyberChefで「ROT13」) flag{notThatSimple:P}
Whitespace部分をスペースは0、タブは1にしてデコードする。
#!/usr/bin/env python3 with open('ghost', 'rb') as f: enc = f.read().splitlines() ct = enc[7] ct = ct.replace(b' ', b'0') ct = ct.replace(b'\t', b'1') flag = '' for i in range(0, len(ct), 8): flag += chr(int(ct[i:i+8], 2)) print(flag)
grey{gh0s7_byt3$_n0t_1nvisIbl3}
Image Upload (Misc)
httpでフィルタリングすると、ctf.pngをPOSTしているパケットがあるので、エクスポートする。
$ exiftool ctf.png ExifTool Version Number : 10.80 File Name : ctf.png Directory : . File Size : 76 kB File Modification Date/Time : 2022:06:07 11:42:13+09:00 File Access Date/Time : 2022:06:07 11:42:31+09:00 File Inode Change Date/Time : 2022:06:07 11:42:13+09:00 File Permissions : rwxrwxrwx File Type : PNG File Type Extension : png MIME Type : image/png Image Width : 996 Image Height : 954 Bit Depth : 8 Color Type : RGB with Alpha Compression : Deflate/Inflate Filter : Adaptive Interlace : Noninterlaced Pixels Per Unit X : 3780 Pixels Per Unit Y : 3780 Pixel Units : meters Author : akashchandrasekaran_grey{wireshark_exiftool_are_good} Image Size : 996x954 Megapixels : 0.950
grey{wireshark_exiftool_are_good}
Parcel (RE)
$ ./parcel Tell me the address of the function h12 (in decimal): 1 Tell me the address of the function t80 (in decimal): 1 Tell me the address of the function g20 (in decimal): 1 One of them was wrong :(
UPXアンパックし、各関数のアドレスを確認してみる。
$ upx -d parcel Ultimate Packer for eXecutables Copyright (C) 1996 - 2017 UPX 3.94 Markus Oberhumer, Laszlo Molnar & John Reiser May 12th 2017 File size Ratio Format Name -------------------- ------ ----------- ----------- 428392 <- 105224 24.56% linux/amd64 parcel Unpacked 1 file. $ objdump -d -M intel parcel | grep h12 0000000000403215 <h12>: $ objdump -d -M intel parcel | grep t80 0000000000406891 <t80>: $ objdump -d -M intel parcel | grep g20 0000000000402e21 <g20>:
>>> 0x0000000000403215 4207125 >>> 0x0000000000406891 4221073 >>> 0x0000000000402e21 4206113
$ ./parcel Tell me the address of the function h12 (in decimal): 4207125 Tell me the address of the function t80 (in decimal): 4221073 Tell me the address of the function g20 (in decimal): 4206113 Congrats! grey{d1d_y0u_us3_nm_0r_objdump_0r_gdb_0r_ghidra_0r_rizin_0r_ida_0r_binja?}
grey{d1d_y0u_us3_nm_0r_objdump_0r_gdb_0r_ghidra_0r_rizin_0r_ida_0r_binja?}
Too Fast (Web)
$ python3 dirsearch.py -u http://challs.nusgreyhats.org:14004/ -e html,php,txt Missing required dependencies to run. Do you want dirsearch to automatically install them? [Y/n] y Installing required dependencies... _|. _ _ _ _ _ _|_ v0.4.2.4 (_||| _) (/_(_|| (_| ) Extensions: html, php, txt | HTTP method: GET | Threads: 25 Wordlist size: 10276 Output File: /mnt/hgfs/Shared/dirsearch/reports/challs.nusgreyhats.org_14004/__22-06-08_17-42-39.txt Target: http://challs.nusgreyhats.org:14004/ [17:42:39] Starting: [17:42:46] 404 - 540B - /txt.tar : [17:43:40] 200 - 429B - /README.md : [17:47:29] 404 - 550B - /zeroclipboard.swf Task Completed $ curl http://challs.nusgreyhats.org:14004/README.md # t00 f4st ### Challenge Details a challenge testing on [Execution After Redirect](https://owasp.org/www-community/attacks/Execution_After_Redirect_(EAR)) ### Key Concepts - enumerate web - learn how to abuse Execution After Redirect ### Solution cURL or figure ways to view the flag before being redirected. Use Burp maybe. ### Learning Objectives same as key concept ### Flag grey{why_15_17_571LL_ruNn1n_4Pn39Mq3CQ7VyGrP}
grey{why_15_17_571LL_ruNn1n_4Pn39Mq3CQ7VyGrP}
Entry (Crypto)
4バイトごとにある鍵でXORされている。フラグは"grey"から始まることから鍵を算出し、復号する。
#!/usr/bin/env python3 enc = '982e47b0840b47a59c334facab3376a19a1b50ac861f43bdbc2e5bb98b3375a68d3046e8de7d03b4' enc = bytes.fromhex(enc) flag_head = b'grey' key = b'' for i in range(len(flag_head)): key += bytes([flag_head[i] ^ enc[i]]) flag = b'' for i in range(len(enc)): flag += bytes([enc[i] ^ key[i%len(key)]]) flag = flag.decode() print(flag)
grey{WelcomeToTheGreyCatCryptoWorld!!!!}