]> git.somenet.org - pub/jan/ctf-seminar.git/blob - writeups/Hetti/tasteless19.md
Hetti: added writeup Tasteless
[pub/jan/ctf-seminar.git] / writeups / Hetti / tasteless19.md
1 # Tasteless CTF 2019 - RGB (steg)
2
3 ## The CTF in retrospective
4 I've checked out some of the challenges, but in the end I've sticked to the RGB Challenge, because I did already quite some
5 steganography challenges. I really liked that they had a good variaty of challenges and some of them were quite unique.
6
7 I would rank this CTF in the skill requirement to the level **high**.  
8 It is also reflected in the scoreboard on CTF Time, where were not a lot of teams that managed to get past 
9 639 Points.
10
11 [Scoreboard Tasteless CTF 2019 on CTFtime](https://ctftime.org/event/872)
12
13 In the End I also managed to grab one of the 3 Flags.
14
15
16 Tasteless released the Files of this CTF on their Github repo:  
17 [Tasteless CTF 2019 Repo](https://github.com/tastelessctf/ctf2019)
18
19 ## Overview - RGB
20
21 We got presented with 3 Challenges called `R`, `G` and `B`.
22 All of them linked to the same pcapng file. So in one file were 3 Flags hidden.
23 This was a steganography challenge. We needed to find the hidden flags in the network dump.
24
25 You can find the pcapng file in the following github link: [chall.pcapng](https://github.com/tastelessctf/ctf2019/blob/master/RGB/chall.pcapng)
26
27 ## R challenge
28
29 ### Investigating the PCAP
30 The PCAP file exists of a single stream of a HTTP Communication:
31
32 The endpoint the page `ctf.tasteless.eu/stegano` is requested by the caller.
33 ```
34 GET /stegano HTTP/1.1
35 Host: ctf.tasteless.eu
36 User-Agent: curl/7.55.1
37 Accept: */*
38 ```
39
40 and get responded by a PNG File
41
42 ```
43 HTTP/1.1 200 OK
44 Content-Type: image/png
45 Accept-Ranges: bytes
46 Transfer-Encoding: chunked
47 Date: Sat, 19 Oct 2019 13:37:00 GMT
48 Server: lighttpd
49
50 <PNG binary Data>
51 ```
52
53 After extracting the picture, I've checked it out with stegsolve.
54 Stegsolve is a cool Steganography tool, written in Java by Caesum.  
55 Caesum made a great [Handbook about Steganography](http://www.caesum.com/handbook/stego.htm)
56 where he also links to his selfwritten tools [Stegsolve](http://www.caesum.com/handbook/Stegsolve.jar)
57
58 In the picture we found some hints for all 3 Challenges in the corresponding Plane
59
60 * Red plane 0:
61 ```
62 2616
63 Category: Standards Track
64 == HTTP1.1
65 ```
66
67 * Green plane 0:
68 ```
69 2083
70 Category: Informational
71 == PNG
72 ```
73 * Blue plane 0:
74 ```
75 1951
76 Category: Informational
77 == DEFLATE
78 ```
79
80 ### Finding the flag
81
82 While checking the PCAP File, I saw that the responses are chunked.
83 When I investigated the TCP Stream I checked the chunked responses, that were introduced with the
84 string `1000;` and I also saw that they have a single character afterwards attached in the line.
85 While stepping through I realized that it was the flag.
86
87 ### Extracting the flag
88
89 I didn't take the time to write a python script with `scapy` to extract the packets, instead I extracted
90 the flag by hand with help of almighty Wireshark.
91
92 I've opened the `Follow -> TCP Stream` Option and put into the search Field the value `1000;`.
93 Then I clicked through and assembled the Flag by hand.
94
95 Flag: `tctf{NoB0dy_3xPec7s_chUnK_ex7En5iOnz}`
96
97
98 ## G challenge
99 This Challenge was not solved by me but by the colleague `@dachleitner` in Mattermost.
100
101 It was hidden in the CRC fields of the IDAT chunks.  
102 CRC Fields are also sometimes a usable sidechannel to hide information :-)
103
104 Flag: `tctf{Wh0_Do3s_n0t_l1k3_fL4gz_1n_cRc}`
105
106 ## B challenge
107
108 ### Finding the flag
109 We didn't managed to find it during the CTF.
110
111 ### Challenge Aftermath
112
113 After the CTF I asked in the IRC channel what was the intended solution for the B challenge.
114 I got the following anser:  
115 `hetti91: extract bits from byte padding in front of stored blocks`
116
117 It was linked to following Function of zlib:  
118 [zlib BYTEBITS()](https://github.com/madler/zlib/blob/master/inflate.c#L534-L538)
119
120 ## Lessons learned
121 * Dig further
122
123 * When doing CTFs, write down the values of the flag format characters in hex, so you can find them in a hexdump or stream of data.