<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Shadow Cats on System Overlord</title><link>https://systemoverlord.com/tags/shadow-cats.html</link><description>Recent content in Shadow Cats 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>Sun, 17 Apr 2016 00:00:00 +0000</lastBuildDate><atom:link href="https://systemoverlord.com/tags/shadow-cats/index.xml" rel="self" type="application/rss+xml"/><item><title>PlaidCTF 2016: Butterfly</title><link>https://systemoverlord.com/2016/04/17/plaidctf-2016-butterfly.html</link><pubDate>Sun, 17 Apr 2016 00:00:00 +0000</pubDate><author>david@systemoverlord.com (David Tomaschik)</author><guid>https://systemoverlord.com/2016/04/17/plaidctf-2016-butterfly.html</guid><description>&lt;p&gt;Butterfly was a 150 point pwnable in the 2016 PlaidCTF. Basic properties:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;x86_64&lt;/li&gt;
&lt;li&gt;Not PIE&lt;/li&gt;
&lt;li&gt;Assume ASLR, NX&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;It turns out to be a very simple binary, all the relevant code in one function
(&lt;code&gt;main&lt;/code&gt;), and using only a handful of libc functions. The first thing that
jumped out to me was two calls to &lt;code&gt;mprotect&lt;/code&gt;, at the same address. I spent some
time looking at the disassembly and figuring out what was going on. The
relevant portions can be seen here:&lt;/p&gt;</description></item><item><title>Codegate 2014 Quals: 120</title><link>https://systemoverlord.com/2014/02/26/codegate-2014-quals-120/</link><pubDate>Wed, 26 Feb 2014 06:51:10 +0000</pubDate><author>david@systemoverlord.com (David Tomaschik)</author><guid>https://systemoverlord.com/2014/02/26/codegate-2014-quals-120/</guid><description>&lt;p&gt;From Codegate 2014 quals comes &amp;ldquo;120&amp;rdquo;. Provided is a web interface with a single text box and a link to the source, reproduced below:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#!php
&amp;lt;?php
session_start();

$link = @mysql_connect('localhost', '', '');
@mysql_select_db('', $link);

function RandomString()
{
 $filename = &amp;quot;smash.txt&amp;quot;;
 $f = fopen($filename, &amp;quot;r&amp;quot;);
 $len = filesize($filename);
 $contents = fread($f, $len);
 $randstring = '';
 while( strlen($randstring)&amp;lt;30 ){
 $t = $contents[rand(0, $len-1)];
 if(ctype_lower($t)){
 $randstring .= $t;
 }
 }
 return $randstring;
}

$max_times = 120;

if ($_SESSION['cnt'] &amp;gt; $max_times){
 unset($_SESSION['cnt']);
}

if ( !isset($_SESSION['cnt'])){
 $_SESSION['cnt']=0;
 $_SESSION['password']=RandomString();

 $query = &amp;quot;delete from rms_120_pw where ip='$_SERVER[REMOTE_ADDR]'&amp;quot;;
 @mysql_query($query);

 $query = &amp;quot;insert into rms_120_pw values('$_SERVER[REMOTE_ADDR]', &amp;quot;.
 &amp;quot;'$_SESSION[password]')&amp;quot;;
 @mysql_query($query);
}
$left_count = $max_times-$_SESSION['cnt'];
$_SESSION['cnt']++;

