<?xml version="1.0" encoding="ISO-8859-1"?>
<rss version="2.0">
	<channel>
		<title>Goonda.Org: Keep It Simple, Stupid.</title>
		<link>http://www.goonda.org/kiss/index.php</link>
		<description><![CDATA[All information on this blog copyright Goonda Security Inc.]]></description>
		<copyright>Copyright 2010, goonda</copyright>
		<managingEditor>goonda</managingEditor>
		<language>en-US</language>
		<generator>SPHPBLOG 0.5.1</generator>
		<item>
			<title>Perl tip: URL Decode and Encode</title>
			<link>http://www.goonda.org/kiss/index.php?entry=entry080317-222231</link>
			<description><![CDATA[Here&#039;s a quick perl tip on how to URL Decode and Encode:<br /><br />To encode a string to be placed in a URL:<br /><code><br />$string =~ s/([^A-Za-z0-9])/sprintf(&quot;%%%02X&quot;, ord($1))/seg;<br /></code><br />To decode a URL-encoded string:<br /><code><br />$string =~ s/\%([A-Fa-f0-9]{2})/pack(&#039;C&#039;, hex($1))/seg;<br /></code>]]></description>
			<category>Programming</category>
			<guid isPermaLink="true">http://www.goonda.org/kiss/index.php?entry=entry080317-222231</guid>
			<author>goonda</author>
			<pubDate>Tue, 18 Mar 2008 03:22:31 GMT</pubDate>
			<comments>http://www.goonda.org/kiss/comments.php?y=08&amp;m=03&amp;entry=entry080317-222231</comments>
		</item>
		<item>
			<title>Bash Pitfalls</title>
			<link>http://www.goonda.org/kiss/index.php?entry=entry080316-214359</link>
			<description><![CDATA[Found this great Wiki on <a href="http://wooledge.org:8000/BashPitfalls" target="_blank" >Bash Pitfalls</a> today which should help avoid common bash scripting errors.]]></description>
			<category>Programming</category>
			<guid isPermaLink="true">http://www.goonda.org/kiss/index.php?entry=entry080316-214359</guid>
			<author>goonda</author>
			<pubDate>Mon, 17 Mar 2008 02:43:59 GMT</pubDate>
			<comments>http://www.goonda.org/kiss/comments.php?y=08&amp;m=03&amp;entry=entry080316-214359</comments>
		</item>
		<item>
			<title>Upgrading firmware on a Linksys WRT54GS to DD-WRT</title>
			<link>http://www.goonda.org/kiss/index.php?entry=entry080316-172058</link>
			<description><![CDATA[Recently I upgraded my old linksys <a href="http://www.linksys.com/servlet/Satellite?c=L_Product_C2&amp;childpagename=US%2FLayout&amp;pagename=Linksys%2FCommon%2FVisitorWrapper&amp;cid=1148435315453" target="_blank" >WRT54GS</a> from the Linksys suppled firmware to the spiffy <a href="http://www.dd-wrt.com" target="_blank" >DD-WRT</a> linux-based distribution so I could more effectively troubleshoot problems with my <a href="http://www.rr.com" target="_blank" >pain-in-the-ass cable modem service</a>. Since Linksys has gotten purchased by a certain <a href="http://www.cisco.com" target="_blank" >networking giant</a>, each subsequent hardware revision of the WRT54G/WRT54GS series has gotten smaller and smaller amounts of RAM and Flash. The most plausible reason for crippling these $40-$50 dollar routers is that with an alternate firmware like DD-WRT, suddenly these cheap boxes are capable of much greater functionality like Quality-of-Service (QoS) bandwidth management, policy routing, IPv6 support, wireless captive portal, login access via SSH/telnet, third party packages, and much more.  In other words, they might be able to start cannibalizing the revenue stream from their more expensive big brothers.<br /><br />Luckily, the router I had was WRT54GS revision v1.1 which has a whopping 32M of RAM and 8M of flash which can run the DD-WRT standard distribution. Make sure to very carefully check the <a href="http://www.dd-wrt.com/wiki/index.php/Supported_Devices" target="_blank" >supported devices</a> list to make sure your router is supported before you start, so you don&#039;t brick your router!! <br /><br />Before beginning, make sure to review the <a href="http://www.dd-wrt.com/wiki/index.php/Installation" target="_blank" >DD-WRT Installation Wiki</a>.<br /><br />Upgrading to the DD-WRT Standard distribution <a href="http://www.dd-wrt.com/dd-wrtv2/downloads/stable/dd-wrt.v23%20SP2/dd-wrt.v23_sp2_standard.zip" target="_blank" >dd-wrt.v23_sp2_standard.zip</a><br />was a two step process. When you unzip the zipfile, pay special attention to the file labeled &#039;hwsupport.txt&#039; as it may contain special instructions for your hardware. In my case it stated:<br /><code><br />3.) Linksys WRT54G/GS (any version) flashing notes:<br />---------------------------------------------------<br />-For upgrading from the original Linksys firmware, please use the generic mini version (dd-wrt.vXX_mini_generic.bin) and flash<br /> it from the web GUI interface.  After this first flashing you can change to any other distribution, if you want.<br />-For flashing via the web GUI interface, always use the included &#039;generic&#039; binaries. The other Linksys router specific binarie<br />s are only meant for tftp upgrades.<br /></code><br />This meant I had to go back and download the Mini distribution <a href="http://www.dd-wrt.com/dd-wrtv2/downloads/stable/dd-wrt.v23%20SP2/dd-wrt.v23_sp2_mini.zip" target="_blank" >dd-wrt.v23_sp2_mini.zip</a><br />from the website and flash that first. The flashing process was uneventful, brought up the web interface from the standard linksys distribution and selected the mini distribution above. Flashing took a minute or two, and then rebooted into the DD-WRT mini distribution. The default login is <code>root</code> with a password of <code>admin</code>. <br /><br />Initially the web interface would not come up although I could ping the router which caused me some fear I had bricked it. However after disconnecting the power cable while holding the reset button (See also <a href="http://www.dd-wrt.com/wiki/index.php/Reset_And_Reboot" target="_blank" >DD-WRT Reset and Reboot </a>) did the trick and I was able to bring up the web interface. <br /><br />Then I was able to select the standard DD-WRT distribution and using the same web process to upgrade. After the last reboot I was able to login to my new more capable router!<br /><br />I&#039;ve been having some fun playing with SNMP, Macupd, rflow, SSH, the flash filesystem (jffs2), and other items which will be subject of future blog entries. Happy hacking!]]></description>
			<category>Wireless</category>
			<guid isPermaLink="true">http://www.goonda.org/kiss/index.php?entry=entry080316-172058</guid>
			<author>goonda</author>
			<pubDate>Sun, 16 Mar 2008 22:20:58 GMT</pubDate>
			<comments>http://www.goonda.org/kiss/comments.php?y=08&amp;m=03&amp;entry=entry080316-172058</comments>
		</item>
		<item>
			<title>Brute force HTTP Basic authentication with authforce</title>
			<link>http://www.goonda.org/kiss/index.php?entry=entry080310-185447</link>
			<description><![CDATA[<a href="http://www.divineinvasion.net/authforce/" target="_blank" >Authforce</a> is a very fast tool for brute forcing <a href="http://en.wikipedia.org/wiki/Basic_authentication_scheme" target="_blank" >HTTP Basic Authentication</a> protected URLs. In HTTP Basic authentication the username and password is Base64 encoded and passed along with the HTTP headers from the client to the HTTP server. This means that the credentials are passed over the network in plaintext and is vulnerable to eavesdropping by an attacker. Despite this weakness, it is still quite widely used - for example access to the default Tomcat manager page is protected by HTTP Basic by default. <br /><br />When a client requests a HTTP Basic-protected resource, the web server will challenge with a HTTP 401 Authorization Required (See <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html" target="_blank" >www.w3.org</a>&#039;s page for a listing of all HTTP codes) which causes a username/password dialog to pop up in your browser. Now you&#039;ve identified the target URL for authforce to run against.<br /><br />Authforce needs a list of usernames, a list of passwords, and target URL to work. Here&#039;s an example:<br /><code><br />authforce --verbose --beep --logfile=aftest --username-file=users --password-file=words <a href="http://192.168.1.100/tmp" target="_blank" >http://192.168.1.100/tmp</a><br /></code><br />authforce will show you the current username and password being tried in realtime. If it gets a match you will see something like this:<br /><code><br />match [goonda:mysecretpass]<br /></code><br />Note that authforce will work against both http and https URLs, however you will need to add the <code>--no-ssl-fail</code> option if the site uses self-signed certificates. Happy Hacking!]]></description>
			<category>Web</category>
			<guid isPermaLink="true">http://www.goonda.org/kiss/index.php?entry=entry080310-185447</guid>
			<author>goonda</author>
			<pubDate>Mon, 10 Mar 2008 23:54:47 GMT</pubDate>
			<comments>http://www.goonda.org/kiss/comments.php?y=08&amp;m=03&amp;entry=entry080310-185447</comments>
		</item>
		<item>
			<title>Setup an SSL tunnel with stunnel 3.x</title>
			<link>http://www.goonda.org/kiss/index.php?entry=entry080307-202928</link>
			<description><![CDATA[<a href="http://www.stunnel.org/" target="_blank" >Stunnel</a> is a very handy utility for wrapping virtually any service in SSL. In a pentesting perspective its especially handy if you want to use a tool which only speaks HTTP (e.g. a perl LWP script which you are too lazy to make speak SSL, or want to make manual HTTP requests adhoc ;). We can setup a tunnel to our target SSL webserver, and have it bind to a local port we can use for access. <i>NOTE: This only applies to stunnel version 3.x, 4.x uses an stunnel.conf file instead of command line switches.</i><br /><br />For example, if our target webserver is called example.foo.com, with a webserver running SSL on port 443, we would run the following command to bind to a local high port e.g. 10666. If you attempted to bind to a local port below 1024, you would have to run this command as root:<br /><code><br />stunnel -d localhost:10666 -c -r example.foo.com:443<br /></code><br />To confirm that its working, first check the log (usually /var/log/messages, but /var/log/daemon.log on my system).<br /><code><br />Mar  7 20:20:32 localhost stunnel[22933]: Using &#039;example.foo.com.10666&#039; as tcpwrapper service name<br />Mar  7 20:20:32 localhost stunnel[22933]: stunnel 3.26 on i486-pc-linux-gnu PTHREAD+LIBWRAP with OpenSSL 0.<br />9.8c 05 Sep 2006<br />Mar  7 20:20:32 localhost stunnel[22934]: FD_SETSIZE=1024, file ulimit=1024 -&gt; 500 clients allowed<br /></code><br />So now our stunnel daemon process is listening on localhost, port 10666, ready to service our requests! Lets try it out by doing a simple HEAD request on the target webserver:<br /><code><br />user@host# nc localhost 10666<br />HEAD / HTTP/1.0<br /><br />HTTP/1.1 403 Forbidden<br />Date: Sat, 08 Mar 2008 01:12:44 GMT<br />Server: Apache<br />Connection: close<br />Content-Type: text/html; charset=iso-8859-1<br /></code><br />Excellent! I have also run password crackers like hydra through stunnel without problems, so it can take a beating. Happy Hacking!]]></description>
			<category>Web</category>
			<guid isPermaLink="true">http://www.goonda.org/kiss/index.php?entry=entry080307-202928</guid>
			<author>goonda</author>
			<pubDate>Sat, 08 Mar 2008 01:29:28 GMT</pubDate>
			<comments>http://www.goonda.org/kiss/comments.php?y=08&amp;m=03&amp;entry=entry080307-202928</comments>
		</item>
		<item>
			<title>Archive pages on Linux and Wireless (802.11b) are now up!</title>
			<link>http://www.goonda.org/kiss/index.php?entry=entry080305-220634</link>
			<description><![CDATA[I haven&#039;t updated my old Linux &amp; Wireless (802.11b) pages in at least five years (2003) but somehow these wacky people on the Internet still want to read about my ancient experiments getting various wireless cards to work under linux. Your mileage may vary, and I don&#039;t vouch for that info anymore. Heck, these pages don&#039;t even talk about 802.11g or any linux distro newer than Redhat 9!<br /><br />Please continue to check the <a href="http://www.goonda.org/kiss/index.php?category=6" target="_blank" >Wireless</a> section of this blog for new developments. I will be posting soon about DD-WRT on my linksys(es)!<br /><br />In the meantime if you want to read about getting <a href="http://www.goonda.org/archive/wireless/aironet/" target="_blank" >aironet</a>, <a href="http://www.goonda.org/archive/wireless/lucent/" target="_blank" >lucent</a>, or <a href="http://www.goonda.org/archive/wireless/prism2/" target="_blank" >prism2</a> cards to work under linux or the collection of links on wardriving, wep cracking, etc, check it out below at:<br /><br /><a href="http://www.goonda.org/archive/wireless/" target="_blank" >Goonda&#039;s Old Timey Wireless Shack</a><br /><br />Y&#039;all come back now, y&#039;hear?]]></description>
			<category>Wireless</category>
			<guid isPermaLink="true">http://www.goonda.org/kiss/index.php?entry=entry080305-220634</guid>
			<author>goonda</author>
			<pubDate>Thu, 06 Mar 2008 03:06:34 GMT</pubDate>
			<comments>http://www.goonda.org/kiss/comments.php?y=08&amp;m=03&amp;entry=entry080305-220634</comments>
		</item>
		<item>
			<title>OpenBSD pf tip: Examining pf logs</title>
			<link>http://www.goonda.org/kiss/index.php?entry=entry080305-192157</link>
			<description><![CDATA[OpenBSD&#039;s pf was ported to FreeBSD and made part of the base system in FreeBSD 5.3, which caused spontaneous combustion in the minds of firewall geeks everywhere. I don&#039;t want to start a flamewar, but prior to FreeBSD 5.3, pf was just about the only feature in OpenBSD that I was really jealous of as its probably the most advanced open-source firewall available. <br /><br />Once enabled, if pf is configured to log, will use the <code>pflog0</code> pseudo-device to log packets in libpcap format. This means that trusty <code>tcpdump</code> can be used to view your firewall logs in realtime, like so:<br /><br /><code><br />[root@phat /var/log]# tcpdump -n -tttt -e -i pflog0<br />tcpdump: WARNING: pflog0: no IPv4 address assigned<br />tcpdump: verbose output suppressed, use -v or -vv for full protocol decode<br />listening on pflog0, link-type PFLOG (OpenBSD pflog file), capture size 96 bytes<br />2008-03-05 20:40:30.293906 rule 12/0(match): pass in on sis0: 192.168.226.140.24951 &gt; 192.168.1.100.22: S 657096168:657096168(0) win 64512 &lt;mss 1460,nop,nop,sackOK&gt;<br />2008-03-05 20:40:30.322713 rule 13/0(match): pass out on sis0: 192.168.1.100.58585 &gt; 192.168.1.1.53:  47450+[|domain]<br /></code><br /><br />If you wanted to read an existing pf logfile rather than in realtime, use the same arguments to <code>tcpdump</code> as you would normally use to read a pcap file. In this example, I&#039;m specifically looking for blocked igmp traffic:<br /><br /><code><br />[root@phat /var/log]# tcpdump -n -tttt -e -r pflog.0 igmp|head -5<br />reading from file pflog.0, link-type PFLOG (OpenBSD pflog file)<br />2008-03-05 19:00:52.405159 rule 2/0(match): block in on sis0: 10.1.49.2 &gt; 224.0.0.1: igmp query v2<br />2008-03-05 19:01:26.748751 rule 2/0(match): block in on sis0: 10.1.49.2 &gt; 224.0.0.1: igmp query v2<br />2008-03-05 19:03:01.698925 rule 2/0(match): block in on sis0: 10.1.49.2 &gt; 224.0.0.1: igmp query v2<br />2008-03-05 19:03:36.042609 rule 2/0(match): block in on sis0: 10.1.49.2 &gt; 224.0.0.1: igmp query v2<br />2008-03-05 19:05:11.018437 rule 2/0(match): block in on sis0: 10.1.49.2 &gt; 224.0.0.1: igmp query v2<br /></code><br />]]></description>
			<category>Network</category>
			<guid isPermaLink="true">http://www.goonda.org/kiss/index.php?entry=entry080305-192157</guid>
			<author>goonda</author>
			<pubDate>Thu, 06 Mar 2008 00:21:57 GMT</pubDate>
			<comments>http://www.goonda.org/kiss/comments.php?y=08&amp;m=03&amp;entry=entry080305-192157</comments>
		</item>
		<item>
			<title>How to prevent image hotlinking with mod_rewrite</title>
			<link>http://www.goonda.org/kiss/index.php?entry=entry080304-122915</link>
			<description><![CDATA[<a href="http://httpd.apache.org/docs/1.3/mod/mod_rewrite.html" target="_blank" >mod_rewrite</a> is a powerful module for Apache for performing URL rewriting on the fly.  However sometimes if your regex kung-fu is not up to par, it can be a frustrating and hair-pulling exercise to figure out why your rewrite rules are not working. The solution is to add a couple logging lines into your httpd.conf or vhost stanza:<br /><br /><code><br />RewriteEngine On<br />RewriteLog &quot;/var/log/apache/rewrite_log&quot;<br />RewriteLogLevel 9<br />RewriteCond etc.<br /></code><br /><br />Once you&#039;ve debugged your problem, its advisable to take these lines out as they can generate A LOT of logs. Another thing I noticed is that these RewriteLog directives only seem to work when placed in the main httpd.conf, not in .htaccess files despite &quot;AllowOverride All&quot;.<br /><br />I was trying to prevent <a href="http://en.wikipedia.org/wiki/Inline_linking" target="_blank" >hotlinking</a> on this site. Basically that means someone who is linking directly to my images (and not to the page in which it is displayed). Essentially this amounts to bandwidth theft. To prevent this, I implemented the following mod_rewrite rules in .htaccess:<br /><br /><code><br />RewriteEngine on<br />RewriteCond %{REQUEST_FILENAME} \.(gif|jpg|js|css)$ [NC]<br />RewriteCond %{HTTP_REFERER} !^$<br />RewriteCond %{HTTP_REFERER} !^http://(www\.)?goonda.org/.*$ [NC]<br />RewriteRule \.(gif|jpg|js|css)$ - [F]<br /></code><br /><br />This code prevents any non-blank referrer which does not originate from my website (goonda.org) to receive a 403 (Forbidden) message. Works great!]]></description>
			<category>Web</category>
			<guid isPermaLink="true">http://www.goonda.org/kiss/index.php?entry=entry080304-122915</guid>
			<author>goonda</author>
			<pubDate>Tue, 04 Mar 2008 17:29:15 GMT</pubDate>
			<comments>http://www.goonda.org/kiss/comments.php?y=08&amp;m=03&amp;entry=entry080304-122915</comments>
		</item>
		<item>
			<title>OpenSSL tip: How to simply encrypt a file</title>
			<link>http://www.goonda.org/kiss/index.php?entry=entry080303-201603</link>
			<description><![CDATA[As part of a project at work recently, I had to figure out how to easily encrypt a file for one of our brain-dead developers. Luckily for me the excellent <a href="http://www.openssl.org" target="_blank" >OpenSSL Toolkit</a> was available on the Unix host. Here&#039;s how you do it:<br /><br />To encrypt a file:<br /><br /><i>openssl enc -aes-256-cbc -salt -in file.txt -out file.enc</i><br /><br />To base-64 encode it, simply add the -a switch (for &#039;ASCII&#039;):<br /><br /><i>openssl enc -aes-256-cbc -a -salt -in file.txt -out file.enc</i><br /><br />The encryption operation requires that you supply a passphrase.<br /><br />To decrypt the same file:<br /><br /><i>openssl enc -d -aes-256-cbc -in file.enc</i><br /><br />To decrypt base-64 version, you guessed it, add -a flag :<br /><br /><i>openssl enc -d -aes-256-cbc -a -in file.enc</i><br /><br />The passphrase will be prompted for. You can also supply the passphrase on the command line using the -pass option, or read the passphrase from a file using -pass file:/path/to/file.<br /><br />Neato. A lot more cool tips at the <a href="http://www.madboa.com/geek/openssl/" target="_blank" >OpenSSL Command-Line HOWTO</a>.<br /><br />Sure beats reading the heinously long and complex man pages for openssl! Now we really need a good way to be able to do this for batch jobs *without* having to store the passphrase in cleartext. ]]></description>
			<category>Crypto</category>
			<guid isPermaLink="true">http://www.goonda.org/kiss/index.php?entry=entry080303-201603</guid>
			<author>goonda</author>
			<pubDate>Tue, 04 Mar 2008 01:16:03 GMT</pubDate>
			<comments>http://www.goonda.org/kiss/comments.php?y=08&amp;m=03&amp;entry=entry080303-201603</comments>
		</item>
		<item>
			<title>cURL tip: How to do a simple HTTP POST</title>
			<link>http://www.goonda.org/kiss/index.php?entry=entry080303-201256</link>
			<description><![CDATA[<a href="http://curl.haxx.se/" target="_blank" >cURL</a> is a very useful utility to perform HTTP/HTTPS operations from the command line. Many times during a web application pentest you need to send an HTTP POST to a login form (e.g. brute force a login to the site). Here&#039;s the very simple way to do it, assuming you the form parameters are called <b>username</b> and <b>password</b>.<br /><br /><i>curl -d &quot;username=SOMEUSER&amp;password=SOMEPASS&quot; -k <a href="https://some.website.com/loginform.jsp" target="_blank" >https://some.website.com/loginform.jsp</a></i><br /><br />The &quot;-d&quot; indicates you are including data for a POST, the -k says ignore SSL certificate warnings from the remote site.<br /><br />Using curl is really only good for doing quick spot checks, to do large scale brute forcing I&#039;d recommend using <a href="http://thc.org/thc-hydra/" target="_blank" >THC Hydra</a>, the super useful perl module <a href="http://www.linpro.no/lwp/" target="_blank" >libwww-perl</a> aka LWP, or <a href="http://www.nessus.org" target="_blank" >Nessus</a> which has incorporated Hydra. On Windows, <a href="http://www.hoobie.net/brutus/" target="_blank" >Brutus</a> works.]]></description>
			<category>Web</category>
			<guid isPermaLink="true">http://www.goonda.org/kiss/index.php?entry=entry080303-201256</guid>
			<author>goonda</author>
			<pubDate>Tue, 04 Mar 2008 01:12:56 GMT</pubDate>
			<comments>http://www.goonda.org/kiss/comments.php?y=08&amp;m=03&amp;entry=entry080303-201256</comments>
		</item>
	</channel>
</rss>
