Bsides Jeddah CTF 2021 Writeup
Contents




URL: https://ctf.bsidesjeddah.com/
2600点を獲得し、96位でした。
平日にやっていたCTFイベントです。
大きく分けて、pcap解析(+ Malware docxの解析)と Memory Dump解析になっています。
同じようなチャレンジや、その他いろいろと勉強になりそうなチャレンジが以下のサイトでいつでもできるようになっているようです。
https://cyberdefenders.org/labs/
時間があるときにやっておこうと思います。
以下、チャレンジの一覧です。









[PCAP]: Q#6 (50 points)
Challenge
What is the server certificate public key that was used in TLS session: 731300002437c17bdfa2593dd0e0b28d391e680f764b5db3c4059f7abadbb28e
Solution
WireSharkのdisplay filterは以下を使いました。
tls.handshake.session_id == 73:13:00:00:24:37:c1:7b:df:a2:59:3d:d0:e0:b2:8d:39:1e:68:0f:76:4b:5d:b3:c4:05:9f:7a:ba:db:b2:8e
このときのpubkeyは以下になっていました。
64089e29f386356f1ffbd64d7056ca0f1d489a09cd7ebda630f2b7394e319406
Flag: 64089e29f386356f1ffbd64d7056ca0f1d489a09cd7ebda630f2b7394e319406
[PCAP]: Q#8 (50 points)
Challenge
The attacker conducted a port scan on the victim machine. How many open ports did the attacker find?
Solution
192.168.112.128 (attacker) が 192.168.112.139 に対してTCP Port Scanをしているので、以下のフィルターを使います。
(ip.addr==192.168.112.139 && ip.addr==192.168.112.128) and tcp
一旦別pcapファイルで保存し、coversationから、csvとして保存、3パケット以下はエディターを使って除外し、Port番号で sort。
$ cat *.csv | cut -d, -f4 | sort -u 110 135 139 143 25 443 445 587 80
あとはどのポートが実際にOpenなのか見ていくんですが、まぁ答えが1桁の数字なのはわかっているので、テキトーに数字を入れたら当たります。
Flag: 7
[PCAP]: Q#15 (100 points)
Challenge
What is the MD5 hash of the email attachment?
Solution
Base64 Encodingされている部分をテキストに落としてからデコードします。
$ cat attachment.txt | tr -d "\n" | base64 -d > web_server.docx $ file web_server.docx web_server.docx: Microsoft OOXML $ md5sum web_server.docx 55e7660d9b21ba07fc34630d49445030 web_server.docx
なお、Windowsで動く NetworkMiner というツールを使ってもファイルは取り出せるはずです。
Flag: 55e7660d9b21ba07fc34630d49445030
[PCAP]: Q#16 (100 points)
Challenge
What is the CVE number the attacker tried to exploit using the malicious document? Format: CVE-XXXX-XXXXX
Solution
VirusTotalにすでにUploadされており、タグを見ると CVE-2021-40444 なのがわかります。
https://www.virustotal.com/gui/file/c7073b7fc18b3ec20e476a7375e2a6695d273f671917a6627430e59534d3a138
Flag: CVE-2021-40444
[PCAP]: Q#17 (100 points)
Challenge
The malicious document file contains a URL to a malicious HTML file. Provide the URL for this file.
Solution
VirusTotalの中で、Embedded URL を確認します。
Flag: http://192.168.112.128/word.html
[PCAP]: Q#18 (100 points)
Challenge
What is the LinkType of the OLEObject related to the relationship which contains the malicious URL?
Solution
docxをzip解凍して、LinkTypeをサーチします。
1行が長いので、trを使って見つけやすくしてます。
$ unzip web_server.docx $ grep -l -r LinkType . ./word/document.xml $ cat ./word/document.xml | tr ">" "\n" | grep LinkType <o:LinkType EnhancedMetaFile</o:LinkType
Flag: EnhancedMetaFile
[PCAP]: Q#19 (100 points)
Challenge
What is the Microsoft Office version installed on the victim machine?
Solution
答えのフォーマットが XX.0.XXXX なのがわかっていたので、以下のように探しました。
$ strings e3.pcap | egrep "\.0\." User-Agent: Microsoft Office Word 2013 (15.0.4517) Windows NT 6.2 User-Agent: Microsoft Office Word 2013 (15.0.4517) Windows NT 6.2 : :
Flag: 15.0.4517
[PCAP]: Q#21 (100 points)
Challenge
The exploit takes advantage of a CAB vulnerability. Provide the vulnerability name?
Solution
CVE-2021-40444 でググって見つけました。
https://github.com/klezVirus/CVE-2021-40444
==> “Due to a Path traversal (ZipSlip) vulnerability in the CAB” だそうです。
Flag: ZipSlip
[PCAP]: Q#23 (150 points)
Challenge
What is the path of malicious dll (msword.inf) after being dropped by the document file? Replace your username with IEUser
Solution
.cabファイルをCuckooにあげてみたところ、以下が見つかりました。

多少Guessですが、Pathは同じだろうということで、フラグは以下です。
Flag: C:\Users\IEUser\AppData\Local\Temp\msword.inf
[PCAP]: Q#24 (100 points)
Challenge
Analyzing the dll file, what is the API used to write the shellcode in the process memory?
Solution
VirusTotalのOutputからわかります。
Flag: WriteProcessMemory
Author CaptureAmerica @ CTF フラxxグゲット
LastMod 2021-10-31