if ( $_POST['password'] ){
 
 if (eregi(&amp;quot;replace|load|information|union|select|from|where|&amp;quot; .
 &amp;quot;limit|offset|order|by|ip|\.|#|-|/|\*&amp;quot;,$_POST['password'])){
 @mysql_close($link);
 exit(&amp;quot;Wrong access&amp;quot;);
 }

 $query = &amp;quot;select * from rms_120_pw where &amp;quot;.
 &amp;quot;(ip='$_SERVER[REMOTE_ADDR]') and &amp;quot; .
 &amp;quot;(password='$_POST[password]')&amp;quot;;
 $q = @mysql_query($query);
 $res = @mysql_fetch_array($q);
 if($res['ip']==$_SERVER['REMOTE_ADDR']){
 @mysql_close($link);
 exit(&amp;quot;True&amp;quot;);
 }
 else{
 @mysql_close($link);
 exit(&amp;quot;False&amp;quot;);
 }
}

@mysql_close($link);
?&amp;gt;

&amp;lt;head&amp;gt;
&amp;lt;link rel=&amp;quot;stylesheet&amp;quot; type=&amp;quot;text/css&amp;quot; href=&amp;quot;black.css&amp;quot;&amp;gt;
&amp;lt;/head&amp;gt;

&amp;lt;form method=post action=index.php&amp;gt;
 &amp;lt;h1&amp;gt; &amp;lt;?= $left_count ?&amp;gt; times left &amp;lt;/h1&amp;gt;
 &amp;lt;div class=&amp;quot;inset&amp;quot;&amp;gt;
 &amp;lt;p&amp;gt;
 &amp;lt;label for=&amp;quot;password&amp;quot;&amp;gt;PASSWORD&amp;lt;/label&amp;gt;
 &amp;lt;input type=&amp;quot;password&amp;quot; name=&amp;quot;password&amp;quot; id=&amp;quot;password&amp;quot; &amp;gt;
 &amp;lt;/p&amp;gt;
 &amp;lt;/div&amp;gt;
 &amp;lt;p class=&amp;quot;p-container&amp;quot;&amp;gt;
 &amp;lt;span onclick=location.href=&amp;quot;auth.php&amp;quot;&amp;gt; Auth &amp;lt;/span&amp;gt;
 &amp;lt;input type=&amp;quot;submit&amp;quot; value=&amp;quot;Check&amp;quot;&amp;gt;
 &amp;lt;/p&amp;gt;
&amp;lt;/form&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The TL;DR of this code is that it uses your PHP session to store a 30 character lowercase letter token, and a counter of how many tries you&amp;rsquo;ve made against it. You&amp;rsquo;re given 120 total tries, then a new code will be generated, meaning any data you&amp;rsquo;ve been able to glean is useless. For what it&amp;rsquo;s worth, not all letters are equally likely &amp;ndash; the source of the data is Aleph One&amp;rsquo;s &amp;ldquo;Smashing the Stack for Fun and Profit.&amp;rdquo; The code contains a blacklist to protect against certain types of SQL injection, but certainly doesn&amp;rsquo;t cover all SQL injection possibilities.&lt;/p&gt;</description></item><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><item><title>BreakIn CTF 2014</title><link>https://systemoverlord.com/2014/01/13/breakin-ctf-2014/</link><pubDate>Mon, 13 Jan 2014 01:20:08 +0000</pubDate><author>david@systemoverlord.com (David Tomaschik)</author><guid>https://systemoverlord.com/2014/01/13/breakin-ctf-2014/</guid><description>&lt;p&gt;The &lt;a href="http://felicity.iiit.ac.in/threads/breakin"&gt;Threads BreakIn CTF&lt;/a&gt; hosted by IIIT Hyderabad has just wrapped up. Shadow Cats did pretty well, placing 16th overall, completing 22/33 challenges, especially considering we only had 2 guys playing this CTF. Mad props goes out to &lt;a href="http://lockboxx.blogspot.com/"&gt;Dan&lt;/a&gt;, and here&amp;rsquo;s hoping for a bigger team turnout next week for &lt;a href="http://ghostintheshellcode.com/"&gt;Ghost in the Shellcode&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;m going to be doing some writeups of a couple of the challenges I thought were particularly interesting, as well as some topical information inspired by the CTF. I&amp;rsquo;ll be linking to the writeups below as they get published.&lt;/p&gt;</description></item></channel></rss>