<?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>Snoop Security Researching Community &#187; Fuzzing</title>
	<atom:link href="http://www.snoop-security.com/blog/index.php/tag/fuzzing/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.snoop-security.com/blog</link>
	<description></description>
	<lastBuildDate>Thu, 04 Mar 2010 08:06:30 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Observation on Immunity Ekoparty 2009 Challenge</title>
		<link>http://www.snoop-security.com/blog/index.php/2009/10/observation-on-immunity-ekoparty-2009-challenge/</link>
		<comments>http://www.snoop-security.com/blog/index.php/2009/10/observation-on-immunity-ekoparty-2009-challenge/#comments</comments>
		<pubDate>Sun, 04 Oct 2009 21:09:39 +0000</pubDate>
		<dc:creator>sCORPINo</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Exploit Development]]></category>
		<category><![CDATA[Fuzzing]]></category>
		<category><![CDATA[RCE]]></category>
		<category><![CDATA[fuzz test]]></category>
		<category><![CDATA[immunity challenge]]></category>
		<category><![CDATA[irc]]></category>
		<category><![CDATA[untidy]]></category>
		<category><![CDATA[xml fuzzer]]></category>

		<guid isPermaLink="false">http://www.snoop-security.com/blog/?p=46</guid>
		<description><![CDATA[Hello,
At the beginning please accept my apologize for a long down-time in last month. our shared hosting had some security issues.
let&#8217;s dig into the subject&#8230;
If you&#8217;re subscriber in DailyDave mailling list, may be you remind 13th August that Nicolas Waisman from Immunity posted a challenge. After that, Me and Shahriyar(Snake) started to try out ourselves. we did [...]]]></description>
			<content:encoded><![CDATA[<p>Hello,</p>
<p>At the beginning please accept my apologize for a long down-time in last month. our shared hosting had some security issues.</p>
<p>let&#8217;s dig into the subject&#8230;</p>
<p>If you&#8217;re subscriber in DailyDave mailling list, may be you remind 13th August that Nicolas Waisman from Immunity posted a <a href="http://lists.immunitysec.com/pipermail/dailydave/2009-August/005849.html" target="_blank">challenge</a>. After that, Me and Shahriyar(Snake) started to try out ourselves. we did some part time examination in 2 days and after that some projects stopped us from continuing!</p>
<p>In this small amount of time, I had some observation of this challenge executable in IDA ,  but decided to pass reversing part to snake and I concentrated on fuzzing section to find possible vulnerabilities!</p>
<p>I&#8217;m here to write down what i did, may be shahriyar do it too later.</p>
<p>Executable scheme in IDA Pro was a little confusing,  continuous jmp(s) and using TinyXML library made it a little confusing for newbie reverses such as me! Later it got easier when symbol included version released by nico.</p>
<p>Our main guess at first was that if something is overwriting , a loop is responsible for writing each characters of string into a buffer, so we searched for loops! not all loops, because we leave doing this incompletely!</p>
<p>next chance was to take a look for known/unkown TinyXML bugs! found a known bug in TinyXML bugtraq but it doesn&#8217;t trigger! so it was&#8217;nt useful either.</p>
<p>My next try was fuzzing! searched for available XML fuzzers and found just fuzzer, <a href="http://untidy.sourceforge.net/" target="_blank">untidy</a> ! because i thought regular file fuzzers and bit flipper won&#8217;t find bug in this situation!</p>
<p>I have written a simple script to make test cases out of default immunity.xml content with untidy !</p>
<pre class="brush: python;">

import untidy
xmlString = &amp;amp;quot;&amp;amp;quot;&amp;amp;quot;
&amp;amp;lt;document&amp;amp;gt;
    &amp;amp;lt;entries&amp;amp;gt;
 &amp;amp;lt;book name=&amp;amp;quot;Immunity 1&amp;amp;quot;/&amp;amp;gt;
 &amp;amp;lt;book name=&amp;amp;quot;Immunity 2&amp;amp;quot;/&amp;amp;gt;
    &amp;amp;lt;/entries&amp;amp;gt;
&amp;amp;lt;/document&amp;amp;gt;
&amp;amp;quot;&amp;amp;quot;&amp;amp;quot;

xf = untidy.xmlFuzzer()
xf.setRepetitions( [3,30,60] )
iter = xf.fuzz( xmlString )
counter = 0
for i in iter:
 ff = open('D:\\untidy-beta2\\untidy\\test-cases\\immunity-'+str(counter)+'.xml', 'w+')
 ff.write(i)
 ff.close()
 counter += 1

 </pre>
<p>It made <strong>~100000</strong> test cases for me. it&#8217;s good to say I did some minor changes in fuzzer such as changing &#8216;A&#8217; sequence to &#8216;H&#8217; and &#8216;B&#8217; for some triggery and anti A sequence reasons! somehow effective in some cases!</p>
<p>Now what I should do was <em>reading each test cases</em> -&gt; <em>saving each of these test cases content as immunity.xml beside immunity.exe</em> -&gt; <em>running immunity.exe under debugger and detect possible faults!</em></p>
<p>for this process I did this:</p>
<pre class="brush: python;">

import os
for i in range(1, 100000):
 print '=' * 80
 print 'test case number %d' % i                             
 print '-' * 80
 print 'openning source file'
 fopen = open('D:\\untidy-beta2\\untidy\\test-cases\\immunity-'+str(i)+'.xml', 'r')
 print 'opening target file'
 wopen = open('D:\\immunity\\immunity.xml', 'w')
 print 'writing source to target'
 for line in fopen:
  wopen.write(line)
 wopen.close()
 fopen.close()
 print 'executing immuinity.exe under debugger..'
 
 if os.system('crash.exe immunity.exe 500 &amp;amp;quot;&amp;amp;quot;') != 0:
  log = open('D:\\immunity\\error.log', 'a')
  log.write('error detected @ test case number: ' + i )
  log.close()
 print '=' * 80
</pre>
<p>I could do it with <strong>PyDBG</strong> or <strong>WinappDBG</strong> or anything else too, but It&#8217;s exactly what I did! Because it wasn&#8217;t successful, I googled for .XML documents, and concatenated a bunch of them as a test case and did the whole stages once more! <strong>~210000</strong> test cases and Unfortunately nothing!</p>
<p>It was my last chance to do tests on Immunity contest. A while later I read winner of the contest in another post at DailyDave mailinglist !</p>
<p>Then it made the idea of improving untidy while I was on a vacation! I&#8221;ve read the source code. All of untidy is placed in 2 files, <strong>fuzzingFunctions.py</strong> and <strong>untidy.py</strong> . almost half of untidy.py LOCs are about making a XML formatted string to a python list. <strong>_getFuzzFunctions()</strong> is a function that originally placed in fuzzingFunction.py and append name of enumerated fuzzing function ( that should start with &#8216;ff&#8217; and then a number, uninterrupted by the way) to a list and then return to caller!</p>
<p>So, all that you need to do to improve untidy is to put your function in <strong>fuzzingFunction.py</strong> and recieve <strong>xmlItem</strong> and optionally <strong>repetitions</strong> and mangle or fuzz items and send them back!</p>
<p>It&#8217;s very bad that there is not many xml fuzzer out there, certainly there are many of xml fuzzers in non-public area! I did my improvement, added some function and now it&#8217;s working better! even added a function to trigger immunity contest way! <img src='http://www.snoop-security.com/blog/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </p>
<p>I&#8217;m not going to release this improvement now(may be later), but  it&#8217;s clear how to do it for everyone interested(have fun)!</p>
<p>though it wasn&#8217;t a successful case , but I earned some experiences and that was cool for me , thank nico <img src='http://www.snoop-security.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><strong>P. S.</strong> :  We at Snoop Security decided to set up an IRC server for Information Security guys to discuss,  we welcome everyone that is interested in!</p>
<p><strong>server</strong>: snoop-security.com</p>
<p><strong>port</strong>: 6667</p>
<p><strong>channel</strong>: #SnoopSec</p>
<p> </p>
<p>Links:</p>
<p>[1] Immunity Challenge: <a href="http://lists.immunitysec.com/pipermail/dailydave/2009-August/005849.html">http://lists.immunitysec.com/pipermail/dailydave/2009-August/005849.html</a></p>
<p>[2] Immunity Challege + Symbols: <a href="http://lists.immunitysec.com/pipermail/dailydave/2009-August/005864.html">http://lists.immunitysec.com/pipermail/dailydave/2009-August/005864.html</a></p>
<p>[3] untidy XML fuzzer: <a href="http://untidy.sourceforge.net/">http://untidy.sourceforge.net/</a></p>
<p>[4] Immunity Challenge Result: <a href="http://lists.immunitysec.com/pipermail/dailydave/2009-September/005889.html">http://lists.immunitysec.com/pipermail/dailydave/2009-September/005889.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.snoop-security.com/blog/index.php/2009/10/observation-on-immunity-ekoparty-2009-challenge/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
