]> git.somenet.org - pub/jan/netsec2.git/blob - report/content/exercise1.tex
task 1.1 fertig - incl. doku.
[pub/jan/netsec2.git] / report / content / exercise1.tex
1 % LVA-Feedback: mehr Freitext, weniger REP$x.$y !!! Diese Stuktur ist wirr und z.b. Failed attempts stehen an 3 unterschiedlichen stellen, obwohl sie doch alle irgendwie zusammenhängen -.-
2
3 \section{Exercise 1 - Task 1}
4 \subsection{Rep:1.a}
5 \fbox{\parbox{\textwidth}{
6 What is the IP address of the suspicious notebook?
7 }}
8
9 The IP address of the suspicious notebook (our own IP address) is \emph{\textbf{192.168.67.37}}.
10
11
12 \subsection{Rep:1.b}
13 \fbox{\parbox{\textwidth}{
14 What is the IP address of the machine presumably leaking information?
15 }}
16
17 The remote IP address is \emph{\textbf{192.168.67.83}}.
18
19
20 \subsection{Rep:1.c}
21 \fbox{\parbox{\textwidth}{
22 Give a detailed (but brief) explanation of these steps you carried out to filter irrelevant data (either Wireshark or Rapidminer).\\
23 Do also specify the keyworks and operators required.
24 }}
25
26 The necessary wireshark filter expression is \emph{\textbf{ip.addr == 192.168.67.83}}.
27
28
29 \subsection{Rep:1.d}
30 \fbox{\parbox{\textwidth}{
31 Which features are not viable to mask a covert channel and could be removed from the analysis?\\
32 List the rejected features and provide short but meaningful reasons for rejection.
33 }}
34
35 \begin{itemize}
36         \item \emph{\textbf{No.}} is just the packet number in the pcap file.
37         \item \emph{\textbf{Source IP}} fixed value: \emph{\textbf{192.168.67.83}}
38         \item \emph{\textbf{Destination IP}} fixed value: \emph{\textbf{192.168.67.37}}
39         \item \emph{\textbf{Protocol}} fixed value: \emph{\textbf{UDP}}
40         \item \emph{\textbf{Length}} fixed value: \emph{\textbf{82}}
41         \item \emph{\textbf{TTL}} fixed value: \emph{\textbf{64}}
42         \item \emph{\textbf{Dest port}} fixed value: \emph{\textbf{118}}
43         \item \emph{\textbf{Flags}} fixed value: \emph{\textbf{n/a}}
44         \item \emph{\textbf{Frag offset}} fixed value: \emph{\textbf{0}}
45 \end{itemize}
46
47 Features containing fixed values have been rejected as one obviously cannot hide more than one bit of information in them.
48
49
50 \subsection{Rep:1.e}
51 \fbox{\parbox{\textwidth}{
52 From the remaining features, which ones are not viable to mask a covert channel and could be removed from the analysis?\\
53 List the newly rejected features and provide short but meaningful reasons for rejection.
54 }}
55
56 We see that the source port changes only between transmissions. The transmission contains only one flow.\\
57 Therefore we can assume that the \emph{\textbf{source port}} can be ignored.\\
58
59 The next step was to apply the following filter in wireshark: \emph{\textbf{ip.addr == 192.168.67.83 and udp.srcport == 52899}}, export the result to a new pcap file and reload in wireshark (to reset the packet numbers) and export the pcap to csv.
60
61
62 \subsection{Rep:1.f}
63 \fbox{\parbox{\textwidth}{
64 Do you think that you have found the covert channel?\\
65 Give a detailed description of where the covert channel is occurring (feature value:covert symbol relationship) and provide a capture of the plot where the abnormal behaviour of the suspicious feature is isolated and clearly visible.
66 }}
67
68 At first we wrote a decoder that made a diff between the current and the last csv line looking at \emph{\textbf{IP.ID}}.\\
69 Combined with the hint 8 bit ASCII we tried to extract full. The results did not made any sense.\\
70
71 After analysis with rapidminer we found that the timing diffrences were obviously not randomly distributed.\\
72 \includegraphics[width=0.8\columnwidth]{content/e11_timing.pdf}
73
74 So the hacky solution was to multiply the time-diff by 10 and cast the result to int. This resulted in a nice one bit/packet list which we quickly converted to 8 bit ascii.
75
76
77 \subsection{Rep:1.g}
78 \fbox{\parbox{\textwidth}{
79 Write in the report the formula of the deployed filter and the steps carried out to prepare the required file.
80 }}
81 \emph{\textbf{Dest port == 118}} and later \emph{\textbf{ip.addr == 192.168.67.83 and udp.srcport == 52899}}.
82
83
84 \subsection{Rep:1.h}
85 \fbox{\parbox{\textwidth}{
86 Write in the report the decoded message. Explain clearly how you carried out the decoding task (step by step in a numbered list).
87 }}
88
89 The message was \emph{\textbf{Starting transmission from Ministry of Cyber {\ucr}ffairs. (Agent Scott)Star{\ucr}i{\ucr}}}\\
90 By applying a corrective timing diffrence of 0.05 we can fully decode the message: \emph{\textbf{Starting transmission from Ministry of Cyber affairs. (Agent Scott)Startin}}\\
91
92 Final py-code
93 \begin{scriptsize}\begin{verbatim}
94 #!/usr/bin/env python                                                                                                                                            
95                                                                                                                                                                 
96 import csv                                                                                                                                                       
97 import binascii                                                                                                                                                  
98                                                                                                                                                                  
99 def somedecode(filename):                                                                                                                                        
100   with open(filename, 'rb') as csvfile:                                                                                                                          
101     spamreader = csv.reader(csvfile, delimiter=',', quotechar='"')                                                                                               
102     header = last = None                                                                                                                                         
103     ln = 0                                                                                                                                                       
104     v = ""                                                                                                                                                       
105                                                                                                                                                                  
106     for row in spamreader:                                                                                                                                       
107       if header is None:                                                                                                                                         
108         header = row                                                                                                                                             
109         continue                                                                                                                                                 
110       if last is None:                                                                                                                                           
111         last = row                                                                                                                                               
112         continue                                                                                                                                                 
113                                                                                                                                                                  
114       va = str(int((float(row[1])-float(last[1])-0.05)*10))                                                                                                      
115       if va not in ["0","1"]:                                                                                                                                    
116         va = "1"                                                                                                                                                 
117                                                                                                                                                                  
118       v = v+va                                                                                                                                                   
119       ln += 1                                                                                                                                                    
120       if ln == 8:                                                                                                                                                
121         print binascii.unhexlify('%x' % int(v, 2)),                                                                                                                      
122         v = ""                                                                                                                                                   
123         ln = 0                                                                                                                                                   
124       last = row                                                                                                                                                 
125                                                                                                                                                                  
126 if __name__ == "__main__":                                                                                                                                       
127     somedecode("filtered.dehexed.csv")                                                                                                                           
128 \end{verbatim}\end{scriptsize}
129
130
131 \subsection{Rep:1.i}
132 \fbox{\parbox{\textwidth}{
133 Report briefly any additional comment or observation related to the exercise solving to be considered during the review of your exercise.
134 }}
135
136 We had our wireshark misconfigured and were looking into the DSCP field for quite some time, before we realising that it was actually IP.ID.
137
138
139 \section{Exercise 1 - Task 2}
140 \subsection{Rep:1.j}
141 \fbox{\parbox{\textwidth}{
142 Give a detailed (but brief) explanation of the steps you carried out to filter irrelevant data (either Wireshark or Rapidminer). Do also specify the keywords and operators required.
143 }}
144
145 Captured. Our new IP is \emph{\textbf{192.168.67.26}}.\\
146
147 Selected local network packets: \emph{\textbf{ip.src == 192.168.67.0/24 and ip.dst == 192.168.67.0/24}} and saved as separate pcap file and also exported the packets to csv.\\
148
149 In Rapidminer we analyzed the csv and removed our gateway (.1) and self (.26) as sources.\\
150
151 % TODO image:stream\_localnet.pdf
152
153 We get 4 network flows: The first from .83 to 80/udp, then from .82 to 443/udp, then .81 to 465/tcp, then .84 to 464/udp.\\
154
155 % TODO image:stream\_localnet\_ports.pdf
156
157 Filters for one complete transmission:
158 \emph{\textbf{udp.port == 58493 or udp.port == 45875 or tcp.port == 40875 or udp.port == 36842}}
159
160 % TODO: failed attempt
161
162 %%%%%%%%%%%%%%%%%%%%%
163 % WTF ?! % WTF ?! % WTF ?! % WTF ?! % WTF ?! 
164 % WTF ?! % WTF ?! % WTF ?! % WTF ?! % WTF ?! 
165 % WTF ?! % WTF ?! % WTF ?! % WTF ?! % WTF ?! 
166 % WTF ?! % WTF ?! % WTF ?! % WTF ?! % WTF ?! 
167 % WTF ?! % WTF ?! % WTF ?! % WTF ?! % WTF ?! 
168 %%%%%%%%%%%%%%%%%%%%%
169
170 %filtered away nfs and ssh
171 %!(tcp.port == 666 || tcp.port == 2049)
172 %asdf.{pcap,csv}
173
174 %look at it via rapidminer
175 %image:stream2.pdf
176
177 %((ip.addr eq 192.168.67.81 or ip.addr eq 192.168.67.82 or ip.addr eq 192.168.67.83) and ip.addr eq 192.168.67.37)
178 %better.{pcap,csv}
179
180 %look at it again via rapidminer
181 %image:stream\_better.pdf
182
183 %dest ports are always first 80/udp, then 443/udp, then 465/tcp
184
185 %filtered for one complete transaction
186 %tcp.port == 56533 or udp.port == 50293 or udp.port == 56040
187 %cool.{pcap,csv}
188
189 %look at it again via rapidminer
190 %image:stream\_cool.pdf
191
192 %%%%%%%%%%%%%%%%%%%%%%%
193
194
195 \subsection{Rep:1.k}
196 \fbox{\parbox{\textwidth}{
197 Which features are not viable to mask a covert channel and could be removed from the analysis? List the
198 rejected features and provide short but meaningful reasons for rejection.
199 }}
200
201 \begin{itemize}
202         \item \emph{\textbf{No.}} (it is generated while monitoring and is strictly monotonically increasing by 1 with each packet)
203         \item \emph{\textbf{Time}} (packets arrive with almost equal delays)
204         \item \emph{\textbf{TTL}} (fixed value: \emph{\textbf{64}})
205         \item \emph{\textbf{Frag offset}} (fixed value: \emph{\textbf{0}})
206 \end{itemize}
207
208 We can also ignore \emph{\textbf{IP.Flags}} as they meet our expected distribution:
209 \begin{itemize}
210         \item 0x0002: SYN (1x)
211         \item 0x0012: SYN,ACK (1x)
212         \item 0x0010: ACK (602x)
213         \item 0x0018: ACK,PSH (600x)
214         \item 0x0011: ACK,FIN (2x)
215 \end{itemize}
216
217
218 \subsection{Rep:1.l}
219 \fbox{\parbox{\textwidth}{
220 From the remaining features, which ones are not viable to mask a covert channel and could be removed
221 from the analysis? List the newly rejected features and provide short but meaningful reasons for rejection.
222 }}
223
224
225 % TODO continue writing here.
226
227 not a high variance detected:
228 \begin{itemize}
229 \item UDP Stream from 192.168.67.83:56040 to 192.168.67.37:80 %TODO fix
230 \item UDP Stream from 192.168.67.82:50293 to 192.168.67.37:443 %TODO fix
231 \item TCP Traffic between 192.168.67.81:56533 to 192.168.67.37:465 %TODO fix
232 \item UDP Stream from 192.168.67.84:36842 to 192.168.67.26:464
233 \end{itemize}
234
235 Length also does not vary very much:
236 \begin{itemize}
237 \item Length 60 for Source Port 56040/udp
238 \item Length 60 for Source Port 52093/udp
239 \item Length 70 for ACK,PSH (600x), 74 for SYN (1x), 66 for ACK (1x) and 66 for FIN (1x) for Source Port 56533/tcp
240 \item Length 66 for ACK, 74 for SYN,ACK for Source Port 465/tcp
241 \item %TODO fix for sport 464
242 \end{itemize}
243
244 % TODO: failed attempt
245 %-> map in rapidminer ipid vs dscp
246 %-> every dscp has two ipid's? (ipid1 xor ipid2) or (ipid1 - ipid2) -> char
247
248
249 \subsection{Rep:1.m}
250 \fbox{\parbox{\textwidth}{
251 What is the IP address of the machine presumably leaking information?
252 }}
253
254 Unknown, because we do have two shorter transmissions before a longer transmission from different source ips
255
256 % TODO: failed attempt 1 - nicht alles
257 Later the IP address turned out to be 192.168.67.84.
258
259
260 \subsection{Rep:1.n}
261 \fbox{\parbox{\textwidth}{
262 Do you think that you have found the covert channel?\\
263 Give a detailed description of where the covert channel is occurring (feature value:covert symbol relationship) and provide a capture of the plot where the abnormal behaviour of the suspicious feature is isolated and clearly visible.
264 }}
265
266 Not yet. We do not know if the three transmissions are connected to each other.
267
268 % TODO: failed attempt 2 - dumm rum gesucht
269 Most likely it is in the DSCP field of the third transmission. (This also has responses from the local system)
270
271 Turned out that the 6 bits from the DSCP field in the 4. transmission just needed to be concatenated and then split into 8 bit chunks again.
272
273
274 \subsection{Rep:1.o}
275 \fbox{\parbox{\textwidth}{
276 Write in the report the decoded message. Explain clearly how you carried out the decoding task (step by step in a numbered list).
277 }}
278
279 \emph{\textbf{Agent South already successfully infiltrated The minister's office. In the next step, we try to acquire data from the Ministry of Cyber Affair's office network. Stay tuned, I will keep you updated on the progress. (This message was sent by agent Scott)Agent South already successfully infiltrated The minister's office. In the next step, we try to acquire data from the Ministry of Cyber Affair's office network. Stay tuned, I will keep you updated on t}}\\
280
281 code\\
282 \begin{verbatim}
283 #!/usr/bin/python                                                                                                                                                   
284                                                                                                                                                                     
285 from pprint import pprint                                                                                                                                           
286                                                                                                                                                                     
287 fullstr = ""                                                                                                                                                        
288                                                                                                                                                                     
289 with open('stream_data.txt', 'r') as infile:                                                                                                                        
290     for line in infile:                                                                                                                                             
291         if len(line) > 0:                                                                                                                                           
292             i = int(line)                                                                                                                                           
293             bin = "{0:06b}".format(i)                                                                                                                               
294             fullstr += bin                                                                                                                                          
295                                                                                                                                                                     
296 bytelist = [ fullstr[i:i+8] for i in range(0, len(fullstr), 8) ]                                                                                                    
297                                                                                                                                                                     
298 solution = ""                                                                                                                                                       
299                                                                                                                                                                     
300 for bchar in bytelist:                                                                                                                                              
301     solution += chr(int(bchar, 2))                                                                                                                                  
302                                                                                                                                                                     
303 print ("%s" % solution)                                                                                                                                             
304 print ("len: %d" % len(solution))                                                                                                                                   
305 \end{verbatim}
306
307
308 \subsection{Rep:1.p}
309 \fbox{\parbox{\textwidth}{
310 Report briefly any additional comment or observation related to the exercise solving to be considered during the review of your exercise.
311 }}
312
313
314 % TODO: failed attempt 3 - config fail
315
316