Ethical Hacking Learn to find vulnerabilities before the bad guys do! Gain real world hands on hacking experience in our state of the art hacking lab. Course designed and taught by expert instructors with years of penetration testing experience. 12 student maximum in every class. Certification attempt included in every package. | Computer Forensics Training at InfoSec Institute Gain the in-demand skills of a certified computer examiner, learn to recover trace data left behind by fraud, theft, and cybercrime perpetrators. Discover the source of computer crime and abuse at your organization so that it never happens again. All of our class sizes are guaranteed to be 12 students or less to facilitate one-on-one interaction with one of our expert instructors. |

| Subject: | Re: Universal PDF XSS Remediation (Fix) |
|---|---|
| Date: | Wed, 14 Feb 2007 18:59:29 +0200 |
Hi Cyril
See my comments below, -Amit
Amit,
It looks like I failed to state that the propsed filter is thought for applications which really need to protect authenticated session. The filter is not designed to protect any website from Universal PDF XSS. I mean what can you steal on a website which does not require authentication? One could probably steal the color out of the web servers ink tank making the web pages fade away. That's it ;) To be serious, you could abuse a domains trust and spoof login forms, hijack user to foreign web sites or spoof news content which might influence a company's share value. You might achieve that goal by abusing e-mail, newspapers or tv channels as well.
> amit wrote: > > Cyrill Brunschwiler wrote: > > > > Compass worked out an advanced technical paper which explains the > > recently identified Adobe Acrobat Plug-in vulnerability. > The document > > highlights the numerous useless remediation trials. Furthermore, you > > will experience why even the Open Web Application Security Project > > (OWASP) proposed solution seldom meets the requested security > > requirements. > > > > The full featured report is prepared for download at... > > http://www.csnc.ch/ (Anti-PDF-XSS Actions 9. Februar 2007) > > > > Interesting paper. Let's see: > > Regarding the "OWASP solution", it states: > "Unfortunately, the client IP address in entry server and proxy > environments is always the same and therefore an attack > during the ten > seconds timeout is still possible.". > This is only correct for users behind NAT/proxy. And the > attacker should > be behind the same proxy/NAT with the victims. I wouldn't say > that this > "seldom meets the requested security requirements", > especially when no > better solution is around (hold on, I'm getting to that).
As Ivan Ristic correctly recognised, I was especially talking about the following topology:
-------- -------------- -------------------- |Client|---(Internet)---|Entry Server|---|Application Server| -------- -------------- --------------------
Please see http://www.owasp.org/index.php/Talk:PDF_Attack_Filter_for_Java_EE, where OWASP states: "Absolutely - fixed", which is simply wrong. (I know I'm guilty as well, because I stated "the definitve solution" and missed to tell I'm talking about protection for authenticated sessions).
I suggest pointing out the remaining risk. I agree with Ivan Ristic's suggestions that the X-Forwarded-For header might be used to improve the OWASP suggested solution and forwarding the Client IP (Remote Proxy) to the backend system. But be aware of tied X-Forwarded-For headers and pick the correct IP (not the client1 IP because this one might be forged).
> Here is an attack against it: > 1. Attacker (from its own machine, at his/her leisure) goes to > http://any.whe.re/file.pdf > 2. Attacker is redirected to (say) > http://any.whe.re/file.pdf?t=12345#X, > and receives a Set-Cookie: jsessionid=67890 > 3. Attacker sends a malicious link to the victim: > http://any.whe.re/file.pdf;jsessionid=67890?t=12345#a=javascri > pt:alert(document.cookie) > 4. The victim's browser requests > http://any.whe.re/file.pdf;jsessionid=67890?t=12345 <http://any.whe.re/file.pdf;jsessionid=67890?t=12345> from the server > (filter). > 5. The filter considers this a legitimate request, because it > ties the > "t" to a session (67890) in which this t was produced. The > filter has no > idea that the session identifier was found in the URL and not in a > cookie, and the filter has no idea that the session was > actually created > for a different client. > > Note that the attack makes use of a J2EE application engine feature - > its willingness to accept URL session ID (even if the session ID was > originally provided via a cookie).
Thoughts on your sequence: 4,5) It makes no sense to request for cookies when the session was delivered in the URL
but you might agree, beeing able to get the jsession from anywhere else (E.g. from the current URL, browser history or proxy log).
1-5) Does it make sense to forge a URL including a stolen session where the attack goal is to steal the already stolen session again?
See above - the jsessionid of interest is in the cookie.
Not so fast ;-)
> > OK, that was a trivial attack, and circumventing it within > the current > code is pretty simple - only allow session IDs inside cookies. But in > the meanwhile we saw an important observation: a secure solution must > take into account the ability of an attacker to communicate with the > server and pass to the victim session-specific data. In this > respect, I > find the following statement from the paper questionable: > "In the sample filter code, session handling is based on > Cookies but the > code could easily be rewritten to allow URL rewriting which would > support clients that reject Cookies as well." > In light of the above attack, it would make life much easier for an > attacker, and quite hard for the filter - as now the filter > can't demand > that the session ID be presented to it via a cookie. How is > the filter > going to protect itself from that attack?
But I agree, if you want to improve protection for sites which doe not require authentication, then the filter should not accept sessions from the URL.
public void do(HttpServletRequest request) {
if (request.isRequestedSessionIdFromCookie()) {
//session delivered in cookie
}
}That's right.
> > Moving on to a pure cookie solution. To begin with, such solution was > already suggested in the past > (http://www.webappsec.org/lists/websecurity/archive/2007-01/ms > g00064.html), > and shown to be vulnerable to a similar attack > (http://www.webappsec.org/lists/websecurity/archive/2007-01/ms > g00065.html).
I missed that somehow but the idea is very similar.
> The attacker now needs to work harder. In step 1, he/she got a cookie
> (jsessionid), but in step 2 the session ID cannot be used in
> the URL. It
> has to be presented to the site inside a Cookie HTTP request header.
> That's where some flash techniques kick in. Flash allows
> pretty liberal
> manipulation of the HTTP request to an arbitrary site. So an attacker
> can send the victim a Flash link (in the attacker's site), or
> a simple
> link (to the attacker's site, showing HTML with Flash object). This
> Flash will send out the request to the PDF-hosting server with the
> Cookie header. Using trivial methods such as
> http://www.securityfocus.com/archive/1/441014 doesn't seem to
> work with
> the Cookie header, but more advanced techniques such as Rapid7's
> http://www.rapid7.com/advisories/R7-0026.jsp and my own
> http://www.securityfocus.com/archive/1/443391
<http://www.securityfocus.com/archive/1/443391> enable crafting
> a complete
> HTTP request. There's a bit of a complication here, since the forged
> request is the second one - the browser has to be forced to
> send another
> HTTP request so that the response will match it. But at the
> end of the
> day, the result is that it's possible to forge requests with
> Cookie header.
> Note: unlike anti-DNS pinning techniques, the Flash tricks
> don't provide
> access to the response, yet do operate within the target's
domain. So
> the XSS vectors are relevant.Over to you, -Amit
------------------------------------------------------------------------- Sponsored by: Watchfire
https://www.watchfire.com/securearea/whitepapers.aspx?id=701500000008fH6 --------------------------------------------------------------------------
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | RE: Universal PDF XSS Remediation (Fix), Cyrill Brunschwiler |
|---|---|
| Next by Date: | Log Injection, Daniel Grzelak |
| Previous by Thread: | RE: Universal PDF XSS Remediation (Fix), Cyrill Brunschwiler |
| Next by Thread: | Re: Universal PDF XSS Remediation (Fix), Amit Klein |
| Indexes: | [Date] [Thread] [Top] [All Lists] |