<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress.com" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>

<channel>
	<title>my-software &amp;laquo; WordPress.com Tag Feed</title>
	<link>http://en.wordpress.com/tag/my-software/</link>
	<description>Feed of posts on WordPress.com tagged "my-software"</description>
	<pubDate>Sun, 29 Nov 2009 11:14:11 +0000</pubDate>

	<generator>http://en.wordpress.com/tags/</generator>
	<language>en</language>

<item>
<title><![CDATA[Quickpost: SelectMyParent or Playing With the Windows Process Tree]]></title>
<link>http://blog.didierstevens.com/2009/11/22/quickpost-selectmyparent-or-playing-with-the-windows-process-tree/</link>
<pubDate>Sun, 22 Nov 2009 20:36:53 +0000</pubDate>
<dc:creator>Didier Stevens</dc:creator>
<guid>http://blog.didierstevens.com/2009/11/22/quickpost-selectmyparent-or-playing-with-the-windows-process-tree/</guid>
<description><![CDATA[I read something very interesting in &#8220;Windows via C/C++&#8221; today: starting with Windows Vi]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>I read something very interesting in <a href="http://www.wintellect.com/BookInformation.aspx?ASIN=0735624240" target="_blank">&#8220;Windows via C/C++&#8221;</a> today: starting with Windows Vista, <a href="http://msdn.microsoft.com/en-us/library/ms682425%28VS.85%29.aspx" target="_blank">CreateProcess</a> can start a program where you specify the parent process! This is something forensic investigators must be aware of when they analyse processes running on a Windows machine.</p>
<p>Normally the parent process of a new process is the process that created the new process (via CreateProcess). But when using <a href="http://msdn.microsoft.com/en-us/library/ms686329%28VS.85%29.aspx" target="_blank">STARTUPINFOEX</a> with the right <a href="http://msdn.microsoft.com/en-us/library/ms683481%28VS.85%29.aspx" target="_blank">LPPROC_THREAD_ATTRIBUTE_LIST</a> to create a process, you can arbitrarely specify the parent process, provided you have the rights (i.e. it&#8217;s your process or you have debug rights).</p>
<p>I developed a small tool to start a program while specifying its parent process: SelectMyParent. Here I use it to start notepad as a child of lsass.exe:</p>
<p><img class="alignnone size-full wp-image-1863" title="20091122-211535" src="http://didierstevens.wordpress.com/files/2009/11/20091122-211535.png" alt="" width="601" height="140" /></p>
<p><img class="alignnone size-full wp-image-1864" title="20091122-211621" src="http://didierstevens.wordpress.com/files/2009/11/20091122-211621.png" alt="" width="619" height="99" /></p>
<p>2 remarks about this example:</p>
<ol>
<li>to make lsass.exe a parent process, you need to use SelectMyParent with admin rights and elevate its rights (Run as administrator)</li>
<li>the notepad process takes over the parent process&#8217; account: NT AUTHORITY\SYSTEM</li>
</ol>
<p>I don&#8217;t know how one can detect that a process&#8217; parent is not the process that created it, because a process has no access to its extended startup info (only to its startup info). And it is the extended startup info that contains the attribute list with the handle to the parent process.</p>
<p>SelectMyParent version 0.0.0.1 is available <a href="http://www.didierstevens.com/files/software/SelectMyParent_v0_0_0_1.zip" target="_self">here</a>.</p>
<hr /><a href="http://blog.didierstevens.com/2007/11/01/announcing-quickposts/">Quickpost info</a></p>
<p>&#160;</p>
<hr />
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Update: bpmtk with hook-createprocess.dll]]></title>
<link>http://blog.didierstevens.com/2009/11/19/update-bpmtk-with-hook-createprocess-dll/</link>
<pubDate>Thu, 19 Nov 2009 19:32:34 +0000</pubDate>
<dc:creator>Didier Stevens</dc:creator>
<guid>http://blog.didierstevens.com/2009/11/19/update-bpmtk-with-hook-createprocess-dll/</guid>
<description><![CDATA[There are no real changes in this new version of bpmtk, only a new DLL (hook-createprocess.dll) was ]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>There are no real changes in this new version of bpmtk, only a new DLL (hook-createprocess.dll) was added. You can use this DLL to protect your Windows machine from getting infected by the current malicious documents found in-the-wild.</p>
<p>You can download bpmtk version 0.1.6.0 <a href="http://www.didierstevens.com/files/software/bpmtk_V0_1_6_0.zip" target="_self">here</a>.</p>
<p>Hook-createprocess.dll is a DLL that patches the process into which it is loaded to prevent it from creating new processes. It does this by patching the Import Address Table of kernel32.dll for ntdll.dll to hook API functions NtCreateProcessEx, NtCreateProcess and NtCreateUserProcess.<br />
Calls to these functions are intercepted and not passed on to the original functions. Instead, a code is returned indicating that the operation was blocked. The result is that functions in kernel32 used to create new processes fail (like WinExec) and hence that the patched process can’t create new processes.<br />
This is all it takes to block most shellcode found in malicious documents like PDF malware. Shellcode like this does the following:</p>
<p><img class="alignnone size-full wp-image-1842" title="20091119-01" src="http://didierstevens.wordpress.com/files/2009/11/20091119-01.png" alt="" width="656" height="260" /><br />
Of course, since this protective measure is taken by patching the process, shellcode could undo this patching and bypass our protection. Or it could use the ntdll API and not be hindered by our patch. But actual malware found in-the-wild doesn’t do this (not talking about targeted attacks) and is thus prevented from executing the trojan it just downloaded or extracted from the PDF document.</p>
<p>If you want better protection, you&#8217;ll have to use something that works at the level of the kernel, like sandboxing software.</p>
<p>However, this patch comes with some drawbacks, because it also blocks bening new processes. For example, the update function of Adobe Acrobat requires the creation of a new process. To reenable the creation of processes, you have to unload hook-createprocess.dll (unloading removes the hooks). bpmtk has a function to unload DLLs from a process (reject).</p>
<p>There are a couple of trick to load this DLL with the program you want to protect. I&#8217;ll describe a generic method in an upcoming post, but now I want to explain it for a specific program.<br />
Programs have a list of DLLs they need for their execution. We will use a PE-file editor to add our hook-createprocess.dll to this list. hook-createprocess.dll exports a dummy function (_Dummy) just so you can add to the imports table of an executable. We will use <a href="http://www.woodmann.net/collaborative/tools/index.php/LordPE" target="_blank">LordPE</a> to add hook-createprocess.dll with _Dummy to Adobe Reader:</p>
<p><img class="alignnone size-full wp-image-1843" title="20091119-195802" src="http://didierstevens.wordpress.com/files/2009/11/20091119-195802.png" alt="" width="653" height="301" /></p>
<p><img class="alignnone size-full wp-image-1844" title="20091119-195846" src="http://didierstevens.wordpress.com/files/2009/11/20091119-195846.png" alt="" width="626" height="496" /></p>
<p><img class="alignnone size-full wp-image-1855" title="20091119-203031" src="http://didierstevens.wordpress.com/files/2009/11/20091119-203031.png" alt="" width="560" height="268" /></p>
<p><img class="alignnone size-full wp-image-1846" title="20091119-200145" src="http://didierstevens.wordpress.com/files/2009/11/20091119-200145.png" alt="" width="446" height="421" /></p>
<p>Right-click the Import table:</p>
<p><img class="alignnone size-full wp-image-1847" title="20091119-200229" src="http://didierstevens.wordpress.com/files/2009/11/20091119-200229.png" alt="" width="644" height="308" /></p>
<p><img class="alignnone size-full wp-image-1848" title="20091119-200412" src="http://didierstevens.wordpress.com/files/2009/11/20091119-200412.png" alt="" width="358" height="203" /></p>
<p><img class="alignnone size-full wp-image-1849" title="20091119-200422" src="http://didierstevens.wordpress.com/files/2009/11/20091119-200422.png" alt="" width="358" height="203" /></p>
<p><img class="alignnone size-full wp-image-1850" title="20091119-200442" src="http://didierstevens.wordpress.com/files/2009/11/20091119-200442.png" alt="" width="644" height="308" /></p>
<p>And don&#8217;t forget to save&#8230;</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Quickpost: "Hiding" a PDF Document]]></title>
<link>http://blog.didierstevens.com/2009/11/09/quickpost-hiding-a-pdf-document/</link>
<pubDate>Mon, 09 Nov 2009 15:00:25 +0000</pubDate>
<dc:creator>Didier Stevens</dc:creator>
<guid>http://blog.didierstevens.com/2009/11/09/quickpost-hiding-a-pdf-document/</guid>
<description><![CDATA[Here&#8217;s some Python code (it uses my mPDF module) to append a new PDF document to an existing P]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Here&#8217;s some Python code (it uses <a href="http://blog.didierstevens.com/programs/pdf-tools#make-pdf" target="_self">my mPDF module</a>) to append a new PDF document to an existing PDF document to &#8220;hide&#8221; the original document. Recovering the original is trivial, you open the PDF document with a HEX-editor and delete the appended document (starting after the second %%EOF counting from the end of the file). This trick uses <a href="http://blog.didierstevens.com/2008/05/07/solving-a-little-pdf-puzzle/" target="_self">incremental updates</a>.</p>
<p><img class="alignnone size-full wp-image-1832" title="20091107-172245" src="http://didierstevens.wordpress.com/files/2009/11/20091107-172245.png" alt="20091107-172245" width="441" height="541" /></p>
<pre class="brush: python;">
#!/usr/bin/python

__description__ = 'make-pdf-hide-original, use it to &#34;hide&#34; the original PDF document'
__author__ = 'Didier Stevens'
__version__ = '0.0.1'
__date__ = '2009/11/07'

&#34;&#34;&#34;
Source code put in public domain by Didier Stevens, no Copyright
https://DidierStevens.com
Use at your own risk

History:
 2009/11/07: start

Todo:

&#34;&#34;&#34;

import mPDF
import time
import zlib
import optparse

def Main():
    oParser = optparse.OptionParser(usage='usage: %prog [options] pdf-file\n' + __description__, version='%prog ' + __version__)
    oParser.add_option('-s', '--line', default='Hello World', help='The line of text to print on the screen (default Hello World')
    (options, args) = oParser.parse_args()

    if len(args) != 1:
        oParser.print_help()
        print ''
        print '  %s' % __description__
        print '  Source code put in the public domain by Didier Stevens, no Copyright'
        print '  Use at your own risk'
        print '  https://DidierStevens.com'

    else:
        pdffile = args[0]
        oPDF = mPDF.cPDF(pdffile)
        oPDF.template1()
        oPDF.stream(5, 0, 'BT /F1 24 Tf 100 700 Td (%s) Tj ET' % options.line)
        oPDF.xrefAndTrailer('1 0 R')

if __name__ == '__main__':
   Main()
</pre>
<hr /><a href="http://blog.didierstevens.com/2007/11/01/announcing-quickposts/">Quickpost info</a></p>
<p>&#160;</p>
<hr />
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[A Windows 7 Launch Party Trick!]]></title>
<link>http://blog.didierstevens.com/2009/10/21/a-windows-7-launch-party-trick/</link>
<pubDate>Wed, 21 Oct 2009 17:19:16 +0000</pubDate>
<dc:creator>Didier Stevens</dc:creator>
<guid>http://blog.didierstevens.com/2009/10/21/a-windows-7-launch-party-trick/</guid>
<description><![CDATA[In search of a new trick for that Windows 7 Launch Party you&#8217;re invited to? Here&#8217;s one: ]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>In search of a new trick for that Windows 7 Launch Party you&#8217;re invited to? <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>Here&#8217;s one:</p>
<p><img class="alignnone size-full wp-image-1817" title="20091021-190621" src="http://didierstevens.wordpress.com/files/2009/10/20091021-190621.png" alt="20091021-190621" width="721" height="440" /></p>
<p>You can download a beta version of my UserAssist tool <a href="http://didierstevens.com/files/software/UserAssistWindows7LaunchParty.zip">here</a>. Soon I&#8217;ll be posting a final version with details and source code.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Update: WhoAmI? Version 0.1.3]]></title>
<link>http://blog.didierstevens.com/2009/10/14/update-whoami-version-0-1-3/</link>
<pubDate>Wed, 14 Oct 2009 18:00:02 +0000</pubDate>
<dc:creator>Didier Stevens</dc:creator>
<guid>http://blog.didierstevens.com/2009/10/14/update-whoami-version-0-1-3/</guid>
<description><![CDATA[I’ve updated my WhoAmI? Firefox add-on for Firefox version 3.5. You can download it here or get it f]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>I’ve updated my <a href="http://blog.didierstevens.com/2007/10/09/whoami-firefox-extension/">WhoAmI?</a> Firefox add-on for Firefox version 3.5.</p>
<p>You can download it <a href="http://didierstevens.com/files/software/whoami_-0.1.3-fx.zip" target="_self">here</a> or get it from the <a href="https://addons.mozilla.org/en-US/firefox/addon/5797" target="_blank">Mozilla</a> site. I’ve nominated it to leave the Sandbox. If you use it, please post a review on the <a href="https://addons.mozilla.org/en-US/firefox/addon/5797" target="_blank">Mozilla</a> page to help it on its way out of the the Sandbox (or keep it there if it’s too buggy).</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Update: PDFiD Version 0.0.9 to Detect Another Adobe 0Day]]></title>
<link>http://blog.didierstevens.com/2009/10/13/update-pdfid-version-0-0-9-to-detect-another-adobe-0day/</link>
<pubDate>Tue, 13 Oct 2009 21:23:27 +0000</pubDate>
<dc:creator>Didier Stevens</dc:creator>
<guid>http://blog.didierstevens.com/2009/10/13/update-pdfid-version-0-0-9-to-detect-another-adobe-0day/</guid>
<description><![CDATA[PDFiD is updated to detect the latest Adobe 0day, CVE-2009-3459. I&#8217;ll provide more details in ]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>PDFiD is updated to detect the latest Adobe 0day, <a href="http://blogs.adobe.com/psirt/2009/10/adobe_reader_and_acrobat_issue_1.html" target="_blank">CVE-2009-3459</a>.</p>
<p>I&#8217;ll provide more details in an upcoming post, just now for know that PDFiD detects a /Colors name followed by a very big number (larger than 2^24 or 16777216).</p>
<p><img class="alignnone size-full wp-image-1808" title="pdfid009" src="http://didierstevens.wordpress.com/files/2009/10/pdfid009.png" alt="pdfid009" width="315" height="139" /></p>
<p>You can download PDFiD <a href="http://blog.didierstevens.com/programs/pdf-tools/#pdfid" target="_self">here</a>.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Preventing Applications From Starting (Malicious) Applications]]></title>
<link>http://blog.didierstevens.com/2009/10/05/preventing-applications-from-starting-malicious-applications/</link>
<pubDate>Mon, 05 Oct 2009 00:00:54 +0000</pubDate>
<dc:creator>Didier Stevens</dc:creator>
<guid>http://blog.didierstevens.com/2009/10/05/preventing-applications-from-starting-malicious-applications/</guid>
<description><![CDATA[Another very effective way to prevent malicious documents from infecting PCs, is to prevent vulnerab]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Another very effective way to <a href="http://blog.didierstevens.com/2009/09/27/preventing-malicious-documents-from-compromising-windows-machines/" target="_self">prevent malicious documents from infecting PCs</a>, is to prevent vulnerable applications from starting other applications. As almost all shellcode found in malicious documents in-the-wild (again, I&#8217;m excluding targeted attacks) will ultimately start another process to execute the trojan, blocking this will prevent the trojan from executing.</p>
<p>This is an old idea you&#8217;ll find implemented in many sandboxes and HIPS. I added a new DLL to my <a href="http://blog.didierstevens.com/2008/02/28/introducing-the-basic-process-manipulation-tool-kit/" target="_self">basic process manipulation tool kit</a> to prevent applications from creating a new process. Loading this DLL inside a process will prevent this process from creating a new process. I&#8217;ll explain the technique used in my DLL and how to load it in vulnerable applications in upcoming blogposts, but I want to start with showing how it prevents malicious documents from infecting a PC.</p>
<p>When the DLL is loaded inside a process, it will patch the Create Process API to intercept and block calls to it:</p>
<p><img class="alignnone size-full wp-image-1790" title="hook-createprocess-010" src="http://didierstevens.wordpress.com/files/2009/10/hook-createprocess-010.png" alt="hook-createprocess-010" width="700" height="182" /></p>
<p>As a first test, we&#8217;ll use my <a href="http://blog.didierstevens.com/2008/05/20/quickpost-eicarpdf/" target="_self">eicar.pdf</a> document.</p>
<p><img class="alignnone size-full wp-image-1791" title="hook-createprocess-009" src="http://didierstevens.wordpress.com/files/2009/10/hook-createprocess-009.png" alt="hook-createprocess-009" width="677" height="310" /></p>
<p>Clicking the button will save the eicar.txt file to a temporary folder and launch the editor.</p>
<p>Adobe Acrobat reader will warn you when an application is to be launched:</p>
<p><img class="alignnone size-full wp-image-1792" title="hook-createprocess-011" src="http://didierstevens.wordpress.com/files/2009/10/hook-createprocess-011.png" alt="hook-createprocess-011" width="574" height="205" /></p>
<p>But when you accept, the editor will be prevented to execute:</p>
<p><img class="alignnone size-full wp-image-1793" title="hook-createprocess-012" src="http://didierstevens.wordpress.com/files/2009/10/hook-createprocess-012.png" alt="hook-createprocess-012" width="510" height="142" /></p>
<p>That&#8217;s because the DLL intercepted and blocked the Create Process call:</p>
<p><img class="alignnone size-full wp-image-1794" title="hook-createprocess-013" src="http://didierstevens.wordpress.com/files/2009/10/hook-createprocess-013.png" alt="hook-createprocess-013" width="717" height="119" /></p>
<p>As a second test, let&#8217;s use a real malicious PDF document. The hooks installed by the DLL prevent it from executing the trojan:</p>
<p><img class="alignnone size-full wp-image-1795" title="hook-createprocess-014" src="http://didierstevens.wordpress.com/files/2009/10/hook-createprocess-014.png" alt="hook-createprocess-014" width="723" height="149" /></p>
<p>Adobe Reader starts and then just crashes, without spawning another process:</p>
<p><img class="alignnone size-full wp-image-1797" title="hook-createprocess-017" src="http://didierstevens.wordpress.com/files/2009/10/hook-createprocess-017.png" alt="hook-createprocess-017" width="724" height="189" /></p>
<p>When opening the same malicious PDF, but without the protecting DLL, the machine gets trojaned (execution of 1.exe and Internet Explorer):</p>
<p><img class="alignnone size-full wp-image-1796" title="hook-createprocess-018" src="http://didierstevens.wordpress.com/files/2009/10/hook-createprocess-018.png" alt="hook-createprocess-018" width="725" height="274" /></p>
<p>This simple way of preventing applications from launching other applications comes with some drawbacks. For example, the Check Update function in Adobe Reader will not function anymore.</p>
<p>When you have a sandboxing system of HIPS installed on the machines you manage, check if you can use it to prevent vulnerable applications from starting other applications. If it doesn&#8217;t provide such a feature, try the new DLL I&#8217;ll be posting in the new version of bpmtk.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Quickpost: SAFER and Malicious Documents]]></title>
<link>http://blog.didierstevens.com/2009/09/28/quickpot-safer-and-malicious-documents/</link>
<pubDate>Mon, 28 Sep 2009 17:50:58 +0000</pubDate>
<dc:creator>Didier Stevens</dc:creator>
<guid>http://blog.didierstevens.com/2009/09/28/quickpot-safer-and-malicious-documents/</guid>
<description><![CDATA[I wasn’t going to mention SAFER to restrict the rights of an application, because Software Restricti]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p><em>I wasn’t going to mention <a href="http://blogs.msdn.com/michael_howard/archive/2005/01/31/363985.aspx" target="_blank">SAFER</a> to <a href="http://blog.didierstevens.com/2009/09/27/preventing-malicious-documents-from-compromising-windows-machines/" target="_self">restrict the rights of an application</a>, because <a href="http://blog.didierstevens.com/2008/03/06/bpmtk-replacing-gpdisable/" target="_self">Software Restriction Policies can be bypassed</a>. But a <a href="http://twitter.com/EdiStrosar/status/4421644065" target="_blank">Tweet by Edi Strosar</a> made me review my viewpoint. In this particular case, bypassing SRP is a non-issue, because the user is already local admin!</em></p>
<p>Software Restriction Policies allow you to force specific applications to run with a restricted token. As Michael explained it with AD GPOs, I&#8217;ll show it with local policies.</p>
<p>Enable SAFER policies for SRPs by adding DWORD registry key Levels (value 0&#215;31000) to HKLM\SOFTWARE\Policies\Microsoft\Windows\Safer\CodeIdentifiers:</p>
<p><img class="alignnone size-full wp-image-1771" title="20090928-184852" src="http://didierstevens.wordpress.com/files/2009/09/20090928-184852.png" alt="20090928-184852" width="737" height="410" /></p>
<p>Start the Local Security Policy administration tool and go to the Software Restriction Policies. You&#8217;ll have to create new policies if this is the first time you configure SRPs.</p>
<p><img class="alignnone size-full wp-image-1770" title="20090928-180154" src="http://didierstevens.wordpress.com/files/2009/09/20090928-180154.png" alt="20090928-180154" width="449" height="341" /></p>
<p>Create a new rule in Additional Rules. We&#8217;ll identify the application to restrict by its path and name, so create a Path Rule:</p>
<p><img class="alignnone size-full wp-image-1772" title="20090928-185739" src="http://didierstevens.wordpress.com/files/2009/09/20090928-185739.png" alt="20090928-185739" width="334" height="393" /></p>
<p>For the security level, select Basic User:</p>
<p><img class="alignnone size-full wp-image-1773" title="20090928-184938" src="http://didierstevens.wordpress.com/files/2009/09/20090928-184938.png" alt="20090928-184938" width="406" height="455" /></p>
<p>If you have no Basic User option, you forgot to update the registry before launching the administration tool:</p>
<p><img class="alignnone size-full wp-image-1774" title="20090928-184657" src="http://didierstevens.wordpress.com/files/2009/09/20090928-184657.png" alt="20090928-184657" width="406" height="455" /></p>
<p>Select the application to restrict:</p>
<p><img class="alignnone size-full wp-image-1775" title="20090928-185830" src="http://didierstevens.wordpress.com/files/2009/09/20090928-185830.png" alt="20090928-185830" width="406" height="455" /></p>
<p>This rule will force Adobe Reader to run with a restricted token:</p>
<p><img class="alignnone size-full wp-image-1777" title="20090928-180534" src="http://didierstevens.wordpress.com/files/2009/09/20090928-180534.png" alt="20090928-180534" width="439" height="515" /></p>
<p>Writing to SYSTEM32 is denied:</p>
<p><img class="alignnone size-full wp-image-1778" title="20090928-180742" src="http://didierstevens.wordpress.com/files/2009/09/20090928-180742.png" alt="20090928-180742" width="462" height="164" /></p>
<hr /><a href="http://blog.didierstevens.com/2007/11/01/announcing-quickposts/">Quickpost info</a></p>
<hr />
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Preventing Malicious Documents from Compromising Windows Machines]]></title>
<link>http://blog.didierstevens.com/2009/09/27/preventing-malicious-documents-from-compromising-windows-machines/</link>
<pubDate>Sun, 27 Sep 2009 13:33:43 +0000</pubDate>
<dc:creator>Didier Stevens</dc:creator>
<guid>http://blog.didierstevens.com/2009/09/27/preventing-malicious-documents-from-compromising-windows-machines/</guid>
<description><![CDATA[Almost all shellcode I see in malicious documents (PDF, Word, Powerpoint, …) found “in the wild” doe]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Almost all shellcode I see in malicious documents (PDF, Word, Powerpoint, …) found “in the wild” does the following:</p>
<ol>
<li>download a trojan from the Internet using HTTP</li>
<li>write the downloaded executable to SYSTEM32</li>
<li>execute the downloaded executable</li>
</ol>
<p>This infection method only works if the user is local admin. If the exploited program has no rights to write to SYSTEM32, the shellcode will just fail and the trojan will not infect the machine.</p>
<p>To protect yourself and/or your users against this type of attack (I&#8217;m not talking about targeted attacks), restrict the user rights. Windows Vista and later versions <a href="http://blog.didierstevens.com/2008/05/26/quickpost-restricted-tokens-and-uac/" target="_self">do this for you with UAC</a>, even if you&#8217;re an administrator.</p>
<p>On Windows XP, you have to use a normal user account in stead of an admin account to achieve this. But running non-admin on Windows XP is not always easy. If you really need to allow admin rights on Windows XP, you can still prevent high-risk applications (like Adobe Acrobat and Microsoft Office) from having full control over the system by restricting their rights. This is done by using a <a href="http://msdn.microsoft.com/en-us/library/aa379316(VS.85).aspx" target="_blank">restricted token</a> for the processes of these applications.</p>
<p>There are 2 popular tools to launch programs with a restricted token:</p>
<ul>
<li><a href="http://download.microsoft.com/download/f/2/e/f2e49491-efde-4bca-9057-adc89c476ed4/DropMyRights.msi" target="_blank">DropMyRights</a> by <a href="http://blogs.msdn.com/michael_howard/" target="_blank">Michael Howard</a></li>
<li><a href="http://www.sysint.no/nedlasting/StripMyRights.htm" target="_blank">StripMyRights</a> by Kåre Smith</li>
</ul>
<p>Both tools create a restricted token (by removing privileges and denying groups that provide local admin rights) and then launch the target program with this restricted token.</p>
<p>It&#8217;s not always easy to launch a program with DropMyRights, as there are many ways a program can be launched on Windows. For example with a file-type association or from a browser. To help you configure Windows to always restrict the rights of a specific program, StripMyRights also support the &#8220;Image File Execution Options&#8221; method with the /D option. The &#8220;Image File Execution Options&#8221; is designed to allow you to launch a program automatically inside a debugger. In the &#8220;Image File Execution Options&#8221; registry key, you specify the debugger to use. But this can really be any executable.</p>
<p>Example: to restrict the rights of Adobe Reader, add StripMyRights to the AcroRd32.exe Image Execution path like this:</p>
<pre>[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\acrord32.exe]
"Debugger"="StripMyRights.exe /D /L N"
</pre>
<p>This way, each time AcroRd32.exe is executed, StripMyRights executes first, creates a restricted token and then launches AcroRd32.exe with this restricted token.</p>
<p><img class="alignnone size-full wp-image-1766" title="20090927-001" src="http://didierstevens.wordpress.com/files/2009/09/20090927-001.png" alt="20090927-001" width="453" height="513" /></p>
<p>But executing StripMyRights before executing the target application doesn&#8217;t always yield satisfactory results, sometimes it breaks the application, because of the broken process tree.</p>
<p>That&#8217;s why I developed an alternative, LowerMyRights.dll, to be presented in an upcoming blogpost.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Phần Mềm Turbo Pascal Version 7.0]]></title>
<link>http://nghiand04.wordpress.com/2009/09/27/ph%e1%ba%a7n-m%e1%bb%81m-turbo-pascal-version-7-0/</link>
<pubDate>Sun, 27 Sep 2009 07:44:38 +0000</pubDate>
<dc:creator>Nguyễn Đại Nghĩa</dc:creator>
<guid>http://nghiand04.wordpress.com/2009/09/27/ph%e1%ba%a7n-m%e1%bb%81m-turbo-pascal-version-7-0/</guid>
<description><![CDATA[New version ! Collect on the Internet Link Download Here !]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>New version !</p>
<p>Collect on the Internet</p>
<p><a title="Copyright 2009 by nghiand04" href="http://www.mediafire.com/download.php?0hjctynotmy" target="_self">Link Download Here !</a></p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Phần mềm Giả Lập Máy Tính CASIO 500MS và 570MS]]></title>
<link>http://nghiand04.wordpress.com/2009/09/27/cong-c%e1%bb%a5-%e2%80%b9-nghiand04s-blog-%e2%80%94-wordpress-2/</link>
<pubDate>Sun, 27 Sep 2009 04:02:21 +0000</pubDate>
<dc:creator>Nguyễn Đại Nghĩa</dc:creator>
<guid>http://nghiand04.wordpress.com/2009/09/27/cong-c%e1%bb%a5-%e2%80%b9-nghiand04s-blog-%e2%80%94-wordpress-2/</guid>
<description><![CDATA[Download ở đây:  CASIO 570MS Download ở đây:  CASIO 500MS]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p><a title="CASIO 570MS" href="http://www.mediafire.com/download.php?zy1ojmxkyd0" target="_blank">Download ở đây:</a>  CASIO 570MS</p>
<p><a title="CASIO 500MS" href="http://www.mediafire.com/download.php?zyzmn4yzir0" target="_blank">Download ở đây:</a>  CASIO 500MS</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Update: Time Lapse Photography with a Nokia Mobile]]></title>
<link>http://blog.didierstevens.com/2009/08/21/update-time-lapse-photography-with-a-nokia-mobile/</link>
<pubDate>Fri, 21 Aug 2009 14:51:05 +0000</pubDate>
<dc:creator>Didier Stevens</dc:creator>
<guid>http://blog.didierstevens.com/2009/08/21/update-time-lapse-photography-with-a-nokia-mobile/</guid>
<description><![CDATA[I&#8217;ve debugged the issues some people had with my Nokia time lapse Python script, you can find ]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>I&#8217;ve debugged the issues some people had with my <a href="http://blog.didierstevens.com/2009/06/29/quickpost-time-lapse-photography-with-a-nokia-mobile/" target="_self">Nokia time lapse Python script</a>, you can find a <a href="http://blog.didierstevens.com/programs/nokia-time-lapse-photography/" target="_self">new version here</a>.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Update: UserAssist Tool Version 2.4.3]]></title>
<link>http://blog.didierstevens.com/2009/08/11/update-userassist-tool-version-2-4-3/</link>
<pubDate>Tue, 11 Aug 2009 16:07:34 +0000</pubDate>
<dc:creator>Didier Stevens</dc:creator>
<guid>http://blog.didierstevens.com/2009/08/11/update-userassist-tool-version-2-4-3/</guid>
<description><![CDATA[I had an interesting discussion with Hans Heins concerning the timestamp displayed by my UserAssist ]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>I had an interesting discussion with <a href="http://blog.didierstevens.com/programs/userassist/#comments" target="_self">Hans Heins</a> concerning the timestamp displayed by my UserAssist tool.</p>
<p>The first version of the UserAssist tool would only decode the UserAssist registry keys of the account under which it was running. And thus it made sense to display the timestamp in local time format, even if the entry is stored in UTC.</p>
<p>I added a warning about the time zones when I added registry file import functions, but this was confusing.</p>
<p>This new version of the UserAssist tool adds an extra column, with the timestamp in UTC:</p>
<p><img class="alignnone size-full wp-image-1647" title="20090811-175725" src="http://didierstevens.wordpress.com/files/2009/08/20090811-175725.png" alt="20090811-175725" width="336" height="265" /></p>
<p>And I&#8217;ll be posting a new version to support the new UserAssist registry key format of <a href="http://blog.didierstevens.com/2009/01/18/quickpost-windows-7-beta-rot13-replaced-with-vigenere-great-joke/" target="_self">Windows 7 and Windows 2008 R2</a>.</p>
<p>Download:</p>
<p><a href="http://didierstevens.com/files/software/UserAssist_V2_4_3.zip">UserAssist_V2_4_3.zip</a> (<a href="https://didierstevens.com/files/software/UserAssist_V2_4_3.zip">https</a>)</p>
<p>MD5: A5244C7F83E0DE70600E27F5D3B8AD7D</p>
<p>SHA256: 7E2D107BE84FBBF7E79F1BD11703401A374B5138B2F77E4FF8AFE1A3E749CCDA</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Update: PDFiD Version 0.0.8]]></title>
<link>http://blog.didierstevens.com/2009/08/05/update-pdfid-version-0-0-8/</link>
<pubDate>Wed, 05 Aug 2009 12:33:24 +0000</pubDate>
<dc:creator>Didier Stevens</dc:creator>
<guid>http://blog.didierstevens.com/2009/08/05/update-pdfid-version-0-0-8/</guid>
<description><![CDATA[PDFiD is updated. Changes: It detects Flash in PDF (/RichMedia) Actions launched by Forms (/AcroForm]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>PDFiD is updated.</p>
<p>Changes:</p>
<ul>
<li>It detects Flash in PDF (/RichMedia)</li>
<li>Actions launched by Forms (/AcroForm)</li>
<li>Less stringent %PDF header checking, because I saw some samples  designed to bypass pddfid</li>
<li>Updated the date format</li>
<li> New option &#8211;force:  force the scanning of a file, even if no valid %PDF  header was found</li>
<li>Accepts stdin for pipes, example:  pdf-parser.py &#8211;filter &#8211;type /ObjStm flash.pdf &#124; <span>pdfid</span>.py &#8211;force<br />
This will scan objects &#8220;hidden&#8221; in object streams (/objStm)</li>
</ul>
<p>Download:</p>
<p><a href="http://www.didierstevens.com/files/software/pdfid_v0_0_8.zip">pdfid_v0_0_8.zip</a> (<a href="https://www.didierstevens.com/files/software/pdfid_v0_0_8.zip">https</a>)</p>
<p>MD5: 9769FB96899F3AD15510C903A4FB29EF</p>
<p>SHA256: 542734C2613439851AF99B59725B1607F96A6E9396B447C5BD3AF197AABB0231</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[LeMMA 0.8 alpha release]]></title>
<link>http://welltemperedstudio.wordpress.com/2009/07/27/lemma-0-8-alpha-release/</link>
<pubDate>Sun, 26 Jul 2009 17:06:32 +0000</pubDate>
<dc:creator>GS</dc:creator>
<guid>http://welltemperedstudio.wordpress.com/2009/07/27/lemma-0-8-alpha-release/</guid>
<description><![CDATA[LeMMA 0.8 is now available as an alpha version. A more &#8216;contemporary&#8217; look-and-feel has ]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>LeMMA 0.8 is now available as an alpha version. A more &#8216;contemporary&#8217; look-and-feel has been adopted for this version. I&#8217;ve also added various usability improvements (e.g. keyboard navigation using arrow keys), and some attempts at supporting the Mac platform better. A new .ini-like configuration file format is used, using the built-in Python config file parsing library, replacing the previous Pickled file format.</p>
<p>If there are any Mac python programmers using this, I&#8217;m interested in learning what&#8217;s the proper way to package a Mac python application, and any other advice you can give me.</p>
<p>Here&#8217;s a screenshot of the new GUI:<br />
<img src="http://xenon.stanford.edu/%7Egeksiong/code/lemma/lemma0.8_1_small.png" /></p>
<p>Get it from <a href="http://welltemperedstudio.wordpress.com/code/LeMMA">the usual place</a>.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[The Ultimate Disaster Recovery Plan]]></title>
<link>http://blog.didierstevens.com/2009/07/22/the-ultimate-disaster-recovery-plan/</link>
<pubDate>Wed, 22 Jul 2009 20:34:13 +0000</pubDate>
<dc:creator>Didier Stevens</dc:creator>
<guid>http://blog.didierstevens.com/2009/07/22/the-ultimate-disaster-recovery-plan/</guid>
<description><![CDATA[The ultimate disaster recovery plan is not a corporate plan. This plan is for your family, to help t]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>The ultimate disaster recovery plan is not a corporate plan.</p>
<p>This plan is for your family, to help them take over from you, when you&#8217;re not able to take up your role in the family. Hopefully, this will only be a temporary situation, but you have to plan for the worse too: your demise.</p>
<p>List all critical tasks you perform for your family. Think about the information a family member needs to take over your tasks. Document this. Communicate this to your family members.</p>
<p>Most of this documentation is private but not confidential. You don&#8217;t want an outsider to read it, but it contains no real secrets. You&#8217;ll only want to use encryption for the real secrets, and communicate the key and decryption procedure to your family members and/or lawyer (or another trustworthy outsider). You don&#8217;t have to trust a single person with your key if you don&#8217;t want to, you can <a href="http://www.guardian.co.uk/technology/2009/jun/30/data-protection-internet" target="_blank">split it over several persons, like Cory Doctorow did</a>.</p>
<p>2 years ago, a very good friend of mine died suddenly. That&#8217;s what motivated me to develop a html/javascript page with AES encryption to record and encrypt my will. The advantage of html/javascript is that it&#8217;s standalone and very portable.</p>
<p>When you open my Virtual Will page, it will detect that it contains no encrypted content, and display the following dialog:</p>
<p><img class="alignnone size-full wp-image-1599" title="20090722-214245" src="http://didierstevens.wordpress.com/files/2009/07/20090722-214245.png" alt="20090722-214245" width="699" height="737" /></p>
<p>Use this dialog to create and encrypt your message.</p>
<p><img class="alignnone size-full wp-image-1600" title="20090722-214421" src="http://didierstevens.wordpress.com/files/2009/07/20090722-214421.png" alt="20090722-214421" width="701" height="728" /></p>
<p>Copy all html code from the encrypt textbox, and save it as an html file. This html file is identical to the original, but it also contains your message encrypted with AES.</p>
<p><img class="alignnone size-full wp-image-1601" title="20090722-214458" src="http://didierstevens.wordpress.com/files/2009/07/20090722-214458.png" alt="20090722-214458" width="706" height="360" /></p>
<p>Provide this document to your family members, together with the (partial) key. For example, you could burn it to a CD-ROM and use autorun to open the page automatically.</p>
<p>To decrypt it, open the html file:</p>
<p><img class="alignnone size-full wp-image-1602" title="20090722-214601" src="http://didierstevens.wordpress.com/files/2009/07/20090722-214601.png" alt="20090722-214601" width="699" height="360" /></p>
<p>and enter the password:</p>
<p><img class="alignnone size-full wp-image-1603" title="20090722-214630" src="http://didierstevens.wordpress.com/files/2009/07/20090722-214630.png" alt="20090722-214630" width="706" height="359" /></p>
<p>You can also use a Virtual Will page with ciphertext to create a new page or update your will: type encrypt in the password field, and you&#8217;ll see the encryption fields appear.</p>
<p>I obtained the <a href="http://www.movable-type.co.uk/scripts/aes.html" target="_blank">JavaScript AES code from Chris Veness</a>.</p>
<p>Some limitations:</p>
<ul>
<li>Chris&#8217; implementation doesn&#8217;t use a standard key derivation algorithm (and is limited to first 32 characters of the password)</li>
<li>the ciphertext is not compatible with the openssl format</li>
<li>it works with many browsers on different operating systems, but not on my S60 Nokia</li>
<li>get the enter key to work correctly</li>
</ul>
<p>I&#8217;ll improve these limitations if my software proves to be useful.</p>
<p>Of course, you can use this html page to encrypt anything and then pass it along, it doesn&#8217;t have to be a disaster recovery plan.</p>
<p>Download: <a href="http://didierstevens.com/files/software/virtualwill.html">virtualwill.html</a></p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Quickpost: More Picture-Taking with Python]]></title>
<link>http://blog.didierstevens.com/2009/07/21/quickpost-more-picture-taking-with-python/</link>
<pubDate>Tue, 21 Jul 2009 09:24:48 +0000</pubDate>
<dc:creator>Didier Stevens</dc:creator>
<guid>http://blog.didierstevens.com/2009/07/21/quickpost-more-picture-taking-with-python/</guid>
<description><![CDATA[Per @TimelessP&#8217;s request, here&#8217;s so more Python code that can be used for time-lapse pho]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Per <a href="http://twitter.com/TimelessP" target="_blank">@TimelessP&#8217;</a>s request, here&#8217;s so more Python code that can be used for <a href="http://blog.didierstevens.com/2009/06/29/quickpost-time-lapse-photography-with-a-nokia-mobile/" target="_self">time-lapse photography</a>.</p>
<p>It&#8217;s code I wrote to take surveillance pictures from IP-cameras:</p>
<p><img class="alignnone size-full wp-image-1594" title="20090720-171815" src="http://didierstevens.wordpress.com/files/2009/07/20090720-171815.png" alt="20090720-171815" width="640" height="189" /></p>
<p>You have to update 2 config files with the data of your IP-cameras: vs.config and credentials.config. Fields in the config files are tab-separated.</p>
<p>vs.config contains the IP cameras, example:</p>
<pre>Hall.jpg    http://192.168.1.1/IMAGE.JPG    -</pre>
<p>First field is the prefix for the name when saving the picture (suffix is a timestamp). Second field is the URL to access the picture on the IP camera (depends on the model your using). Third field is a fixed name for the picture, use a hyphen (-) if not used.</p>
<p>credentials.config contains the passwords to access the IP-cameras, example:</p>
<pre>192.168.1.1    admin    password</pre>
<p>Download:</p>
<p><a href="http://www.didierstevens.com/files/software/vs_v0_2.zip" target="_self">vs_v0_2.zip</a> (<a href="https://www.didierstevens.com/files/software/vs_v0_2.zip" target="_self">https</a>)</p>
<p>MD5: DB806B49705D544F4B928A8F76622125</p>
<p>SHA256: 042FA2CE1F5AEBD433D59B9D4755783E6CE58014FE59086C6A2A8E8781C63B45</p>
<hr /><a href="http://blog.didierstevens.com/2007/11/01/announcing-quickposts/">Quickpost info</a></p>
<hr />
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Embedding and Hiding Files in PDF Documents]]></title>
<link>http://blog.didierstevens.com/2009/07/01/embedding-and-hiding-files-in-pdf-documents/</link>
<pubDate>Wed, 01 Jul 2009 06:28:14 +0000</pubDate>
<dc:creator>Didier Stevens</dc:creator>
<guid>http://blog.didierstevens.com/2009/07/01/embedding-and-hiding-files-in-pdf-documents/</guid>
<description><![CDATA[My corrupted PDF quip inspired me to program another steganography trick: embed a file in a PDF docu]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>My <a href="http://blog.didierstevens.com/2009/06/09/quickpost-make-your-own-corrupted-pdfs-for-free/" target="_self">corrupted PDF quip</a> inspired me to program another steganography trick: embed a file in a PDF document and corrupt the reference, thereby effectively making the embedded file invisible to the PDF reader.</p>
<p>The PDF specification provides ways to embed files in PDF documents. I&#8217;m releasing my Python program to create a PDF file with embedded file (I used make-pdf-embedded.py to create my <a href="http://blog.didierstevens.com/2008/05/20/quickpost-eicarpdf/" target="_self">EICAR.pdf</a>).</p>
<p>Here&#8217;s how a PDF document with an embedded file looks like:</p>
<p><img class="alignnone size-full wp-image-1549" title="20090630-220314" src="http://didierstevens.wordpress.com/files/2009/06/20090630-220314.png" alt="20090630-220314" width="756" height="526" /></p>
<p>/EmbeddedFiles points to the dictionary with the embedded files:</p>
<p><img class="alignnone size-full wp-image-1550" title="20090630-220228" src="http://didierstevens.wordpress.com/files/2009/06/20090630-220228.png" alt="20090630-220228" width="537" height="151" /></p>
<p>As names defined in the PDF specification are case sensitive, changing the case changes the semantics: /Embeddedfiles has no meaning, and thus the PDF reader ignores it and doesn&#8217;t find the embedded file.</p>
<p><img class="alignnone size-full wp-image-1551" title="20090630-220137" src="http://didierstevens.wordpress.com/files/2009/06/20090630-220137.png" alt="20090630-220137" width="537" height="148" /></p>
<p><img class="alignnone size-full wp-image-1552" title="20090630-215901" src="http://didierstevens.wordpress.com/files/2009/06/20090630-215901.png" alt="20090630-215901" width="756" height="526" /></p>
<p>Actually, I used this trick in my <a href="http://blog.brucon.org/2009/06/small-contest-win-discount-and-some.html" target="_blank">Brucon puzzle</a>. I used the &#8211;stego option of make-pdf-embedded.py:</p>
<p><img class="alignnone size-full wp-image-1554" title="20090630-222453" src="http://didierstevens.wordpress.com/files/2009/06/20090630-222453.png" alt="20090630-222453" width="632" height="280" /></p>
<p>Of course, once you know the stego trick, it&#8217;s easy to recover the embedded file: edit the PDF document with an hex editor and change the case back to /EmbeddedFiles.</p>
<p>But if you want to make it harder to detect, use <a href="http://blog.didierstevens.com/2008/04/29/pdf-let-me-count-the-ways/" target="_self">PDF obfuscation techniques</a>. Or embed the file twice with <a href="http://blog.didierstevens.com/2008/05/07/solving-a-little-pdf-puzzle/" target="_self">incremental updates</a>. First version is the file you want to hide, second version is a decoy&#8230;</p>
<p>The PDF language offers so many features to hide and obfuscate data!</p>
<p>Download:</p>
<p><a href="http://www.didierstevens.com/files/software/make-pdf_V0_1_2.zip" target="_self">make-pdf_V0_1_2.zip</a> (<a href="https://www.didierstevens.com/files/software/make-pdf_V0_1_2.zip" target="_self">https</a>)</p>
<p>MD5: 305D57692C27DD3CD91D8C85A3932948</p>
<p>SHA256: A030BBCB8B54137D8047A4CB5C350725599383A4B113CABBA8871AC221378C5B</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[bpmtk: Injecting VBScript]]></title>
<link>http://blog.didierstevens.com/2009/06/25/bpmtk-injecting-vbscript/</link>
<pubDate>Thu, 25 Jun 2009 07:03:52 +0000</pubDate>
<dc:creator>Didier Stevens</dc:creator>
<guid>http://blog.didierstevens.com/2009/06/25/bpmtk-injecting-vbscript/</guid>
<description><![CDATA[Here&#8217;s a new trick: injecting VBScript in a process. I&#8217;ve developed a DLL that will crea]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Here&#8217;s a new trick: injecting VBScript in a process. I&#8217;ve developed a DLL that will create a COM instance of the VBScripting engine and let it execute a VBScript. Injecting this DLL in a running program results in execution of the VBScript in the context of the running program. Here&#8217;s an example where I wrote a VBScript to search and replace a string in the memory of the notepad process:</p>
<p><span style='text-align:center; display: block;'><object width='425' height='350'><param name='movie' value='http://www.youtube.com/v/ry0tABJn1Dc&#038;rel=1&#038;fs=1&#038;showsearch=0&#038;hd=0' /><param name='allowfullscreen' value='true' /><param name='wmode' value='transparent' /><embed src='http://www.youtube.com/v/ry0tABJn1Dc&#038;rel=1&#038;fs=1&#038;showsearch=0&#038;hd=0' type='application/x-shockwave-flash' allowfullscreen='true' width='425' height='350' wmode='transparent'></embed></object></span></p>
<p>Here is part of the VBScript I developed to search and replace inside the memory of a process. It uses custom methods like Peek, Poke and Output that I&#8217;ve added to the scripting engine:</p>
<p><img class="alignnone size-full wp-image-1519" title="20090609-205420" src="http://didierstevens.wordpress.com/files/2009/06/20090609-205420.png" alt="20090609-205420" width="724" height="406" /></p>
<p>I&#8217;ll provide more details in an upcoming blogpost on bpmtk version 0.1.5.0, but you can already <a href="http://www.didierstevens.com/files/software/bpmtk_V0_1_5_0.zip" target="_self">download it here</a>.</p>
<p><a href="http://www.youtube.com/watch?v=ry0tABJn1Dc" target="_blank">YouTube</a>, <a href="http://www.vimeo.com/5081750" target="_blank">Vimeo</a> and <a href="http://didierstevens.com/files/movies/injectscript-xvid.avi" target="_blank">hires Xvid</a>.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Update: Disitool V0.3]]></title>
<link>http://blog.didierstevens.com/2009/06/07/update-disitool-v0-3/</link>
<pubDate>Sun, 07 Jun 2009 23:15:57 +0000</pubDate>
<dc:creator>Didier Stevens</dc:creator>
<guid>http://blog.didierstevens.com/2009/06/07/update-disitool-v0-3/</guid>
<description><![CDATA[Last January, I got a little challenge from @hdmoore via my Twitter account: add data to a signed ex]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Last January, I got a little challenge from<a href="http://twitter.com/hdmoore" target="_blank"> @hdmoore</a> via my <a href="http://twitter.com/DidierStevens" target="_blank">Twitter account</a>: add data to a signed executable without invalidating the Authenticode signature. I updated my <a href="http://blog.didierstevens.com/programs/disitool/" target="_self">Digital signature tool</a>, but I realize now I had only announced the update on Twitter, not on my blog.</p>
<p>The trick is to increase the size of the image data directory for the digital signature and inject the extra data after the digital signature. This way, the Authenticode validation algorithm ignores the extra data, because it considers it to be part of the signature. Use Disitool&#8217;s new inject command:</p>
<pre>disitool.py inject ms-patch.exe data.bin ms-patch-data.exe</pre>
<p>The authenticode signature of ms-patch.exe will remain valid in ms-patch-data.exe, provided that the length of the injected data (file data.bin) is a multiple of 8.</p>
<p>You can use the paddata option to make the injected data size a multiple of 8 if it isn&#8217;t:</p>
<pre>disitool.py inject --paddata ms-patch.exe data.bin ms-patch-data.exe</pre>
<p>Disitool can be downloaded <a href="http://blog.didierstevens.com/programs/disitool/" target="_self">here</a>.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Quickpost: Sending WiFi Beacon Frames with an AirPcap Adapter]]></title>
<link>http://blog.didierstevens.com/2009/06/01/quickpost-sending-wifi-beacon-frames-with-an-airpcap-adapter/</link>
<pubDate>Mon, 01 Jun 2009 10:29:11 +0000</pubDate>
<dc:creator>Didier Stevens</dc:creator>
<guid>http://blog.didierstevens.com/2009/06/01/quickpost-sending-wifi-beacon-frames-with-an-airpcap-adapter/</guid>
<description><![CDATA[While preparing for my OSWP exam, I came across an unpublished Python program for the AirPcap adapte]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>While preparing for my <a href="http://www.offensive-security.com/wifu.php" target="_blank">OSWP</a> exam, I came across an unpublished Python program for the <a href="http://www.cacetech.com/products/airpcap_family.htm" target="_blank">AirPcap adapter</a>. I cleaned-it up a bit and here it is: <a href="http://didierstevens.com/files/software/apc-b_v0_1_1.zip">apc-b</a></p>
<p>This program allows you to send out <a href="http://en.wikipedia.org/wiki/Beacon_frame" target="_blank">beacon frames</a>, a very simple way to spoof WiFi access points.</p>
<p>This is the command to generate beacon frames on channel 6 for a couple of ESSIDs listed in file apc-b-2.txt:</p>
<p><img class="alignnone size-full wp-image-1462" title="20090601-120518" src="http://didierstevens.wordpress.com/files/2009/06/20090601-120518.png" alt="20090601-120518" width="375" height="128" /></p>
<p>And here is Kismet on my N800 capturing these beacon frames:</p>
<p><img class="alignnone size-full wp-image-1463" title="kismet-n800" src="http://didierstevens.wordpress.com/files/2009/06/kismet-n800.png" alt="kismet-n800" width="800" height="480" /></p>
<hr /><a href="http://blog.didierstevens.com/2007/11/01/announcing-quickposts/">Quickpost info</a></p>
<hr />
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Malformed PDF Documents]]></title>
<link>http://blog.didierstevens.com/2009/05/14/malformed-pdf-documents/</link>
<pubDate>Thu, 14 May 2009 07:55:46 +0000</pubDate>
<dc:creator>Didier Stevens</dc:creator>
<guid>http://blog.didierstevens.com/2009/05/14/malformed-pdf-documents/</guid>
<description><![CDATA[For the sake of this post, I consider a PDF document malformed when it doesn&#8217;t observe the bas]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>For the sake of this post, I consider a PDF document malformed when it doesn&#8217;t observe the <a href="http://blog.didierstevens.com/2008/04/09/quickpost-about-the-physical-and-logical-structure-of-pdf-files/" target="_self">basic structure of a PDF document</a>.</p>
<p>I&#8217;ve seen a couple of malicious, malformed PDF documents. The most recent was a malicious swine flu PDF document that contains another, bening, PDF document with information about the swine flu (obtained from the CDC site). This second PDF document is displayed to mislead the user while the exploit runs.</p>
<p><img class="alignnone size-full wp-image-1418" title="20090513-211945" src="http://didierstevens.wordpress.com/files/2009/05/20090513-211945.png" alt="20090513-211945" width="656" height="388" /></p>
<p>This second PDF document is XOR-encoded and appended to the end of the malicious PDF document, making the malicious PDF document malformed (FYI: the PDF file format supports embedded files, but this wasn&#8217;t used here). A PDF reader like Adobe or Foxit has no problems opening this malformed PDF, because it scans a PDF document for the trailer (%%EOF) starting from the end of the document. Everything that follows this trailer and doesn&#8217;t adhere to the PDF syntax is just ignored.</p>
<p><img class="alignnone size-full wp-image-1419" title="20090513-213940" src="http://didierstevens.wordpress.com/files/2009/05/20090513-213940.png" alt="20090513-213940" width="503" height="857" /></p>
<p>I&#8217;ve added some new features to my <a href="http://blog.didierstevens.com/programs/pdf-tools/" target="_self">PDF tools</a> to handle malformed PDF documents.</p>
<p><strong>PDFiD</strong></p>
<p>The new version of <a href="http://blog.didierstevens.com/programs/pdf-tools/#pdfid" target="_self">PDFiD</a> has an &#8211;extra option. Like it names imply, use it to add extra analysis data to the PDFiD report. The extra option adds <a href="http://en.wikipedia.org/wiki/Information_entropy" target="_blank">entropy</a> calculations to the report:</p>
<p><img class="alignnone size-full wp-image-1425" title="20090513-220050" src="http://didierstevens.wordpress.com/files/2009/05/20090513-220050.png" alt="20090513-220050" width="443" height="77" /></p>
<p>For a normal PDF file, expect the total entropy and the entropy of bytes inside stream objects to be close to the maximum value 8.0. This means that the distribution of byte values is close to random, which is characteristic of compressed and encrypted data.</p>
<p>Outside streams objects, the data appears much less random, and the entropy is much lower, usually around 4.0 or 5.0.</p>
<p>However, for malformed PDF documents, where data is added without using stream objects, the entropy outside stream objects is much higher. Here is the report for the malicious swine flu PDF:</p>
<p><img class="alignnone size-full wp-image-1426" title="20090513-203729" src="http://didierstevens.wordpress.com/files/2009/05/20090513-203729.png" alt="20090513-203729" width="430" height="268" /></p>
<p>Another datum added to the report by using the &#8211;extra option is for the end-of-file marker %%EOF.</p>
<p>The &#8220;%%EOF&#8221; line mentions the number of times %%EOF appears in the document (more than once usually indicates <a href="http://blog.didierstevens.com/2008/05/07/solving-a-little-pdf-puzzle/" target="_self">incremental updates</a>). &#8220;After last %%EOF&#8221; counts the number of bytes after the last %%EOF. This value will be not be zero when data has been appended.</p>
<p><strong>pdf-parser</strong></p>
<p>The previous versions of <a href="http://blog.didierstevens.com/programs/pdf-tools/" target="_self">pdf-parser</a> output a lot of &#8220;todo 10&#8243; data (an indication of malformed PDF data) when they parse a malformed PDF document. I&#8217;ve suppresed this behavior, you&#8217;ll need to use option &#8211;verbose to enable it from now on, should you need it. Since I first use PDFiD to check a PDF document before using pdf-parser, I don&#8217;t consider the &#8220;todo&#8221; output relevant anymore, as PDFiDs entropy and %%EOF report will tell me if a PDF document is malformed.</p>
<p><img class="alignnone size-full wp-image-1430" title="20090513-223049" src="http://didierstevens.wordpress.com/files/2009/05/20090513-223049.png" alt="20090513-223049" width="436" height="156" /></p>
<p>But the other new option in pdf-parser, &#8211;extract, is more important. Example:</p>
<p>pdf-parser.py &#8211;extract payload.bin malformed.pdf</p>
<p>This option will extract all malformed data from malformed.pdf and write it to file payload.bin, giving you easy access to the embedded payload.</p>
<p><strong>Samples</strong></p>
<p>You can download a normal and malformed Hello World PDF file <a href="http://www.didierstevens.com/files/data/normal-and-malformed-pdf.zip" target="_self">here</a> to get familiarized with my updated tools. 4096 random bytes have been appended to the end of the PDF document to make it malformed.</p>
<p>Here is a last example when the entropy calculation can be handy even if the payload is stored inside a stream object:</p>
<p><img class="alignnone size-full wp-image-1440" title="20090513-203522" src="http://didierstevens.wordpress.com/files/2009/05/20090513-203522.png" alt="20090513-203522" width="430" height="268" /></p>
<p>The reason the total entropy and entropy of bytes inside stream objects is very low here, is that this malicious PDF document has a payload with a very long, uncompressed NOP-sled (more than one million times 0&#215;90).</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[PDF Filter Abbreviations]]></title>
<link>http://blog.didierstevens.com/2009/05/11/pdf-filter-abbreviations/</link>
<pubDate>Mon, 11 May 2009 00:00:05 +0000</pubDate>
<dc:creator>Didier Stevens</dc:creator>
<guid>http://blog.didierstevens.com/2009/05/11/pdf-filter-abbreviations/</guid>
<description><![CDATA[@binjo &#8217;s tweet made me realize PDF filter abbreviations do apply to stream objects too, altho]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p><a href="http://twitter.com/binjo/status/1693929918" target="_blank">@binjo &#8217;s tweet</a> made me realize <a href="http://blog.didierstevens.com/2008/05/19/pdf-stream-objects/" target="_self">PDF filter</a> abbreviations do apply to stream objects too, although the PDF reference document only defines them for inline images. Here are the abbreviations:</p>
<ul>
<li>ASCIIHexDecode -&#62; AHx</li>
<li>ASCII85Decode -&#62; A85</li>
<li>LZWDecode -&#62; LZW</li>
<li>FlateDecode -&#62; Fl</li>
<li>RunLengthDecode -&#62; RL</li>
<li>CCITTFaxDecode -&#62; CCF</li>
<li>DCTDecode -&#62; DCT</li>
</ul>
<p>This means that, for example, a flatedecode filter for a stream object can not only be specified as /Filter /FlateDecode, but also as /Filter /Fl.</p>
<p>I updated my <a href="http://blog.didierstevens.com/programs/pdf-tools/" target="_self">PDF-tools</a> to support this.</p>
<p>And <a href="http://twitter.com/jprosco" target="_blank">jprosco</a> e-mailed me an update to my pdf-parser tool to support ASCIIHexDecode, because he had to analyze some malicious PDF documents that used it to encode the JavaScript.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Quickpost: Disinformational Tweets]]></title>
<link>http://blog.didierstevens.com/2009/05/10/quickpost-disinformational-tweets/</link>
<pubDate>Sun, 10 May 2009 12:55:23 +0000</pubDate>
<dc:creator>Didier Stevens</dc:creator>
<guid>http://blog.didierstevens.com/2009/05/10/quickpost-disinformational-tweets/</guid>
<description><![CDATA[This useless Python program is the result of some lazy Sunday coding. It will create random tweets b]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>This useless Python program is the result of some lazy Sunday coding. It will create random tweets based on a template file. You could use it to try to protect your privacy on Twitter by <a href="http://en.wikipedia.org/wiki/Disinformation" target="_blank">disinforming</a> potential data miners.</p>
<p>Will I use it for my <a href="http://twitter.com/DidierStevens" target="_blank">Twitter account</a>? No, I don&#8217;t need a program to disinform <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p><img class="alignnone size-full wp-image-1401" title="20090510-142457" src="http://didierstevens.wordpress.com/files/2009/05/20090510-142457.png" alt="20090510-142457" width="471" height="415" /></p>
<p>Each time you run the program, it will post one random tweet. This tweet is generated from a templates file. Each line in the templates file is the template for a tweet. You can use variables (between curly braces, example: {location}) in the templates to increase the number of possible tweets. Variables and their values are also stored in the template file, after the template lines. Your template file must allow the program to generate at least 2 different tweets, because it generates a tweet different from the last tweet.</p>
<p><img class="alignnone size-full wp-image-1402" title="20090510-143740" src="http://didierstevens.wordpress.com/files/2009/05/20090510-143740.png" alt="20090510-143740" width="517" height="418" /></p>
<p>The program requires the <a href="http://code.google.com/p/python-twitter/" target="_blank">twitter module</a>, itself requiring the <a href="http://cheeseshop.python.org/pypi/simplejson" target="_blank">simplejson module</a>.</p>
<p>And you need to create a credentials file (disinformational-tweets.cred) with the Twitter credentials of the account for which the program has to generate random Tweets. The first line of the credentials file has to contain the username, the second line has to contain the password.</p>
<p>A Firefox plugin to generate these tweets would probably be more &#8216;useful&#8217;, but hey, it&#8217;s a lazy Sunday.</p>
<p>Download:</p>
<p><a rel="#someid2" href="http://www.didierstevens.com/files/software/disinformational-tweets_v0_0_1.zip" target="_self">disinformational-tweets_v0_0_1.zip</a> (<a rel="#someid3" href="https://www.didierstevens.com/files/software/disinformational-tweets_v0_0_1.zip" target="_self">https</a>)</p>
<p>MD5: 36CDB584634ED299E7ACE0D64E846003</p>
<p>SHA256: C5FCE76443549C3A8882B799B6F7A754EF6AEE5F11F3E94FF255EE541205C17B</p>
<hr /><a href="http://blog.didierstevens.com/2007/11/01/announcing-quickposts/">Quickpost info</a></p>
<hr />
</div>]]></content:encoded>
</item>

</channel>
</rss>
