<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"><channel><atom:id>tag:blogger.com,1999:blog-6231564296864090820</atom:id><lastBuildDate>Thu, 16 Feb 2012 06:28:41 +0000</lastBuildDate><category>bittorrent</category><category>shellcode</category><category>IDS</category><category>Nessus</category><category>opcode</category><category>perl</category><category>reverse proxy</category><category>conversion</category><category>configuration review</category><category>pf</category><category>metasploit</category><category>wine</category><category>john the ripper</category><category>exploit development</category><category>group id</category><category>IPsec</category><category>Gentoo</category><category>wi-fi</category><category>nat</category><category>Cisco ASA</category><category>password cracking</category><category>Nipper</category><category>wireless</category><category>juniper</category><category>Pentoo</category><category>cross compiling</category><category>tap</category><category>JUNOS</category><category>firewall</category><category>deluge</category><title>stoked-security</title><description /><link>http://blog.stoked-security.com/</link><managingEditor>noreply@blogger.com (Erwin)</managingEditor><generator>Blogger</generator><openSearch:totalResults>11</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/Stoked-security" /><feedburner:info uri="stoked-security" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6231564296864090820.post-5647891301535271080</guid><pubDate>Wed, 26 Oct 2011 07:56:00 +0000</pubDate><atom:updated>2011-10-26T09:56:49.609+02:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">exploit development</category><category domain="http://www.blogger.com/atom/ns#">conversion</category><category domain="http://www.blogger.com/atom/ns#">opcode</category><category domain="http://www.blogger.com/atom/ns#">shellcode</category><title>quick post: Converting shellcode to opcodes</title><description>Mainly as a note to myself, but other people might benefit from this as well.&lt;br /&gt;
&lt;br /&gt;
Last night I was looking for a way to convert small bits of shellcode into the equivalent opcode. While there is metasm-shell to convert opcodes to shellcode, there is no shell to do it the other way around. Metasm has disassemble.rb, but that's only file based. A quick question in #metasploit resulted in the following one liner, which worked perfectly:&lt;br /&gt;
&lt;br /&gt;
echo -ne "\xeb\xe0" |ndisasm -u -&lt;br /&gt;
00000000&amp;nbsp; EBE0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; jmp short 0xffffffe2&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6231564296864090820-5647891301535271080?l=blog.stoked-security.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/Stoked-security/~4/9j_zz-N2Fhs" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/Stoked-security/~3/9j_zz-N2Fhs/quick-post-converting-shellcode-to.html</link><author>noreply@blogger.com (Erwin)</author><thr:total>0</thr:total><feedburner:origLink>http://blog.stoked-security.com/2011/10/quick-post-converting-shellcode-to.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6231564296864090820.post-2571790916826803655</guid><pubDate>Mon, 13 Jun 2011 18:48:00 +0000</pubDate><atom:updated>2011-06-13T21:09:01.853+02:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">JUNOS</category><category domain="http://www.blogger.com/atom/ns#">Nipper</category><category domain="http://www.blogger.com/atom/ns#">juniper</category><category domain="http://www.blogger.com/atom/ns#">configuration review</category><category domain="http://www.blogger.com/atom/ns#">perl</category><title>Juniper $9$ the equivalent of Cisco type 7</title><description>Some time ago during a configuration review of a Juniper JUNOS device I noticed some sort of hash format starting with $9$. Wondering what format was being used I searched on Google and found a &lt;a href="http://password-decrypt.com/"&gt;website&lt;/a&gt; that was able to get the password instantly. This means that the password is stored in a reversable format and is not a real hash, but some sort of obfuscation. This is similar to the Cisco type 7 password obfuscation, which use the &lt;a href="http://en.wikipedia.org/wiki/Vigen%C3%A8re_cipher"&gt;Vinegere algorithm&lt;/a&gt;. While you can find many tools to decrypt Cisco type 7 password there are no offline tools you could use for Juniper $9$. After some more searches I found a convenient Perl library named &lt;a href="http://search.cpan.org/dist/Crypt-Juniper/lib/Crypt/Juniper.pm"&gt;Crypt-Juniper&lt;/a&gt;, which allows you to decrypt $9$ passwords. While I am not an experienced Perl coder I wrote th following proof of concept within 5 minutes:&lt;br /&gt;
&lt;br /&gt;
&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;#!/usr/bin/perl&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;use lib '/some/path/Crypt-Juniper-0.02/lib/'&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;Use Crypt::Juniper;&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;my $hash = $ARGV[0];&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;my $secret = juniper_decrypt($hash);&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;print "secret: $secret \n";&lt;/div&gt;&lt;br /&gt;
Using the script is straight forward:&lt;br /&gt;
&lt;br /&gt;
&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;$ perl juniper-decrypt.pl \$9\$U-iqf36A1cSTzRSreXxDik.Tzn/CuBI&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;secret: ju&amp;amp;iper123&lt;/div&gt;&lt;br /&gt;
The current 2.0 beta version of &lt;a href="https://www.titania-security.com/nipper/features"&gt;Nipper&lt;/a&gt; does not warn you about the $9$ format at all. This issue was reported to Titania and the upcoming release of Nipper will report use of the $9$ format. Of course the remediation is easy, use MD5 based hashes ($1$ format) on Juniper JUNOS where possible.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6231564296864090820-2571790916826803655?l=blog.stoked-security.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/Stoked-security/~4/G78HZkQRS_Q" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/Stoked-security/~3/G78HZkQRS_Q/juniper-9-equivalent-of-cisco-type-7.html</link><author>noreply@blogger.com (Erwin)</author><thr:total>0</thr:total><feedburner:origLink>http://blog.stoked-security.com/2011/06/juniper-9-equivalent-of-cisco-type-7.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6231564296864090820.post-8490278962773321434</guid><pubDate>Wed, 09 Mar 2011 20:11:00 +0000</pubDate><atom:updated>2011-03-09T21:25:27.003+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">deluge</category><category domain="http://www.blogger.com/atom/ns#">reverse proxy</category><category domain="http://www.blogger.com/atom/ns#">bittorrent</category><title>Deluge bittorrent webUI behind reverse proxy</title><description>Maybe not strictly security related, but this might by handy for other people who also want to put their &lt;a href="http://deluge-torrent.org/"&gt;Deluge bittorrent&lt;/a&gt; webUI behind a reverse proxy. There are several tutorials available on the internet describing how to do this, but none of them work for the latest stable version (&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;1.3.1&lt;/span&gt;) of Deluge. The webUI uses a lot of &lt;a href="http://en.wikipedia.org/wiki/Ajax_%28programming%29"&gt;AJAX&lt;/a&gt; and gzip compression for some parts, which makes the use of a reverse proxy more complicated. I've used Apache (&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;2.2.16&lt;/span&gt;) with the following enabled modules:&lt;br /&gt;
&lt;br /&gt;
&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;authz_host_module&lt;br /&gt;
deflate_module&lt;br /&gt;
dir_module&lt;br /&gt;
filter_module&lt;br /&gt;
headers_module&lt;br /&gt;
mime_module&lt;br /&gt;
proxy_module&lt;br /&gt;
proxy_http_module&lt;br /&gt;
rewrite_module&lt;br /&gt;
ssl_module&lt;br /&gt;
unique_id_module&lt;/div&gt;&lt;br /&gt;
Not all of them are needed, but most are needed for this setup. Here is the vhost I have configured:&lt;br /&gt;
&lt;br /&gt;
&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;lt;VirtualHost *:80=""&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Servername dmz&lt;br /&gt;
&lt;br /&gt;
ProxyRequests off&lt;br /&gt;
ProxyHTMLExtended on&lt;br /&gt;
ProxyPass /deluge http://127.0.0.1:8112/&lt;br /&gt;
ProxyHTMLURLMap http://127.0.0.1:8112 /deluge&lt;br /&gt;
&lt;br /&gt;
Header unset Server&lt;br /&gt;
&lt;br /&gt;
&amp;lt;location /deluge&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ProxyPassReverse /&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ProxyPassReverseCookiePath / /deluge/&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SetOutputFilter INFLATE;proxy-html;DEFLATE &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ProxyHTMLURLMap / /deluge/ ec&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ProxyHTMLURLMap /deluge /deluge ec&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ProxyHTMLURLMap ([^*])(\/[^*].*) $1/deluge$2 hRxL&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #ProxyHTMLLogVerbose On&lt;br /&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Order allow,deny&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Allow from all&lt;/span&gt;&lt;br /&gt;
&amp;lt;/Location&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/VirtualHost&amp;gt;&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;br /&gt;
&lt;/div&gt;The webUI is running on a python based web server on port 8112.&amp;nbsp; The "Header unset Server" line will remove the following banner that is normally displayed by the web server:&lt;br /&gt;
&lt;br /&gt;
&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;Server: TwistedWeb/10.2.0&lt;/div&gt;&lt;br /&gt;
The &lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;SetOutputFilter&lt;/span&gt; line will inflate the gzip compressed data, modify it and deflate it again. If this configuration stops working for a new version of Deluge the &lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;ProxyHTMLLogVerbose&lt;/span&gt; option can be uncommented to debug. Also make sure the system running the webUI is able to make outbound connections to &lt;a href="http://en.wikipedia.org/wiki/BitTorrent_tracker"&gt;torrent trackers&lt;/a&gt; in the torrent file you are uploading or the webUI will take forever to load a new torrent file. Happy dowloading!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6231564296864090820-8490278962773321434?l=blog.stoked-security.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/Stoked-security/~4/DGQbHXrnRtU" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/Stoked-security/~3/DGQbHXrnRtU/deluge-bittorrent-webui-behind-reverse.html</link><author>noreply@blogger.com (Erwin)</author><thr:total>2</thr:total><feedburner:origLink>http://blog.stoked-security.com/2011/03/deluge-bittorrent-webui-behind-reverse.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6231564296864090820.post-2063507793252200672</guid><pubDate>Tue, 11 Jan 2011 11:45:00 +0000</pubDate><atom:updated>2011-01-11T12:45:46.474+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Gentoo</category><category domain="http://www.blogger.com/atom/ns#">Pentoo</category><category domain="http://www.blogger.com/atom/ns#">john the ripper</category><category domain="http://www.blogger.com/atom/ns#">password cracking</category><title>Quickpost: Running Gentoo and looking for updated John the Ripper ebuild?</title><description>I've just written an updated ebuild for John the Ripper, that includes:&lt;br /&gt;
- Latest OpenMP patches&lt;br /&gt;
- Latest jumbo patch&lt;br /&gt;
- Full OpenMPI support &lt;br /&gt;
- MSCache2 support&lt;br /&gt;
&lt;br /&gt;
You can find the &lt;a href="http://trac.pentoo.ch/browser/portage/trunk/app-crypt/johntheripper/johntheripper-1.7.6-r2.ebuild"&gt;ebuild&lt;/a&gt; in the &lt;a href="http://www.pentoo.ch/"&gt;Pentoo overlay&lt;/a&gt;, which contains a lot of usefull pentest tools. Enjoy!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6231564296864090820-2063507793252200672?l=blog.stoked-security.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/Stoked-security/~4/swcbfe1047o" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/Stoked-security/~3/swcbfe1047o/quickpost-running-gentoo-and-looking.html</link><author>noreply@blogger.com (Erwin)</author><thr:total>0</thr:total><feedburner:origLink>http://blog.stoked-security.com/2011/01/quickpost-running-gentoo-and-looking.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6231564296864090820.post-8859486570070339932</guid><pubDate>Tue, 21 Dec 2010 23:20:00 +0000</pubDate><atom:updated>2010-12-22T21:05:57.311+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">group id</category><category domain="http://www.blogger.com/atom/ns#">IPsec</category><category domain="http://www.blogger.com/atom/ns#">metasploit</category><category domain="http://www.blogger.com/atom/ns#">Cisco ASA</category><title>How hard could it be to brute force a Cisco IPsec VPN group id?</title><description>Apparently not as hard as you would think, due to a recently updated &lt;a href="http://www.cisco.com/en/US/products/products_security_response09186a0080b5992c.html"&gt;security advisory&lt;/a&gt;. The group id is used in Cisco IPsec VPN to distinguish a &lt;span class="content"&gt;set of users that use common connection parameters and client attributes. Back in 2005 &lt;/span&gt;&lt;span class="content"&gt;NTA Monitor &lt;a href="http://www.cisco.com/warp/public/707/cisco-sn-20050624-vpn-grpname.shtml"&gt;discovered&lt;/a&gt; that a vulnerable Cisco IPsec implementation &lt;/span&gt;&lt;span class="content"&gt;would   reply to the IKE negotiation if the group name in the IKE message was valid,   whereas an invalid group name would result in no response.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span class="content"&gt;The new variant discovered by &lt;/span&gt;&lt;span class="content"&gt;Gavin Jones of NGS Secure&lt;/span&gt;&lt;span class="content"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="content"&gt;&lt;/span&gt;depends on the difference in response for the &lt;span class="content"&gt;dead peer detection VID. Dead peer detection or &lt;a href="https://supportforums.cisco.com/docs/DOC-8554"&gt;DPD&lt;/a&gt; could be seen as a polling mechanism to see if the other IKE peer is still alive. I was wondering how difficult it would be to reproduce given the fact nobody else noticed it for 5 years or cared enough to inform Cisco about it. Since Cisco ASA is the only vulnerable product this would be the most interesting type of device to test, but since I don't have a physical device to test I used an emulated VMWare version provided by the &lt;a href="http://asaproject.gromnet.net/?p=86"&gt;ASA project&lt;/a&gt;. The vulnerability is only present when the ASA is used as a remote access VPN and I used this &lt;a href="http://www.cisco.com/en/US/docs/security/asa/asa83/getting_started/5580/guide/remvpn.html#wp1057207"&gt;guide&lt;/a&gt; with Cisco ASDM to configure it. I could only use DES instead of 3DES or AES encryption, because you need a separate license for it and the virtual ASA simple crashes when you try to add one.&lt;/span&gt;&lt;br /&gt;
&lt;span class="content"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span class="content"&gt;Once configured whe can use ike-scan to probe and test the device. I won't point you to the NTA monitor site, as it is currently reported as malicious website by Google, so be carefull. However if we use ike-scan to probe the ASA using IPsec aggressive mode without a group id using the following command we get no response:&lt;/span&gt;&lt;br /&gt;
&lt;span class="content"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span class="content"&gt;# ike-scan -M -A 192.168.173.50&lt;br /&gt;
Starting ike-scan 1.9 with 1 hosts (http://www.nta-monitor.com/tools/ike-scan/)&lt;br /&gt;
&lt;br /&gt;
Ending ike-scan 1.9: 1 hosts scanned in 2.437 seconds (0.41 hosts/sec).&amp;nbsp; 0 returned handshake; 0 returned notify&lt;/span&gt;&lt;br /&gt;
&lt;span class="content"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span class="content"&gt;If we specify a random group id we receive the following response:&lt;/span&gt;&lt;br /&gt;
&lt;span class="content"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span class="content"&gt;# ike-scan -M --id=foobar -A 192.168.173.50&lt;br /&gt;
Starting ike-scan 1.9 with 1 hosts (http://www.nta-monitor.com/tools/ike-scan/)&lt;br /&gt;
192.168.173.50&amp;nbsp;&amp;nbsp;&amp;nbsp; Aggressive Mode Handshake returned&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; HDR=(CKY-R=0fb137a8ae462a21)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; SA=(Enc=DES Hash=SHA1 Group=2:modp1024 Auth=PSK LifeType=Seconds LifeDuration=28800)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; KeyExchange(128 bytes)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; Nonce(20 bytes)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; ID(Type=ID_IPV4_ADDR, Value=192.168.173.50)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; Hash(20 bytes)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; VID=12f5f28c457168a9702d9fe274cc0100 (Cisco Unity)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; VID=09002689dfd6b712 (XAUTH)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; VID=4048b7d56ebce88525e7de7f00d6c2d3c0000000 (IKE Fragmentation)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; VID=1f07f70eaa6514d3b0fa96542a500100 (Cisco VPN Concentrator)&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span class="content"&gt;If we guess the correct group id we will receive the following response:&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span class="content"&gt;# ike-scan -M --id=secret -A 192.168.173.50&lt;br /&gt;
Starting ike-scan 1.9 with 1 hosts (http://www.nta-monitor.com/tools/ike-scan/)&lt;br /&gt;
192.168.173.50&amp;nbsp;&amp;nbsp;&amp;nbsp; Aggressive Mode Handshake returned&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; HDR=(CKY-R=c27436032ea1c5fd)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; SA=(Enc=DES Hash=SHA1 Group=2:modp1024 Auth=PSK LifeType=Seconds LifeDuration=28800)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; KeyExchange(128 bytes)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; Nonce(20 bytes)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; ID(Type=ID_IPV4_ADDR, Value=192.168.173.50)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; Hash(20 bytes)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; VID=12f5f28c457168a9702d9fe274cc0100 (Cisco Unity)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; VID=09002689dfd6b712 (XAUTH)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;b&gt;VID=afcad71368a1f1c96b8696fc77570100 (Dead Peer Detection v1.0)&lt;/b&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; VID=4048b7d56ebce88525e7de7f00d6c2d3c0000000 (IKE Fragmentation)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; VID=1f07f70eaa6514d3b0fa96542a500100 (Cisco VPN Concentrator)&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span class="content"&gt;The DPD option that is added to the received response will allow us to distinguish between a valid and invalid group id. The PDP VID valua is static and does not change between requests with a valid group id. I was quite surprised that it was this simple. Once we know the valid group id we could save the pre-shared key with the --pskcrack option of ike-scan and use psk-crack consequently to perform a dictionary or brute force attack:&lt;/span&gt;&lt;br /&gt;
&lt;span class="content"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span class="content"&gt;$ psk-crack testkey &lt;br /&gt;
Starting psk-crack [ike-scan 1.9] (http://www.nta-monitor.com/tools/ike-scan/)&lt;br /&gt;
Running in dictionary cracking mode&lt;br /&gt;
key "cisco" matches SHA1 hash a0520306d83e6c642be92f9684c10dfcc409fede&lt;br /&gt;
Ending psk-crack: 70752 iterations in 0.194 seconds (364486.85 iterations/sec)&lt;/span&gt;&lt;br /&gt;
&lt;span class="content"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span class="content"&gt;Now that we have the key does that mean the we have VPN access to the network? Unfortunately this is not the case, because commonly the IPsec gateway requests extended authentication through &lt;a href="http://www.ciscopress.com/articles/article.asp?p=421514"&gt;IPsec XAUTH&lt;/a&gt;. What we could do however is eavesdrop on another user connecting via IPsec and gain access to the XAUTH authentication credentials, as these are in clear text once we decrypt the IPsec network traffic wih the pre-shared secret we just cracked. Not very likely in a pentesting scenario, but maybe you are lucky and no XAUTH is used on the device you are pentesting.&lt;/span&gt;&lt;br /&gt;
&lt;span class="content"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span class="content"&gt;ike-scan is not the best tool to perform a brute force of the group id in a convenient way, so luckily Francois Ropert recently submitted a Metasploit module to perform the &lt;a href="http://www.metasploit.com/redmine/issues/3386"&gt;brute force&lt;/a&gt;. Currently the module has not yet been added to trunk yet. According the Cisco security response the vulnerability will be fixed in February 2011. It is advised to disable IPsec aggressive mode as a workaround for this vulnerability.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6231564296864090820-8859486570070339932?l=blog.stoked-security.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/Stoked-security/~4/p-4KKTqn5ns" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/Stoked-security/~3/p-4KKTqn5ns/how-hard-could-it-be-to-brute-force.html</link><author>noreply@blogger.com (Erwin)</author><thr:total>0</thr:total><feedburner:origLink>http://blog.stoked-security.com/2010/12/how-hard-could-it-be-to-brute-force.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6231564296864090820.post-7270153163633937863</guid><pubDate>Sun, 29 Nov 2009 17:45:00 +0000</pubDate><atom:updated>2009-11-29T20:32:45.923+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Gentoo</category><category domain="http://www.blogger.com/atom/ns#">cross compiling</category><category domain="http://www.blogger.com/atom/ns#">wine</category><title>Compiling and running Windows programs on Linux</title><description>While the title of this post could make you wonder why you ever want to do this, there is actually a scenario where this comes handy. Let's say you downloaded exploit code or for instance the sample &lt;a href="http://media.wiley.com/product_ancillary/14/07645780/DOWNLOAD/578014_Code.zip"&gt;source code&lt;/a&gt; of the &lt;a href="http://eu.wiley.com/WileyCDA/WileyTitle/productCd-0764578014.html"&gt;Database hackers handbook&lt;/a&gt;. In both cases you may encounter source code that requires a Windows development environment to compile. While Microsoft offers free &lt;a href="http://www.microsoft.com/exPress/"&gt;express editions&lt;/a&gt; for many of their development tools, you still need a copy of Windows somewhere.&lt;br /&gt;
&lt;br /&gt;
Last week I decided to try a different route with &lt;a href="http://www.mingw.org/"&gt;MinGW&lt;/a&gt;, which is a port of GCC that can be used to develop native Windows applications. If you want to use MinGW under Linux you have to build a cross compiler. Historically this has been a difficult task. On Gentoo Linux however there is a package named &lt;a href="http://packages.gentoo.org/package/sys-devel/crossdev?full_cat"&gt;crossdev&lt;/a&gt;. Once installed this package automates the task of building a cross compiler. With the following command you can build a MinGW cross compiler:&lt;br /&gt;
&lt;br /&gt;
$ sudo crossdev -t i686-mingw32&lt;br /&gt;
&lt;br /&gt;
Building the cross compiler may take some time. Once installed the following command could be tried to compile one of the source code samples from the Database hackers handbook:&lt;br /&gt;
&lt;br /&gt;
$ i686-mingw32-gcc C2_2.cpp -o dbsnmp.exe&lt;br /&gt;
&lt;br /&gt;
However, you will receive receive several errors:&lt;br /&gt;
C2_2.cpp: In function ‘int StartWinsock()’:&lt;br /&gt;
C2_2.cpp:83: error: ‘isalpha’ was not declared in this scope&lt;br /&gt;
C2_2.cpp: In function ‘int QueryDBSNMP(int)’:&lt;br /&gt;
C2_2.cpp:128: error: ‘con’ was not declared in this scope&lt;br /&gt;
C2_2.cpp:128: error: ‘nect’ was not declared in this scope&lt;br /&gt;
C2_2.cpp:134: error: invalid conversion from ‘unsigned char*’ to ‘const char*’&lt;br /&gt;
C2_2.cpp:134: error:&amp;nbsp;&amp;nbsp; initializing argument 2 of ‘int send(SOCKET, const char*, int, int)’&lt;br /&gt;
C2_2.cpp:135: error: invalid conversion from ‘unsigned char*’ to ‘char*’&lt;br /&gt;
C2_2.cpp:135: error:&amp;nbsp;&amp;nbsp; initializing argument 2 of ‘int recv(SOCKET, char*, int, int)’&lt;br /&gt;
C2_2.cpp:142: error: ‘PrintResponse’ was not declared in this scope&lt;br /&gt;
C2_2.cpp:143: error: invalid conversion from ‘unsigned char*’ to ‘const char*’&lt;br /&gt;
C2_2.cpp:143: error:&amp;nbsp;&amp;nbsp; initializing argument 2 of ‘int send(SOCKET, const char*, int, int)’&lt;br /&gt;
C2_2.cpp:144: error: invalid conversion from ‘unsigned char*’ to ‘char*’&lt;br /&gt;
C2_2.cpp:144: error:&amp;nbsp;&amp;nbsp; initializing argument 2 of ‘int recv(SOCKET, char*, int, int)’&lt;br /&gt;
C2_2.cpp:152: error: invalid conversion from ‘unsigned char*’ to ‘const char*’&lt;br /&gt;
C2_2.cpp:152: error:&amp;nbsp;&amp;nbsp; initializing argument 2 of ‘int send(SOCKET, const char*, int, int)’&lt;br /&gt;
C2_2.cpp:153: error: invalid conversion from ‘unsigned char*’ to ‘char*’&lt;br /&gt;
C2_2.cpp:153: error:&amp;nbsp;&amp;nbsp; initializing argument 2 of ‘int recv(SOCKET, char*, int, int)’&lt;br /&gt;
C2_2.cpp:166: error: invalid conversion from ‘unsigned char*’ to ‘const char*’&lt;br /&gt;
C2_2.cpp:166: error:&amp;nbsp;&amp;nbsp; initializing argument 2 of ‘int send(SOCKET, const char*, int, int)’&lt;br /&gt;
C2_2.cpp:167: error: invalid conversion from ‘unsigned char*’ to ‘char*’&lt;br /&gt;
C2_2.cpp:167: error:&amp;nbsp;&amp;nbsp; initializing argument 2 of ‘int recv(SOCKET, char*, int, int)’&lt;br /&gt;
&lt;br /&gt;
The error on line 83, about the isalpha function can be fixed by including ctype.h. The error about line 128 are caused by the extra minus sign in the connect function name. Script kiddie protection, who knows? The rest of the errors could be fixed by casting (char *) the send and receive buffers. Trying to compile again leaves us with one error:&lt;br /&gt;
&lt;br /&gt;
C2_2.cpp:143: error: ‘PrintResponse’ was not declared in this scope&lt;br /&gt;
&lt;br /&gt;
This error is caused by a missing declaration of the PrintResponse() function at the top of the source file. Once that error is fixed we encounter linking errors:&lt;br /&gt;
/tmp/ccf47BD7.o:C2_2.cpp:(.text+0x125): undefined reference to `_WSACleanup@0'&lt;br /&gt;
/tmp/ccf47BD7.o:C2_2.cpp:(.text+0x158): undefined reference to `_WSAStartup@8'&lt;br /&gt;
/tmp/ccf47BD7.o:C2_2.cpp:(.text+0x18d): undefined reference to `_WSACleanup@0'&lt;br /&gt;
/tmp/ccf47BD7.o:C2_2.cpp:(.text+0x1b9): undefined reference to `_gethostbyname@4'&lt;br /&gt;
/tmp/ccf47BD7.o:C2_2.cpp:(.text+0x20c): undefined reference to `_inet_addr@4'&lt;br /&gt;
/tmp/ccf47BD7.o:C2_2.cpp:(.text+0x2cf): undefined reference to `_socket@12'&lt;br /&gt;
/tmp/ccf47BD7.o:C2_2.cpp:(.text+0x30a): undefined reference to `_htons@4'&lt;br /&gt;
/tmp/ccf47BD7.o:C2_2.cpp:(.text+0x32b): undefined reference to `_bind@12'&lt;br /&gt;
/tmp/ccf47BD7.o:C2_2.cpp:(.text+0x343): undefined reference to `_closesocket@4'&lt;br /&gt;
/tmp/ccf47BD7.o:C2_2.cpp:(.text+0x368): undefined reference to `_htons@4'&lt;br /&gt;
/tmp/ccf47BD7.o:C2_2.cpp:(.text+0x38d): undefined reference to `_connect@12'&lt;br /&gt;
/tmp/ccf47BD7.o:C2_2.cpp:(.text+0x3a5): undefined reference to `_closesocket@4'&lt;br /&gt;
/tmp/ccf47BD7.o:C2_2.cpp:(.text+0x3e2): undefined reference to `_send@16'&lt;br /&gt;
/tmp/ccf47BD7.o:C2_2.cpp:(.text+0x40d): undefined reference to `_recv@16'&lt;br /&gt;
/tmp/ccf47BD7.o:C2_2.cpp:(.text+0x424): undefined reference to `_closesocket@4'&lt;br /&gt;
/tmp/ccf47BD7.o:C2_2.cpp:(.text+0x476): undefined reference to `_send@16'&lt;br /&gt;
/tmp/ccf47BD7.o:C2_2.cpp:(.text+0x4a1): undefined reference to `_recv@16'&lt;br /&gt;
/tmp/ccf47BD7.o:C2_2.cpp:(.text+0x4b8): undefined reference to `_closesocket@4'&lt;br /&gt;
/tmp/ccf47BD7.o:C2_2.cpp:(.text+0x50a): undefined reference to `_send@16'&lt;br /&gt;
/tmp/ccf47BD7.o:C2_2.cpp:(.text+0x535): undefined reference to `_recv@16'&lt;br /&gt;
/tmp/ccf47BD7.o:C2_2.cpp:(.text+0x54c): undefined reference to `_closesocket@4'&lt;br /&gt;
/tmp/ccf47BD7.o:C2_2.cpp:(.text+0x58b): undefined reference to `_closesocket@4'&lt;br /&gt;
/tmp/ccf47BD7.o:C2_2.cpp:(.text+0x5c3): undefined reference to `_send@16'&lt;br /&gt;
/tmp/ccf47BD7.o:C2_2.cpp:(.text+0x5ee): undefined reference to `_recv@16'&lt;br /&gt;
/tmp/ccf47BD7.o:C2_2.cpp:(.text+0x605): undefined reference to `_closesocket@4'&lt;br /&gt;
/tmp/ccf47BD7.o:C2_2.cpp:(.text+0x626): undefined reference to `_closesocket@4'&lt;br /&gt;
collect2: ld returned 1 exit status&lt;br /&gt;
&lt;br /&gt;
All these functions are part of winsock library on Windows. What we need to do now is locate winsock.h on the local file system (use the one in the mingw directory, when multiple are found) and add the following options to our compile command:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
$ i686-mingw32-gcc C2_2.cpp -o dbsnmp.exe -L/usr/i686-mingw32/usr/include/ -lws2_32&lt;br /&gt;
&lt;br /&gt;
Finally our source compiled and linked and now we can run it with wine:&lt;br /&gt;
$ wine dbsnmp.exe &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; Oracle DBSNMP Tool&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; C:\&amp;gt;dbsnmp.exe host status|stop&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; David Litchfield&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; davidl@ngssoftware.com&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; 4th June 2004&lt;br /&gt;
&lt;br /&gt;
Yeah, a running program at last!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6231564296864090820-7270153163633937863?l=blog.stoked-security.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/Stoked-security/~4/SEjkPrvzX8w" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/Stoked-security/~3/SEjkPrvzX8w/compiling-and-running-windows-programs.html</link><author>noreply@blogger.com (Erwin)</author><thr:total>0</thr:total><feedburner:origLink>http://blog.stoked-security.com/2009/11/compiling-and-running-windows-programs.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6231564296864090820.post-2471598597702442664</guid><pubDate>Mon, 23 Nov 2009 21:47:00 +0000</pubDate><atom:updated>2009-12-01T15:26:53.644+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Gentoo</category><category domain="http://www.blogger.com/atom/ns#">IDS</category><category domain="http://www.blogger.com/atom/ns#">tap</category><title>Building your own ethernet tap for just over 25 euros</title><description>Recently I was looking for a solution to place an IDS in front of my firewall and monitor my internet connection. This way I would be able to detect all attacks, even the ones that get blocked by my firewall. My ADSL modem is in bridging mode and my firewall has the external IP address of the connection. I have a Siemens modem and although the embedded XSH shell is not very well documented it does not seem like it has a SPAN port feature like some of the &lt;a href="http://deckardt.nl/blog/2008/06/27/speedtouch-fun-the-port-mirror/"&gt;Speedtouch ADSL modems&lt;/a&gt;, which are also commonly used for broadband connections in the Netherlands.&lt;br /&gt;
&lt;br /&gt;
While I could have run Snort on my firewall, I decided I wanted to have a separate system for monitoring. I looked at buying a 100Mbit tap of the shelve, but those are still too expensive for home use. I searched the internet to see if it would be possible to build my own. Several people already succeeded in building their own, so I decided to give it a shot.&lt;br /&gt;
&lt;br /&gt;
In order to build a tap for 10/100Mbit you need four ethernet ports. Two to connect both hosts and two ports which will receive a copy of either the sent (TX) or receive (RX) pair of wires from the ethernet cable. So each tap port will receive only half of the connection, as shown in the diagram below, which used to be on the Snort website:&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://3.bp.blogspot.com/_mHlJi6oQdiA/SwsZTO4Z8PI/AAAAAAAAAAc/hMs0BbZ2bhA/s1600/tapdiagram.gif" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5407443595791298802" src="http://3.bp.blogspot.com/_mHlJi6oQdiA/SwsZTO4Z8PI/AAAAAAAAAAc/hMs0BbZ2bhA/s400/tapdiagram.gif" style="cursor: pointer; display: block; height: 327px; margin: 0px auto 10px; text-align: center; width: 363px;" /&gt;&lt;/a&gt;This means that the tap ports can only receive traffic, and will not be able to send out any network traffic. This will prevent you from creating dangerous loop holes bypassing your firewall.&lt;br /&gt;
&lt;br /&gt;
I made a small shopping list and tried to get the supplies at the local computer or electronic shops. Many examples use ethernet mounting wall systems with four ports, but those are hard to get in the shops. I ended up taking a different route and I bought two ethernet cat 5e surface mounting wall boxes at the local computer shop. Once you take of the plastic covers you end up with to metal boxes as shown below:&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://3.bp.blogspot.com/_mHlJi6oQdiA/Swsc80GuPDI/AAAAAAAAAAk/PlBTqZv3BsQ/s1600/tap1.jpg" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5407447608692980786" src="http://3.bp.blogspot.com/_mHlJi6oQdiA/Swsc80GuPDI/AAAAAAAAAAk/PlBTqZv3BsQ/s400/tap1.jpg" style="cursor: pointer; display: block; height: 197px; margin: 0px auto 10px; text-align: center; width: 400px;" /&gt;&lt;/a&gt;&lt;br /&gt;
When the covers are taken of you can see the punch through blades for the individual wires, which allow you to do the wiring without soldering. I carefully stripped 15 cm of ethernet cable and took the twisted wire pairs out. Following the coloring diagram above I wired the wire pairs through the punch through blades with a screw driver. It is important to keep the wire pairs twisted, in order to minimize interference. The picture below shows the end result:&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://4.bp.blogspot.com/_mHlJi6oQdiA/SwsgJzLffKI/AAAAAAAAAAs/iggsgjxQy2M/s1600/tap2.jpg" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5407451130317733026" src="http://4.bp.blogspot.com/_mHlJi6oQdiA/SwsgJzLffKI/AAAAAAAAAAs/iggsgjxQy2M/s400/tap2.jpg" style="cursor: pointer; display: block; height: 250px; margin: 0px auto 10px; text-align: center; width: 400px;" /&gt;&lt;/a&gt;&lt;br /&gt;
Although the wiring does not look too clean in the picture, it turns out it works very well for over a week now, without any interface errors on the firewall. The ethernet tap cost me just over 25 euros and a few hours to build.&lt;br /&gt;
&lt;br /&gt;
The last step is to combine both tap ports into one virtual interface on the monitoring system, which will see the complete traffic flow in both directions. This can be done by using the interface bonding option (CONFIG_BONDING) of the Linux kernel. On Gentoo systems the following configuration in /etc/init.d/net allows the virtual bond interface at boot time:&lt;br /&gt;
&lt;br /&gt;
slaves_bond0="eth0 eth1 "&lt;br /&gt;
config_bond0=( "null" )&lt;br /&gt;
config_eth0=( "null" )&lt;br /&gt;
config_eth1=( "null" )&lt;br /&gt;
RC_NEED_bond0="net.eth0 neth.eth1"&lt;br /&gt;
&lt;br /&gt;
Of course the proper symlinks need to be in place in /etc/init.d/ for all network interfaces that must be started at boot time. Tests with tcpdump and wireshark on the bond0 interface show the complete traffic flow between the systems. Next step is to install &lt;a href="http://sguil.sourceforge.net/"&gt;Sguil&lt;/a&gt; on the monitoring system!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6231564296864090820-2471598597702442664?l=blog.stoked-security.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/Stoked-security/~4/OtvwczpGdyw" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/Stoked-security/~3/OtvwczpGdyw/building-your-own-ethernet-tap-for-just.html</link><author>noreply@blogger.com (Erwin)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/_mHlJi6oQdiA/SwsZTO4Z8PI/AAAAAAAAAAc/hMs0BbZ2bhA/s72-c/tapdiagram.gif" height="72" width="72" /><thr:total>2</thr:total><feedburner:origLink>http://blog.stoked-security.com/2009/11/building-your-own-ethernet-tap-for-just.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6231564296864090820.post-1267894421603038916</guid><pubDate>Mon, 13 Jul 2009 21:03:00 +0000</pubDate><atom:updated>2009-07-14T13:46:16.780+02:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">nat</category><category domain="http://www.blogger.com/atom/ns#">pf</category><category domain="http://www.blogger.com/atom/ns#">firewall</category><title>PF based NAT firewall quirk</title><description>It's been a while since my last post, but today I decided to finish a post that I started some time ago, but never finished. It's about a configuration issue with the PF firewall when using NAT for the systems behind the firewall. All the examples you will find on the net define the following rule for NAT-ing internal traffic before it is send to the internet:&lt;br /&gt;&lt;br /&gt;# NAT inside -&gt; outside&lt;br /&gt;nat on $ext_if from !($ext_if) to any -&gt; ($ext_if)&lt;br /&gt;&lt;br /&gt;This may a look a bit cryptic at first sight, but this basically performs NAT on the external interface for packets which have an ip source address, which is not equal (exclamation mark) to the dynamic ip address (denoted by the parentheses) of the external interface. This rule only performs the NAT and does not let the network packets actually flow through the firewall. We need two more rules. One to let the traffic in on the internal interface and one to let the traffic go out on the external interface:&lt;br /&gt;&lt;br /&gt;# allow internal lan to access the Internet&lt;br /&gt;pass quick from $int_lan to any&lt;br /&gt;&lt;br /&gt;# allow packets out&lt;br /&gt;pass out quick on $ext_if&lt;br /&gt;&lt;br /&gt;These rules are not very strict and basicly allow all outgoing traphic, but even if we replace them with stricter ones, something odd happens. In the past I have used iptables a lot and there you have the concept of chains, namely INPUT, OUTPUT and FORWARD. The INPUT and OUTPUT chain are for the local machine or firewall and the FORWARD chain along with the PREROUTING and POSTROUTING chains are for the systems behind the firewall and NAT. &lt;br /&gt;&lt;br /&gt;PF does not have that concept and the rules above will also allow all outgoing traffic initiated from the firewall itself! This is probably not what we intended here and is caused by the NAT rule that translates the source ip address of the packets that are about to leave the firewall. Since the source ip address is already translated before the last pass out rule is hit, this rules is not able to differentiate local generated traffic from NAT-ed traffic and will allow all traffic to leave the firewall. So is there a way to prevent this? Luckily there is an option with PF to tag a packet, which labels a packet with a tag that can be read by other rules and acted upon. This way we can differentiate traffic that flows through a NAT rule and traffic that does not.&lt;br /&gt;&lt;br /&gt;Let me show you how this works in practice. First we tag packets on the NAT rule:&lt;br /&gt;&lt;br /&gt;# NAT inside -&gt; outside&lt;br /&gt;nat on $ext_if from !($ext_if) to any tag NAT -&gt; ($ext_if)&lt;br /&gt;&lt;br /&gt;Next we pass out only tagged traffic on the external interface:&lt;br /&gt;&lt;br /&gt;# allow NAT-ed packets out&lt;br /&gt;pass out quick on $ext_if tagged NAT&lt;br /&gt;&lt;br /&gt;Keep an eye out for this pitfall when performing security reviews on PF rulesets, because I have seen many examples on the internet without the tag option.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6231564296864090820-1267894421603038916?l=blog.stoked-security.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/Stoked-security/~4/K5YqAmtXhrY" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/Stoked-security/~3/K5YqAmtXhrY/pf-based-nat-firewall-quirk.html</link><author>noreply@blogger.com (Erwin)</author><thr:total>0</thr:total><feedburner:origLink>http://blog.stoked-security.com/2009/03/pf-based-nat-firewall-quirk.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6231564296864090820.post-6586543765461165670</guid><pubDate>Wed, 15 Apr 2009 18:58:00 +0000</pubDate><atom:updated>2009-04-15T21:17:12.517+02:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Nessus</category><category domain="http://www.blogger.com/atom/ns#">Gentoo</category><title>Nessus 4.0.0 Gentoo ebuilds</title><description>Today I've updated my Gentoo Nessus ebuilds to the just &lt;a href="http://blog.tenablesecurity.com/2009/04/nessus-version-4-released.html#more"&gt;released version 4&lt;/a&gt;. Since the official maintainer of the Nessus ebuilds for Gentoo is very slow with updating, I've submitted the updated packages to the &lt;a href="http://gentoo.o0o.nu/"&gt;sec-tools overlay&lt;/a&gt;. At the moment they are not available yet, but I expect them to become available very soon. &lt;br /&gt;&lt;br /&gt;If you can't wait you can also grab the ebuilds for both the server and the client from &lt;a href="http://bugs.gentoo.org/show_bug.cgi?id=265555"&gt;this&lt;/a&gt; Gentoo bug report. Unlike the previous versions this version of the service package does not include any plugins anymore. So in order to do something usefull with it you have to register either a Professional or Home feed at &lt;a href="http://www.nessus.org/plugins/index.php?view=register-info"&gt;Tenable&lt;/a&gt; and fetch the newest plugins once installed.&lt;br /&gt;&lt;br /&gt;Please let me know if you encounter any problems and leave a comment here or at bug id &lt;a href="http://bugs.gentoo.org/show_bug.cgi?id=265555"&gt;265555&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6231564296864090820-6586543765461165670?l=blog.stoked-security.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/Stoked-security/~4/GcIvYtKATw4" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/Stoked-security/~3/GcIvYtKATw4/nessus-400-gentoo-ebuilds.html</link><author>noreply@blogger.com (Erwin)</author><thr:total>1</thr:total><feedburner:origLink>http://blog.stoked-security.com/2009/04/nessus-400-gentoo-ebuilds.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6231564296864090820.post-3698368566527877799</guid><pubDate>Tue, 07 Apr 2009 20:22:00 +0000</pubDate><atom:updated>2009-04-08T11:48:40.206+02:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">wi-fi</category><category domain="http://www.blogger.com/atom/ns#">wireless</category><title>Channel 13, now you see it, now you don't</title><description>This is just a quick blog post about scanning for wireless Wi-Fi networks. As you might know, in the US only 11 channels are allowed for the B/G band, but outside the US we have a few more &lt;a href="http://en.wikipedia.org/wiki/List_of_WLAN_channels"&gt;channels&lt;/a&gt;. Here in the Netherlands also channel 12 and 13 are being used and Japan uses channel 14 as well.&lt;br /&gt;&lt;br /&gt;When we scan for wireless networks with for instance &lt;a href="http://www.aircrack-ng.org/doku.php"&gt;airodump-ng&lt;/a&gt; using a default Linux installation, we might not directly notice that we are commonly scanning only 11 channels. Access points, ad-hoc networks and clients might show up on channels above 11 depending on your geographic location and the distance to these networks and clients. However, the trouble starts when you actually try to connect to these networks on channels 12, 13 or even 14 using iwconfig, wpa_supplicant or GNOME NetworkManager. Suddenly you are not able to connect, although you detected the network before. How is this possible? This caused by overlapping channels, which is described in &lt;a href="http://en.wikipedia.org/wiki/List_of_WLAN_channels#2.4.C2.A0GHz_.28802.11b.2Fg.2Fdraft-n.29"&gt;this&lt;/a&gt; wikipedia article and I quote the relevant section below:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;"There are 14 channels designated in the 2.4 GHz range spaced 5 MHz apart (with the exception of a 12 MHz spacing before Channel 14). As the protocol requires 25 MHz of channel separation, adjacent channels overlap and will interfere with each other."&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;This means there are only three non overlapping channels, namely 1, 6 and 11. The following picture shows the overlap of the other channels (courtesy of the same wikipedia article):&lt;br /&gt;&lt;a href="http://en.wikipedia.org/wiki/List_of_WLAN_channels"&gt;&lt;/a&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_mHlJi6oQdiA/SdvJ3xrrBzI/AAAAAAAAAAU/sf-t6G5oz0s/s1600-h/2.4_GHz_Wi-Fi_channels.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400x; height: 100px;" src="http://4.bp.blogspot.com/_mHlJi6oQdiA/SdvJ3xrrBzI/AAAAAAAAAAU/sf-t6G5oz0s/s400/2.4_GHz_Wi-Fi_channels.png" alt="" id="BLOGGER_PHOTO_ID_5322069344734873394" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;This explains why we detect channels in monitor mode we can't consequently connect to. How can this be fixed? First of all, you need the proper wireless card, because most cards have only the allowed channels enabled for the region they are sold. For some cards other channels can be enabled by hacking the firmware, but that's outside the scope of this blog posting. It also depends on which driver or Linux IEEE 802.11 networking stack the wireless card is using. Many &lt;a href="http://wireless.kernel.org/en/users/Drivers"&gt;cards&lt;/a&gt; use the mac80211 networking stack, which uses a kernel module named cfg80211. This module has the option to set the regdomain using the ieee_regdom variable. This variable accepts currently the values US (default), EU and JP. To enable the correct regdomain at boot time for most Linux distributions the following line should be added to the file &lt;span style="font-weight: bold;"&gt;/etc/modules.d/cfg80211&lt;/span&gt;:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;options cfg80211 ieee_regdom=EU&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Atheros chipset based wireless cards who use the madwifi-ng drivers need to follow a different &lt;a href="http://madwifi-project.org/wiki/UserDocs/CountryCode"&gt;procedure&lt;/a&gt;, because these drivers use their own hal (hardware abstraction layer) instead of the generic mac80211 layer.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.kismetwireless.net/"&gt;Kismet&lt;/a&gt; users should also enable the channels they want to scan for in the &lt;span style="font-weight: bold;"&gt;kismet.conf&lt;/span&gt; configuration file (defaultchannels option).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6231564296864090820-3698368566527877799?l=blog.stoked-security.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/Stoked-security/~4/evTC6s6OLzg" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/Stoked-security/~3/evTC6s6OLzg/channel-13-now-you-see-it-now-you-dont.html</link><author>noreply@blogger.com (Erwin)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/_mHlJi6oQdiA/SdvJ3xrrBzI/AAAAAAAAAAU/sf-t6G5oz0s/s72-c/2.4_GHz_Wi-Fi_channels.png" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://blog.stoked-security.com/2009/04/channel-13-now-you-see-it-now-you-dont.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6231564296864090820.post-3571120215421147651</guid><pubDate>Sat, 07 Feb 2009 21:25:00 +0000</pubDate><atom:updated>2009-02-07T22:47:32.964+01:00</atom:updated><title>Welcome to my shiny new blog</title><description>Hi,&lt;br /&gt;Welcome to my shiny new blog! A long time idea, but finally realised in 2009. This blog will contain tips, tricks, research and observations about penetration testing and security in general.&lt;br /&gt;&lt;br /&gt;For those who are wondering what stoked means, urban dictionary has a nice &lt;a href="http://www.urbandictionary.com/define.php?term=stoked"&gt;definition&lt;/a&gt;:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;"stoked" - adjective - to be "stoked" is to be completely and intensely enthusiastic, exhilirated, or excited about something. those who are stoked all of the time know this; being stoked is the epitome of all being. when one is stoked, there is no limit to what one can do.&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;The term is commonly associated with surfing, which is also a hobby of me.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6231564296864090820-3571120215421147651?l=blog.stoked-security.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/Stoked-security/~4/yLq72XytH-I" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/Stoked-security/~3/yLq72XytH-I/welcome-to-my-shiny-new-blog.html</link><author>noreply@blogger.com (Erwin)</author><thr:total>0</thr:total><feedburner:origLink>http://blog.stoked-security.com/2009/02/welcome-to-my-shiny-new-blog.html</feedburner:origLink></item></channel></rss>

