<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Ghost in the Shellcode on System Overlord</title><link>https://systemoverlord.com/tags/ghost-in-the-shellcode.html</link><description>Recent content in Ghost in the Shellcode on System Overlord</description><generator>Hugo</generator><language>en-us</language><managingEditor>david@systemoverlord.com (David Tomaschik)</managingEditor><webMaster>david@systemoverlord.com (David Tomaschik)</webMaster><lastBuildDate>Tue, 21 Jan 2014 04:57:33 +0000</lastBuildDate><atom:link href="https://systemoverlord.com/tags/ghost-in-the-shellcode/index.xml" rel="self" type="application/rss+xml"/><item><title>Ghost in the Shellcode 2014</title><link>https://systemoverlord.com/2014/01/21/ghost-in-the-shellcode-2014/</link><pubDate>Tue, 21 Jan 2014 04:57:33 +0000</pubDate><author>david@systemoverlord.com (David Tomaschik)</author><guid>https://systemoverlord.com/2014/01/21/ghost-in-the-shellcode-2014/</guid><description>&lt;p&gt;A quick Ghost in the Shellcode 2014 summary. Great CTF, but you better know your binary exploitation. I&amp;rsquo;m pretty happy with the overall 27th finish Shadow Cats managed. Here&amp;rsquo;s a summary of our team writeups, the first 3 by me, the last one by Dan.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://systemoverlord.com/2014/01/19/ghost-in-the-shellcode-2014-radioactive/"&gt;Radioactive&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://systemoverlord.com/2014/01/19/ghost-in-the-shellcode-2014-lugkist/"&gt;Lugkist&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://systemoverlord.com/2014/01/19/ghost-in-the-shellcode-2014-pillowtalk/"&gt;Pillowtalk&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://lockboxx.blogspot.com/2014/01/ghost-in-shellcode-2014-ctf-writeup.html"&gt;Unbearable&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>Ghost in the Shellcode 2014: Radioactive</title><link>https://systemoverlord.com/2014/01/19/ghost-in-the-shellcode-2014-radioactive/</link><pubDate>Sun, 19 Jan 2014 20:21:46 +0000</pubDate><author>david@systemoverlord.com (David Tomaschik)</author><guid>https://systemoverlord.com/2014/01/19/ghost-in-the-shellcode-2014-radioactive/</guid><description>&lt;p&gt;Radioactive was a crypto challenge that executed arbitrary python code, if you could apply a correct cryptographic tag. Source was provided, and the handler is below:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#!python
class RadioactiveHandler(SocketServer.BaseRequestHandler):
 def handle(self):
 key = open(&amp;quot;secret&amp;quot;, &amp;quot;rb&amp;quot;).read()
 cipher = AES.new(key, AES.MODE_ECB)

 self.request.send(&amp;quot;Waiting for command:\n&amp;quot;)
 tag, command = self.request.recv(1024).strip().split(':')
 command = binascii.a2b_base64(command)
 pad = &amp;quot;\x00&amp;quot; * (16 - (len(command) % 16))
 command += pad

 blocks = [command[x:x+16] for x in xrange(0, len(command), 16)]
 cts = [str_to_bytes(cipher.encrypt(block)) for block in blocks]
 for block in cts:
 print ''.join(chr(x) for x in block).encode('hex')

 command = command[:-len(pad)]

 t = reduce(lambda x, y: [xx^yy for xx, yy in zip(x, y)], cts)
 t = ''.join([chr(x) for x in t]).encode('hex')

 match = True
 print tag, t
 for i, j in zip(tag, t):
 if i != j:
 match = False

 del key
 del cipher

 if not match:
 self.request.send(&amp;quot;Checks failed!\n&amp;quot;)
 eval(compile(command, &amp;quot;script&amp;quot;, &amp;quot;exec&amp;quot;))

 return
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;So, it looks for a tag:command pair, where the tag is hex-encoded and the command is base64 encode. The command must be valid python, passed through compile and eval, so you&amp;rsquo;ll need to send a response back to yourself via self.request.send.&lt;/p&gt;</description></item><item><title>Ghost in the Shellcode 2014: Lugkist</title><link>https://systemoverlord.com/2014/01/19/ghost-in-the-shellcode-2014-lugkist/</link><pubDate>Sun, 19 Jan 2014 19:43:56 +0000</pubDate><author>david@systemoverlord.com (David Tomaschik)</author><guid>https://systemoverlord.com/2014/01/19/ghost-in-the-shellcode-2014-lugkist/</guid><description>&lt;p&gt;Lugkist was an interesting &amp;ldquo;trivia&amp;rdquo; challenge. We were told &amp;ldquo;it&amp;rsquo;s not crypto&amp;rdquo;, but it sure looked like a crypto challenge. We had a file like:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Find the key.&lt;/p&gt;
&lt;p&gt;GVZSNG&lt;br&gt;
AXZIOG&lt;br&gt;
YNAISG&lt;br&gt;
ASAIUG&lt;br&gt;
IVPIOK&lt;br&gt;
AXPIVG&lt;br&gt;
PVZIUG&lt;br&gt;
AXLIEG&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Always 6 letters, but no other obvious pattern. I did notice that the 4th character always was S or I and the final character G or K, but couldn&amp;rsquo;t make anything of that. I realized the full character set was &amp;lsquo;AEGIKLONPSUTVYXZ&amp;rsquo;. Searching for this string revealed nothing, but searching for the characters space separated revealed that this was the same character set as used by the codes for the original Game Genie. And Game Genie codes were 6 characters long.&lt;/p&gt;</description></item><item><title>Ghost in the Shellcode 2014: Pillowtalk</title><link>https://systemoverlord.com/2014/01/19/ghost-in-the-shellcode-2014-pillowtalk/</link><pubDate>Sun, 19 Jan 2014 19:11:27 +0000</pubDate><author>david@systemoverlord.com (David Tomaschik)</author><guid>https://systemoverlord.com/2014/01/19/ghost-in-the-shellcode-2014-pillowtalk/</guid><description>&lt;p&gt;Pillowtalk was a 200 point crypto challenge. Provided was a stripped 64-bit binary along with a pcap file. I started off by exercising the behavior of the binary, looking at system calls/library calls to see what it was doing.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Client connects to server&lt;/li&gt;
&lt;li&gt;Server reads 32 bytes from /dev/urandom&lt;/li&gt;
&lt;li&gt;Server sends 32 bytes on the wire (not same bytes as read from /dev/urandom)&lt;/li&gt;
&lt;li&gt;Client does same 32 byte read/send&lt;/li&gt;
&lt;li&gt;Loop:
&lt;ul&gt;
&lt;li&gt;Server reads a line from stdin&lt;/li&gt;
&lt;li&gt;Server sends 4 byte length&lt;/li&gt;
&lt;li&gt;Server sends encrypted line&lt;/li&gt;
&lt;li&gt;Client does the same steps&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;My first approach was by trying to use scapy to replay the pcap to the server, but this only gave complete noise, so I decided the two 32 byte values must be significant. I even tried controlling /dev/urandom (via LD_PRELOAD) to see if putting in the 32 bytes from the pcap would get to the right key. It didn&amp;rsquo;t.&lt;/p&gt;</description></item></channel></rss>