<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Didier Stevens</title>
	<atom:link href="http://blog.didierstevens.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.didierstevens.com</link>
	<description>(blog 'DidierStevens)</description>
	<lastBuildDate>Mon, 08 Feb 2010 21:18:22 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='blog.didierstevens.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/60bb50c97cd147341ffb43b0e2ef0d15?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>Didier Stevens</title>
		<link>http://blog.didierstevens.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://blog.didierstevens.com/osd.xml" title="Didier Stevens" />
		<item>
		<title>Excel with cmd.dll &amp; regedit.dll</title>
		<link>http://blog.didierstevens.com/2010/02/08/excel-with-cmd-dll-regedit-dll/</link>
		<comments>http://blog.didierstevens.com/2010/02/08/excel-with-cmd-dll-regedit-dll/#comments</comments>
		<pubDate>Mon, 08 Feb 2010 21:17:57 +0000</pubDate>
		<dc:creator>Didier Stevens</dc:creator>
				<category><![CDATA[Hacking]]></category>
		<category><![CDATA[My Software]]></category>

		<guid isPermaLink="false">http://blog.didierstevens.com/?p=1989</guid>
		<description><![CDATA[I modified the source code of ReactOS&#8216; cmd and regedit for the following trick:

Let me summarize how I did this, as this is the combined result of several techniques I blogged about before.

The Excel spreadsheet contains macros that use VirtualAlloc, WriteProcessMemory and CreateThread to &#8220;inject&#8221; shellcode (stored inside macros) into the Excel process itself. Details [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.didierstevens.com&blog=264765&post=1989&subd=didierstevens&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<br /><p>I modified the source code of <a href="http://en.wikipedia.org/wiki/ReactOS">ReactOS</a>&#8216; cmd and regedit for the following trick:</p>
<p><span style="text-align:center; display: block;"><a href="http://blog.didierstevens.com/2010/02/08/excel-with-cmd-dll-regedit-dll/"><img src="http://img.youtube.com/vi/kex2yO-xQvI/2.jpg" alt="" /></a></span></p>
<p>Let me summarize how I did this, as this is the combined result of several techniques I blogged about before.</p>
<ul>
<li>The Excel spreadsheet contains macros that use VirtualAlloc, WriteProcessMemory and CreateThread to &#8220;inject&#8221; shellcode (stored inside macros) into the Excel process itself. Details <a href="http://blog.didierstevens.com/2008/10/23/excel-exercises-in-style/">here</a> and source code <a href="http://blog.didierstevens.com/2009/05/06/shellcode-2-vbscript/">here</a>.</li>
<li>The <a href="http://blog.didierstevens.com/2010/01/28/quickpost-shellcode-to-load-a-dll-from-memory/">shellcode loads a DLL from memory into memory</a>.</li>
<li>I modified source code from ReactOS to <a href="http://blog.didierstevens.com/2010/02/04/cmd-dll/">transform cmd.exe into cmd.dll</a> and regedit into a dll.</li>
</ul>
<p>You can download regedit.dll <a href="http://www.didierstevens.com/files/software/regedit-dll_v0_0_1.zip">here</a> and the new version of cmd.dll with the DLL command <a href="http://www.didierstevens.com/files/software/cmd-dll_v0_0_2.zip">here</a>. The DLL command I added allows you to load a DLL with LoadLibrary or directly into memory (/m option). When loaded with LoadLibrary, the library will be unloaded with FreeLibrary unless you use option /k to keep it loaded.</p>
<p>The DLL command assumes that your DLLs execute via the DllMain entry-point when they get loaded.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/didierstevens.wordpress.com/1989/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/didierstevens.wordpress.com/1989/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/didierstevens.wordpress.com/1989/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/didierstevens.wordpress.com/1989/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/didierstevens.wordpress.com/1989/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/didierstevens.wordpress.com/1989/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/didierstevens.wordpress.com/1989/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/didierstevens.wordpress.com/1989/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/didierstevens.wordpress.com/1989/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/didierstevens.wordpress.com/1989/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.didierstevens.com&blog=264765&post=1989&subd=didierstevens&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://blog.didierstevens.com/2010/02/08/excel-with-cmd-dll-regedit-dll/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">didierstevens</media:title>
		</media:content>

		<media:content url="http://img.youtube.com/vi/kex2yO-xQvI/2.jpg" medium="image" />
	</item>
		<item>
		<title>cmd.dll</title>
		<link>http://blog.didierstevens.com/2010/02/04/cmd-dll/</link>
		<comments>http://blog.didierstevens.com/2010/02/04/cmd-dll/#comments</comments>
		<pubDate>Thu, 04 Feb 2010 01:16:32 +0000</pubDate>
		<dc:creator>Didier Stevens</dc:creator>
				<category><![CDATA[Hacking]]></category>
		<category><![CDATA[My Software]]></category>

		<guid isPermaLink="false">http://blog.didierstevens.com/?p=1975</guid>
		<description><![CDATA[This is something I&#8217;ve wanted to do for some time: take a command interpreter and transform it from an EXE into a DLL.
Why you ask? Well, because it&#8217;s a fun challenge  
But also because a DLL is loaded into a process. In a restricted environment, it can be injected into a legitimate process and [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.didierstevens.com&blog=264765&post=1975&subd=didierstevens&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<br /><p>This is something I&#8217;ve wanted to do for some time: take a command interpreter and transform it from an EXE into a DLL.</p>
<p>Why you ask? Well, because it&#8217;s a fun challenge <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>But also because a DLL is loaded into a process. In a restricted environment, it can be injected into a legitimate process and thus bypass the restriction mechanisms.</p>
<p>Metasploit&#8217;s Meterpreter is another example of a command interpreter in DLL form.</p>
<p>cmd.exe from Microsoft is closed source, but there is an open-source variant available from the <a href="http://en.wikipedia.org/wiki/ReactOS">ReactOS project</a>.</p>
<p>Compiling cmd.exe from ReactOS is simple: download the <a href="http://www.reactos.org/en/download.html">source-code</a> and the <a href="http://www.reactos.org/wiki/Build_Environment">ReactOS build environment</a>. Install it, start the build environment  and issue command <em>make cmd</em>. That&#8217;s all you need to do to compile cmd.exe (I used version 0.3.11).</p>
<p>Transforming the source code to generate a DLL in stead of an EXE is simple. You need to change 3 files.</p>
<p>Edit file cmd.rbuild and make these changes to the module element:</p>
<pre class="brush: xml;">
&lt;module name=&quot;cmd&quot; type=&quot;win32dll&quot; installbase=&quot;system32&quot; installname=&quot;cmd.dll&quot; unicode=&quot;yes&quot; crt=&quot;msvcrt&quot;&gt;
</pre>
<p>Because I want to use this DLL in GUI-processes without console, I need to create a console. Edit file cmd.c and add AllocConsole(); to function cmd_main:</p>
<pre class="brush: cpp;">
SetFileApisToOEM();
InputCodePage= 0;
OutputCodePage = 0;

AllocConsole();

hConsole = CreateFile(_T(&quot;CONOUT$&quot;), GENERIC_READ|GENERIC_WRITE,
 FILE_SHARE_READ|FILE_SHARE_WRITE, NULL,
 OPEN_EXISTING, 0, NULL);
</pre>
<p>And because a DLL has another entry-function than an EXE, edit file main.c and replace function main with function DllMain:</p>
<pre class="brush: cpp;">
#include &lt;precomp.h&gt;

INT WINAPI
DllMain(
 IN PVOID hInstanceDll,
 IN ULONG dwReason,
 IN PVOID reserved)
{
 switch (dwReason)
 {
 case DLL_PROCESS_ATTACH:
 cmd_main(0, NULL);
 break;

 case DLL_THREAD_ATTACH:
 break;

 case DLL_THREAD_DETACH:
 break;

 case DLL_PROCESS_DETACH:
 break;
 }

 return TRUE;
}
</pre>
<p>That&#8217;s it. Recompile with <em>make cmd</em> to generate cmd.dll</p>
<p>There are still some improvements we can make, but that&#8217;s for a later version: error messages are not displayed, exiting the shell terminates the host process, &#8230;</p>
<p>You can download the modified source files and compiled cmd.dll <a href="http://www.didierstevens.com/files/software/cmd-dll_v0_0_1.zip" target="_self">here</a>.</p>
<p>This is a screenshot of cmd.dll injected inside Excel with my <a href="http://blog.didierstevens.com/2010/01/28/quickpost-shellcode-to-load-a-dll-from-memory/">memory module shellcode</a>:</p>
<p><img class="alignnone size-full wp-image-1980" title="cmd-dll-01" src="http://didierstevens.files.wordpress.com/2010/02/cmd-dll-01.png?w=1024&#038;h=577" alt="" width="1024" height="577" /></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/didierstevens.wordpress.com/1975/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/didierstevens.wordpress.com/1975/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/didierstevens.wordpress.com/1975/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/didierstevens.wordpress.com/1975/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/didierstevens.wordpress.com/1975/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/didierstevens.wordpress.com/1975/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/didierstevens.wordpress.com/1975/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/didierstevens.wordpress.com/1975/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/didierstevens.wordpress.com/1975/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/didierstevens.wordpress.com/1975/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.didierstevens.com&blog=264765&post=1975&subd=didierstevens&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://blog.didierstevens.com/2010/02/04/cmd-dll/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">didierstevens</media:title>
		</media:content>

		<media:content url="http://didierstevens.files.wordpress.com/2010/02/cmd-dll-01.png" medium="image">
			<media:title type="html">cmd-dll-01</media:title>
		</media:content>
	</item>
		<item>
		<title>Quickpost: Quasi-Tautologies &amp; SQL-Injection</title>
		<link>http://blog.didierstevens.com/2010/02/02/quickpost-quasi-tautologies-sql-injection/</link>
		<comments>http://blog.didierstevens.com/2010/02/02/quickpost-quasi-tautologies-sql-injection/#comments</comments>
		<pubDate>Tue, 02 Feb 2010 09:54:27 +0000</pubDate>
		<dc:creator>Didier Stevens</dc:creator>
				<category><![CDATA[Hacking]]></category>
		<category><![CDATA[Quickpost]]></category>

		<guid isPermaLink="false">http://blog.didierstevens.com/?p=1966</guid>
		<description><![CDATA[Last OWASP/ISSA Belgian chapter meeting was the location of an interesting discussion. For a full report of the meeting, read Xavier&#8217;s excellent blogpost.
Many SQL-injection techniques rely on tautologies: adding an expression that is always true to the where-clause of a select statement. Like OR 1=1. 1=1 is a tautology, it&#8217;s an expression that always yields [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.didierstevens.com&blog=264765&post=1966&subd=didierstevens&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<br /><p>Last <a href="http://www.owasp.org/index.php/Belgium#tab=Chapter_Meetings">OWASP/ISSA Belgian chapter meeting</a> was the location of an interesting discussion. For a full report of the meeting, read <a href="http://blog.rootshell.be/2010/02/01/owasp-issa-belgium-chapter-meeting/">Xavier&#8217;s excellent blogpost</a>.</p>
<p>Many <a href="http://en.wikipedia.org/wiki/SQL_injection">SQL-injection techniques</a> rely on <a href="http://en.wikipedia.org/wiki/Tautology_%28logic%29">tautologies</a>: adding an expression that is always true to the where-clause of a select statement. Like <strong>OR 1=1</strong>. <strong>1=1</strong> is a tautology, it&#8217;s an expression that always yields true.</p>
<p>So if <strong>SELECT * FROM USERS WHERE USERNAME = &#8216;ADMIN&#8217; and PASSWORD = &#8216;UNKNOWN&#8217;</strong> doesn&#8217;t select any rows because the password is not correct, injecting <strong>&#8216; OR 1=1 &#8211;</strong> gives SQL statement <strong>SELECT * FROM USERS WHERE USERNAME = &#8216;ADMIN&#8217; and PASSWORD = &#8221; OR 1=1 &#8211;&#8217;</strong> which will return all rows, because the where-clause is always true (<strong>OR 1=1</strong>).</p>
<p>There are several security applications (WAFs, SQL firewalls, &#8230;) designed to monitor the stream of SQL statements and reject statements with tautologies, i.e. the result of a SQL-injection. Some are very simple and just try to match pattern 1=1. Bypassing them is easy: 1&gt;0 is also a tautology. Others are more sophisticated and try to find constant expressions in the where-clause. Constant expressions are expressions with operators, functions and constants, but without variables. If a constant expression is detected that always evaluates to true, the firewall assumes it&#8217;s the result of a SQL-injection and blocks the query.</p>
<p>This is all classic SQL-injection, but now comes the interesting part.</p>
<p>What if I use an expression that is not a tautology in it&#8217;s mathematical sense, but is almost one&#8230; Say I use expression <strong>RAND() &gt; 0.01</strong> ? The <a href="http://dev.mysql.com/doc/refman/5.0/en/mathematical-functions.html#function_rand">RAND</a> function is a random number generator and returns a floating point value in the range [0.0, 1.0[. Expression <strong>RAND() &gt; 0.01</strong> is not a tautology, it&#8217;s not always true, but it is true about 99% percent of the time. I call this a quasi-tautology.</p>
<p>A firewall looking for tautologies will not detect this, because it is not a tautology. But when you use it in a SQL-injection, you stand a 99% chance of being succesful (provided the application is vulnerable to SQL-injection)!</p>
<p>There are other functions than RAND to create quasi-tautologies. An expression comparing the seconds of the current system time with 59 is also a quasi-tautology.</p>
<p>The <a href="http://www.greensql.net/">GreenSQL firewall</a> will detect SQL statements with quasi-tautologies, not because it looks for them, but because it builds a whitelist in training mode.</p>
<hr /><a href="http://blog.didierstevens.com/2007/11/01/announcing-quickposts/">Quickpost info</a></p>
<hr />
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/didierstevens.wordpress.com/1966/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/didierstevens.wordpress.com/1966/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/didierstevens.wordpress.com/1966/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/didierstevens.wordpress.com/1966/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/didierstevens.wordpress.com/1966/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/didierstevens.wordpress.com/1966/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/didierstevens.wordpress.com/1966/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/didierstevens.wordpress.com/1966/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/didierstevens.wordpress.com/1966/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/didierstevens.wordpress.com/1966/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.didierstevens.com&blog=264765&post=1966&subd=didierstevens&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://blog.didierstevens.com/2010/02/02/quickpost-quasi-tautologies-sql-injection/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">didierstevens</media:title>
		</media:content>
	</item>
		<item>
		<title>Quickpost: Shellcode to Load a DLL From Memory</title>
		<link>http://blog.didierstevens.com/2010/01/28/quickpost-shellcode-to-load-a-dll-from-memory/</link>
		<comments>http://blog.didierstevens.com/2010/01/28/quickpost-shellcode-to-load-a-dll-from-memory/#comments</comments>
		<pubDate>Thu, 28 Jan 2010 03:08:14 +0000</pubDate>
		<dc:creator>Didier Stevens</dc:creator>
				<category><![CDATA[Hacking]]></category>
		<category><![CDATA[My Software]]></category>
		<category><![CDATA[Quickpost]]></category>

		<guid isPermaLink="false">http://blog.didierstevens.com/?p=1959</guid>
		<description><![CDATA[I finally took time to develop shellcode to load a DLL, not with LoadLibrary, but directly from memory. Not storing the DLL on disk prevents it from being detected by AV software; not using LoadLibrary bypasses HIPS software that monitors this system call.
My shellcode is based on Joachim&#8217;s code.
In previous posts, I showed how to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.didierstevens.com&blog=264765&post=1959&subd=didierstevens&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<br /><p>I finally took time to develop shellcode to load a DLL, not with LoadLibrary, but directly from memory. Not storing the DLL on disk prevents it from being detected by AV software; not using LoadLibrary bypasses HIPS software that monitors this system call.</p>
<p>My shellcode is based on <a href="http://www.joachim-bauch.de/tutorials/load_dll_memory.html">Joachim&#8217;s code</a>.</p>
<p>In previous posts, I showed how to <a href="http://blog.didierstevens.com/2008/06/05/bpmtk-how-about-srp-whitelists/">load a DLL</a> <a href="http://blog.didierstevens.com/2008/10/23/excel-exercises-in-style/">or shellcode</a> with VBA in Excel. This is a combination of both techniques: a VBA macro loads and executes shellcode in Excel&#8217;s process space, and the shellcode loads a DLL from memory into Excel&#8217;s process memory.</p>
<p>With the <a href="http://blog.didierstevens.com/2008/06/25/bpmtk-bypassing-srp-with-dll-restrictions/">code of the previous post</a>, the DLL appears in the list of loaded DLLs:</p>
<p><img class="alignnone size-full wp-image-1960" title="20100127-193739" src="http://didierstevens.files.wordpress.com/2010/01/20100127-193739.png?w=616&#038;h=419" alt="" width="616" height="419" /></p>
<p>With this shellcode, it doesn&#8217;t:</p>
<p><img class="alignnone size-full wp-image-1961" title="20100127-192408" src="http://didierstevens.files.wordpress.com/2010/01/20100127-192408.png?w=616&#038;h=419" alt="" width="616" height="419" /></p>
<hr /><a href="http://blog.didierstevens.com/2007/11/01/announcing-quickposts/">Quickpost info</a></p>
<hr />
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/didierstevens.wordpress.com/1959/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/didierstevens.wordpress.com/1959/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/didierstevens.wordpress.com/1959/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/didierstevens.wordpress.com/1959/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/didierstevens.wordpress.com/1959/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/didierstevens.wordpress.com/1959/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/didierstevens.wordpress.com/1959/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/didierstevens.wordpress.com/1959/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/didierstevens.wordpress.com/1959/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/didierstevens.wordpress.com/1959/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.didierstevens.com&blog=264765&post=1959&subd=didierstevens&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://blog.didierstevens.com/2010/01/28/quickpost-shellcode-to-load-a-dll-from-memory/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">didierstevens</media:title>
		</media:content>

		<media:content url="http://didierstevens.files.wordpress.com/2010/01/20100127-193739.png" medium="image">
			<media:title type="html">20100127-193739</media:title>
		</media:content>

		<media:content url="http://didierstevens.files.wordpress.com/2010/01/20100127-192408.png" medium="image">
			<media:title type="html">20100127-192408</media:title>
		</media:content>
	</item>
		<item>
		<title>Quickpost: PDF Header %!PS-Adobe-N.n PDF-M.m</title>
		<link>http://blog.didierstevens.com/2010/01/21/quickpost-pdf-header-ps-adobe-n-n-pdf-m-m/</link>
		<comments>http://blog.didierstevens.com/2010/01/21/quickpost-pdf-header-ps-adobe-n-n-pdf-m-m/#comments</comments>
		<pubDate>Thu, 21 Jan 2010 11:21:03 +0000</pubDate>
		<dc:creator>Didier Stevens</dc:creator>
				<category><![CDATA[My Software]]></category>
		<category><![CDATA[PDF]]></category>
		<category><![CDATA[Quickpost]]></category>

		<guid isPermaLink="false">http://blog.didierstevens.com/?p=1953</guid>
		<description><![CDATA[@Feliam has an interesting PDF library to create PDF files with an unconventional header (the generated document doesn&#8217;t start with %PDF-&#8230;, but %PDF appears somewhere in the first 1024 bytes of the document). As this trick is likely to be taken over by malware authors, I updated PDFiD to support this.
The PDF reference document also [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.didierstevens.com&blog=264765&post=1953&subd=didierstevens&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<br /><p><a href="http://twitter.com/feliam" target="_self">@Feliam</a> has an interesting <a href="http://feliam.wordpress.com/">PDF library</a> to create PDF files with an unconventional header (the generated document doesn&#8217;t start with %PDF-&#8230;, but %PDF appears somewhere in the first 1024 bytes of the document). As this trick is likely to be taken over by malware authors, I updated <a href="http://blog.didierstevens.com/2010/01/13/quickpost-new-versions-of-pdfid-and-pdf-parser/" target="_self">PDFiD</a> to support this.</p>
<p>The PDF reference document also mentions %!PS-Adobe-N.n PDF-M.m as a valid header, however, the PDF documents I and @Feliam generated with this header are not rendered by Adobe Reader (neither Foxit or Sumatra PDF).</p>
<p>I was told Adobe did support this header in older versions. My tests show Adobe Reader version 3, 4, 5 and 6 will render PDF documents with header %!PS-Adobe-N.n PDF-M.m. Versions 7, 8 and 9 will not. Therefor I decided not to include support for this header to PDFiD.</p>
<p>pdf-parser doesn&#8217;t test the header, it analyzes PDF documents regardless of the header.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/didierstevens.wordpress.com/1953/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/didierstevens.wordpress.com/1953/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/didierstevens.wordpress.com/1953/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/didierstevens.wordpress.com/1953/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/didierstevens.wordpress.com/1953/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/didierstevens.wordpress.com/1953/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/didierstevens.wordpress.com/1953/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/didierstevens.wordpress.com/1953/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/didierstevens.wordpress.com/1953/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/didierstevens.wordpress.com/1953/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.didierstevens.com&blog=264765&post=1953&subd=didierstevens&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://blog.didierstevens.com/2010/01/21/quickpost-pdf-header-ps-adobe-n-n-pdf-m-m/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">didierstevens</media:title>
		</media:content>
	</item>
		<item>
		<title>Update: XORSearch Version 1.6.0</title>
		<link>http://blog.didierstevens.com/2010/01/18/update-xorsearch-version-1-6-0/</link>
		<comments>http://blog.didierstevens.com/2010/01/18/update-xorsearch-version-1-6-0/#comments</comments>
		<pubDate>Mon, 18 Jan 2010 01:26:11 +0000</pubDate>
		<dc:creator>Didier Stevens</dc:creator>
				<category><![CDATA[My Software]]></category>
		<category><![CDATA[Update]]></category>

		<guid isPermaLink="false">http://blog.didierstevens.com/?p=1949</guid>
		<description><![CDATA[A couple of new features:

searching for Unicode
searching for Hex code
printing of neighbouring bytes

Unicode support is rather simple: I consider Unicode as ASCII with 2 bytes per character, last byte always equals 0.
Usage case of hexcode search: search for embedded and encoded PE-file by searching for the PE-magic bytes MZ:
XORSearch -h malware.exe 50450000
Remember that XORSearch is [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.didierstevens.com&blog=264765&post=1949&subd=didierstevens&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<br /><p>A couple of new features:</p>
<ul>
<li>searching for Unicode</li>
<li>searching for Hex code</li>
<li>printing of neighbouring bytes</li>
</ul>
<p>Unicode support is rather simple: I consider Unicode as ASCII with 2 bytes per character, last byte always equals 0.</p>
<p>Usage case of hexcode search: search for embedded and encoded PE-file by searching for the PE-magic bytes MZ:</p>
<p>XORSearch -h malware.exe 50450000</p>
<p>Remember that XORSearch is not limited to win32, you can compile it on *nix too: cc -o XORSearch XORSearch.c</p>
<p>Download <a href="http://blog.didierstevens.com/programs/xorsearch/" target="_self">here</a>.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/didierstevens.wordpress.com/1949/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/didierstevens.wordpress.com/1949/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/didierstevens.wordpress.com/1949/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/didierstevens.wordpress.com/1949/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/didierstevens.wordpress.com/1949/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/didierstevens.wordpress.com/1949/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/didierstevens.wordpress.com/1949/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/didierstevens.wordpress.com/1949/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/didierstevens.wordpress.com/1949/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/didierstevens.wordpress.com/1949/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.didierstevens.com&blog=264765&post=1949&subd=didierstevens&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://blog.didierstevens.com/2010/01/18/update-xorsearch-version-1-6-0/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">didierstevens</media:title>
		</media:content>
	</item>
		<item>
		<title>Quickpost: New Versions of PDFiD and pdf-parser</title>
		<link>http://blog.didierstevens.com/2010/01/13/quickpost-new-versions-of-pdfid-and-pdf-parser/</link>
		<comments>http://blog.didierstevens.com/2010/01/13/quickpost-new-versions-of-pdfid-and-pdf-parser/#comments</comments>
		<pubDate>Wed, 13 Jan 2010 21:54:00 +0000</pubDate>
		<dc:creator>Didier Stevens</dc:creator>
				<category><![CDATA[My Software]]></category>
		<category><![CDATA[PDF]]></category>
		<category><![CDATA[Quickpost]]></category>

		<guid isPermaLink="false">http://blog.didierstevens.com/?p=1940</guid>
		<description><![CDATA[A new version of PDFiD (V0.0.10): to deal with PDF samples trying to evade detection by preceding the header with some random bytes, I use less stringent conditions to identify a PDF file. If PDFiD finds keyword %PDF in the first 1024 bytes of a file, it assumes it&#8217;s a PDF file and starts analyzing [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.didierstevens.com&blog=264765&post=1940&subd=didierstevens&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<br /><p>A new version of PDFiD (V0.0.10): to deal with PDF samples trying to evade detection by preceding the header with some random bytes, I use less stringent conditions to identify a PDF file. If PDFiD finds keyword %PDF in the first 1024 bytes of a file, it assumes it&#8217;s a PDF file and starts analyzing it.</p>
<p>A new version of pdf-parser (v0.3.7):</p>
<ul>
<li>added support for filters /LZWDecode and /RunLengthDecode</li>
<li>added a &#8211;dump option to extract the unfiltered data of a stream object (useful when the data is not actually compressed, but a payload)</li>
<li>testing the Python version before execution</li>
</ul>
<p>Both can be downloaded on the <a href="http://blog.didierstevens.com/programs/pdf-tools/" target="_self">PDF Tools</a> page.</p>
<hr /><a href="http://blog.didierstevens.com/2007/11/01/announcing-quickposts/">Quickpost info</a></p>
<hr />
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/didierstevens.wordpress.com/1940/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/didierstevens.wordpress.com/1940/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/didierstevens.wordpress.com/1940/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/didierstevens.wordpress.com/1940/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/didierstevens.wordpress.com/1940/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/didierstevens.wordpress.com/1940/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/didierstevens.wordpress.com/1940/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/didierstevens.wordpress.com/1940/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/didierstevens.wordpress.com/1940/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/didierstevens.wordpress.com/1940/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.didierstevens.com&blog=264765&post=1940&subd=didierstevens&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://blog.didierstevens.com/2010/01/13/quickpost-new-versions-of-pdfid-and-pdf-parser/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">didierstevens</media:title>
		</media:content>
	</item>
		<item>
		<title>Adobe Reader JavaScript Blacklist Framework</title>
		<link>http://blog.didierstevens.com/2010/01/11/adobe-reader-javascript-blacklist-framework/</link>
		<comments>http://blog.didierstevens.com/2010/01/11/adobe-reader-javascript-blacklist-framework/#comments</comments>
		<pubDate>Mon, 11 Jan 2010 01:51:17 +0000</pubDate>
		<dc:creator>Didier Stevens</dc:creator>
				<category><![CDATA[Malware]]></category>
		<category><![CDATA[PDF]]></category>
		<category><![CDATA[Vulnerabilities]]></category>

		<guid isPermaLink="false">http://blog.didierstevens.com/?p=1926</guid>
		<description><![CDATA[The JavaScript Blacklist Framework is a security feature Adobe released with Adobe Reader and Acrobat versions 8.1.7 and 9.2.
When you&#8217;re in a case where you need to use Adobe Reader and you can&#8217;t disable JavaScript, the JavaScript Blacklist Framework can help you mitigate zero-days in JavaScript API functions by disabling the vulnerable functions.
I produced a [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.didierstevens.com&blog=264765&post=1926&subd=didierstevens&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<br /><p>The <a href="http://kb2.adobe.com/cps/504/cpsid_50431.html" target="_blank">JavaScript Blacklist Framework</a> is a security feature Adobe released with Adobe Reader and Acrobat versions 8.1.7 and 9.2.</p>
<p>When you&#8217;re in a case where you need to use Adobe Reader and you can&#8217;t disable JavaScript, the JavaScript Blacklist Framework can help you mitigate zero-days in JavaScript API functions by disabling the vulnerable functions.</p>
<p>I produced a video where I disable util.printf:</p>
<p><span style="text-align:center; display: block;"><a href="http://blog.didierstevens.com/2010/01/11/adobe-reader-javascript-blacklist-framework/"><img src="http://img.youtube.com/vi/wDAc88GS9cQ/2.jpg" alt="" /></a></span></p>
<p>Notice that when I blacklist util.printf, the script still executes until the blacklisted function util.printf is called. At that moment, the script is cancelled and the user is warned.</p>
<p>On Windows, you can blacklist functions by adding them to registry value tBlackList (HKLM\SOFTWARE\Policies\Adobe\<em>product</em>\<em>version</em>\FeatureLockDown\cJavaScriptPerms\tBlackList). To blacklist more than one function, use the same registry value and separate the functions by the pipe-character (e.g. Util.printf|Collab.getIcon). Pay attention to the fact that the framework is case-sensitive (e.g. Util.printf is correct, util.printf is not correct).</p>
<p>The framework is impervious to bypassing with some basic obfuscation techniques found in malicious PDFs (eval(&#8220;util.printf&#8230; ; x = util.printf; x(&#8220;&#8230; ).</p>
<p>It&#8217;s too bad that blacklisting is limited to the JavaScript API; the functions to blacklist must be in the form &lt;object-name&gt;.&lt;function-name&gt;. Otherwise we would be able to blacklist some global functions of the JavaScript language that are often used in malicious PDF files, like unescape. According to the <a href="http://en.wikipedia.org/wiki/ECMAScript" target="_blank">ECMAScript</a> specification, unescape is a member function of the Global Object. I tried several ways to blacklist it (unescape, .unescape, this.unescape, Doc.unescape, &#8230;), but failed.</p>
<p>If you really want to disable unescape, you could do this by patching the JavaScript plugin EScript.api. Maybe I&#8217;ll post a method to do this in-memory with my basic process manipulation tool kit.</p>
<div id="_mcePaste" style="overflow:hidden;position:absolute;left:-10000px;top:0;width:1px;height:1px;">
<h1>Adobe Reader JavaScript Blacklist Framework</h1>
</div>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/didierstevens.wordpress.com/1926/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/didierstevens.wordpress.com/1926/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/didierstevens.wordpress.com/1926/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/didierstevens.wordpress.com/1926/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/didierstevens.wordpress.com/1926/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/didierstevens.wordpress.com/1926/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/didierstevens.wordpress.com/1926/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/didierstevens.wordpress.com/1926/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/didierstevens.wordpress.com/1926/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/didierstevens.wordpress.com/1926/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.didierstevens.com&blog=264765&post=1926&subd=didierstevens&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://blog.didierstevens.com/2010/01/11/adobe-reader-javascript-blacklist-framework/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">didierstevens</media:title>
		</media:content>

		<media:content url="http://img.youtube.com/vi/wDAc88GS9cQ/2.jpg" medium="image" />
	</item>
		<item>
		<title>New Format for UserAssist Registry Keys</title>
		<link>http://blog.didierstevens.com/2010/01/04/new-format-for-userassist-registry-keys/</link>
		<comments>http://blog.didierstevens.com/2010/01/04/new-format-for-userassist-registry-keys/#comments</comments>
		<pubDate>Mon, 04 Jan 2010 15:29:45 +0000</pubDate>
		<dc:creator>Didier Stevens</dc:creator>
				<category><![CDATA[Forensics]]></category>
		<category><![CDATA[My Software]]></category>
		<category><![CDATA[Windows 7]]></category>

		<guid isPermaLink="false">http://blog.didierstevens.com/?p=1920</guid>
		<description><![CDATA[With Windows 7 and Windows Server 2008 R2, the binary data format of the values stored in the UserAssist registry keys has changed.
Here&#8217;s a partial description of the new format:

the counter is 32-bits long, starting at byte 4 (first byte is byte 0)
the timestamp (64-bits) starts at byte 60
there is a 32-bit value that appears [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.didierstevens.com&blog=264765&post=1920&subd=didierstevens&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<br /><p>With Windows 7 and Windows Server 2008 R2, the binary data format of the values stored in the UserAssist registry keys has changed.</p>
<p>Here&#8217;s a partial description of the new format:</p>
<ul>
<li>the counter is 32-bits long, starting at byte 4 (first byte is byte 0)</li>
<li>the timestamp (64-bits) starts at byte 60</li>
<li>there is a 32-bit value that appears to be the total time an application has focus, expressed in milli-seconds (starts at byte 8 )</li>
</ul>
<p>For more details, read my article in the new forensic magazine <a href="http://intotheboxes.wordpress.com/2010/01/01/into-the-boxes-issue-0x0/" target="_blank">Into The Boxes</a>.</p>
<p>Don&#8217;t forget to use the <a href="http://blog.didierstevens.com/2009/10/21/a-windows-7-launch-party-trick/" target="_self">special version of my UserAssist tool</a> on Windows 7 and Windows Server 2008 R2.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/didierstevens.wordpress.com/1920/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/didierstevens.wordpress.com/1920/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/didierstevens.wordpress.com/1920/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/didierstevens.wordpress.com/1920/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/didierstevens.wordpress.com/1920/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/didierstevens.wordpress.com/1920/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/didierstevens.wordpress.com/1920/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/didierstevens.wordpress.com/1920/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/didierstevens.wordpress.com/1920/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/didierstevens.wordpress.com/1920/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.didierstevens.com&blog=264765&post=1920&subd=didierstevens&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://blog.didierstevens.com/2010/01/04/new-format-for-userassist-registry-keys/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">didierstevens</media:title>
		</media:content>
	</item>
		<item>
		<title>The Undeletable SafeBoot Key</title>
		<link>http://blog.didierstevens.com/2010/01/01/the-undeletable-safeboot-key/</link>
		<comments>http://blog.didierstevens.com/2010/01/01/the-undeletable-safeboot-key/#comments</comments>
		<pubDate>Fri, 01 Jan 2010 12:53:41 +0000</pubDate>
		<dc:creator>Didier Stevens</dc:creator>
				<category><![CDATA[Malware]]></category>
		<category><![CDATA[My Software]]></category>

		<guid isPermaLink="false">http://blog.didierstevens.com/?p=1908</guid>
		<description><![CDATA[I present you a new program to create the SafeBoot registry key with special permissions protecting it from deletion. After using this new program, you&#8217;ll be able to restore the SafeBoot registry keys with my .REG files.
Many malware deletes the SafeBoot registry key to prevent you from booting into Safe Mode. I provide a registry [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.didierstevens.com&blog=264765&post=1908&subd=didierstevens&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<br /><p>I present you a new program to create the SafeBoot registry key with special permissions protecting it from deletion. After using this new program, you&#8217;ll be able to restore the SafeBoot registry keys with <a href="http://blog.didierstevens.com/2007/02/19/restoring-safe-mode-with-a-reg-file/">my .REG files</a>.</p>
<p>Many malware <a href="http://blog.didierstevens.com/2006/06/22/save-safeboot/">deletes the SafeBoot registry key</a> to prevent you from booting into Safe Mode. I provide <a href="http://blog.didierstevens.com/2007/02/19/restoring-safe-mode-with-a-reg-file/">a registry fix</a> to restore these keys.</p>
<p>But there exists malware that goes even further and actively monitors the registry to thwart every attempt to restore the keys by deleting them as soon as they are restored. Untill now, I recommended to use <a href="http://blog.didierstevens.com/2008/11/26/update-restoring-safe-mode-with-a-reg-file-and-a-live-cd/">a Live CD to restore the keys in</a> such a case (this is a complex procedure). This way, the malware is not running while you restore the SafeBoot keys.</p>
<p>Now I developed another solution: a program to create the SafeBoot registry key with permissions to deny Administrators and System accounts to delete the key. This way, the malware can&#8217;t delete the keys because it lacks the permissions to do so.</p>
<p>Here are the SafeBoot permissions on a default Windows XP install:</p>
<p><img class="alignnone size-full wp-image-1910" title="20100101-122749e" src="http://didierstevens.files.wordpress.com/2010/01/20100101-122749e.png?w=567&#038;h=492" alt="" width="567" height="492" /></p>
<p>And here are the permissions of the SafeBoot key created with my new program:</p>
<p><img class="alignnone size-full wp-image-1911" title="20100101-122911e" src="http://didierstevens.files.wordpress.com/2010/01/20100101-122911e.png?w=567&#038;h=492" alt="" width="567" height="492" /></p>
<p>I designed my program to create the SafeBoot key only when it is missing, and to set the special permissions while it is created:</p>
<p><img class="alignnone size-full wp-image-1912" title="20100101-122826e" src="http://didierstevens.files.wordpress.com/2010/01/20100101-122826e.png?w=440&#038;h=73" alt="" width="440" height="73" /></p>
<p>My program will not set the special permissions when the key exists. If the SafeBoot keys exists and you can&#8217;t boot into Safe Mode, you&#8217;re dealing with another issue than a Safe Mode disabling malware (probably a buggy driver).</p>
<p>The program is a console program, but it will pause at the end so you can read its output, even when you launch it from Windows Explorer (i.e. double-click it). If you want to use it in a script and prevent the prompt from appearing, use option -n.</p>
<p>If the SafeBoot key exists, my program will tell this (SYSTEM\CurrentControlSet\Control\SafeBoot exists.) and it will leave the permissions unchanged. If your system is clean but you want to protect the SafeBoot keys, I recommend you change the permissions manually using RegEdit.</p>
<p>My program creates only registry key SYSTEM\CurrentControlSet\Control\SafeBoot, and not the subkeys. To restore the subkeys, you just need to <a href="http://blog.didierstevens.com/2007/02/19/restoring-safe-mode-with-a-reg-file/">use the appropriate .REG file</a>.</p>
<p>Having read this, you might have thought that malware authors could bypass this protection by changing the permissions before deleting the keys. You&#8217;re right. I don&#8217;t deny Administrator and System accounts the permission to change the permissions, because I don&#8217;t expect there is malware in the wild that changes permissions of the SafeBoot key. I&#8217;ll deal with it when it eventually appears.</p>
<p>Download:</p>
<p><a href="http://www.didierstevens.com/files/software/UndeletableSafebootKey_V0_0_0_1.zip" target="_self">UndeletableSafebootKey_V0_0_0_1.zip</a> (<a href="https://www.didierstevens.com/files/software/UndeletableSafebootKey_V0_0_0_1.zip" target="_self">https</a>)</p>
<p>MD5: 2FAC291AD547657E31B157B8581D4601</p>
<p>SHA256: 7A1E42A57BBF8E804491318671AE992947C82DCC9C2001E3033B45E4AEAB2DDE</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/didierstevens.wordpress.com/1908/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/didierstevens.wordpress.com/1908/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/didierstevens.wordpress.com/1908/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/didierstevens.wordpress.com/1908/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/didierstevens.wordpress.com/1908/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/didierstevens.wordpress.com/1908/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/didierstevens.wordpress.com/1908/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/didierstevens.wordpress.com/1908/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/didierstevens.wordpress.com/1908/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/didierstevens.wordpress.com/1908/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.didierstevens.com&blog=264765&post=1908&subd=didierstevens&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://blog.didierstevens.com/2010/01/01/the-undeletable-safeboot-key/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">didierstevens</media:title>
		</media:content>

		<media:content url="http://didierstevens.files.wordpress.com/2010/01/20100101-122749e.png" medium="image">
			<media:title type="html">20100101-122749e</media:title>
		</media:content>

		<media:content url="http://didierstevens.files.wordpress.com/2010/01/20100101-122911e.png" medium="image">
			<media:title type="html">20100101-122911e</media:title>
		</media:content>

		<media:content url="http://didierstevens.files.wordpress.com/2010/01/20100101-122826e.png" medium="image">
			<media:title type="html">20100101-122826e</media:title>
		</media:content>
	</item>
	</channel>
</rss>