CTF Writeup TMCTF2018 » 履歴 » バージョン 1
kanata, 2025/04/13 15:26
1 | 1 | kanata | # CTF Writeup TMCTF2018 |
---|---|---|---|
2 | |||
3 | {{toc}} |
||
4 | |||
5 | {{rawhtml(<blockquote class="embedly-card"><h4><a href="https://www.trendmicro.com/ja_jp/campaigns/capture-the-flag.html">Trend Micro CTF 2018 - Raimund Genes Cup</a></h4><p>IoT、制御システム、標的型サイバー攻撃など、サイバーセキュリティに関する知識と技術を競い合う、トレンドマイクロが主催する技術者向けの競技大会です。サイバーセキュリティのプロフェッショナルは、毎年、標的型攻撃、IoT(Internet of Things)、産業用制御システム(ICS)などの知識を向上させるために切磋琢磨しています。</p></blockquote><script async src="//cdn.embedly.com/widgets/platform.js" charset="UTF-8"></script>)}} |
||
6 | |||
7 | # 結果&感想 |
||
8 | |||
9 | Trend Micro CTF 2018 に、某チームで参加しました。 |
||
10 | 今年もチームは善戦しましたよ!(国内10位以内)。しかし、、私が解いたのは100点1問だけでした。 |
||
11 | 途中までやったやつが二問ありますが、どちらも(私は)解けずでした。 |
||
12 | |||
13 | という訳で、解ってる部分のwriteupです。 |
||
14 | |||
15 | Trend Micro CTF 2018 オンライン予選 ランキングページ |
||
16 | https://ctf.trendmicro.com/ranking.html |
||
17 | |||
18 | # Misc 100 |
||
19 | |||
20 | 問題 |
||
21 | |||
22 | ``` |
||
23 | Brave Challenger, welcome! |
||
24 | |||
25 | I will hand you the flag, just not on a silver platter. Closely analyze the file, peel it back layer by layer, examine it byte by byte and the flag will reveal itself. |
||
26 | |||
27 | Follow the rabbit hole, the flag is hiding at the end of the tunnel! |
||
28 | |||
29 | Get your hands dirty! Whip out all your tools! Use your hex editor! But also be careful my brave challenger, for it might blow up in your face. |
||
30 | |||
31 | Good Luck! |
||
32 | ``` |
||
33 | |||
34 | それで、binwalkかけるじゃろ? |
||
35 | |||
36 | ``` |
||
37 | $ binwalk -eM EATME.pdf |
||
38 | |||
39 | Scan Time: 2018-09-09 21:02:01 |
||
40 | Target File: /home/ctf/20180915_TMCTF/Misc_100/EATME.pdf |
||
41 | MD5 Checksum: e579c3844a68e6f0f007dc34ea2a9ed1 |
||
42 | Signatures: 386 |
||
43 | |||
44 | DECIMAL HEXADECIMAL DESCRIPTION |
||
45 | -------------------------------------------------------------------------------- |
||
46 | 0 0x0 PDF document, version: "1.7" |
||
47 | 353 0x161 JPEG image data, JFIF standard 1.01 |
||
48 | 383 0x17F TIFF image data, big-endian, offset of first image directory: 8 |
||
49 | 749016 0xB6DD8 Zip archive data, at least v2.0 to extract, compressed size: 41, uncompressed size: 200, name: flag.txt |
||
50 | 749123 0xB6E43 Zip archive data, at least v2.0 to extract, compressed size: 4168158, uncompressed size: -1, name: galf.txt |
||
51 | 4969997 0x4BD60D End of Zip archive, footer length: 31, comment: "Boooooom!" |
||
52 | 4970099 0x4BD673 Zlib compressed data, default compression |
||
53 | |||
54 | Signature Exception: Extractor.dd failed to extract data from '/home/ctf/20180915_TMCTF/Misc_100/EATME.pdf' to '4BDACE.zlib': [Errno 28] No space left on device |
||
55 | ---------------------------------------------------------------------------------------------------- |
||
56 | |||
57 | ※途中でエラーになってますが、ディスク容量が無くなったからですw |
||
58 | ``` |
||
59 | |||
60 | それで、中身見るじゃろ? |
||
61 | |||
62 | ``` |
||
63 | $ cd _EATME.pdf.extracted |
||
64 | $ ls |
||
65 | 4BD673 4BD673.zlib 4BDACE.zlib B6DD8.zip flag.txt galf.txt |
||
66 | ``` |
||
67 | |||
68 | フラグあるじゃろ? |
||
69 | |||
70 | ``` |
||
71 | $ cat flag.txt |
||
72 | TMCTF{QWxpY2UgaW4gV29uZGVybGFuZA==} |
||
73 | ``` |
||
74 | |||
75 | はい |
||
76 | |||
77 | # Misc 200 |
||
78 | |||
79 | 問題(pcapファイルとpythonのソースが渡されます) |
||
80 | |||
81 | ``` |
||
82 | *************************** If you look at that Constellation the sky will open ***************** |
||
83 | |||
84 | Traffic Traffic Traffic... |
||
85 | |||
86 | this is really strange ... |
||
87 | |||
88 | hour 1... |
||
89 | |||
90 | hour 2... |
||
91 | |||
92 | hour 3... |
||
93 | |||
94 | where is the data!!!!!? AAAAAAAAAAA ... |
||
95 | lets take a look to the night and see if we can plot something.... |
||
96 | ``` |
||
97 | |||
98 | pcapはWiresharkで見ると、pingに何か数値が入っているのが見えます |
||
99 | こういうpingパケットがめっちゃあります |
||
100 | |||
101 |  |
||
102 | |||
103 | チームの方がこれを抽出してくださいました |
||
104 | |||
105 | ``` |
||
106 | 4.242410,2.97088 |
||
107 | 7.021890,1.98935 |
||
108 | 4.113620,2.99082 |
||
109 | ・ |
||
110 | ・ |
||
111 | ・ |
||
112 | ``` |
||
113 | |||
114 | これをインプットに、与えられたPythonコードを使えばフラグが出てきそうなんですが、予想以上の ~~クソコード~~ バクバグしたコードでうまく動いてくれません。 |
||
115 | |||
116 | 諦めて、Excelでプロットしてみました。 |
||
117 | |||
118 |  |
||
119 | |||
120 | お、文字っぽいの見えるじゃーん |
||
121 | と小躍りしながら入力するも不正解。。1:aAAじゃないんだろうなと思って、いろいろ試すもincorrect… |
||
122 | |||
123 | >与えられたPythonコードもクラスタリングしてグラフにプロットするだけだから、同じものが見えてると思うんだけどなぁ。。 |
||
124 | |||
125 | と、うーん(時間切れ) |
||
126 | |||
127 | >正解は TMCTF{flag:1} あぁ。。。これは。。。読めないわwww 言われたらわかるけど |
||
128 | |||
129 | # Forensics-Crypto1 100 |
||
130 | |||
131 | 問題 |
||
132 | |||
133 | ``` |
||
134 | Here is the full flag, unfortunately it burnt a bit. I know you can handle it with all the things you know. |
||
135 | ``` |
||
136 | |||
137 | {{thumbnail(qrcode.png)}} |
||
138 | |||
139 | まさかのQRコードw |
||
140 | |||
141 | まず、Excelに書き写して、以下を見て補完できる所は補完します |
||
142 | |||
143 | WebTec kikineria QRcode > QRコードの作り方 > データの配置 |
||
144 | https://sites.google.com/site/kikineria/qrcode/qr-kb/qr_recipe_4 |
||
145 | |||
146 |  |
||
147 | |||
148 | そして、以下のデコーダーにかけます |
||
149 | |||
150 | strong-qr-decoder - 強力なQRコード解析ツール(ただし、テキスト化が必要) |
||
151 | https://github.com/waidotto/strong-qr-decoder |
||
152 | |||
153 | が…ダメっ |
||
154 | データ部が全部無いこのパターンは、デコーダーではデコードできないようです |
||
155 | |||
156 | よくよく調べると、そっくりな問題が[SECCON2014](https://github.com/ctfs/write-ups-2014/tree/master/seccon-ctf-2014/bbqr)でありました |
||
157 | |||
158 | >その時は高難易度の400点問題だったのに。。 |
||
159 | |||
160 | どうやらQRコードの残りの部分がリード・ソロモン符号で、そこから消失した分を復元できるようです |
||
161 | |||
162 | リード・ソロモン符号を抽出してよしなにやってくれる素敵なソフトないかな~と探しましたらありました |
||
163 | |||
164 | QRazyBox |
||
165 | https://merricx.github.io/qrazybox/ |
||
166 | |||
167 | ``` |
||
168 | QR version : 2 (25x25) |
||
169 | Error correction level : Q |
||
170 | Mask pattern : 7 |
||
171 | Number of missing bytes (erasures) : 0 bytes (0.00%) |
||
172 | Data blocks : |
||
173 | ["10001001","11011000","10011101","10001001","01000110","11100100","01101110","01000110","10111101","01000010","11110101","10001001","11010011","00110010","11010100","11100011","00010111","01100110","10100011","01000111","11010000","11101100","11011010","10011101","00101101","01111111","01000101","01100001","10001110","01011100","10101000","11111101","10011100","11111111","01101100","10101011","10110100","10111010","01011001","10111100","00100110","00011001","00100001","11101000"] |
||
174 | ----------------Block 1---------------- |
||
175 | Reed-Solomon Block : [137,216,157,137,70,228,110,70,189,66,245,137,211,50,212,227,23,102,163,71,208,236,218,157,45,127,69,97,142,92,168,253,156,255,108,171,180,186,89,188,38,25,33,232] |
||
176 | Syndrome : [60,113,92,240,55,140,2,200,61,78,80,150,119,91,66,54,203,180,164,235,152,99] |
||
177 | Number of Errors : 10 |
||
178 | Coefficient of the error location polynomial : [144,88,205,226,152,69,193,116,235,88] |
||
179 | Error Position : [] |
||
180 | Error Magnitude : |
||
181 | Final data bits : |
||
182 | 10001001110110001001110110001001010001101110010001101110010001101011110101000010111101011000100111010011001100101101010011100011000101110110011010100011010001111101000011101100 |
||
183 | Final Decoded string : |
||
184 | ``` |
||
185 | |||
186 | ここまでやって、寝て起きたらチームのQRソムリエさんがサクッと解いてたw |
||
187 | |||
188 | >やり方は間違ってなかったっぽいけど、エクセルにQRコード書き写すのを間違えたかなぁ。。 |
||
189 | |||
190 | # 参考(writeup集) |
||
191 | |||
192 | CTFtime.org / Trend Micro CTF 2018 - Raimund Genes Cup - Online Qualifier tasks and writeups |
||
193 | https://ctftime.org/event/659/tasks/ |