<?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>thatsBroken</title>
	<atom:link href="http://thatsbroken.com/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://thatsbroken.com</link>
	<description>Breaking things that go beep since 1996</description>
	<lastBuildDate>Fri, 23 Jul 2010 18:05:19 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>VMWare ESXi 3.5/4.0 Information Disclosure (Vulnerability?)</title>
		<link>http://thatsbroken.com/?p=320</link>
		<comments>http://thatsbroken.com/?p=320#comments</comments>
		<pubDate>Fri, 23 Jul 2010 17:50:25 +0000</pubDate>
		<dc:creator>jRichards</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://thatsbroken.com/?p=320</guid>
		<description><![CDATA[Let me start out by saying that ESX and ESXi both have the ability to allow management from a defined IP address or IP mask.  In addition, they both allow you to set a management interface and bind the management interface to only allow connections from an administrative subnet.  This is just security best practice [...]]]></description>
			<content:encoded><![CDATA[<p>Let me start out by saying that ESX and ESXi both have the ability to  allow management from a defined IP address or IP mask.  In addition,  they both allow you to set a management interface and bind the  management interface to only allow connections from an administrative  subnet.  This is just security best practice and in this case, following  best practice will mitigate much of the risk involved in this  &#8216;Information Leakage&#8217; issue.</p>
<p>Both ESX and ESXi have a web based management interface that can be  used to browse the data store and download the vShpere (thick) client  for managing the ESX/ESXi host.  This management interface seems a  little dangerous to me in that exposes a massive web service (vim.wsdl)  and at lest a portion can queried successfully without authentication.</p>
<p>The webservice endpoint is at https://esx-server-ip/sdk</p>
<p>The web service is configured to point to  /usr/lib/vmware/hostd/docroot if you want to go snooping yourself.</p>
<p>I do vulnerability research and write code to detect remotely vulnerable hosts on a network.  Some of the best remote detection rules I&#8217;ve written depend on very obscure &#8216;information disclosure&#8217; vulnerabilities.</p>
<p>Web apps there are all kinds of tricks to finding the exact build of an app by generating diffs of publicly accessible supporting java-script files.  Another trick is to enumerate all of the calls you can  make to a web service as an unauthenticated user and then start parsing the responses.  You&#8217;ll start to develop a fuzzy finger print that will generate ranges of possible versions.</p>
<p>This blog posting isn&#8217;t about any of these neat techniques.  This blog post is about sending a single specific post to the vmware sdk running on the management interface with no authentication or cookie trickery.</p>
<p>The following post request will generate an xml response that be parsed to identify the ESX version right down to the build level.  The build level is increased on every major update which provides exceptional granularity to patch detection.</p>
<p><strong>POST /sdk HTTP/1.1\r\nContent-Type: text/xml; charset=\&#8221;utf-8\&#8221;\r\nSOAPAction: \&#8221;urn:internalvim25/4.0\&#8221;\r\nContent-Length: 410\r\n\r\n&lt;soap:Envelope xmlns:xsd=\&#8221;http://www.w3.org/2001/XMLSchema\&#8221; xmlns:xsi=\&#8221;http://www.w3.org/2001/XMLSchema-instance\&#8221; xmlns:soap=\&#8221;http://schemas.xmlsoap.org/soap/envelope/\&#8221;&gt;\r\n  &lt;soap:Body&gt;\r\n    &lt;RetrieveServiceContent xmlns=\&#8221;urn:internalvim25\&#8221;&gt;\r\n      &lt;_this xsi:type=\&#8221;ServiceInstance\&#8221; type=\&#8221;ServiceInstance\&#8221; serverGuid=\&#8221;\&#8221;&gt;ServiceInstance&lt;/_this&gt;\r\n    &lt;/RetrieveServiceContent&gt;\r\n  &lt;/soap:Body&gt;\r\n&lt;/soap:Envelope&gt;\r\n\r\n\r\n</strong></p>
<p>What does the response look like?</p>
<p>Well you get a whole bunch of XML but the interesting bit is here:</p>
<p>&lt;RetrieveServiceContentResponse xmlns=&#8221;urn:internalvim25&#8243;&gt;&lt;returnval&gt;&lt;rootFolder type=&#8221;Folder&#8221;&gt;ha-folder-root&lt;/rootFolder&gt;&lt;propertyCollector type=&#8221;PropertyCollector&#8221;&gt;ha-property-collector&lt;/propertyCollector&gt;&lt;viewManager type=&#8221;ViewManager&#8221;&gt;ViewManager&lt;/viewManager&gt;&lt;about&gt;&lt;name&gt;VMware ESX&lt;/name&gt;<strong>&lt;fullName&gt;VMware ESX 4.0.0 build-164009&lt;/fullName&gt;</strong>&lt;vendor&gt;VMware, Inc.&lt;/vendor&gt;&lt;version&gt;4.0.0&lt;/version&gt;&lt;build&gt;164009&lt;/build&gt;&lt;localeVersion&gt;INTL&lt;/localeVersion&gt;&lt;localeBuild&gt;000&lt;/localeBuild&gt;&lt;osType&gt;vmnix-x86&lt;/osType&gt;&lt;p</p>
<p>So my question to you:  Is this a &#8216;vulnerability&#8217; vmware needs to fix or just some undocumented feature that doesn&#8217;t really need to be fixed?  The build number matches directly to patches that increment the build when applied&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://thatsbroken.com/?feed=rss2&amp;p=320</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Reversing the iPhone Device Service (AppleMobileDeviceService.exe)</title>
		<link>http://thatsbroken.com/?p=296</link>
		<comments>http://thatsbroken.com/?p=296#comments</comments>
		<pubDate>Mon, 22 Feb 2010 20:19:44 +0000</pubDate>
		<dc:creator>jRichards</dc:creator>
				<category><![CDATA[Fuzzing]]></category>
		<category><![CDATA[Reversing]]></category>

		<guid isPermaLink="false">http://thatsbroken.com/?p=296</guid>
		<description><![CDATA[UPDATE: ***** ACCESS VIOLATION ***** AppleMobileDeviceService.exe:0040fe9a mov eax,[eax] from thread 276 caused acces s violation when attempting to read from 0x6b736643 CONTEXT DUMP EIP: 0040fe9a mov eax,[eax] EAX: 6b736643 (1802724931) -&#62; N/A EBX: 003c3ee8 (   3948264) -&#62; A&#62;&#60;XAAAC (heap) ECX: 00420498 (   4326552) -&#62; H&#62;&#60; (AppleMobileDeviceService.exe.data) EDX: 00000000 (         0) -&#62; N/A EDI: 0078fc04 (   [...]]]></description>
			<content:encoded><![CDATA[<p><strong>UPDATE:</strong></p>
<p><em>***** ACCESS VIOLATION *****<br />
AppleMobileDeviceService.exe:0040fe9a mov eax,[eax] from thread 276 caused acces<br />
s violation<br />
when attempting to read from 0x6b736643</p>
<p>CONTEXT DUMP<br />
EIP: 0040fe9a mov eax,[eax]<br />
EAX: 6b736643 (1802724931) -&gt; N/A<br />
EBX: 003c3ee8 (   3948264) -&gt; A&gt;&lt;XAAAC (heap)<br />
ECX: 00420498 (   4326552) -&gt; H&gt;&lt; (AppleMobileDeviceService.exe.data)<br />
EDX: 00000000 (         0) -&gt; N/A<br />
EDI: 0078fc04 (   7928836) -&gt; H# (heap)<br />
ESI: 003c3ee8 (   3948264) -&gt; A&gt;&lt;XAAAC (heap)<br />
EBP: 008cfeec (   9240300) -&gt; t(AB &lt;}e= |~| &lt; ;&lt;&gt;&lt;C&lt;B&lt;n@&gt;&lt;be=x&gt;&lt;&gt;&lt;x09@=@x)|&gt;&lt;x<br />
x&gt;&lt;[x|0| (stack)<br />
ESP: 008cfee4 (   9240292) -&gt; Cfsk (stack)<br />
+00: 6b736643 (1802724931) -&gt; N/A<br />
+04: 00420498 (   4326552) -&gt; H&gt;&lt; (AppleMobileDeviceService.exe.data)<br />
+08: 008cff74 (   9240436) -&gt; N/A<br />
+0c: 00410c28 (   4262952) -&gt; N/A<br />
+10: 004204a0 (   4326560) -&gt; Cfsk  (AppleMobileDeviceService.exe.data)<br />
+14: 00000009 (         9) -&gt; N/A</p>
<p>disasm around:<br />
0x0040fe88 leave<br />
0x0040fe89 ret<br />
0x0040fe8a push ebp<br />
0x0040fe8b mov ebp,esp<br />
0x0040fe8d push ecx<br />
0x0040fe8e push ecx<br />
0x0040fe8f mov eax,[ebp+0x8]<br />
0x0040fe92 mov eax,[eax]<br />
0x0040fe94 mov [ebp-0x8],eax<br />
0x0040fe97 mov eax,[ebp-0x8]<br />
0x0040fe9a mov eax,[eax]<br />
0x0040fe9c mov [ebp-0x4],eax<br />
0x0040fe9f mov eax,[ebp+0x8]<br />
0x0040fea2 mov ecx,[ebp-0x4]<br />
0x0040fea5 mov [eax],ecx<br />
0x0040fea7 mov eax,[ebp-0x4]<br />
0x0040feaa mov ecx,[ebp+0x8]<br />
0x0040fead mov [eax+0x4],ecx<br />
0x0040feb0 mov eax,[ebp-0x8]<br />
0x0040feb3 leave<br />
0x0040feb4 ret</p>
<p>stack unwind:<br />
AppleMobileDeviceService.exe:00410c28<br />
AppleMobileDeviceService.exe:00401c6e<br />
AppleMobileDeviceService.exe:00401d13</p>
<p>SEH unwind:<br />
008cffdc -&gt; AppleMobileDeviceService.exe:00403930 sub esp,0&#215;14<br />
ffffffff -&gt; kernel32.dll:7c839ad8 push ebp</em></p>
<p>In previous posts we started fuzzing AppleMobileDeviceService.exe using a technique called In Memory Fuzzing.  This approach was outlined in chapter 19/20 of Fuzzing:  Brute Force Vulnerability Discovery.</p>
<p>This article will briefly touch on the topic of reverse engineering your binary to determine your enrty and restore hooks.  These hooks are very important as they tell the debugger where to take its first memory snapshot and when to revert back to this state.</p>
<p>As fuzzing becomes more complex it will be up to you to determine the changes made in memory during this time and take this into consideration when looking into crashes.</p>
<p>Since we are interested in hooking data received via winsock the best place to start is the imports section of the binary.  When we double click recv and jump to xRefs we see only one.</p>
<p>The decompiled look at this function goes a little something like this:</p>
<p><a href="http://thatsbroken.com/wp-content/uploads/2010/02/21.png"><img class="alignnone size-full wp-image-306" title="2" src="http://thatsbroken.com/wp-content/uploads/2010/02/21.png" alt="" width="566" height="209" /></a></p>
<p>If recv returns FFFFFFFF (or -1) there is an error. And v7 points to it.  If not, v7 is set to 0.  If everything looks good, return the data.</p>
<p>Cool, so this is just a little wrapper to recv with some error handling I guess.  I wonder where this function is called from…</p>
<p><a href="http://thatsbroken.com/wp-content/uploads/2010/02/3.png"><img class="alignnone size-full wp-image-299" title="3" src="http://thatsbroken.com/wp-content/uploads/2010/02/3.png" alt="" width="592" height="241" /></a></p>
<p>…We’re on the right track so lets set breakpoints after the return of the calls to this function.</p>
<p><a href="http://thatsbroken.com/wp-content/uploads/2010/02/4.png"><img class="alignnone size-full wp-image-300" title="4" src="http://thatsbroken.com/wp-content/uploads/2010/02/4.png" alt="" width="707" height="391" /></a></p>
<p>(set a breakpoint on all of them!)</p>
<p>When we attach our iPhone IDA hits a breakpoint.  If you set breakpoints after all calls to our recv() wrapper you’ll get a breakpoint at the first packet receved, the address is 004133F3…</p>
<p>We take a look at ESP:</p>
<p><a href="http://thatsbroken.com/wp-content/uploads/2010/02/6.png"><img class="alignnone size-full wp-image-302" title="6" src="http://thatsbroken.com/wp-content/uploads/2010/02/6.png" alt="" width="403" height="327" /></a></p>
<p>If you look at ESP+4 (009CFEE4) you may notice this is a dword pointer, by pressing D a couple of times it will convert this to an address that you can double click on or mouse over to de-reference…</p>
<p><a href="http://thatsbroken.com/wp-content/uploads/2010/02/7.png"><img class="alignnone size-full wp-image-303" title="7" src="http://thatsbroken.com/wp-content/uploads/2010/02/7.png" alt="" width="982" height="263" /></a></p>
<p>So, there we have it… a pointer to our data (ESP+4) and a spot to hook, 004133F3.</p>
<p>If we take a look at the call graph:</p>
<p><a href="http://thatsbroken.com/wp-content/uploads/2010/02/8.png"><img class="alignnone size-full wp-image-304" title="8" src="http://thatsbroken.com/wp-content/uploads/2010/02/8.png" alt="" width="360" height="390" /></a></p>
<p>We can see a pretty logical restore hook:</p>
<p>Zooming in we snag the address and hope for the best.</p>
<p><a href="http://thatsbroken.com/wp-content/uploads/2010/02/9.png"><img class="alignnone size-large wp-image-305" title="9" src="http://thatsbroken.com/wp-content/uploads/2010/02/9-1024x316.png" alt="" width="1024" height="316" /></a></p>
<p>We will take a look at using code coverage tools to determine the best entry and restore hook points as soon as I get my paws on BaSO4</p>
<p>You can grab the script <a href="http://thatsbroken.com/wp-content/uploads/snapply.py">here</a> or just copy-and paste from the end of this posting.</p>
<p>Here is a video of the basic fuzzer in action:<br />
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="800" height="600" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://vimeo.com/moogaloop.swf?clip_id=9653391&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" /><embed type="application/x-shockwave-flash" width="800" height="600" src="http://vimeo.com/moogaloop.swf?clip_id=9653391&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p><a href="http://vimeo.com/9653391">In Memory Fuzzing iPhone Device Service</a> from <a href="http://vimeo.com/user1447918">jeremy Richards</a> on <a href="http://vimeo.com">Vimeo</a>.</p>
<p>And here is the source to the fuzzer:</p>
<pre class="python">#!c:\python\python.exe

"""
In Memory Fuzzer 0.02a
"""

import time
import random
import utils
import struct

from pydbg import *
from pydbg.defines import *

snapshot_hook  = 0x00413495
restore_hook   = 0x00413604
snapshot_taken = False
hit_count      = 0
address        = 0

########################################################################################################################
### callback handlers.
########################################################################################################################

def handle_bp (dbg):
    global snapshot_hook, restore_hook, snapshot_taken, hit_count, address

    if dbg.exception_address == snapshot_hook:
        hit_count += 1
        print "snapshot / mutate hook point hit #%d" % hit_count

        # if a process snapshot has not yet been taken, take one now.
        if not snapshot_taken:
            start = time.time()
            print "taking process snapshot...",
            dbg.process_snapshot()
            end = time.time() - start
            print "done. completed in %.03f seconds" % end
            #context_list = dbg.dump_context_list(stack_depth=4, print_dots=True)
            print dbg.dump_context(stack_depth=4, print_dots=True)
            #print dbg.hex_dump(dbg.read_process_memory(dbg.context.Eax, 20))
            snapshot_taken = True

        if hit_count &gt; 1:
            if address:
                print "freeing last chunk at %08x" % address
                dbg.virtual_free(address, 1000, MEM_DECOMMIT)

            print "allocating chunk of memory to hold mutation"
            address = dbg.virtual_alloc(None, 1000, MEM_COMMIT, PAGE_READWRITE)
            print "memory allocated at %08x" % address
            print "generating mutant...",
            mutant = struct.pack('hllll',random.randint(0, 255),0,2,2,0)
            print "done. generating mutant"
            print "writing mutant into target memory space"
            dbg.write(address, mutant)
            print "modifying function argument to point to mutant"
            dbg.write(dbg.context.Esp + 4, dbg.flip_endian(address))
            print dbg.hex_dump(dbg.read_process_memory(address,16))
            print "continuing execution...\n"
            dbg.bp_set(restore_hook)

    if dbg.exception_address == restore_hook:
        start = time.time()
        print "restoring process snapshot...",
        dbg.process_restore()
        end = time.time() - start
        print "done. completed in %.03f seconds" % end
        dbg.bp_set(restore_hook)

    return DBG_CONTINUE

def handle_av (dbg):
    print "***** ACCESS VIOLATION *****"

    crash_bin = utils.crash_binning.crash_binning()
    crash_bin.record_crash(dbg)

    print crash_bin.crash_synopsis()
    dbg.terminate_process()

########################################################################################################################

dbg = pydbg()

dbg.set_callback(EXCEPTION_BREAKPOINT,       handle_bp)
dbg.set_callback(EXCEPTION_ACCESS_VIOLATION, handle_av)

found_target = False
for (pid, proc_name) in dbg.enumerate_processes():
    if proc_name.lower() == "applemobiledeviceservice.exe":
        found_target = True
        break

if found_target:
    dbg.attach(pid)
    dbg.bp_set(snapshot_hook)
    dbg.bp_set(restore_hook)
    print "attached to %d. debugger active." % pid
    for addr in dbg.breakpoints.keys():
        print "bp at %08x" % addr
    dbg.run()
else:
    print "target not found."</pre>
]]></content:encoded>
			<wfw:commentRss>http://thatsbroken.com/?feed=rss2&amp;p=296</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>LOL @ Apple</title>
		<link>http://thatsbroken.com/?p=291</link>
		<comments>http://thatsbroken.com/?p=291#comments</comments>
		<pubDate>Sun, 14 Feb 2010 00:09:59 +0000</pubDate>
		<dc:creator>jRichards</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://thatsbroken.com/?p=291</guid>
		<description><![CDATA[I&#8217;m writing up a proper post about reverse engineering your target to properly identify snapshot and restore points but I had to quickly share something I found in the binary:]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m writing up a proper post about reverse engineering your target to properly identify snapshot and restore points but I had to quickly share something I found in the binary:</p>
<p><a href="http://thatsbroken.com/wp-content/uploads/2010/02/hahapple.png"><img class="alignnone size-large wp-image-292" title="hahapple" src="http://thatsbroken.com/wp-content/uploads/2010/02/hahapple-1024x341.png" alt="" width="1024" height="341" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://thatsbroken.com/?feed=rss2&amp;p=291</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>In Memory Fuzzing</title>
		<link>http://thatsbroken.com/?p=282</link>
		<comments>http://thatsbroken.com/?p=282#comments</comments>
		<pubDate>Fri, 12 Feb 2010 04:41:54 +0000</pubDate>
		<dc:creator>jRichards</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://thatsbroken.com/?p=282</guid>
		<description><![CDATA[In memory fuzzing is a form off process instrumentation that allows the analyst to bypass parsers, network limitations, encryption and data marshaling steps to deal directly with a functions inputs and test its integrity. The upsides: It&#8217;s faster to get to your target function than creating mini-clients or modifying file formats (or generating 1.5 TB [...]]]></description>
			<content:encoded><![CDATA[<p>In memory fuzzing is a form off process instrumentation that allows the analyst to bypass parsers, network limitations, encryption and data marshaling steps to deal directly with a functions inputs and test its integrity.</p>
<p>The upsides:</p>
<ul>
<li>It&#8217;s faster to get to your target function than creating mini-clients or modifying file formats (or generating 1.5 TB worth&#8230;)</li>
<li>Once you&#8217;re up and running the process fuzz cases happen much faster and it&#8217;s easier to distribute fuzz space to multiple VMs</li>
<li>It&#8217;s a lot more fun</li>
</ul>
<p>The down sides:</p>
<ul>
<li>Found a bug? No you didn&#8217;t&#8230; yes you did&#8230; did you?  Now that you found your bug you need to get to that section of the code&#8230; did you fuzz with the proper bounds?</li>
<li>There is a bit of a learning curve and not a lot of help out there.  This has been done in an ad-hoc manner for a few years but there are no real tools to get the job done simply.</li>
</ul>
<p>So how exactly do we accomplish in memory fuzzing?  If you&#8217;ve been following along with the other posts you know I&#8217;m in love with pydbg and the PaiMei framework.  I want to continue to use this</p>
<p>framework but it should be noted that Dion Blazakis just had a fairly <a href="http://www.shmoocon.org/presentations-all.html#bas04">good shmoocon</a> talk on BaSO4: A Dynamic Dataflow Analysis Tool for Auditing and Reversing and, from what I can tell, it can and should be used in tandum with in memory fuzzing.  He has done work on analyzing the dependancies of call graph flow which would be useful in building a more intelligent in memory fuzzer.  In anycase, he hasn&#8217;t released any code but its an IDA plugin which means it will be trivial to export the data using IDA Pro&#8217;s -A, -B and -S flags.</p>
<p><em>(Automatic disasm and creating of IDB / ASM files, Batch Mode with a a modified PIDA_dump.py to launch automatically, -S or script mode to define an IDC script that can be used to launch an IDAPython script to export more info&#8230; I&#8217;ll go over all of this in another post if anyone is interested)</em></p>
<p>&#8230;getting back to in-memory fuzzing, the basic steps are:</p>
<p>Initalize the debugger variables (DONE)<br />
Attach to process (DONE)<br />
Set your hooks (DONE)<br />
When the entry point is hit time save memory state and continue (DONE)</p>
<p>Monitor process for memory access of function arguements, save address (IN PROGRESS)<br />
When the exit point is reached revert to saved_state (DONE)<br />
Allocate a space for our fuzz string or buffer with pydbg.virtual_alloc() (DONE)<br />
Modify the functions argument pointers to our fuzz data (IN PROGRESS)<br />
Monitor for stack integrity (IN PROGRESS)</p>
<p>Haz a nice cold coke. (IN PROGRESS)</p>
<p>There is much more to it than this of course.. but that&#8217;s the basic idea that I get&#8230;. here is a video of steps 1-4, step five is a whole new ball game so stay tuned. (Code is available at the end of the post).</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="800" height="604" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="data" value="http://www.vimeo.com/moogaloop.swf?clip_id=9394497&amp;server=www.vimeo.com&amp;fullscreen=1&amp;show_title=1&amp;show_byline=1&amp;show_portrait=1&amp;color=00adef" /><param name="quality" value="best" /><param name="scale" value="showAll" /><param name="allowfullscreen" value="true" /><param name="wmode" value="transparent" /><param name="src" value="http://www.vimeo.com/moogaloop.swf?clip_id=9394497&amp;server=www.vimeo.com&amp;fullscreen=1&amp;show_title=1&amp;show_byline=1&amp;show_portrait=1&amp;color=00adef" /><embed type="application/x-shockwave-flash" width="800" height="604" src="http://www.vimeo.com/moogaloop.swf?clip_id=9394497&amp;server=www.vimeo.com&amp;fullscreen=1&amp;show_title=1&amp;show_byline=1&amp;show_portrait=1&amp;color=00adef" wmode="transparent" allowfullscreen="true" scale="showAll" quality="best" data="http://www.vimeo.com/moogaloop.swf?clip_id=9394497&amp;server=www.vimeo.com&amp;fullscreen=1&amp;show_title=1&amp;show_byline=1&amp;show_portrait=1&amp;color=00adef"></embed></object></p>
<p>The source code to the start of the in-memory fuzzer:</p>
<pre class="python">#!/usr/bin/env python

from pydbg import *
from pydbg.defines import *

import time
import random

snapshot_hook 	= 0x0040FBE8
restore_hook 	= 0x0040FBEB
snapshot_taken 	= False
hit_count		= 0
address			= 0

def set_entry(pydbg):
	return 1

def handle_bp(pydbg):
	global snapshot_hook, restore_hook
	global snapshot_taken, hit_count, address

	if pydbg.first_breakpoint:
		return DBG_CONTINUE

	print "ws2_32.recv() called from thread %d @%08x" % (pydbg.dbg.dwThreadId, pydbg.exception_address)

	context_dump = dbg.dump_context(stack_depth=4, print_dots=False)

	print context_dump

	if pydbg.exception_address == snapshot_hook:
		hit_count += 1
		print "hit the snapshot address"
		start = time.time()
		print "taking snapshot..."
		pydbg.process_snapshot()
		end = time.time() - start
		print "snapshot took: %.03f seconds\n" % end
		if hit_count &gt;= 1:
			if address:
				print "freeing last chunk"
				print "%08x" % address
				pydbg.virtual_free(address, 1000, MEM_DECOMMIT)
		print "allocating memory for mutated data"
		address = pydbg.virtual_alloc( None, 1000, MEM_COMMIT, PAGE_READWRITE)
		print "Allocated 1000 bytes at: %08x" % address		

	return DBG_CONTINUE

def handle_av (pydbg, dbg, context):
    '''
    As we are mucking around with process state and calling potentially unknown subroutines, it is likely that we may
    cause an access violation. We register this handler to provide some useful information about the cause.
    '''

    crash_bin = utils.crash_binning.crash_binning()
    crash_bin.record_crash(dbg)

    print crash_bin.crash_synopsis()
    dbg.terminate_process()

dbg = pydbg()
dbg.set_callback(EXCEPTION_BREAKPOINT,handle_bp)
dbg.set_callback(EXCEPTION_ACCESS_VIOLATION, handle_av)

found_target = False

for (pid, proc_name) in dbg.enumerate_processes():
	#print proc_name.lower()
	if proc_name.lower() == "applemobiledeviceservice.exe":
		found_target = True
		print "[+] Found Target:\"%s" %proc_name.lower()
		break

if found_target:
	dbg.attach(pid)
	print "[+] Attached to :" + str(pid)
	dbg.bp_set(snapshot_hook)
	dbg.bp_set(restore_hook)
	print "[+] Hooks set, entering debug loop..."
	dbg.debug_event_loop()
else:
	print "Target not found\n"</pre>
]]></content:encoded>
			<wfw:commentRss>http://thatsbroken.com/?feed=rss2&amp;p=282</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MS10-012 Remote Unauthenticated Vulnerability Check.</title>
		<link>http://thatsbroken.com/?p=269</link>
		<comments>http://thatsbroken.com/?p=269#comments</comments>
		<pubDate>Wed, 10 Feb 2010 16:20:51 +0000</pubDate>
		<dc:creator>jRichards</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://thatsbroken.com/?p=269</guid>
		<description><![CDATA[You don&#8217;t get this often&#8230; the advisory released by the vulnerability researcher includes a ton of PoC code that can be used to, among other things, detect the MS10-012 patch without authentication. The script connects to a target over TCP 445 and sends it a negotiation request.  The response is parsed for the 8byte challenge [...]]]></description>
			<content:encoded><![CDATA[<p>You don&#8217;t get this often&#8230; the advisory released by the vulnerability researcher includes a ton of PoC code that can be used to, among other things, detect the MS10-012 patch without authentication.</p>
<p>The script connects to a target over TCP 445 and sends it a negotiation request.  The response is parsed for the 8byte challenge token and stored.  After approximately 2000 request we get our first duplicate challenge token.</p>
<p>At the end of a 5 minute test run my results were:</p>
<p>Challenges: 49,328<br />
Duplicates: 198</p>
<p>&#8230; um, wow. (10.7.0.122 = PATCHED and 10.7.0.140 = UNPATCHED)</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="800" height="604" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="data" value="http://www.vimeo.com/moogaloop.swf?clip_id=9353196&amp;server=www.vimeo.com&amp;fullscreen=1&amp;show_title=1&amp;show_byline=0&amp;show_portrait=0&amp;color=00adef" /><param name="quality" value="best" /><param name="scale" value="showAll" /><param name="allowfullscreen" value="true" /><param name="wmode" value="transparent" /><param name="src" value="http://www.vimeo.com/moogaloop.swf?clip_id=9353196&amp;server=www.vimeo.com&amp;fullscreen=1&amp;show_title=0&amp;show_byline=0&amp;show_portrait=0&amp;color=00adef" /><embed type="application/x-shockwave-flash" width="800" height="604" src="http://www.vimeo.com/moogaloop.swf?clip_id=9353196&amp;server=www.vimeo.com&amp;fullscreen=1&amp;show_title=0&amp;show_byline=0&amp;show_portrait=0&amp;color=00adef" wmode="transparent" allowfullscreen="true" scale="showAll" quality="best" data="http://www.vimeo.com/moogaloop.swf?clip_id=9353196&amp;server=www.vimeo.com&amp;fullscreen=1&amp;show_title=1&amp;show_byline=0&amp;show_portrait=0&amp;color=00adef"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://thatsbroken.com/?feed=rss2&amp;p=269</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PAIMEIPeek.py vs AppleMobileDeviceService.exe</title>
		<link>http://thatsbroken.com/?p=263</link>
		<comments>http://thatsbroken.com/?p=263#comments</comments>
		<pubDate>Wed, 10 Feb 2010 00:10:59 +0000</pubDate>
		<dc:creator>jRichards</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://thatsbroken.com/?p=263</guid>
		<description><![CDATA[I notice that anyone with a computer that has itunes + iphone gets a nifty little service called AppleMobileDeviceService.exe. I also noticed that it listens on a TCP port and it runs as SYSTEM. Before anyone gets super excited, I&#8217;m not going to drop a 0day in this post. I&#8217;m simply going to show you [...]]]></description>
			<content:encoded><![CDATA[<p>I notice that anyone with a computer that has itunes + iphone gets a nifty little service called AppleMobileDeviceService.exe.  I also noticed that it listens on a TCP port and it runs as SYSTEM.</p>
<p>Before anyone gets super excited, I&#8217;m not going to drop a 0day in this post.  I&#8217;m simply going to show you the process/menthod I used to listen to the network chatter&#8230;</p>
<p>I used my modified version of PAIMEIPeek.py to trace all calls to send() and recv().  I added context dumping as well so that I can see what registers hold the content that I sent.  This is going to be used later to get/set the pointer to the buffer recv() fills.</p>
<p>Here is a video of the recv() and send() hooks doing their thing:</p>
<p><strong>* NOTE: Switch to full screen for best resolution.  I have no idea what this will look like scaled</strong></p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="800" height="604" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="data" value="http://www.vimeo.com/moogaloop.swf?clip_id=9336588&amp;server=www.vimeo.com&amp;fullscreen=1&amp;show_title=1&amp;show_byline=1&amp;show_portrait=1&amp;color=00adef" /><param name="quality" value="best" /><param name="scale" value="showAll" /><param name="allowfullscreen" value="true" /><param name="wmode" value="transparent" /><param name="src" value="http://www.vimeo.com/moogaloop.swf?clip_id=9336588&amp;server=www.vimeo.com&amp;fullscreen=1&amp;show_title=1&amp;show_byline=1&amp;show_portrait=1&amp;color=00adef" /><embed type="application/x-shockwave-flash" width="800" height="604" src="http://www.vimeo.com/moogaloop.swf?clip_id=9336588&amp;server=www.vimeo.com&amp;fullscreen=1&amp;show_title=1&amp;show_byline=1&amp;show_portrait=1&amp;color=00adef" wmode="transparent" allowfullscreen="true" scale="showAll" quality="best" data="http://www.vimeo.com/moogaloop.swf?clip_id=9336588&amp;server=www.vimeo.com&amp;fullscreen=1&amp;show_title=1&amp;show_byline=1&amp;show_portrait=1&amp;color=00adef"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://thatsbroken.com/?feed=rss2&amp;p=263</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MS10-012 and TurboDiff 1.0.1b2</title>
		<link>http://thatsbroken.com/?p=248</link>
		<comments>http://thatsbroken.com/?p=248#comments</comments>
		<pubDate>Tue, 09 Feb 2010 22:28:10 +0000</pubDate>
		<dc:creator>jRichards</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://thatsbroken.com/?p=248</guid>
		<description><![CDATA[The vulnerability researcher responsible for part of MS10-012, Hernan Ochoa, from Hexale / Core Security and author of UHooker will be releasing an advisory on the Weak NTLM Entropy. I am hoping his post goes into detail and he provides some kind of proof of conecpt. Keep an eye on thatsBroken for a breakdown and [...]]]></description>
			<content:encoded><![CDATA[<p>The vulnerability researcher responsible for part of MS10-012, <a href="mailto:hernan@gmail.com">Hernan Ochoa</a>, from <a href="http://www.hexale.org/">Hexale </a>/ Core Security and author of <a href="http://oss.coresecurity.com/projects/uhooker.htm">UHooker</a> will be releasing an advisory on the Weak NTLM Entropy.  I am hoping his post goes into detail and he provides some kind of proof of conecpt.  Keep an eye on thatsBroken for a breakdown and review of this vulnerability&#8230;</p>
<p>Using <a href="http://corelabs.coresecurity.com/index.php?module=Wiki&amp;action=view&amp;type=tool&amp;name=turbodiff">TurboDiff 1.0.1b2</a> from core I am doing a binary diff of srvsys between MS09-001 and MS10-012</p>
<p>The file size has grown by almost 20k so we can expect to see some signifigant change. Thankfully TurboDiff does a great job of matching functions&#8230; lets take a look:</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
matched functions: 14<br />
[.] 000267f3 sub_267F3                                        &#8211; 00022df3 sub_22DF3<br />
[.] 00027b74 sub_27B74                                        &#8211; 00024174 sub_24174<br />
[.] 00028cd7 sub_28CD7                                        &#8211; 000252d7 sub_252D7<br />
[.] 0002ad05 sub_2AD05                                        &#8211; 00027305 sub_27305<br />
[.] 0002bbe8 sub_2BBE8                                        &#8211; 000281df sub_281DF<br />
[.] 0002c4c3 sub_2C4C3                                        &#8211; 00028abb sub_28ABB<br />
[.] 0002c9a7 sub_2C9A7                                        &#8211; 00028f9f sub_28F9F<br />
[.] 0003aee7 sub_3AEE7                                        &#8211; 000374cf sub_374CF<br />
[.] 0003c099 sub_3C099                                        &#8211; 00038681 sub_38681<br />
[.] 0003e3a5 sub_3E3A5                                        &#8211; 0003a81b sub_3A81B<br />
[.] 00045a7b sub_45A7B                                        &#8211; 00041f39 sub_41F39<br />
[.] 0004c063 sub_4C063                                        &#8211; 00048519 sub_48519<br />
[.] 00050033 sub_50033                                        &#8211; 0004c4fd sub_4C4FD<br />
[.] 000520bd sub_520BD                                        &#8211; 0004e597 sub_4E597<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
unmatched functions1: 53<br />
00013052 sub_13052<br />
0001319f sub_1319F<br />
00013902 sub_13902<br />
00014459 sub_14459<br />
000156f8 sub_156F8<br />
0001623d sub_1623D<br />
0001dabb sub_1DABB<br />
000207d1 sub_207D1<br />
00020831 sub_20831<br />
00020886 PsGetCurrentThreadId<br />
00020891 PsGetCurrentProcessId<br />
00020aab sub_20AAB<br />
00020b8e sub_20B8E<br />
00020cb3 sub_20CB3<br />
00020d69 sub_20D69<br />
00020e33 sub_20E33<br />
00020ee4 sub_20EE4<br />
00020f18 sub_20F18<br />
00021055 sub_21055<br />
000210f6 sub_210F6<br />
000442a9 sub_442A9<br />
0005c7a8 sub_5C7A8<br />
0005c7ea sub_5C7EA<br />
0005c805 sub_5C805<br />
0005cc5d sub_5CC5D<br />
0005cd7b sub_5CD7B<br />
0005cdbd sub_5CDBD<br />
0005ce42 sub_5CE42<br />
0005cea4 sub_5CEA4<br />
0005cedf sub_5CEDF<br />
0005cf13 sub_5CF13<br />
0005d059 sub_5D059<br />
0005d0bc sub_5D0BC<br />
0005d180 sub_5D180<br />
0005d1fa sub_5D1FA<br />
0005d22d sub_5D22D<br />
0005d280 sub_5D280<br />
0005d2d1 sub_5D2D1<br />
0005d338 sub_5D338<br />
0005d375 sub_5D375<br />
0005d686 sub_5D686<br />
0005d6b2 sub_5D6B2<br />
0005d6ff sub_5D6FF<br />
0005d749 sub_5D749<br />
0005d7ed sub_5D7ED<br />
0005d7f6 sub_5D7F6<br />
0005d822 sub_5D822<br />
0005d82b sub_5D82B<br />
0005d851 sub_5D851<br />
0005d85a sub_5D85A<br />
0005d87f sub_5D87F<br />
0005d888 sub_5D888<br />
0005d8a7 sub_5D8A7<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
unmatched functions2: 1<br />
0004071f sub_4071F<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
changed functions: 5<br />
[.] 0002b782 sub_2B782                                        &#8211; [.] 00027d82 sub_27D82<br />
[.] 0003cbc9 sub_3CBC9                                        &#8211; [.] 000391b1 sub_391B1<br />
[.] 0003d0f3 sub_3D0F3                                        &#8211; [.] 000396cf sub_396CF<br />
[.] 0003d7d3 sub_3D7D3                                        &#8211; [.] 00039ccf sub_39CCF<br />
[.] 0004f9c9 sub_4F9C9                                        &#8211; [.] 0004be7f sub_4BE7F<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-</p>
<p>I am working on narrowing down the NTLM Entropy changes in hopes that I can create an unauthenticated remote check.  The rest of the bugs in MS10-012 require authentication and appear to be cause by improperly parsing unicode file names strings with wildcards&#8230;</p>
<p>Of course there are were a ton of matched functions between the two files, I&#8217;ve included the:</p>
<p>14 Matched Functions ~ These are functions that have probably changed</p>
<p>53 unmatched functions ~ These are new functions in the updated srv.sys</p>
<p>5 changed functions ~ The number of basic blocks in this function has changed suggesting a significant change.</p>
<p>Here is what the TurboDiff results window looks like:</p>
<p><a href="http://thatsbroken.com/wp-content/uploads/2010/02/turbodiff1.jpg"><img class="alignnone size-full wp-image-257" title="turbodiff1" src="http://thatsbroken.com/wp-content/uploads/2010/02/turbodiff1.jpg" alt="" width="775" height="728" /></a></p>
<p>Choosing a function will bring up two function call graphs.  We&#8217;re most concerend about red blocks but don&#8217;t let the tricker bugs to spot slip past!</p>
<p>Here is a side by side shot showing the changed code:</p>
<p><a href="http://thatsbroken.com/wp-content/uploads/2010/02/turbodiff2.jpg"><img class="alignnone size-full wp-image-256" title="turbodiff2" src="http://thatsbroken.com/wp-content/uploads/2010/02/turbodiff2.jpg" alt="" width="695" height="865" /></a></p>
<p>When we take a closer look at this code however we can see its a false positive:</p>
<p><a href="http://thatsbroken.com/wp-content/uploads/2010/02/turbodiff2-fp12.png"><img class="alignnone size-full wp-image-259" title="turbodiff2-fp1" src="http://thatsbroken.com/wp-content/uploads/2010/02/turbodiff2-fp12.png" alt="" width="706" height="846" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://thatsbroken.com/?feed=rss2&amp;p=248</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Adding a hook to the PAIMEIpeek UI</title>
		<link>http://thatsbroken.com/?p=235</link>
		<comments>http://thatsbroken.com/?p=235#comments</comments>
		<pubDate>Tue, 09 Feb 2010 02:53:50 +0000</pubDate>
		<dc:creator>jRichards</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://thatsbroken.com/?p=235</guid>
		<description><![CDATA[Hey all, I&#8217;m working on fuzzing an Apple service and I needed PAIMEIPeek to track send() as well as recv()&#8230; since recv() function tracing is already in PAIMEIpeek.py adding support for send() was pretty damn simple. update: paimei/console/modules/PAIMEIpeek.py and paimei/console/modules/_PAIMEIpeek/PeekOptionsDlg.py The new options window: I&#8217;ll continue fuzzing this project using a more advanced technique called [...]]]></description>
			<content:encoded><![CDATA[<p>Hey all, I&#8217;m working on fuzzing an Apple service and I needed PAIMEIPeek to track send() as well as recv()&#8230; since recv() function tracing is already in PAIMEIpeek.py adding support for send() was pretty damn simple.</p>
<p>update:</p>
<p>paimei/console/modules/<a href="http://thatsbroken.com/wp-content/uploads/PAIMEIpeek.py">PAIMEIpeek.py</a><br />
and<br />
paimei/console/modules/_PAIMEIpeek/<a href="http://thatsbroken.com/wp-content/uploads/PeekOptionsDlg.py">PeekOptionsDlg.py</a></p>
<p>The new options window:<P><br />
<a href="http://thatsbroken.com/wp-content/uploads/2010/02/paimei-send.jpg"><img src="http://thatsbroken.com/wp-content/uploads/2010/02/paimei-send.jpg" alt="" title="paimei-send" width="230" height="276" class="alignnone size-full wp-image-245" /></a><br />
<a href="http://thatsbroken.com/wp-content/uploads/2010/02/apple-service.jpg"><img class="alignnone size-large wp-image-240" title="apple-service" src="http://thatsbroken.com/wp-content/uploads/2010/02/apple-service-1024x634.jpg" alt="" width="1024" height="634" /></a></p>
<p>I&#8217;ll continue fuzzing this project using a more advanced technique called &#8220;In Memory Fuzzing&#8221;.</p>
<p>Using functionality supported by pydbg I&#8217;ll be setting a pydbg.process_snapshot() on the recv hook and then a pydbg.virtual_alloc().  This will allow me to create space and import my munged XML into the process space using pydbg.write_process_memory(address, mungedxml)</p>
<p>Then, after the munged xml is in memory I&#8217;ll change context.esp+4 pointer to mungedxml&#8230; restore the hook&#8230; and use pydbg&#8217;s built in memory/stack corruption detection to look for faults.  </p>
<p>What I&#8217;d like to start working on is a gui to setup hooks on functions, parse the input and replace them with sulley strings&#8230; I haven&#8217;t seen a good set of tools to do in memory fuzzing and PaiMei seems to be the perfect platform &#8212; any takers?</p>
]]></content:encoded>
			<wfw:commentRss>http://thatsbroken.com/?feed=rss2&amp;p=235</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PaiMei:  Fixing PAIMEIpeek.py</title>
		<link>http://thatsbroken.com/?p=227</link>
		<comments>http://thatsbroken.com/?p=227#comments</comments>
		<pubDate>Thu, 04 Feb 2010 18:34:12 +0000</pubDate>
		<dc:creator>jRichards</dc:creator>
				<category><![CDATA[Fuzzing]]></category>
		<category><![CDATA[PaiMei]]></category>
		<category><![CDATA[Reversing]]></category>

		<guid isPermaLink="false">http://thatsbroken.com/?p=227</guid>
		<description><![CDATA[If you&#8217;ve spent any time playing with PaiMei&#8217;s PEEK! Module you&#8217;ve no doubt run into bugs. PEEK! has the ability to track and print to screen the registers and stack when calls to recv() and recvfrom() are made. When these functions return EAX holds the buffer length of the recieved packet&#8230; unless there is a [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;ve spent any time playing with PaiMei&#8217;s PEEK! Module you&#8217;ve no doubt run into bugs.  </p>
<p>PEEK! has the ability to track and print to screen the registers and stack when calls to recv() and recvfrom() are made.  When these functions return EAX holds the buffer length of the recieved packet&#8230; unless there is a failure and it returns -1 (or FFFFFFFF).  Unfortunately pydbg is instructed to do this without first checking the value of length.:<br />
<P></p>
<blockquote><p> read_buf     = create_string_buffer(length)</p></blockquote>
<p><P><br />
Which results in this:<P></p>
<blockquote><p>  File &#8220;C:\Python25\lib\ctypes\__init__.py&#8221;, line 70, in create_string_buffer<br />
    buftype = c_char * init<br />
OverflowError: cannot fit &#8216;long&#8217; into an index-sized integer</p></blockquote>
<p>What&#8217;s the right ay to fix this?  Should we edit pydbg to make sure it doesnt try to create a buffer 4294967295 in length? Maybe&#8230; but for now we&#8217;ll edit PAIMEIpeek.py because its easier, faster, and I don&#8217;t have commit to the svn </p>
<p>To resolve this, I modified each hook container call back like so:</p>
<pre name="code" class="python">    ####################################################################################################################
    def socket_logger_ws2_recvfrom (self, dbg, args, ret):
        '''
        Hook container call back.
        '''

        self.msg("ws2_32.recvfrom(buf=%08x, len=%d)" % (args[1], args[2]))
        self.msg("Actually received %d bytes:" % ret)
        if int(ret) == 4294967295:
            self.msg("ERROR received from ws2_32:%d" % ret)
        else:
            self.msg(dbg.hex_dump(dbg.read(args[1], ret)))

    ####################################################################################################################
</pre>
<p>Yes, its a hack but it accomplishes what I need to continue monitoring so it&#8217;s good enough for now.</p>
]]></content:encoded>
			<wfw:commentRss>http://thatsbroken.com/?feed=rss2&amp;p=227</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>PaiMei: Fixing proc_peek_recon.py and proc_peek_recon_db.py</title>
		<link>http://thatsbroken.com/?p=224</link>
		<comments>http://thatsbroken.com/?p=224#comments</comments>
		<pubDate>Thu, 04 Feb 2010 18:14:47 +0000</pubDate>
		<dc:creator>jRichards</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://thatsbroken.com/?p=224</guid>
		<description><![CDATA[The versions of proc_peek_recon.py and proc_peek_recon_db.py are slightly broken. They both suffer from the same problem. Simply change: for xref in CodeRefsTo(location, True) + DataRefsTo(location): To this: for xref in list(CodeRefsTo(location, True)) + list(DataRefsTo(location)): This will convert the generators that are returned by CodeRefsTo and DataRefsTo into lists that can be combined and iterated through. [...]]]></description>
			<content:encoded><![CDATA[<p>The versions of proc_peek_recon.py and proc_peek_recon_db.py are slightly broken.<br />
<P><br />
They both suffer from the same problem.  Simply change:<br />
<P><br />
for xref in CodeRefsTo(location, True) + DataRefsTo(location):<br />
<P><br />
To this:<P><br />
for xref in <strong>list</strong>(CodeRefsTo(location, True)) + <strong>list</strong>(DataRefsTo(location)):<br />
<P><br />
This will convert the generators that are returned by CodeRefsTo and DataRefsTo into lists that can be combined and iterated through.  </p>
<p>Failure to do this will result in the following error:</p>
<blockquote><p>
Traceback (most recent call last):<br />
  File &#8220;<string>&#8220;, line 1, in <module><br />
  File &#8220;C:\Program Files\IDA\python\init.py&#8221;, line 65, in runscript<br />
    execfile(script, g)<br />
  File &#8220;C:/paimei/proc_peek_recon_db.py&#8221;, line 357, in <module><br />
    main()<br />
  File &#8220;C:/paimei/proc_peek_recon_db.py&#8221;, line 354, in main<br />
    meat_and_potatoes(mysql)<br />
  File &#8220;C:/paimei/proc_peek_recon_db.py&#8221;, line 253, in meat_and_potatoes<br />
    for xref in CodeRefsTo(location, True) + DataRefsTo(location):<br />
TypeError: unsupported operand type(s) for +: &#8216;generator&#8217; and &#8216;generator&#8217;</p>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://thatsbroken.com/?feed=rss2&amp;p=224</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
