]> git.somenet.org - pub/jan/ctf-seminar.git/blob - writeups/astra/overthewire2019.md
add overthewire2019 writeup ;)
[pub/jan/ctf-seminar.git] / writeups / astra / overthewire2019.md
1 # OverTheWire Advent Challenge:
2
3 # Northpole Airwaves
4
5 ## Description
6
7 During our latest expedition to the north pole, one of our scientists tuned her
8 radio to 88Mhz and captured a slice of 1MHz (samplerate = 1M/s) to a GNURadio
9 file sink. Surprisingly, there was more than just silence. We need your help to
10 figure out what's going on.
11
12 Download: <https://advent2019.s3.amazonaws.com/d6d0f728ac3ff4848f849b8cf222fb38a14aee870184cc22f2efe01336b2ec17-northpole-airwaves.bin>
13
14 ## Attempts
15
16 This challenge is from the OverTheWire Advent challenge, which we attemted, but
17 didn't solve during the CTF - although we were at least guessing in the right
18 direction.
19
20 It consists of three parts, which can be easily seen when looking at the file in gqrx.
21
22 ![](overthewire2019/gqrx_initial.png "gqrx tuned to 88MHz")
23
24 The leftmost part contains the third part of the flag, the middle part contains
25 the first part of the flag, and the rightmost part contains the second part.
26
27 Unfortunately when attempting to solve the challenge, we expected the whole
28 flag to be hidden in one of the parts, and so did I, so I focussed on the
29 rightmost part first, as it looked most promising - it also has the strongest signal.
30 But unfortunately it turns out to be the most complex one to read.
31
32 At some point we managed to extract most of the rightmost channel - which
33 seemed to contain a audio track with some violin and piano.
34
35 We tried guessing the title of the track - at some point we even tried to use
36 "AOTW{Jesu, Joy of Man's Desiring}" as flag - which it quite obviously wasn't.
37
38 On Dec 21, Gabor had the idea, that it could be possible that the audio track
39 contained RDS (Radio Data System) data, but unfortunately we didn't find
40 anything looking like that either.
41
42 ## Solution
43
44 ### First part
45
46 The first part of the flag is hidden in the middle part of the stream at
47 exactly 88 MHz - unfortunately we had excluded morse quite early.
48
49 When filtered properly, this contains a morse sequence, sent at 32 words per
50 minute. This we should have found, as morse code sent with that speed should
51 still be recognizable as morse, as 25 words per minute can still be decoded by
52 humans, with some people even being able to transcribe even 70 words per
53 minute.
54
55 The stream can be easily seen when opening the filtered stream with e.g.
56 audacity, and can be found in the file [stream\_morse.mp3](overthewire2019/stream_morse.mp3).
57
58 The extracted byte sequence is `414F54577B5468335F626535745F7761795F74305F`,
59 revealing the first part of the flag:
60
61 ```
62 AOTW{Th3_be5t_way_t0_
63 ```
64
65 ### Second part
66
67 This part was the most interesting part, as it contained something, that we
68 actually found, namely the music. It also contained RDS data - so that guess
69 would have been correct, we just were unable to extract it.
70
71 The solution was then published, including a gnuradio file containing the
72 structures needed to extract the RDS data.
73
74 I tried minimizing the solution, as it still was quite complex, and resulted
75 with the following structure. (The right half is only for playing the audio,
76 but is not necessary for decoding)
77
78 ![](overthewire2019/gnuradio_minified.png "minified gnuradio structure")
79
80 The stream is FM modulated, and not exactly on the frequency the receiver was
81 on.  So first the stream has to be shifted by -0.3MHz from 88.3MHz to 88.0MHz,
82 and filtered to remove the remaining stuff around it. After that the stream
83 just contains the audio data.
84
85 Then it is split to the audio playing part an the RDS part. The audio playing
86 part is just split to the left and right channel, so I won't elaborate on this
87 any further.
88
89 The next part is a filter cutting off about 2.5kHz at a carrier frequency of
90 57kHz in the audio signal, as this is the frequency of the RDS data signal:
91 ![](overthewire2019/rds_signal.png "RDS data signal" )
92
93 (Image from <http://joshisanerd.com/projects/sdr_snippets/gnuradio_and_ipython//2%20Broadcast%20FM%20RDS%20Decode.html>)
94
95 The RDS stream is then filtered through two more filters to clean noise and
96 then demodulated using a Phase-Shift-Key (PSK) Demodulator.
97
98 The bits are then sent to the RDS Decoder/Parser (a separate gnuradio module),
99 which prints the data to the terminal. (The RDS Panel just shows a some of the
100 Radio Station Data).
101
102 As a gimmick, another included message tells us, that we should take a
103 different route (`diversion recommended`) for the next hour, as the weather
104 will be `swarms of insects (visibility reduced to Q)`.
105
106 The full output can be found in [stream\_rds.txt](overthewire2019/stream_rds.txt).
107 The RDS data stream also contains the string `Radio Text A: 7370726561645f584d41535f63683333723a5f7331`,
108 which is the second part of the flag:
109
110 ```
111 spread_XMAS_ch33r:_s1
112 ```
113
114 ### Third part
115
116 The third part of the flag was hidden in the leftmost part of the stream.
117 Reportedly this is a RC-car control stream. Usually those are in the 27 MHz or
118 49 MHz range, a few newer ones in the 72 MHz or 75 MHz range.
119
120 This channel was located at 87.6 MHz, containing said RC-car stream, encoded as
121 PWM (Pulse Width Modulation). The markers are long pulses with duty cycles of 100%.
122
123 It looks like an pulse width of 5ms, and 6 channels, all controlled together.
124
125 That can be read by just counting the number of pulse groups after each marker,
126 interpreting each pulse group as one nibble, and it will give
127 `6E67696E675F6C3075645F345F2A5F325F686561727D`.
128 The extracted stream can also be found in [stream\_rccar.mp3](overthewire2019/stream_rccar.mp3).
129
130 Converted to bytes again this will return:
131
132 ```
133 nging_l0ud_4_*_2_hear}
134 ```
135
136 ## Solution
137
138 ```
139 AOTW{Th3_be5t_way_t0_spread_XMAS_ch33r:_s1nging_l0ud_4_*_2_hear}
140 ```
141
142 The provided challenge generator and solver as well as the minified version of
143 the solver are also included in [gnuradio-files.zip](overthewire2019/gnuradio-files.zip)
144 and [solution\_minified.grc](overthewire2019/solution_minified.grc).