<?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 &#187; Search Results  &#187;  srp</title>
	<atom:link href="http://blog.didierstevens.com/search/srp/feed/rss2/" rel="self" type="application/rss+xml" />
	<link>http://blog.didierstevens.com</link>
	<description>(blog 'DidierStevens)</description>
	<lastBuildDate>Wed, 08 Feb 2012 19:24:03 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='blog.didierstevens.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Didier Stevens &#187; Search Results  &#187;  srp</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" />
	<atom:link rel='hub' href='http://blog.didierstevens.com/?pushpress=hub'/>
		<item>
		<title>Hotfix For SRP/AppLocker Bypass</title>
		<link>http://blog.didierstevens.com/2011/11/17/hotfix-for-srpapplocker-bypass/</link>
		<comments>http://blog.didierstevens.com/2011/11/17/hotfix-for-srpapplocker-bypass/#comments</comments>
		<pubDate>Thu, 17 Nov 2011 10:53:32 +0000</pubDate>
		<dc:creator>Didier Stevens</dc:creator>
				<category><![CDATA[Windows 7]]></category>

		<guid isPermaLink="false">http://blog.didierstevens.com/?p=2918</guid>
		<description><![CDATA[Remember Microsoft has features to bypass its own Software Restriction Policies and AppLocker: Circumventing SRP and AppLocker, By Design and Circumventing SRP and AppLocker to Create a New Process, By Design. Microsoft has issued a hotfix for this bypass: KB2532445 It is only for Windows 7 and Windows Server 2008 R2 though, it will not [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.didierstevens.com&amp;blog=264765&amp;post=2918&amp;subd=didierstevens&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Remember Microsoft has features to bypass its own Software Restriction Policies and AppLocker: <a href="http://blog.didierstevens.com/2011/01/24/circumventing-srp-and-applocker-by-design/">Circumventing SRP and AppLocker, By Design</a> and <a href="http://blog.didierstevens.com/2011/01/25/circumventing-srp-and-applocker-to-create-a-new-process-by-design/">Circumventing SRP and AppLocker to Create a New Process, By Design</a>.</p>
<p>Microsoft has issued a hotfix for this bypass: <a href="http://support.microsoft.com/kb/2532445">KB2532445</a></p>
<p>It is only for Windows 7 and Windows Server 2008 R2 though, it will not help you if you use SRP on Windows XP or Vista.</p>
<p>Thanks to <a href="http://twitter.com/mount_knowledge">@mount_knowledge</a>.</p>
<h3 class="storytitle"><a href="http://blog.didierstevens.com/2011/01/24/circumventing-srp-and-applocker-by-design/" rel="bookmark">Circumventing SRP and AppLocker, By Design</a></h3>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/didierstevens.wordpress.com/2918/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/didierstevens.wordpress.com/2918/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/didierstevens.wordpress.com/2918/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/didierstevens.wordpress.com/2918/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/didierstevens.wordpress.com/2918/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/didierstevens.wordpress.com/2918/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/didierstevens.wordpress.com/2918/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/didierstevens.wordpress.com/2918/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/didierstevens.wordpress.com/2918/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/didierstevens.wordpress.com/2918/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/didierstevens.wordpress.com/2918/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/didierstevens.wordpress.com/2918/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/didierstevens.wordpress.com/2918/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/didierstevens.wordpress.com/2918/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.didierstevens.com&amp;blog=264765&amp;post=2918&amp;subd=didierstevens&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.didierstevens.com/2011/11/17/hotfix-for-srpapplocker-bypass/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">didierstevens</media:title>
		</media:content>
	</item>
		<item>
		<title>Circumventing SRP and AppLocker to Create a New Process, By Design</title>
		<link>http://blog.didierstevens.com/2011/01/25/circumventing-srp-and-applocker-to-create-a-new-process-by-design/</link>
		<comments>http://blog.didierstevens.com/2011/01/25/circumventing-srp-and-applocker-to-create-a-new-process-by-design/#comments</comments>
		<pubDate>Tue, 25 Jan 2011 00:00:19 +0000</pubDate>
		<dc:creator>Didier Stevens</dc:creator>
				<category><![CDATA[Vulnerabilities]]></category>

		<guid isPermaLink="false">http://blog.didierstevens.com/?p=2557</guid>
		<description><![CDATA[There&#8217;s an interesting comment on my Circumventing SRP and AppLocker, By Design post. In my previous post, I showed a feature to circumvent SRP and AppLocker validation when a DLL is loaded. The anonymous commenter points out a feature to create a new process, while circumventing SRP and AppLocker. Flag SANDBOX_INERT in function CreateRestrictedToken allows [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.didierstevens.com&amp;blog=264765&amp;post=2557&amp;subd=didierstevens&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>There&#8217;s an interesting comment on my <a href="http://blog.didierstevens.com/2011/01/24/circumventing-srp-and-applocker-by-design/">Circumventing SRP and AppLocker, By Design post</a>.</p>
<p>In my previous post, I showed a feature to circumvent SRP and AppLocker validation when a DLL is loaded.</p>
<p>The anonymous commenter points out a feature to create a new process, while circumventing SRP and AppLocker. Flag SANDBOX_INERT in function <a href="http://msdn.microsoft.com/en-us/library/aa446583%28v=vs.85%29.aspx">CreateRestrictedToken</a> allows you to do this.</p>
<p>Per MSDN:</p>
<p><em>If this value is used, the system does not check AppLocker rules or apply Software Restriction Policies. For AppLocker, this flag disables checks for all four rule collections: Executable, Windows Installer, Script, and DLL.</em></p>
<p><em>When creating a setup program that must run extracted DLLs during installation, use the flag SAFER_TOKEN_MAKE_INERT in the SaferComputeTokenFromLevel function.</em></p>
<p>I wrote a small program to test this:</p>
<p><pre class="brush: cpp;">
HANDLE hToken;
HANDLE hNewToken;
PROCESS_INFORMATION sPI;
STARTUPINFO sSI;

if (OpenProcessToken(GetCurrentProcess(), TOKEN_ALL_ACCESS, &amp;hToken))
{
	if (CreateRestrictedToken(hToken, SANDBOX_INERT, 0, NULL, 0, NULL, 0, NULL, &amp;hNewToken))
	{
		memset(&amp;sSI, 0, sizeof(sSI));
		sSI.cb = sizeof(sSI);
		if (CreateProcessAsUser(hNewToken, L&quot;c:\\test\\Dialog42.exe&quot;, NULL, NULL, NULL, TRUE, 0, NULL, NULL, &amp;sSI, &amp;sPI))
		{
			puts(&quot;process created&quot;);
		}
}
</pre></p>
<p>This program starts another program, Dialog42.exe. I&#8217;ve configured SRP with a whitelist, Dialog42.exe is not whitelisted:</p>
<p><img class="alignnone size-full wp-image-2558" title="20110124-191205" src="http://didierstevens.files.wordpress.com/2011/01/20110124-191205.png" alt="" width="616" height="162" /></p>
<p>But when I use my program with the SANDBOX_INERT flag to start Dialog42.exe, it is allowed to run:</p>
<p><img class="alignnone size-full wp-image-2559" title="20110124-191425" src="http://didierstevens.files.wordpress.com/2011/01/20110124-191425.png" alt="" width="277" height="194" /></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/didierstevens.wordpress.com/2557/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/didierstevens.wordpress.com/2557/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/didierstevens.wordpress.com/2557/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/didierstevens.wordpress.com/2557/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/didierstevens.wordpress.com/2557/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/didierstevens.wordpress.com/2557/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/didierstevens.wordpress.com/2557/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/didierstevens.wordpress.com/2557/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/didierstevens.wordpress.com/2557/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/didierstevens.wordpress.com/2557/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/didierstevens.wordpress.com/2557/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/didierstevens.wordpress.com/2557/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/didierstevens.wordpress.com/2557/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/didierstevens.wordpress.com/2557/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.didierstevens.com&amp;blog=264765&amp;post=2557&amp;subd=didierstevens&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.didierstevens.com/2011/01/25/circumventing-srp-and-applocker-to-create-a-new-process-by-design/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">didierstevens</media:title>
		</media:content>

		<media:content url="http://didierstevens.files.wordpress.com/2011/01/20110124-191205.png" medium="image">
			<media:title type="html">20110124-191205</media:title>
		</media:content>

		<media:content url="http://didierstevens.files.wordpress.com/2011/01/20110124-191425.png" medium="image">
			<media:title type="html">20110124-191425</media:title>
		</media:content>
	</item>
		<item>
		<title>Circumventing SRP and AppLocker, By Design</title>
		<link>http://blog.didierstevens.com/2011/01/24/circumventing-srp-and-applocker-by-design/</link>
		<comments>http://blog.didierstevens.com/2011/01/24/circumventing-srp-and-applocker-by-design/#comments</comments>
		<pubDate>Mon, 24 Jan 2011 00:00:47 +0000</pubDate>
		<dc:creator>Didier Stevens</dc:creator>
				<category><![CDATA[Vulnerabilities]]></category>

		<guid isPermaLink="false">http://blog.didierstevens.com/?p=2534</guid>
		<description><![CDATA[We&#8217;ve seen it countless times before. A vendor designs a security product, but punches a hole in this shield to accommodate developers. Yet, I still love the irony of it. Software Restriction Policies and AppLocker can be configured to whitelist DLLs. But LoadLibraryEx has a feature (LOAD_IGNORE_CODE_AUTHZ_LEVEL) to circumvent SRP and AppLocker. From the MSDN [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.didierstevens.com&amp;blog=264765&amp;post=2534&amp;subd=didierstevens&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>We&#8217;ve seen it countless times before. A vendor designs a security product, but punches a hole in this shield to accommodate developers. Yet, I still love the irony of it.</p>
<p>Software Restriction Policies and AppLocker can be configured to whitelist DLLs. But <a href="http://msdn.microsoft.com/en-us/library/ms684179%28v=vs.85%29.aspx">LoadLibraryEx</a> has a feature (LOAD_IGNORE_CODE_AUTHZ_LEVEL) to circumvent SRP and AppLocker. From the MSDN documentation:</p>
<p><em>If this value is used, the system does not check AppLocker rules or apply Software Restriction Policies for the DLL. This action applies only to the DLL being loaded and not to its dependents. This value is recommended for use in setup programs that must run extracted DLLs during installation.</em></p>
<p>I&#8217;ve blogged about a <a href="http://blog.didierstevens.com/2008/06/05/bpmtk-how-about-srp-whitelists/">spreadsheet</a> that creates a DLL in a temporary location, and loads it inside the Excel process with LoadLibrary. It&#8217;s easy to block this DLL with SRP or AppLocker. But now I found out it&#8217;s also easy to bypass this, <a href="http://blog.didierstevens.com/2010/02/08/excel-with-cmd-dll-regedit-dll/">much easier than what I&#8217;ve done before</a>. I just have to replace a call to LoadLibrary with a call to LoadLibraryEx, and pass it argument LOAD_IGNORE_CODE_AUTHZ_LEVEL. That&#8217;s all it takes to bypass SRP and AppLocker.</p>
<p><img class="alignnone size-full wp-image-406" src="http://didierstevens.files.wordpress.com/2008/06/bpmtk-0002.png" alt="" /></p>
<p>Let it be clear that this only makes it possible to load arbitrary DLLs inside existing processes, it does not allow you to create a new process that SRP/AppLocker wouldn&#8217;t allow.</p>
<p>If you use SPR/AppLocker, should you worry? It depends against what risk you use it.</p>
<p>When you use SRP/AppLocker to prevent common malware or other unwanted programs from infecting your machine, there&#8217;s no problem (now). If you use it on corporate computers to prevent your users from using software you don&#8217;t support, there&#8217;s no problem.</p>
<p>But if you use SRP/AppLocker as a security layer against (skilled) evil haxors, then you have to be aware that there is a large hole in your security layer and that it&#8217;s easy to misuse. In that case, you should better look out for another whitelisting security layer without <a href="http://images.google.com/images?q=jeans+holes">&#8220;designer holes&#8221;</a>. Unless it turns out Microsoft has a (hidden) setting to disable this feature, but I&#8217;ve not found one.</p>
<div id="_mcePaste" class="mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;overflow:hidden;">
<p>If this value is used, the system does not check <a href="http://go.microsoft.com/fwlink/?LinkId=161970" target="_blank">AppLocker</a> rules  or apply <a href="http://go.microsoft.com/fwlink/?LinkId=161971" target="_blank">Software Restriction Policies</a> for the DLL. This action applies only to the DLL being loaded and not  to its dependents. This value is recommended for use in setup programs  that must run extracted DLLs during installation.</p>
</div>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/didierstevens.wordpress.com/2534/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/didierstevens.wordpress.com/2534/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/didierstevens.wordpress.com/2534/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/didierstevens.wordpress.com/2534/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/didierstevens.wordpress.com/2534/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/didierstevens.wordpress.com/2534/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/didierstevens.wordpress.com/2534/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/didierstevens.wordpress.com/2534/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/didierstevens.wordpress.com/2534/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/didierstevens.wordpress.com/2534/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/didierstevens.wordpress.com/2534/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/didierstevens.wordpress.com/2534/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/didierstevens.wordpress.com/2534/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/didierstevens.wordpress.com/2534/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.didierstevens.com&amp;blog=264765&amp;post=2534&amp;subd=didierstevens&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.didierstevens.com/2011/01/24/circumventing-srp-and-applocker-by-design/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">didierstevens</media:title>
		</media:content>

		<media:content url="http://didierstevens.files.wordpress.com/2008/06/bpmtk-0002.png" medium="image" />
	</item>
		<item>
		<title>Quickpost: Ariad &amp; DLL Preloading</title>
		<link>http://blog.didierstevens.com/2010/08/26/quickpost-ariad-dll-preloading/</link>
		<comments>http://blog.didierstevens.com/2010/08/26/quickpost-ariad-dll-preloading/#comments</comments>
		<pubDate>Thu, 26 Aug 2010 12:11:11 +0000</pubDate>
		<dc:creator>Didier Stevens</dc:creator>
				<category><![CDATA[My Software]]></category>
		<category><![CDATA[Quickpost]]></category>
		<category><![CDATA[Vulnerabilities]]></category>

		<guid isPermaLink="false">http://blog.didierstevens.com/?p=2267</guid>
		<description><![CDATA[I&#8217;m writing this quickpost just in case you hadn&#8217;t figured this out for yourself: the techniques I described to protect machines from the .LNK vulnerability also help you mitigate the DLL preloading issue. The .LNK vulnerability mitigation examples I gave with Ariad (no file execute) and SRP prevent loading of DLLs from untrusted locations (USB [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.didierstevens.com&amp;blog=264765&amp;post=2267&amp;subd=didierstevens&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m writing this quickpost just in case you hadn&#8217;t figured this out for yourself: the <a href="http://blog.didierstevens.com/2010/07/18/mitigating-lnk-exploitation-with-ariad/">techniques</a> <a href="http://blog.didierstevens.com/2010/07/20/mitigating-lnk-exploitation-with-srp/">I described</a> to protect machines from the .LNK vulnerability also help you mitigate the <a href="http://blogs.technet.com/b/srd/archive/2010/08/23/more-information-about-dll-preloading-remote-attack-vector.aspx">DLL preloading issue</a>.</p>
<p>The .LNK vulnerability mitigation examples I gave with <a href="http://blog.didierstevens.com/2010/07/18/mitigating-lnk-exploitation-with-ariad/">Ariad (no file execute)</a> and <a href="http://blog.didierstevens.com/2010/07/20/mitigating-lnk-exploitation-with-srp/">SRP</a> prevent loading of DLLs from untrusted locations (USB sticks, network drives, &#8230;). These will also prevent DLLs from loading from untrusted sources in the case of DLL Preloading exploits.</p>
<hr /><a href="http://blog.didierstevens.com/2007/11/01/announcing-quickposts/">Quickpost info</a></p>
<hr />
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/didierstevens.wordpress.com/2267/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/didierstevens.wordpress.com/2267/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/didierstevens.wordpress.com/2267/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/didierstevens.wordpress.com/2267/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/didierstevens.wordpress.com/2267/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/didierstevens.wordpress.com/2267/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/didierstevens.wordpress.com/2267/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/didierstevens.wordpress.com/2267/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/didierstevens.wordpress.com/2267/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/didierstevens.wordpress.com/2267/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/didierstevens.wordpress.com/2267/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/didierstevens.wordpress.com/2267/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/didierstevens.wordpress.com/2267/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/didierstevens.wordpress.com/2267/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.didierstevens.com&amp;blog=264765&amp;post=2267&amp;subd=didierstevens&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.didierstevens.com/2010/08/26/quickpost-ariad-dll-preloading/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">didierstevens</media:title>
		</media:content>
	</item>
		<item>
		<title>Mitigating .LNK Exploitation With SRP</title>
		<link>http://blog.didierstevens.com/2010/07/20/mitigating-lnk-exploitation-with-srp/</link>
		<comments>http://blog.didierstevens.com/2010/07/20/mitigating-lnk-exploitation-with-srp/#comments</comments>
		<pubDate>Tue, 20 Jul 2010 07:13:09 +0000</pubDate>
		<dc:creator>Didier Stevens</dc:creator>
				<category><![CDATA[Vulnerabilities]]></category>

		<guid isPermaLink="false">http://blog.didierstevens.com/?p=2242</guid>
		<description><![CDATA[As I&#8217;ve used Software Restriction Policies (SRP) on several occasions in my blogposts, and several people have suggested using SRP to protect against .LNK exploitation as an alternative to Ariad, I&#8217;ll describe how to configure SRP for the first time on a workstation that is not a member of a domain. For domain members, you [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.didierstevens.com&amp;blog=264765&amp;post=2242&amp;subd=didierstevens&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>As I&#8217;ve used Software Restriction Policies (SRP) on several occasions in my <a href="http://blog.didierstevens.com/?s=srp">blogposts</a>, and several people have suggested using SRP to protect against .LNK exploitation as an alternative to <a href="http://blog.didierstevens.com/2010/07/18/mitigating-lnk-exploitation-with-ariad/">Ariad</a>, I&#8217;ll describe how to configure SRP for the first time on a workstation that is not a member of a domain. For domain members, you have to configure SRP in the GPO on the domain controller.</p>
<p>Start the Local Security Policy manager from Control Panel / Administrative Tools:</p>
<p><img class="alignnone size-full wp-image-2243" title="20100720-083156" src="http://didierstevens.files.wordpress.com/2010/07/20100720-083156.png" alt="" width="180" height="73" /></p>
<p>Software Restriction Policies need to be defined the first time:</p>
<p><img class="alignnone size-full wp-image-2244" title="20100720-083430" src="http://didierstevens.files.wordpress.com/2010/07/20100720-083430.png" alt="" width="629" height="262" /></p>
<p>We exclude our system drive (C:) from being restricted (add other drives if you have more):</p>
<p><img class="alignnone size-full wp-image-2245" title="20100720-083556" src="http://didierstevens.files.wordpress.com/2010/07/20100720-083556.png" alt="" width="552" height="228" /></p>
<p><img class="alignnone size-full wp-image-2246" title="20100720-083726" src="http://didierstevens.files.wordpress.com/2010/07/20100720-083726.png" alt="" width="420" height="245" /></p>
<p>To protect against .LNK exploitation, we need to restrict DLLs too, not only EXEs:</p>
<p><img class="alignnone size-full wp-image-2247" title="20100720-083852" src="http://didierstevens.files.wordpress.com/2010/07/20100720-083852.png" alt="" width="328" height="156" /></p>
<p><img class="alignnone size-full wp-image-2248" title="20100720-083941" src="http://didierstevens.files.wordpress.com/2010/07/20100720-083941.png" alt="" width="420" height="230" /></p>
<p>And finally, switch from blacklisting to whitelisting:</p>
<p><img class="alignnone size-full wp-image-2249" title="20100720-084026" src="http://didierstevens.files.wordpress.com/2010/07/20100720-084026.png" alt="" width="656" height="233" /></p>
<p><img class="alignnone size-full wp-image-2250" title="20100720-084056" src="http://didierstevens.files.wordpress.com/2010/07/20100720-084056.png" alt="" width="419" height="367" /></p>
<p>After configuring SRP, execute a logoff/logon to apply them immediately.</p>
<p>From now on, only executables on your C: drive will be allowed to run.</p>
<p>.LNK exploitation from removable media is blocked:</p>
<p><img class="alignnone size-full wp-image-2251" title="20100720-084233" src="http://didierstevens.files.wordpress.com/2010/07/20100720-084233.png" alt="" width="637" height="445" /></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/didierstevens.wordpress.com/2242/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/didierstevens.wordpress.com/2242/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/didierstevens.wordpress.com/2242/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/didierstevens.wordpress.com/2242/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/didierstevens.wordpress.com/2242/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/didierstevens.wordpress.com/2242/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/didierstevens.wordpress.com/2242/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/didierstevens.wordpress.com/2242/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/didierstevens.wordpress.com/2242/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/didierstevens.wordpress.com/2242/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/didierstevens.wordpress.com/2242/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/didierstevens.wordpress.com/2242/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/didierstevens.wordpress.com/2242/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/didierstevens.wordpress.com/2242/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.didierstevens.com&amp;blog=264765&amp;post=2242&amp;subd=didierstevens&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.didierstevens.com/2010/07/20/mitigating-lnk-exploitation-with-srp/feed/</wfw:commentRss>
		<slash:comments>61</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/07/20100720-083156.png" medium="image">
			<media:title type="html">20100720-083156</media:title>
		</media:content>

		<media:content url="http://didierstevens.files.wordpress.com/2010/07/20100720-083430.png" medium="image">
			<media:title type="html">20100720-083430</media:title>
		</media:content>

		<media:content url="http://didierstevens.files.wordpress.com/2010/07/20100720-083556.png" medium="image">
			<media:title type="html">20100720-083556</media:title>
		</media:content>

		<media:content url="http://didierstevens.files.wordpress.com/2010/07/20100720-083726.png" medium="image">
			<media:title type="html">20100720-083726</media:title>
		</media:content>

		<media:content url="http://didierstevens.files.wordpress.com/2010/07/20100720-083852.png" medium="image">
			<media:title type="html">20100720-083852</media:title>
		</media:content>

		<media:content url="http://didierstevens.files.wordpress.com/2010/07/20100720-083941.png" medium="image">
			<media:title type="html">20100720-083941</media:title>
		</media:content>

		<media:content url="http://didierstevens.files.wordpress.com/2010/07/20100720-084026.png" medium="image">
			<media:title type="html">20100720-084026</media:title>
		</media:content>

		<media:content url="http://didierstevens.files.wordpress.com/2010/07/20100720-084056.png" medium="image">
			<media:title type="html">20100720-084056</media:title>
		</media:content>

		<media:content url="http://didierstevens.files.wordpress.com/2010/07/20100720-084233.png" medium="image">
			<media:title type="html">20100720-084233</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 [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.didierstevens.com&amp;blog=264765&amp;post=1959&amp;subd=didierstevens&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<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" 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" alt="" width="616" height="419" /></p>
<hr /><a href="http://blog.didierstevens.com/2007/11/01/announcing-quickposts/">Quickpost info</a></p>
<hr />
<br />  <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/gofacebook/didierstevens.wordpress.com/1959/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/didierstevens.wordpress.com/1959/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/didierstevens.wordpress.com/1959/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/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&amp;blog=264765&amp;post=1959&amp;subd=didierstevens&amp;ref=&amp;feed=1" width="1" height="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>16</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: SAFER and Malicious Documents</title>
		<link>http://blog.didierstevens.com/2009/09/28/quickpot-safer-and-malicious-documents/</link>
		<comments>http://blog.didierstevens.com/2009/09/28/quickpot-safer-and-malicious-documents/#comments</comments>
		<pubDate>Mon, 28 Sep 2009 17:50:58 +0000</pubDate>
		<dc:creator>Didier Stevens</dc:creator>
				<category><![CDATA[My Software]]></category>
		<category><![CDATA[Quickpost]]></category>

		<guid isPermaLink="false">http://blog.didierstevens.com/?p=1769</guid>
		<description><![CDATA[I wasn’t going to mention SAFER to restrict the rights of an application, because Software Restriction Policies can be bypassed. But a Tweet by Edi Strosar made me review my viewpoint. In this particular case, bypassing SRP is a non-issue, because the user is already local admin! Software Restriction Policies allow you to force specific [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.didierstevens.com&amp;blog=264765&amp;post=1769&amp;subd=didierstevens&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<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.files.wordpress.com/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.files.wordpress.com/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.files.wordpress.com/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.files.wordpress.com/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.files.wordpress.com/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.files.wordpress.com/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.files.wordpress.com/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.files.wordpress.com/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 />
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/didierstevens.wordpress.com/1769/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/didierstevens.wordpress.com/1769/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/didierstevens.wordpress.com/1769/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/didierstevens.wordpress.com/1769/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/didierstevens.wordpress.com/1769/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/didierstevens.wordpress.com/1769/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/didierstevens.wordpress.com/1769/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/didierstevens.wordpress.com/1769/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/didierstevens.wordpress.com/1769/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/didierstevens.wordpress.com/1769/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/didierstevens.wordpress.com/1769/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/didierstevens.wordpress.com/1769/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/didierstevens.wordpress.com/1769/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/didierstevens.wordpress.com/1769/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.didierstevens.com&amp;blog=264765&amp;post=1769&amp;subd=didierstevens&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.didierstevens.com/2009/09/28/quickpot-safer-and-malicious-documents/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">didierstevens</media:title>
		</media:content>

		<media:content url="http://didierstevens.files.wordpress.com/2009/09/20090928-184852.png" medium="image">
			<media:title type="html">20090928-184852</media:title>
		</media:content>

		<media:content url="http://didierstevens.files.wordpress.com/2009/09/20090928-180154.png" medium="image">
			<media:title type="html">20090928-180154</media:title>
		</media:content>

		<media:content url="http://didierstevens.files.wordpress.com/2009/09/20090928-185739.png" medium="image">
			<media:title type="html">20090928-185739</media:title>
		</media:content>

		<media:content url="http://didierstevens.files.wordpress.com/2009/09/20090928-184938.png" medium="image">
			<media:title type="html">20090928-184938</media:title>
		</media:content>

		<media:content url="http://didierstevens.files.wordpress.com/2009/09/20090928-184657.png" medium="image">
			<media:title type="html">20090928-184657</media:title>
		</media:content>

		<media:content url="http://didierstevens.files.wordpress.com/2009/09/20090928-185830.png" medium="image">
			<media:title type="html">20090928-185830</media:title>
		</media:content>

		<media:content url="http://didierstevens.files.wordpress.com/2009/09/20090928-180534.png" medium="image">
			<media:title type="html">20090928-180534</media:title>
		</media:content>

		<media:content url="http://didierstevens.files.wordpress.com/2009/09/20090928-180742.png" medium="image">
			<media:title type="html">20090928-180742</media:title>
		</media:content>
	</item>
		<item>
		<title>Excel Exercises in Style</title>
		<link>http://blog.didierstevens.com/2008/10/23/excel-exercises-in-style/</link>
		<comments>http://blog.didierstevens.com/2008/10/23/excel-exercises-in-style/#comments</comments>
		<pubDate>Thu, 23 Oct 2008 10:34:07 +0000</pubDate>
		<dc:creator>Didier Stevens</dc:creator>
				<category><![CDATA[Hacking]]></category>

		<guid isPermaLink="false">http://didierstevens.wordpress.com/?p=821</guid>
		<description><![CDATA[I developed another variant of my &#8220;Excel macro injects embedded DLL&#8221; script. In stead of creating and loading a temporary DLL from VBScript, I inject and execute shellcode directly from the VBA application. Some HIPS would prevent my previous script from running, because it loaded an unapproved DLL. But my new version doesn&#8217;t load a [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.didierstevens.com&amp;blog=264765&amp;post=821&amp;subd=didierstevens&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I developed another variant of my <a href="http://blog.didierstevens.com/2008/06/25/bpmtk-bypassing-srp-with-dll-restrictions/" target="_self">&#8220;Excel macro injects embedded DLL&#8221;</a> script.</p>
<p>In stead of creating and loading a temporary DLL from VBScript, I inject and execute shellcode directly from the VBA application.</p>
<p>Some <a href="http://en.wikipedia.org/wiki/Intrusion-prevention_system" target="_blank">HIPS</a> would prevent my previous script from running, because it loaded an unapproved DLL. But my new version doesn&#8217;t load a DLL.</p>
<p><img class="alignnone size-full wp-image-823" title="20081022-212126" src="http://didierstevens.files.wordpress.com/2008/10/20081022-212126.png" alt="" width="720" height="556" /></p>
<p>Of course, writing shellcode is more difficult than developing a PE executable.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/didierstevens.wordpress.com/821/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/didierstevens.wordpress.com/821/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/didierstevens.wordpress.com/821/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/didierstevens.wordpress.com/821/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/didierstevens.wordpress.com/821/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/didierstevens.wordpress.com/821/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/didierstevens.wordpress.com/821/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/didierstevens.wordpress.com/821/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/didierstevens.wordpress.com/821/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/didierstevens.wordpress.com/821/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/didierstevens.wordpress.com/821/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/didierstevens.wordpress.com/821/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/didierstevens.wordpress.com/821/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/didierstevens.wordpress.com/821/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.didierstevens.com&amp;blog=264765&amp;post=821&amp;subd=didierstevens&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.didierstevens.com/2008/10/23/excel-exercises-in-style/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">didierstevens</media:title>
		</media:content>

		<media:content url="http://didierstevens.files.wordpress.com/2008/10/20081022-212126.png" medium="image">
			<media:title type="html">20081022-212126</media:title>
		</media:content>
	</item>
		<item>
		<title>bpmtk: Bypassing SRP with DLL Restrictions</title>
		<link>http://blog.didierstevens.com/2008/06/25/bpmtk-bypassing-srp-with-dll-restrictions/</link>
		<comments>http://blog.didierstevens.com/2008/06/25/bpmtk-bypassing-srp-with-dll-restrictions/#comments</comments>
		<pubDate>Wed, 25 Jun 2008 06:51:09 +0000</pubDate>
		<dc:creator>Didier Stevens</dc:creator>
				<category><![CDATA[Hacking]]></category>
		<category><![CDATA[My Software]]></category>

		<guid isPermaLink="false">http://didierstevens.wordpress.com/?p=429</guid>
		<description><![CDATA[In my last bpmtk post, I argued that although whitelisting DLLs (supplementary to whitelisting EXEs) prevents my Excel macro from loading the embedded DLL, it would be far too difficult to build and maintain such a whitelist of DLLs. However, Cd-MaN commented with a technique to add DLL restrictions to the Software Restriction Policies without [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.didierstevens.com&amp;blog=264765&amp;post=429&amp;subd=didierstevens&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>In my <a href="http://blog.didierstevens.com/2008/06/05/bpmtk-how-about-srp-whitelists/" target="_self">last bpmtk post</a>, I argued that although whitelisting DLLs (supplementary to whitelisting EXEs) prevents my Excel macro from loading the embedded DLL, it would be far too difficult to build and maintain such a whitelist of DLLs. However, Cd-MaN commented with a technique to add DLL restrictions to the Software Restriction Policies without building an exhaustive DLL whitelist, the details are in <a href="http://hype-free.blogspot.com/2008/04/windows-xp-high-security-configuration.html" target="_blank">his excellent blogpost</a> (step 3).</p>
<p>In a nutshell, Cd-MaN configures SRP to restrict allowed DLLs to those found in the Windows and Programs Files directories (a restricted user is not allowed to write to these directories).</p>
<p>To bypass this SRP configuration with my Excel macro, I had to update it so that it would perform the process manipulation directly, in stead of doing this manipulation from within the embedded DLL. And here his how I did it:</p>
<p><img class="alignnone size-full wp-image-431" src="http://didierstevens.files.wordpress.com/2008/06/20080624-224226.png" alt="" /></p>
<p>The trick is to call WriteProcessMemory directly from within the script to disable SRP. Because I didn&#8217;t want to recode my search-and-write function from C to VBscript, I hardcoded the addresses to write to (this will only work for the specified version of advapi32.dll). The effect of these 2 WriteProcessMemory calls is to patch advapi32.dll inside the Excel process, thereby disabling SRP so that the embedded DLL is allowed to load (of course, now that SRP is disabled for Excel, I can also just start another program).</p>
<p>A new version of my bpmtk utility (with the DLL version of bpmtk.exe) will be posted soon.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/didierstevens.wordpress.com/429/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/didierstevens.wordpress.com/429/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/didierstevens.wordpress.com/429/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/didierstevens.wordpress.com/429/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/didierstevens.wordpress.com/429/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/didierstevens.wordpress.com/429/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/didierstevens.wordpress.com/429/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/didierstevens.wordpress.com/429/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/didierstevens.wordpress.com/429/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/didierstevens.wordpress.com/429/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/didierstevens.wordpress.com/429/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/didierstevens.wordpress.com/429/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/didierstevens.wordpress.com/429/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/didierstevens.wordpress.com/429/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/didierstevens.wordpress.com/429/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/didierstevens.wordpress.com/429/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.didierstevens.com&amp;blog=264765&amp;post=429&amp;subd=didierstevens&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.didierstevens.com/2008/06/25/bpmtk-bypassing-srp-with-dll-restrictions/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">didierstevens</media:title>
		</media:content>

		<media:content url="http://didierstevens.files.wordpress.com/2008/06/20080624-224226.png" medium="image" />
	</item>
		<item>
		<title>Quickpost: Embedding an Executable in a VBscript</title>
		<link>http://blog.didierstevens.com/2008/06/09/quickpost-embedding-an-executable-in-a-vbscript/</link>
		<comments>http://blog.didierstevens.com/2008/06/09/quickpost-embedding-an-executable-in-a-vbscript/#comments</comments>
		<pubDate>Mon, 09 Jun 2008 11:53:34 +0000</pubDate>
		<dc:creator>Didier Stevens</dc:creator>
				<category><![CDATA[My Software]]></category>
		<category><![CDATA[Quickpost]]></category>

		<guid isPermaLink="false">http://didierstevens.wordpress.com/?p=415</guid>
		<description><![CDATA[My latest bpmtk post got some people to ask me for the VBscript. I&#8217;ll do better, I&#8217;m posting the Python program I wrote to generate the script. You can download it here. You have to provide it 2 arguments: the name of the executable to embed and the name of the VBscript to generate, like [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.didierstevens.com&amp;blog=264765&amp;post=415&amp;subd=didierstevens&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>My latest <a href="http://blog.didierstevens.com/2008/06/05/bpmtk-how-about-srp-whitelists/">bpmtk post</a> got some people to ask me for the VBscript. I&#8217;ll do better, I&#8217;m posting the Python program I wrote to generate the script. You can download it <a href="http://www.didierstevens.com/files/software/file2vbscript_v0_3.zip">here</a>.</p>
<p>You have to provide it 2 arguments: the name of the executable to embed and the name of the VBscript to generate, like this:</p>
<pre>file2vbscript cmd.exe cmd.vbs</pre>
<p>This will generate a VBscript that will write cmd.exe to the current directory and execute it (create a new process). If you want to load a DLL in stead of executing an EXE, use the -l option:</p>
<pre>file2vbscript -l mydll.dll mydll.vbs</pre>
<p>And to use it in an Office application (Office VBA doesn&#8217;t take long subs), use the option -o:</p>
<pre>file2vbscript -ol mydll.dll mydll.vbs</pre>
<p>This will split the embedded file over several subs, to accommodate for the size limitation of Office VBscripts.</p>
<hr /><a href="http://blog.didierstevens.com/2007/11/01/announcing-quickposts/">Quickpost info</a></p>
<hr />
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/didierstevens.wordpress.com/415/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/didierstevens.wordpress.com/415/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/didierstevens.wordpress.com/415/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/didierstevens.wordpress.com/415/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/didierstevens.wordpress.com/415/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/didierstevens.wordpress.com/415/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/didierstevens.wordpress.com/415/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/didierstevens.wordpress.com/415/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/didierstevens.wordpress.com/415/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/didierstevens.wordpress.com/415/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/didierstevens.wordpress.com/415/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/didierstevens.wordpress.com/415/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/didierstevens.wordpress.com/415/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/didierstevens.wordpress.com/415/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/didierstevens.wordpress.com/415/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/didierstevens.wordpress.com/415/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.didierstevens.com&amp;blog=264765&amp;post=415&amp;subd=didierstevens&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.didierstevens.com/2008/06/09/quickpost-embedding-an-executable-in-a-vbscript/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">didierstevens</media:title>
		</media:content>
	</item>
	</channel>
</rss>
