<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>KOrUPt</title>
	<atom:link href="http://korupt.co.uk/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://korupt.co.uk</link>
	<description>Disassembling logic at its best...</description>
	<lastBuildDate>Thu, 16 Jul 2009 14:48:49 +0000</lastBuildDate>
	
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Binary Leetness 300 Comic</title>
		<link>http://korupt.co.uk/?p=164</link>
		<comments>http://korupt.co.uk/?p=164#comments</comments>
		<pubDate>Thu, 16 Jul 2009 02:40:27 +0000</pubDate>
		<dc:creator>KOrUPt</dc:creator>
				<category><![CDATA[Reversing]]></category>
		<category><![CDATA[300]]></category>
		<category><![CDATA[Analysis]]></category>
		<category><![CDATA[b300]]></category>
		<category><![CDATA[Bin300]]></category>
		<category><![CDATA[Binary]]></category>
		<category><![CDATA[comic]]></category>
		<category><![CDATA[CTF]]></category>
		<category><![CDATA[DC17]]></category>
		<category><![CDATA[Defcon]]></category>
		<category><![CDATA[hackerschool]]></category>
		<category><![CDATA[KOrUPt]]></category>
		<category><![CDATA[Leetness]]></category>
		<category><![CDATA[Mongii]]></category>
		<category><![CDATA[RCE]]></category>
		<category><![CDATA[RE]]></category>
		<category><![CDATA[sapheads]]></category>
		<category><![CDATA[write up]]></category>
		<category><![CDATA[writeup]]></category>

		<guid isPermaLink="false">http://korupt.co.uk/?p=164</guid>
		<description><![CDATA[Okay I&#8217;m sure 80% of you would have already seen this comic of ours but I figured I&#8217;d publish a link to it from here too&#8230;
Mongii, part of the Saphead&#8217;s binary analysis team, took the time to create the comic alongside the other Saphead&#8217;s and he did a great job may I point out!
Hopefully we&#8217;ll [...]]]></description>
			<content:encoded><![CDATA[<p>Okay I&#8217;m sure 80% of you would have already seen this comic of ours but I figured I&#8217;d publish a link to it from here too&#8230;</p>
<p>Mongii, part of the Saphead&#8217;s binary analysis team, took the time to create the comic alongside the other Saphead&#8217;s and he did a great job may I point out!</p>
<p>Hopefully we&#8217;ll be able to produce more work in this form after the Defcon finals <img src='http://korupt.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</p>
<p>You can find the comic at:<br />
  <a href="http://hackerschool.org/DefconCTF/17/B300.html">http://hackerschool.org/DefconCTF/17/B300.html</a></p>
<p>Any feedback is appreciated as always!</p>
<p>Please spread the word where applicable and feel free to leave a pingback if you like. Thank you!</p>
<p>I hope you enjoy the comic as much as I did <img src='http://korupt.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</p>
<p>&#8220;That has got to be the coolest write up, ever, in the history of ever.&#8221; &#8211; DarkTangent. Glad you like it DarkTangent <img src='http://korupt.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</p>
<p>It was also nice to see the comic featured on HackADay at <a href="http://hackaday.com/2009/07/14/binary-reversing-comic/">http://hackaday.com/2009/07/14/binary-reversing-comic/</a> <img src='http://korupt.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> . </p>
<p>KOrUPt.</p>
]]></content:encoded>
			<wfw:commentRss>http://korupt.co.uk/?feed=rss2&amp;p=164</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Defcon CTF 2009 Potent Pwnable&#8217;s 200 write up</title>
		<link>http://korupt.co.uk/?p=158</link>
		<comments>http://korupt.co.uk/?p=158#comments</comments>
		<pubDate>Sun, 21 Jun 2009 13:47:30 +0000</pubDate>
		<dc:creator>KOrUPt</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Reversing]]></category>
		<category><![CDATA[200]]></category>
		<category><![CDATA[adc]]></category>
		<category><![CDATA[CTF]]></category>
		<category><![CDATA[Defcon]]></category>
		<category><![CDATA[loller skaterz]]></category>
		<category><![CDATA[Pastie]]></category>
		<category><![CDATA[Potent]]></category>
		<category><![CDATA[Pre]]></category>
		<category><![CDATA[Pwn200]]></category>
		<category><![CDATA[Pwnable's]]></category>
		<category><![CDATA[Qualifications]]></category>
		<category><![CDATA[Quals]]></category>

		<guid isPermaLink="false">http://korupt.co.uk/?p=158</guid>
		<description><![CDATA[Okay so ADC was nice to enough to do a write up for the Potent Pwnable&#8217;s 200 challenge&#8230;
During the qualification round I took a brief look over this challenge and was able to locate the upload scripts and made a note of the SQL commands contained within the files you could download(once they were unpacked)&#8230; [...]]]></description>
			<content:encoded><![CDATA[<p>Okay so ADC was nice to enough to do a write up for the Potent Pwnable&#8217;s 200 challenge&#8230;</p>
<p>During the qualification round I took a brief look over this challenge and was able to locate the upload scripts and made a note of the SQL commands contained within the files you could download(once they were unpacked)&#8230; However I got sidetracked with Binary Analysis so I left this challenge to my team, unfortunately we didn&#8217;t solve it&#8230; Which makes this write up all the more interesting <img src='http://korupt.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</p>
<p>As usual you can find it over at Pastie:</p>
<p>http://pastie.org/505249.txt</p>
<p>I&#8217;ll have it mirrored locally in a few days.</p>
<p>Nice work Adc! I&#8217;m about to read over it now <img src='http://korupt.co.uk/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> .</p>
<p>KOrUPt.</p>
]]></content:encoded>
			<wfw:commentRss>http://korupt.co.uk/?feed=rss2&amp;p=158</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Overhauled the Blog&#8230;</title>
		<link>http://korupt.co.uk/?p=153</link>
		<comments>http://korupt.co.uk/?p=153#comments</comments>
		<pubDate>Fri, 19 Jun 2009 14:26:30 +0000</pubDate>
		<dc:creator>KOrUPt</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://korupt.co.uk/?p=153</guid>
		<description><![CDATA[Okay well as you can see, quite a few things have changed today&#8230;
I&#8217;ve added some custom themes and a theme selection tool so you can revert back to the old one should you not like the current one, however I don&#8217;t recommend it.
I&#8217;ve also added quite a few more widgets and plugins, you can now [...]]]></description>
			<content:encoded><![CDATA[<p>Okay well as you can see, quite a few things have changed today&#8230;</p>
<p>I&#8217;ve added some custom themes and a theme selection tool so you can revert back to the old one should you not like the current one, however I don&#8217;t recommend it.</p>
<p>I&#8217;ve also added quite a few more widgets and plugins, you can now receive email updates simply by subscribing(see the Notifications form to the right)&#8230;</p>
<p>For those interested I&#8217;ve integrated my Twitter account with this theme, so you can see what I&#8217;m up to on a daily basis.</p>
<p>Furthermore I&#8217;ve surveyed and updated the security settings and enhanced the search feature&#8230;</p>
<p>I took the time to remove some of the clutter from the sidebar too <img src='http://korupt.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</p>
<p>Hope you like the new look, I&#8217;m open to suggestions.</p>
<p>Just a quick update.</p>
<p>KOrUPt.</p>
]]></content:encoded>
			<wfw:commentRss>http://korupt.co.uk/?feed=rss2&amp;p=153</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Defcon CTF 2009 Trivia 400 write up</title>
		<link>http://korupt.co.uk/?p=149</link>
		<comments>http://korupt.co.uk/?p=149#comments</comments>
		<pubDate>Wed, 17 Jun 2009 18:12:08 +0000</pubDate>
		<dc:creator>KOrUPt</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Reversing]]></category>
		<category><![CDATA[2009]]></category>
		<category><![CDATA[400]]></category>
		<category><![CDATA[challenge]]></category>
		<category><![CDATA[CTF]]></category>
		<category><![CDATA[Defcon]]></category>
		<category><![CDATA[Pursuit]]></category>
		<category><![CDATA[Pursuits]]></category>
		<category><![CDATA[Qualifications]]></category>
		<category><![CDATA[Quals]]></category>
		<category><![CDATA[T400]]></category>
		<category><![CDATA[Trivia]]></category>
		<category><![CDATA[Trivial]]></category>
		<category><![CDATA[up]]></category>
		<category><![CDATA[write]]></category>
		<category><![CDATA[writeup]]></category>

		<guid isPermaLink="false">http://korupt.co.uk/?p=149</guid>
		<description><![CDATA[Seems someone took the time to do a write up for this years Defcon Trivial Pursuits 400 challenge  .
Let me start by saying me nor my team take any credit for this write up, it&#8217;s unclear as to who the author is but my guess is ADC of Loller Skaters produced it? Please correct [...]]]></description>
			<content:encoded><![CDATA[<p>Seems someone took the time to do a write up for this years Defcon Trivial Pursuits 400 challenge <img src='http://korupt.co.uk/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> .</p>
<p>Let me start by saying me nor my team take any credit for this write up, it&#8217;s unclear as to who the author is but my guess is ADC of Loller Skaters produced it? Please correct me if I&#8217;m wrong in this assumption.</p>
<p>The write up can be found over at Pastie:</p>
<p>http://pastie.org/510841</p>
<p>I&#8217;ve also mirrored it locally just incase, it can be found here:</p>
<p>http://korupt.co.uk/defcon/T400Writeup.txt</p>
<p>I strongly recommend you view the above write up within a web browser(preferably Firefox).</p>
<p>To the author of the above guide, very nice work <img src='http://korupt.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> . My team and I didn&#8217;t manage to solve the T400 challenge during the qualification round. If you&#8217;d like me to update the above links please leave a comment and I&#8217;ll do so at the earliest opertunity.</p>
<p>KOrUPt ~ Sapheads.</p>
]]></content:encoded>
			<wfw:commentRss>http://korupt.co.uk/?feed=rss2&amp;p=149</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Haha&#8217;s Defcon Crypto Badness 400 write up&#8230;</title>
		<link>http://korupt.co.uk/?p=143</link>
		<comments>http://korupt.co.uk/?p=143#comments</comments>
		<pubDate>Sun, 14 Jun 2009 00:20:45 +0000</pubDate>
		<dc:creator>KOrUPt</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Reversing]]></category>
		<category><![CDATA[09]]></category>
		<category><![CDATA[2009]]></category>
		<category><![CDATA[400]]></category>
		<category><![CDATA[Badness]]></category>
		<category><![CDATA[Beist]]></category>
		<category><![CDATA[C400]]></category>
		<category><![CDATA[Crypto]]></category>
		<category><![CDATA[CTF]]></category>
		<category><![CDATA[Defcon]]></category>
		<category><![CDATA[Qualifications]]></category>
		<category><![CDATA[Quals]]></category>
		<category><![CDATA[up]]></category>
		<category><![CDATA[write]]></category>
		<category><![CDATA[writeup]]></category>

		<guid isPermaLink="false">http://korupt.co.uk/?p=143</guid>
		<description><![CDATA[Just thought I&#8217;d bring this to your attention  &#8230;
For those interested in solving the Crypto Badness 400 challenge of the Defcon quals&#8230;
Hahah did a very good write up, which can be found at:
http://beist.org/defcon2009/defcon2009_crypto400_solution.txt
Good work Hahah, looking forward to any others you may do  .
Thanks to T1g3r for bringing the article to my attention [...]]]></description>
			<content:encoded><![CDATA[<p>Just thought I&#8217;d bring this to your attention <img src='http://korupt.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> &#8230;</p>
<p>For those interested in solving the Crypto Badness 400 challenge of the Defcon quals&#8230;<br />
Hahah did a very good write up, which can be found at:</p>
<p>http://beist.org/defcon2009/defcon2009_crypto400_solution.txt</p>
<p>Good work Hahah, looking forward to any others you may do <img src='http://korupt.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</p>
<p>Thanks to T1g3r for bringing the article to my attention :p.</p>
<p>Enjoy!</p>
<p>KOrUPt.</p>
<p>Edit: Author updated.</p>
]]></content:encoded>
			<wfw:commentRss>http://korupt.co.uk/?feed=rss2&amp;p=143</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Defcon CTF 09 Quals&#8230;</title>
		<link>http://korupt.co.uk/?p=135</link>
		<comments>http://korupt.co.uk/?p=135#comments</comments>
		<pubDate>Fri, 12 Jun 2009 23:55:32 +0000</pubDate>
		<dc:creator>KOrUPt</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[CTF]]></category>
		<category><![CDATA[ddtek]]></category>
		<category><![CDATA[Defcon]]></category>
		<category><![CDATA[experiences]]></category>
		<category><![CDATA[first]]></category>
		<category><![CDATA[impressions]]></category>
		<category><![CDATA[Kenshoto]]></category>
		<category><![CDATA[Qualifications]]></category>
		<category><![CDATA[Quals]]></category>
		<category><![CDATA[sapheads]]></category>
		<category><![CDATA[up]]></category>
		<category><![CDATA[write]]></category>

		<guid isPermaLink="false">http://korupt.co.uk/?p=135</guid>
		<description><![CDATA[Okay so recently I said I&#8217;d post my views regarding my experience at this years Defcon CTF qualifications&#8230;
This year we put forward a new and considerably stronger team than last year and we decided to go by the name of &#8220;Sapheads&#8221;, for those wondering, the definition of a &#8220;saphead&#8221; is an &#8220;idiot&#8221;, this name was [...]]]></description>
			<content:encoded><![CDATA[<p>Okay so recently I said I&#8217;d post my views regarding my experience at this years Defcon CTF qualifications&#8230;</p>
<p>This year we put forward a new and considerably stronger team than last year and we decided to go by the name of &#8220;Sapheads&#8221;, for those wondering, the definition of a &#8220;saphead&#8221; is an &#8220;idiot&#8221;, this name was chosen out of comedic value with [I assume] the intention of having a touch of irony to it&#8230; Similar to Lastplace, who tend to end up in first place <img src='http://korupt.co.uk/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> (props @tlas and co <img src='http://korupt.co.uk/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> ).</p>
<p>In fact, our team this year is the combined force of three of last years teams&#8230;</p>
<p>We finished 11th,  after 48 hours of what seemed to be near non-stop analysis, I got a passive 4 hours sleep during that period.</p>
<p>Our final result I think goes to show just how important it is to be well prepared, organized and to communicate correctly. Our team members excelled themselves and without the collaboration between us I doubt we&#8217;d of done as well as we did&#8230;</p>
<p>Binary Leetness 400 is a prime example of this, I served as my teams binary analyst. 85MB&#8217;s of JPEG&#8217;s&#8230; To a binary analyst, that doesn&#8217;t mean much&#8230; Though I was able to put together some of the puzzle. After handing the file down to our teams forensics expert, he eventually came back to us with an executable which I was able to provide an analysis of&#8230; That said, without his efforts, we wouldn&#8217;t have solved the challenge.</p>
<p>During the qualification rounds, good resource utilization is also helpful&#8230; Thinking about it, I did initially intend to stock 20 or so energy drinks, don&#8217;t know what happened to that plan though.</p>
<p>I think most of our team this year were a bit apprehensive once they&#8217;d learned that Kenshoto had stepped down and Ddtek opted to fill their shoes(props to you guys!)&#8230; I know I was! None of us were sure what to expect this year.</p>
<p>My initial impression wasn&#8217;t a very good one, the scoreboard was very slow to begin with and some of the services were periodically updated which threw a few of us off during mid-analysis. However, I have to admit the Ddtek crew did a very very good job to resolve the issues at hand, after a while things where once again bearable and all went well. I think I speak for everyone when I say we all had a great time!</p>
<p>Our team did solve all of the Binary Leetness challenges, which is something I&#8217;m proud of. We&#8217;ll be doing write up&#8217;s soon, as it stands I&#8217;ve already done a write up for the Binary Leetness 300 challenge, which can be found via a quick search.</p>
<p>Currently we intend to solve some of the challenges we weren&#8217;t able to solve during the qualification rounds and hopefully do write up&#8217;s of their solutions.</p>
<p>That said, I&#8217;m just one side of this team, you can find the rest of us over at http://www.sapheads.org, I&#8217;ll be mirroring most of the content here over there, with the intention of having a more centralized source of information for you all <img src='http://korupt.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> . I hope you all drop by sometime <img src='http://korupt.co.uk/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> .</p>
<p>I&#8217;d like to conclude this post by extending a very big thank you to the ddtek team, and of course Kenshoto, who also put on a very good game over the years.</p>
<p>To my team, very good job, we will only continue to get stronger <img src='http://korupt.co.uk/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> .</p>
<p>DDTek, best of luck handling the CTF at Defcon, I&#8217;m sure you&#8217;ll do well&#8230; P.S Mars, let me know how it goes if possible <img src='http://korupt.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</p>
<p>That just about wraps this article up for now I think&#8230; At this rate I&#8217;ll have to make a category specifically for Defcon related content <img src='http://korupt.co.uk/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> .</p>
<p>References:</p>
<p>http://www.sapheads.org/ &lt; our team.</p>
<p>http://ddtek.biz/ &lt; this years ctf organizers.</p>
<p>http://shallweplayaga.me/ &lt; VedaGodz.</p>
<p>http://brycekerley.net/blog/2009/06/trivia300.html &lt; Bryce&#8217;s T300 solution.</p>
<p>Signing off.</p>
<p>~ KOrUPt.</p>
]]></content:encoded>
			<wfw:commentRss>http://korupt.co.uk/?feed=rss2&amp;p=135</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>Defcon CTF 2009 Binary Leetness 300</title>
		<link>http://korupt.co.uk/?p=132</link>
		<comments>http://korupt.co.uk/?p=132#comments</comments>
		<pubDate>Thu, 11 Jun 2009 00:56:01 +0000</pubDate>
		<dc:creator>KOrUPt</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Reversing]]></category>
		<category><![CDATA[300]]></category>
		<category><![CDATA[Bin300]]></category>
		<category><![CDATA[Binary]]></category>
		<category><![CDATA[CTF]]></category>
		<category><![CDATA[ddtek]]></category>
		<category><![CDATA[Defcon]]></category>
		<category><![CDATA[Leetness]]></category>
		<category><![CDATA[Quals]]></category>
		<category><![CDATA[sapheads]]></category>
		<category><![CDATA[up]]></category>
		<category><![CDATA[write]]></category>
		<category><![CDATA[writeup]]></category>

		<guid isPermaLink="false">http://korupt.co.uk/?p=132</guid>
		<description><![CDATA[http://korupt.co.uk/defcon/B300Writeup.rar]]></description>
			<content:encoded><![CDATA[<p>Well, the Defcon CTF 2009 qualifications are over&#8230; I&#8217;ve decided to do a write up for the Binary Leetness 300 challenge <img src='http://korupt.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</p>
<p>Feedback appreciated!</p>
<p>Note: your anti-virus may detect the below archive as infected, it contains the b300 binary, which is packed. This is a false positive, I recommend you disable your AV.</p>
<p>http://korupt.co.uk/defcon/B300Writeup.rar</p>
<p>I&#8217;ll be posting a more in-depth overview of my experience at the quals shortly.</p>
<p>Enjoy!</p>
<p>KOrUPt ~ Sapheads.org.</p>
]]></content:encoded>
			<wfw:commentRss>http://korupt.co.uk/?feed=rss2&amp;p=132</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Wargaming and idea&#8217;s&#8230;</title>
		<link>http://korupt.co.uk/?p=129</link>
		<comments>http://korupt.co.uk/?p=129#comments</comments>
		<pubDate>Tue, 17 Feb 2009 17:27:54 +0000</pubDate>
		<dc:creator>KOrUPt</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Reversing]]></category>
		<category><![CDATA[Defcon]]></category>
		<category><![CDATA[Idea's]]></category>
		<category><![CDATA[Randoms]]></category>
		<category><![CDATA[Services]]></category>
		<category><![CDATA[Wargames]]></category>
		<category><![CDATA[Wargaming]]></category>

		<guid isPermaLink="false">http://korupt.co.uk/?p=129</guid>
		<description><![CDATA[Recently a friend of mine asked me if I'd like to write a few RE challenges and Wargame services for him... I thought this would be fun and I've had a few crafty idea's :D. The intended platform is a currently undecided Linux distribution. This post documents some of my idea's and thoughts on the matter :p.]]></description>
			<content:encoded><![CDATA[<p>Hi all.</p>
<p>First things first, I apoligise for the drought in new posts, I&#8217;m very busy at the moment dealing with real life problems and such&#8230;</p>
<p>Now on to what I actually wanted to write about.</p>
<p>Recently a friend of mine asked me if I&#8217;d like to write a few RE challenges and Wargame services for him&#8230; I thought this would be fun and I&#8217;ve had a few crafty idea&#8217;s <img src='http://korupt.co.uk/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> . The intended platform is a currently undecided Linux distribution. This post documents some of my idea&#8217;s and thoughts on the matter :p.</p>
<p>I was thinking about creating some stripped bins and having some fun with RAW sockets, SSL certs, FLIRT signatures, kernel modules and a few other things, if all goes to plan this could be a fun adventure&#8230;</p>
<p>Drunken TCP servers and custom encryption schemes come to mind :p.</p>
<p>I was wondering if any of my readers have any idea&#8217;s for services I could implement and such?</p>
<p>I&#8217;d also like some opinions on how you&#8217;d go about throwing together some of the aforementioned things.</p>
<p>As I mentioned earlier, I&#8217;m very busy with real lifes issues at the moment so I don&#8217;t have much free time. So it could be a while before I actually implement these services.</p>
<p>I&#8217;m thinking of setting up an environment similar to the Defcon quals.</p>
<p>If anyone has any feedback or suggestions I&#8217;d love to hear them.</p>
<p>If you&#8217;d like to lend a hand in implementing a few services don&#8217;t hesitate to contact me. Support is something I need at the moment <img src='http://korupt.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</p>
<p>Hope to hear from you all. Spread the word where applicable.</p>
<p>KOrUPt.</p>
]]></content:encoded>
			<wfw:commentRss>http://korupt.co.uk/?feed=rss2&amp;p=129</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Defcon CTF Catdoord writeup</title>
		<link>http://korupt.co.uk/?p=127</link>
		<comments>http://korupt.co.uk/?p=127#comments</comments>
		<pubDate>Mon, 19 Jan 2009 01:50:27 +0000</pubDate>
		<dc:creator>KOrUPt</dc:creator>
				<category><![CDATA[Reversing]]></category>
		<category><![CDATA[Catdoor]]></category>
		<category><![CDATA[CTF]]></category>
		<category><![CDATA[Defcon]]></category>
		<category><![CDATA[nopsr.us]]></category>
		<category><![CDATA[writeup]]></category>

		<guid isPermaLink="false">http://korupt.co.uk/?p=127</guid>
		<description><![CDATA[Okay so a few days back I got bored and decided to try my hand at some of Defcon&#8217;s 2008 CTF binaries.
For those not familiar with Defcon CTF, it&#8217;s basically a contest that consists of seven teams of highly skilled individuals. Each team must defend their server and attack the other teams server. For a [...]]]></description>
			<content:encoded><![CDATA[<p>Okay so a few days back I got bored and decided to try my hand at some of Defcon&#8217;s 2008 CTF binaries.</p>
<p>For those not familiar with Defcon CTF, it&#8217;s basically a contest that consists of seven teams of highly skilled individuals. Each team must defend their server and attack the other teams server. For a more in depth description I&#8217;ll refer you to this page:</p>
<ul>
<li>http://nopsr.us/ctf2008/overview.html</li>
</ul>
<p>Now before you go on reading this article&#8230; I want to point out that I was unable to get this binary to function correctly(or at all for that matter) on my FreeBsd 6.4 VM&#8230; So the write up I&#8217;m presenting here is mainly the outcome of my time spent performing static analysis and thus it may be incorrect. I&#8217;m hoping that if I am incorrect in my solution that someone may be able to correct me.</p>
<p>Well, of course we start by downloading the binary in question, you can find it here:</p>
<ul>
<li> http://nopsr.us/ctf2008/binaries/catdoord</li>
</ul>
<p>Thanks go out to 1@stPlace for uploading the binaries <img src='http://korupt.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> , If you guys are reading this, I&#8217;d really like to hear from you.</p>
<p>We start by checking the file type:</p>
<blockquote><p>[KOrUPt@Area51 /usr/home/KOrUPt/defcon]$ file catdoord<br />
catdoord: ELF 32-bit LSB executable, Intel 80386, version 1 (FreeBSD),<br />
dynamically linked (uses shared libs), stripped</p></blockquote>
<p>No debug symbols, this makes disassembling with GDB rather awkward. But it isn&#8217;t a problem in this case as I&#8217;m using IDA.</p>
<p>I&#8217;ll be focusing on explaining the main callback procedure of this binary as the initial routines are near enough the same throughout every other available service. Just to outline the basic functionality:</p>
<ol>
<li>Listen for connections on port 4341.</li>
<li>Drop &#8220;catdoor&#8221;&#8217;s user privileges.</li>
<li>Accept incoming connections and enter the client callback routine.</li>
</ol>
<p>The callback routine in question can be found at the following address:</p>
<ul>
<li> 0&#215;080493C0</li>
</ul>
<p>Upon starting my initial analysis of the callback routine I used HexRays IDA decompiler plugin. This helped simplify a fair amount of the code.</p>
<p>I could see a few uninitialized variable&#8217;s being passed to memcpy:</p>

<div class="wp_codebox"><table><tr id="p1275"><td class="code" id="p127code5"><pre class="c" style="font-family:monospace;">pSzChar <span style="color: #339933;">=</span> <span style="color: #339933;">&amp;</span>szChar<span style="color: #339933;">;</span>
pStruct <span style="color: #339933;">=</span> <span style="color: #339933;">&amp;</span>struct<span style="color: #009900;">&#91;</span>i<span style="color: #339933;">++</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// 'i' is globally defined</span>
memcpy<span style="color: #009900;">&#40;</span>pStruct<span style="color: #339933;">,</span> <span style="color: #339933;">&amp;</span>szChar<span style="color: #339933;">,</span> 8u<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>the unknown structure is defined as follows:</p>

<div class="wp_codebox"><table><tr id="p1276"><td class="code" id="p127code6"><pre class="asm" style="font-family:monospace;"><span style="color: #339933;">.</span>bss<span style="color: #339933;">:</span>0804A7C0 <span style="color: #000000; font-weight: bold;">struct</span>          struct_0 <span style="color: #0000ff;">200h</span> <span style="color: #000000; font-weight: bold;">dup</span><span style="color: #009900; font-weight: bold;">&#40;</span><span style="color: #009900; font-weight: bold;">&#41;</span></pre></td></tr></table></div>

<p>Regarding the calls to memcpy(), we see similar code throughout or analysis, this kept me wondering for quite a while but eventually I came to the conclusion that it must be a red-herring of sorts. I&#8217;ll go into more detail shortly.</p>
<p>Continuing our analysis we see a few calls to unknown functions, after a little time analysing them, it&#8217;s clear that the first seems to be a wrapper for the recv() function.</p>
<p>Its code is as follows and as you can see I&#8217;ve named this function &#8220;RecvData&#8221;:</p>

<div class="wp_codebox"><table><tr id="p1277"><td class="code" id="p127code7"><pre class="asm" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">; int __cdecl RecvData(SOCKET sock, char *buf)</span>
<span style="color: #339933;">.</span>text<span style="color: #339933;">:</span><span style="color: #0000ff;">08049338</span> RecvData        <span style="color: #000000; font-weight: bold;">proc</span> <span style="color: #000000; font-weight: bold;">near</span>               <span style="color: #666666; font-style: italic;">; CODE XREF: callback+70</span>
<span style="color: #339933;">.</span>text<span style="color: #339933;">:</span><span style="color: #0000ff;">08049338</span>
<span style="color: #339933;">.</span>text<span style="color: #339933;">:</span><span style="color: #0000ff;">08049338</span> fd              = <span style="color: #000000; font-weight: bold;">dword</span> <span style="color: #000000; font-weight: bold;">ptr</span> <span style="color: #339933;">-</span><span style="color: #0000ff;">8</span>
<span style="color: #339933;">.</span>text<span style="color: #339933;">:</span><span style="color: #0000ff;">08049338</span> nbytesRecvd     = <span style="color: #000000; font-weight: bold;">dword</span> <span style="color: #000000; font-weight: bold;">ptr</span> <span style="color: #339933;">-</span><span style="color: #0000ff;">4</span>
<span style="color: #339933;">.</span>text<span style="color: #339933;">:</span><span style="color: #0000ff;">08049338</span> sock            = <span style="color: #000000; font-weight: bold;">dword</span> <span style="color: #000000; font-weight: bold;">ptr</span>  <span style="color: #0000ff;">8</span>
<span style="color: #339933;">.</span>text<span style="color: #339933;">:</span><span style="color: #0000ff;">08049338</span> buf             = <span style="color: #000000; font-weight: bold;">dword</span> <span style="color: #000000; font-weight: bold;">ptr</span>  <span style="color: #0000ff;">0Ch</span>
<span style="color: #339933;">.</span>text<span style="color: #339933;">:</span><span style="color: #0000ff;">08049338</span>
<span style="color: #339933;">.</span>text<span style="color: #339933;">:</span><span style="color: #0000ff;">08049338</span>                 <span style="color: #00007f; font-weight: bold;">push</span>    <span style="color: #00007f;">ebp</span>
<span style="color: #339933;">.</span>text<span style="color: #339933;">:</span><span style="color: #0000ff;">08049339</span>                 <span style="color: #00007f; font-weight: bold;">mov</span>     <span style="color: #00007f;">ebp</span><span style="color: #339933;">,</span> <span style="color: #00007f;">esp</span>
<span style="color: #339933;">.</span>text<span style="color: #339933;">:</span>0804933B                 <span style="color: #00007f; font-weight: bold;">sub</span>     <span style="color: #00007f;">esp</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">8</span>
<span style="color: #339933;">.</span>text<span style="color: #339933;">:</span>0804933E                 <span style="color: #00007f; font-weight: bold;">mov</span>     <span style="color: #009900; font-weight: bold;">&#91;</span><span style="color: #00007f;">ebp</span><span style="color: #339933;">+</span>nbytesRecvd<span style="color: #009900; font-weight: bold;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">0</span>
<span style="color: #339933;">.</span>text<span style="color: #339933;">:</span><span style="color: #0000ff;">08049345</span>                 <span style="color: #00007f; font-weight: bold;">mov</span>     <span style="color: #00007f;">edx</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">&#91;</span><span style="color: #00007f;">ebp</span><span style="color: #339933;">+</span>fd<span style="color: #009900; font-weight: bold;">&#93;</span>
<span style="color: #339933;">.</span>text<span style="color: #339933;">:</span><span style="color: #0000ff;">08049348</span>                 <span style="color: #00007f; font-weight: bold;">lea</span>     <span style="color: #00007f;">edx</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">&#91;</span><span style="color: #00007f;">esp</span><span style="color: #339933;">+</span><span style="color: #0000ff;">8</span><span style="color: #009900; font-weight: bold;">&#93;</span>    <span style="color: #666666; font-style: italic;">; first function parameter</span>
<span style="color: #339933;">.</span>text<span style="color: #339933;">:</span>0804934C                 <span style="color: #00007f; font-weight: bold;">mov</span>     <span style="color: #00007f;">eax</span><span style="color: #339933;">,</span> <span style="color: #00007f;">edx</span>
<span style="color: #339933;">.</span>text<span style="color: #339933;">:</span>0804934E                 <span style="color: #00007f; font-weight: bold;">mov</span>     <span style="color: #009900; font-weight: bold;">&#91;</span><span style="color: #00007f;">ebp</span><span style="color: #339933;">+</span>fd<span style="color: #009900; font-weight: bold;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #00007f;">eax</span>
<span style="color: #339933;">.</span>text<span style="color: #339933;">:</span><span style="color: #0000ff;">08049351</span>                 <span style="color: #00007f; font-weight: bold;">sub</span>     <span style="color: #00007f;">esp</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">4</span>
<span style="color: #339933;">.</span>text<span style="color: #339933;">:</span><span style="color: #0000ff;">08049354</span>                 <span style="color: #00007f; font-weight: bold;">push</span>    <span style="color: #0000ff;">8</span>               <span style="color: #666666; font-style: italic;">; size_t</span>
<span style="color: #339933;">.</span>text<span style="color: #339933;">:</span><span style="color: #0000ff;">08049356</span>                 <span style="color: #00007f; font-weight: bold;">push</span>    <span style="color: #009900; font-weight: bold;">&#91;</span><span style="color: #00007f;">ebp</span><span style="color: #339933;">+</span>fd<span style="color: #009900; font-weight: bold;">&#93;</span>        <span style="color: #666666; font-style: italic;">; void *</span>
<span style="color: #339933;">.</span>text<span style="color: #339933;">:</span><span style="color: #0000ff;">08049359</span>                 <span style="color: #00007f; font-weight: bold;">mov</span>     <span style="color: #00007f;">eax</span><span style="color: #339933;">,</span> <span style="color: #00007f;">ds</span><span style="color: #339933;">:</span>i
<span style="color: #339933;">.</span>text<span style="color: #339933;">:</span>0804935E                 <span style="color: #00007f; font-weight: bold;">shl</span>     <span style="color: #00007f;">eax</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">3</span>          <span style="color: #666666; font-style: italic;">; counter &lt;&lt; 3</span>
<span style="color: #339933;">.</span>text<span style="color: #339933;">:</span><span style="color: #0000ff;">08049361</span>                 <span style="color: #00007f; font-weight: bold;">add</span>     <span style="color: #00007f;">eax</span><span style="color: #339933;">,</span> <span style="color: #000000; font-weight: bold;">offset</span> <span style="color: #000000; font-weight: bold;">struct</span>
<span style="color: #339933;">.</span>text<span style="color: #339933;">:</span><span style="color: #0000ff;">08049366</span>                 <span style="color: #00007f; font-weight: bold;">push</span>    <span style="color: #00007f;">eax</span>             <span style="color: #666666; font-style: italic;">; void *</span>
<span style="color: #339933;">.</span>text<span style="color: #339933;">:</span><span style="color: #0000ff;">08049367</span>                 <span style="color: #00007f; font-weight: bold;">inc</span>     <span style="color: #00007f;">ds</span><span style="color: #339933;">:</span>i
<span style="color: #339933;">.</span>text<span style="color: #339933;">:</span>0804936D                 <span style="color: #00007f; font-weight: bold;">call</span>    _memcpy
<span style="color: #339933;">.</span>text<span style="color: #339933;">:</span><span style="color: #0000ff;">08049372</span>                 <span style="color: #00007f; font-weight: bold;">add</span>     <span style="color: #00007f;">esp</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">10h</span>
<span style="color: #339933;">.</span>text<span style="color: #339933;">:</span><span style="color: #0000ff;">08049375</span>
<span style="color: #339933;">.</span>text<span style="color: #339933;">:</span><span style="color: #0000ff;">08049375</span> recvLoop<span style="color: #339933;">:</span>                               <span style="color: #666666; font-style: italic;">; CODE XREF: RecvData+5C</span>
<span style="color: #339933;">.</span>text<span style="color: #339933;">:</span><span style="color: #0000ff;">08049375</span>                 <span style="color: #00007f; font-weight: bold;">push</span>    <span style="color: #0000ff;">0</span>               <span style="color: #666666; font-style: italic;">; flags</span>
<span style="color: #339933;">.</span>text<span style="color: #339933;">:</span><span style="color: #0000ff;">08049377</span>                 <span style="color: #00007f; font-weight: bold;">push</span>    <span style="color: #0000ff;">4096</span>            <span style="color: #666666; font-style: italic;">; len</span>
<span style="color: #339933;">.</span>text<span style="color: #339933;">:</span>0804937C                 <span style="color: #00007f; font-weight: bold;">push</span>    <span style="color: #009900; font-weight: bold;">&#91;</span><span style="color: #00007f;">ebp</span><span style="color: #339933;">+</span>buf<span style="color: #009900; font-weight: bold;">&#93;</span>       <span style="color: #666666; font-style: italic;">; buf</span>
<span style="color: #339933;">.</span>text<span style="color: #339933;">:</span><span style="color: #0000ff;">0804937F</span>                 <span style="color: #00007f; font-weight: bold;">push</span>    <span style="color: #009900; font-weight: bold;">&#91;</span><span style="color: #00007f;">ebp</span><span style="color: #339933;">+</span>sock<span style="color: #009900; font-weight: bold;">&#93;</span>      <span style="color: #666666; font-style: italic;">; s</span>
<span style="color: #339933;">.</span>text<span style="color: #339933;">:</span><span style="color: #0000ff;">08049382</span>                 <span style="color: #00007f; font-weight: bold;">call</span>    _recv
<span style="color: #339933;">.</span>text<span style="color: #339933;">:</span><span style="color: #0000ff;">08049387</span>                 <span style="color: #00007f; font-weight: bold;">add</span>     <span style="color: #00007f;">esp</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">10h</span>
<span style="color: #339933;">.</span>text<span style="color: #339933;">:</span>0804938A                 <span style="color: #00007f; font-weight: bold;">mov</span>     <span style="color: #009900; font-weight: bold;">&#91;</span><span style="color: #00007f;">ebp</span><span style="color: #339933;">+</span>nbytesRecvd<span style="color: #009900; font-weight: bold;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #00007f;">eax</span>
<span style="color: #339933;">.</span>text<span style="color: #339933;">:</span>0804938D                 <span style="color: #00007f; font-weight: bold;">cmp</span>     <span style="color: #009900; font-weight: bold;">&#91;</span><span style="color: #00007f;">ebp</span><span style="color: #339933;">+</span>nbytesRecvd<span style="color: #009900; font-weight: bold;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">4095</span>
<span style="color: #339933;">.</span>text<span style="color: #339933;">:</span><span style="color: #0000ff;">08049394</span>                 <span style="color: #00007f; font-weight: bold;">jg</span>      <span style="color: #000000; font-weight: bold;">short</span> recvLoop
<span style="color: #339933;">.</span>text<span style="color: #339933;">:</span><span style="color: #0000ff;">08049396</span>                 <span style="color: #00007f; font-weight: bold;">sub</span>     <span style="color: #00007f;">esp</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">4</span>
<span style="color: #339933;">.</span>text<span style="color: #339933;">:</span><span style="color: #0000ff;">08049399</span>                 <span style="color: #00007f; font-weight: bold;">push</span>    <span style="color: #0000ff;">8</span>               <span style="color: #666666; font-style: italic;">; size_t</span>
<span style="color: #339933;">.</span>text<span style="color: #339933;">:</span>0804939B                 <span style="color: #00007f; font-weight: bold;">dec</span>     <span style="color: #00007f;">ds</span><span style="color: #339933;">:</span>i
<span style="color: #339933;">.</span>text<span style="color: #339933;">:</span>080493A1                 <span style="color: #00007f; font-weight: bold;">mov</span>     <span style="color: #00007f;">eax</span><span style="color: #339933;">,</span> <span style="color: #00007f;">ds</span><span style="color: #339933;">:</span>i
<span style="color: #339933;">.</span>text<span style="color: #339933;">:</span>080493A6                 <span style="color: #00007f; font-weight: bold;">shl</span>     <span style="color: #00007f;">eax</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">3</span>
<span style="color: #339933;">.</span>text<span style="color: #339933;">:</span>080493A9                 <span style="color: #00007f; font-weight: bold;">add</span>     <span style="color: #00007f;">eax</span><span style="color: #339933;">,</span> <span style="color: #000000; font-weight: bold;">offset</span> <span style="color: #000000; font-weight: bold;">struct</span>
<span style="color: #339933;">.</span>text<span style="color: #339933;">:</span>080493AE                 <span style="color: #00007f; font-weight: bold;">push</span>    <span style="color: #00007f;">eax</span>             <span style="color: #666666; font-style: italic;">; void *</span>
<span style="color: #339933;">.</span>text<span style="color: #339933;">:</span>080493AF                 <span style="color: #00007f; font-weight: bold;">push</span>    <span style="color: #009900; font-weight: bold;">&#91;</span><span style="color: #00007f;">ebp</span><span style="color: #339933;">+</span>fd<span style="color: #009900; font-weight: bold;">&#93;</span>        <span style="color: #666666; font-style: italic;">; void *</span>
<span style="color: #339933;">.</span>text<span style="color: #339933;">:</span>080493B2                 <span style="color: #00007f; font-weight: bold;">call</span>    _memcpy
<span style="color: #339933;">.</span>text<span style="color: #339933;">:</span>080493B7                 <span style="color: #00007f; font-weight: bold;">add</span>     <span style="color: #00007f;">esp</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">10h</span>
<span style="color: #339933;">.</span>text<span style="color: #339933;">:</span>080493BA                 <span style="color: #00007f; font-weight: bold;">mov</span>     <span style="color: #00007f;">eax</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">&#91;</span><span style="color: #00007f;">ebp</span><span style="color: #339933;">+</span>nbytesRecvd<span style="color: #009900; font-weight: bold;">&#93;</span>
<span style="color: #339933;">.</span>text<span style="color: #339933;">:</span>080493BD                 <span style="color: #00007f; font-weight: bold;">leave</span>
<span style="color: #339933;">.</span>text<span style="color: #339933;">:</span>080493BE                 <span style="color: #00007f; font-weight: bold;">retn</span></pre></td></tr></table></div>

<p>Again, we see more operations taking place in regard to these mysterious structures. After going over the disassembly it&#8217;s worth noting that the data we send to this service does not appear to effect any variable&#8217;s used in the operations involving the unknown structure&#8217;s. Given we are trying to exploit the service I cannot see how the use of these structures may present a vulnerability and it is for this reason I decided to divert my attention to the other parts of the code.</p>
<p>Whilst writing this a quick thought has come to mind, unfortunately I&#8217;m unable to put this theory to the test at the moment, but perhaps an overflow condition is created during the receiving of data over the socket, which in turn overwrites the address of the functions local variable&#8217;s and the hardship is that of trying to keep the service up and running? This would address my later concern(which I&#8217;ll mention shortly). Any comments?</p>
<p>Disregarding my above sentiments, I shall continue with my explanation.</p>
<p>Just after the call to RecvData(), we&#8217;ve a second function being called, this one I&#8217;ve decided to call &#8220;WriteData&#8221;. Its code is as follows:</p>

<div class="wp_codebox"><table><tr id="p1278"><td class="code" id="p127code8"><pre class="c" style="font-family:monospace;">size_t __cdecl WriteData<span style="color: #009900;">&#40;</span><span style="color: #993333;">int</span> a1<span style="color: #339933;">,</span> <span style="color: #993333;">void</span> <span style="color: #339933;">*</span>buff<span style="color: #339933;">,</span> size_t length<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
<span style="color: #993333;">void</span> <span style="color: #339933;">*</span>pStruct<span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// ST00_4@1</span>
<span style="color: #993333;">char</span> <span style="color: #339933;">*</span>envHome<span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// eax@1</span>
FILE <span style="color: #339933;">*</span>pFile<span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// eax@1</span>
size_t bytesWritten<span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// eax@3</span>
size_t pBytesWritten<span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// [sp+41Ch] [bp-Ch]@1</span>
<span style="color: #993333;">char</span> filename<span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// [sp+10h] [bp-418h]@1</span>
FILE <span style="color: #339933;">*</span>pFile2<span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// [sp+Ch] [bp-41Ch]@1</span>
<span style="color: #993333;">void</span> <span style="color: #339933;">*</span>localStruct<span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// [sp+8h] [bp-420h]@1</span>
&nbsp;
pBytesWritten <span style="color: #339933;">=</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
memset<span style="color: #009900;">&#40;</span><span style="color: #339933;">&amp;</span>filename<span style="color: #339933;">,</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">,</span> 1024u<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
pFile2 <span style="color: #339933;">=</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
localStruct <span style="color: #339933;">=</span> <span style="color: #339933;">&amp;</span>localStruct<span style="color: #339933;">;</span>
pStruct <span style="color: #339933;">=</span> <span style="color: #339933;">&amp;</span>struct<span style="color: #009900;">&#91;</span>i<span style="color: #339933;">++</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
memcpy<span style="color: #009900;">&#40;</span>pStruct<span style="color: #339933;">,</span> <span style="color: #339933;">&amp;</span>localStruct<span style="color: #339933;">,</span> 8u<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
envHome <span style="color: #339933;">=</span> getenv<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;HOME&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
snprintf<span style="color: #009900;">&#40;</span><span style="color: #339933;">&amp;</span>filename<span style="color: #339933;">,</span> <span style="color: #0000dd;">1024</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;%s/.ssh/authorized_keys2&quot;</span><span style="color: #339933;">,</span> envHome<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
pFile <span style="color: #339933;">=</span> fopen<span style="color: #009900;">&#40;</span><span style="color: #339933;">&amp;</span>filename<span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;w+&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
pFile2 <span style="color: #339933;">=</span> pFile<span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> pFile <span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
bytesWritten <span style="color: #339933;">=</span> fwrite<span style="color: #009900;">&#40;</span>buff<span style="color: #339933;">,</span> 1u<span style="color: #339933;">,</span> length<span style="color: #339933;">,</span> pFile2<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
pBytesWritten <span style="color: #339933;">=</span> bytesWritten<span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #009900;">&#40;</span><span style="color: #993333;">signed</span> <span style="color: #993333;">int</span><span style="color: #009900;">&#41;</span>bytesWritten <span style="color: #339933;">&gt;=</span> <span style="color: #0000dd;">0</span> <span style="color: #009900;">&#41;</span>
fclose<span style="color: #009900;">&#40;</span>pFile2<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #339933;">--</span>i<span style="color: #339933;">;</span>
memcpy<span style="color: #009900;">&#40;</span>localStruct<span style="color: #339933;">,</span> <span style="color: #339933;">&amp;</span>struct<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> 8u<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">return</span> pBytesWritten<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Again we see more operations involving our structures. But more importantly we can see that this code is overwriting the &#8220;~/.ssh/authorized_keys2&#8243; file with the data we received over our socket earlier.</p>
<p>In theory, we should be able to generate a pair of DSA keys(public and private), overwrite the authorized_keys2 file with our public key and login via SSH using our chosen passphrase.</p>
<p>To further your understanding of this concept, I&#8217;ll quote a web page I read prior to writing this:</p>
<blockquote><p>
DSA key generation<br />
-<br />
While RSA keys are used by version 1 of the ssh protocol, DSA keys are used for protocol level 2, an updated version of the ssh protocol. Any modern version of OpenSSH should be able to use both RSA and DSA keys. Generating DSA keys using OpenSSH&#8217;s ssh-keygen can be done similarly to RSA in the following manner:</p>
<p>&#8220;% ssh-keygen -t dsa&#8221;</p>
<p>Again, we&#8217;ll be prompted for a passphrase. Enter a secure one. We&#8217;ll also be prompted for a location to save our DSA keys. The default, normally ~/.ssh/id_dsa and ~/.ssh/id_dsa.pub, should be fine. After our one-time DSA key generation is complete, it&#8217;s time to install our DSA public key to remote systems.</p>
<p>-</p>
<p>DSA public key install<br />
-<br />
Again, DSA public key installation is almost identical to RSA. For DSA, we&#8217;ll want to copy our ~/.ssh/id_dsa.pub file to remotebox, and then append it to the ~/.ssh/authorized_keys2 on remotebox. Note that this file has a different name than the RSA authorized_keys file. Once configured, we should be able to log in to remotebox by typing in our DSA private key passphrase rather than typing in our actual remotebox password.</p></blockquote>
<p>Once we&#8217;ve SSH access there are many things that can be done. As I&#8217;m sure you&#8217;re aware of. On that note, we have effectively gained a means towards unauthorized access to the target machine(this being a game, we&#8217;re not breaking any laws :p).</p>
<p>Now to address my earlier concern&#8230; This is too easy! From my past experiences most Defcon services are rather complex, this service just doesn&#8217;t seem to be on the same level as the past ones I&#8217;ve faced. Thus for some reason I cant help but think I&#8217;m wrong in this explanation&#8230;</p>
<p>Well, given my current time constraints I&#8217;ll wrap this up here.</p>
<p>Please do not hesitate to leave me a comment and as always I hope you liked the read.</p>
<p>I&#8217;ll be having a go at some of the other Defcon binaries soon so stay tuned for more writeups <img src='http://korupt.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</p>
<p>KOrUPt.</p>
]]></content:encoded>
			<wfw:commentRss>http://korupt.co.uk/?feed=rss2&amp;p=127</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Bypassing custom exception handlers</title>
		<link>http://korupt.co.uk/?p=122</link>
		<comments>http://korupt.co.uk/?p=122#comments</comments>
		<pubDate>Thu, 15 Jan 2009 04:17:16 +0000</pubDate>
		<dc:creator>KOrUPt</dc:creator>
				<category><![CDATA[Malware analysis]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[Custom]]></category>
		<category><![CDATA[Exception]]></category>
		<category><![CDATA[Handler]]></category>
		<category><![CDATA[Overwriting]]></category>
		<category><![CDATA[SEH]]></category>
		<category><![CDATA[Structured]]></category>

		<guid isPermaLink="false">http://korupt.co.uk/?p=122</guid>
		<description><![CDATA[There are quite a few reasons as to why we may need to restore the default Structured Exception Handler(which resides within Kernel32). Such a need arises when we may want to stall a foreign process via using an INT3(Breakpoint) instruction so we can attach to the process with our JIT debugger...]]></description>
			<content:encoded><![CDATA[<p>There are quite a few reasons as to why we may need to restore the default Structured Exception Handler(which resides within Kernel32). Such a need arises when we may want to stall a foreign process via using an INT3(Breakpoint) instruction so we can attach to the process with our JIT debugger&#8230; For more information regarding that subject, see my article here:</p>
<ul>
<li><a href="http://korupt.co.uk/?p=115">http://korupt.co.uk/?p=115</a></li>
</ul>
<p>If a custom exception handler is in place the default Windows Error Reporting dialog will not be triggered and we wont have the chance to attach to our process using the JIT debugger&#8230; This is not what we want.</p>
<p>So, how do we go about restoring the default exception handler?</p>
<p>The default exception handler is always the last handler within the exception chain. A custom exception handler is set up like follows:</p>

<div class="wp_codebox"><table><tr id="p1229"><td class="code" id="p122code9"><pre class="asm" style="font-family:monospace;"><span style="color: #00007f; font-weight: bold;">push</span> NewHandler  <span style="color: #666666; font-style: italic;">; address of our new exception handler</span>
<span style="color: #00007f; font-weight: bold;">mov</span>  <span style="color: #00007f;">eax</span><span style="color: #339933;">,</span> <span style="color: #00007f;">FS</span><span style="color: #339933;">:</span><span style="color: #009900; font-weight: bold;">&#91;</span><span style="color: #0000ff;">0</span><span style="color: #009900; font-weight: bold;">&#93;</span> <span style="color: #666666; font-style: italic;">;</span>
<span style="color: #00007f; font-weight: bold;">push</span> <span style="color: #00007f;">eax</span>         <span style="color: #666666; font-style: italic;">; address of previous exception handler</span>
<span style="color: #00007f; font-weight: bold;">mov</span>  <span style="color: #00007f;">FS</span><span style="color: #339933;">:</span><span style="color: #009900; font-weight: bold;">&#91;</span><span style="color: #0000ff;">0</span><span style="color: #009900; font-weight: bold;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #00007f;">ESP</span> <span style="color: #666666; font-style: italic;">; write the new handler</span></pre></td></tr></table></div>

<p>Assuming this is the first custom exception handler within our chain, the previous handler is in fact the default Kernel32 exception handler. We&#8217;ll need the address of this handler should we want to restore it. Note that the address of this handler is version specific.</p>
<p>if we check [EAX + 4] in OllyDbg&#8217;s dump window we&#8217;ll see the following:</p>

<div class="wp_codebox"><table><tr id="p12210"><td class="code" id="p122code10"><pre class="asm" style="font-family:monospace;"><span style="color: #adadad; font-style: italic;">0012FFE0</span> A8 9A <span style="color: #0000ff;">83</span> 7C</pre></td></tr></table></div>

<p>Intel&#8217;s x86 architecture uses little endian, so we end up with an address of:</p>
<ul>
<li>0&#215;7C839AA8</li>
</ul>
<p>This is the address of our default exception handler. So how do we go about overwriting the custom exception handler?</p>
<p>This task is rather trivial, the following code can do this for us:</p>

<div class="wp_codebox"><table><tr id="p12211"><td class="code" id="p122code11"><pre class="asm" style="font-family:monospace;"><span style="color: #00007f; font-weight: bold;">mov</span>  <span style="color: #00007f;">eax</span><span style="color: #339933;">,</span> <span style="color: #00007f;">fs</span><span style="color: #339933;">:</span><span style="color: #009900; font-weight: bold;">&#91;</span><span style="color: #0000ff;">0</span><span style="color: #009900; font-weight: bold;">&#93;</span>
<span style="color: #00007f; font-weight: bold;">mov</span>  <span style="color: #009900; font-weight: bold;">&#91;</span><span style="color: #00007f;">eax</span> <span style="color: #339933;">+</span> <span style="color: #0000ff;">4</span><span style="color: #009900; font-weight: bold;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">0x7C839AA8</span>
<span style="color: #00007f; font-weight: bold;">int</span> <span style="color: #0000ff;">3</span> <span style="color: #666666; font-style: italic;">; throw that exception!</span></pre></td></tr></table></div>

<p>No longer do we have to worry about custom exception handlers wreaking havoc.</p>
<p>It&#8217;s worth pointing out that there are various other methods we can use to stall a process, polymorphic breakpoints and the typical JMP -2 tactics are often useful should for some reason a typical INT 3 instruction turn out to be sub-standard.</p>
<p>We&#8217;ll, as always I look forward to reading your comments and such. I hope you enjoyed the read.</p>
<p>KOrUPt.</p>
]]></content:encoded>
			<wfw:commentRss>http://korupt.co.uk/?feed=rss2&amp;p=122</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>
