Slashdot Log In
Web 2.0 Under Siege
Posted by
Hemos
on Mon Apr 02, 2007 10:22 AM
from the in-dark-territory dept.
from the in-dark-territory dept.
Robert writes "Security researchers have found what they say is an entirely new kind of web-based
attack, and it only targets the Ajax applications so beloved of the 'Web 2.0' movement.
Fortify Software, which said it discovered the new class of vulnerability and has named it
'JavaScript hijacking', said that almost all the major Ajax toolkits have been found vulnerable. 'JavaScript
Hijacking allows an unauthorized attacker to read sensitive data from a vulnerable
application using a technique similar to the one commonly used to create mashups'"
This discussion has been archived.
No new comments can be posted.
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
XSS (Score:2, Interesting)
Re:XSS (Score:5, Informative)
(http://www.inter-sections.net/)
Daniel
Re:XSS (Score:5, Informative)
(http://www.inter-sections.net/)
Daniel
Vocabulary Fix (Score:3, Funny)
Okay, I'll be the first to ask. (Score:5, Insightful)
(http://www.clutterme.com/)
"In an example attack, a victim who has already authenticated themselves to an Ajax application, and has the login cookie in their browser, is persuaded to visit the attacker's web site. This web site contains JavaScript code that makes calls to the Ajax app. Data received from the app is sent to the attacker."
Re:Okay, I'll be the first to ask. (Score:5, Informative)
(http://amazing.com/)
Let's say someone wants to attack my site, amazing.com. I browse to their site, remarkable.com, and the exploit code gets loaded into my browser. Remarkable.com can post to amazing.com using AJAX and receive replies as though they were authenticated on my site, because the browser automatically sends the amazing.com cookies with it when accessing an amazing.com URL. It appears to the browser fundamentally as though I was in remarkable.com and then typed the amazing.com URL on to the address bar.
(Of course you could spoof the referer but not from an existing browser session so I think the referer can be relied on in this context.)
If this is so, then it could truly be a throbbing migraine to fix - you would have to use the HTTP referer field to verify that the site calling your Ajax code was valid.
Hope that helps. Not the cheeriest news this morning
D
Re:Okay, I'll be the first to ask. (Score:5, Informative)
No, that kind of thing has always been possible since the very first implementation of JavaScript. If you don't need POST, then you can even do it with plain HTML 2.0, no JavaScript.
The problem here is that JSON is a subset of JavaScript and so it is automatically parsed under the local domain's security context when it's included in a document with <script>. There's a few tricks to "hide" it even though it's already been parsed and is sitting in memory, I assume these guys have found a way around that.
Re:Okay, I'll be the first to ask. (Score:5, Informative)
No, that's the vulnerability. This allows other domains to get the data when the applications don't want to share it.
The news here is that the "additional precautions" that most Ajax libraries take are ineffective.
XSRF (Score:2, Interesting)
http://en.wikipedia.org/wiki/Cross-site_request_f
quick! (Score:5, Funny)
(http://freedomsforums.com/)
Duh (Score:3, Informative)
Mashups? (Score:5, Funny)
(http://robvincent.net/ | Last Journal: Tuesday October 09, @01:55PM)
Does this mean... (Score:3, Funny)
(Last Journal: Friday May 18, @11:07AM)
Where's the problem? (Score:5, Interesting)
So essentially it means that the attacker can use the authentication cookie of the user to authenticate them again, and then run javascript with that authentication. But why are AJAX apps storing authentication in cookies? If you need to store authentication (User session id's etc), store them in a variable within the javascript. That'll stay there until a page refresh clears variable status, and how many page refreshes occur with AJAX?
AJAX apps do not need to (and should not!) store user authentication in cookies. Cookies are useful for keeping a continual session open between pages. AJAX needs no continual session. If they don't use cookies, then other sites cannot use that authentication.
Where's the problem? (What am i missing?)
PimTerry
Re:Where's the problem? (Score:4, Informative)
AJAX really do need sessions. Just think of Gmail. It it a single AJAX session starting when you login, and finishing when you logout or timeout.
If AJAX don't use sessions, it would have to authenticate itself with username and password with each request it made to the server.
An better solution might be to let the AJAX application explicit handle sessions by storing the session id, and sending it in the post part of all it's requests. But that might be a problem with the browsers history, because it would then loose your session id, if you used the back button.
Shirky's Law: (Score:5, Interesting)
The obvious implication of Shirky's Law is that Web 2.0 services are an attractive nuisance and give spammers and other griefers an incentive to game the system. Any new web service has to account for this and build in extremely high levels of security. Obviously nobody is doing this.
Is that title sarcastic? (Score:4, Insightful)
(http://www.apaddedcell.com/)
This is a vulnerability that appears only when passing Javascript between client and server. An attacker has to get a potential-victim who is logged-in to a site, that uses the JSON format to exchange data using AJAX, to visit a page they've setup. Then the attacker can intercept the data as it travels between client and server, a man in the middle attack. From the article:
So it's a known method of attack, but because it's aimed at web sites using AJAX it has to be labelled 'Web 2.0'. Ugh.
We've already seen this before (Score:5, Interesting)
(http://slashdot.org/dev/null)
It actually could be pretty nasty. I think the only solution is for you to pass authenticated tokens through the url or input parameters (not through cookies).
It might be a good time to use the firefox NoScript plugin if you're not using it already. Only allow javascript on sites you trust.
Re:We've already seen this before (Score:5, Informative)
http://getahead.org/blog/joe/2007/01/01/csrf_atta
Of course, DWR 2.0 will have all this goodness built in.
They discovered this? (Score:1, Informative)
(http://www.noprizes.net/)
All AJAX applications transfer data between the webpage in the client's browser and the server. If the data is in XML, the webpage and the XML have to come from the same server. If it's JSON (JavaScript Object Notation), then they do not have to come from the same server. So, if you are sending data that depends on some kind of authentication - don't use JSON.
The JSON vulnerability comes from having your session open too long. Someone navigates to a bad site and it access the active session on the target site. Shorter session timeouts help with this. You can also do some authentication in the XML request as well. And don't use JSON for data that requires authentication.
In short, if you're using AJAX for data that requires authentication, then you need to take some simple precautions.
Easy Fix (Score:2, Funny)
Leaves web to trusted sites only (Score:2)
So if I only visit about 10 websties daily and those 10 sites I'm reasonably sure are safe why would I go anywhere else if it could cause problems to my computer? I've seen and heard from a lot of people fed-up with spyware, adware and viruses. Its a waster of their time. So going to these other sites, simply because they could be infected would also be a waste of their time (assume they're interested in the content). If this blows up any more - or alternately - if the perception exists that the Internet will only get worse, its not going to help people go much past those 10 websites regularly.
Suprised? (Score:1)
(http://boxxa.com/)
Backwards quote... (Score:2)
Actually, I'd claim "everybody" with a toe in the security world thought it was the opposite; we'd start hearing about daily/weekly Ajax security problems as a regular course of business.
(If you think various operating systems have legacy code problems; you don't know "Javascript as implemented by browsers"...)
The Biggest WTF... (Score:5, Funny)
(Captcha: backtotheweb1.0)
Detailed report on this problem (no reg required) (Score:3, Informative)
sigh (Score:5, Insightful)
I still maintain that the collective blindness to these security issues comes from our absolute refusal to see HTTP requests as function calls. This is partly due to the silly ideology of the REST crowd.
Rephrase the situation as follows and see if this doesn't make you pee your pants: "Any site can instruct your browser to execute an arbitrary function on another site using your authentication credentials."
Re:sigh (Score:4, Interesting)
That'll be because it is. It's basically an observation that CSRF on a site which returns data in JSON format allows the attacker to read the content of the result. Well, duh. Of course that happens. It's one of the reasons I've always opposed JSON as a useful format.
The other reason is equally bad, but only applies to "mash up" type situations: the coder of the client has to trust the server with access to all data in the client. This makes it useless in many situations.
The best solution would be to scrap the current security system, make subrequest cookies (including XMLHttpRequests) dependent on both the domain the request goes to *and* the domain of the page that caused the request, and allow XMLHttpRequest to access servers other than the page source. This would both fix CSRF and eliminate the need for JSON. What more do you want?
vulnerable == cookie && json && !p (Score:3, Informative)
- It uses cookies to store session IDs or other forms of credentials; and
- It sends data from server to browser using "JSON" notation; and
- It doesn't require POST data in each request.
A vulnerable application can be fixed by changing any of these three aspects:
- Stop using cookies, and instead supply the credentials in the request's URL or POST data.
- Don't use JSON, or munge your JSON so that it can't be run directly from within a <script> tag; for example, you could put comments around it in the server and strip them off in your client.
- Have the client send some POST data and check for it on the server (a <script> tag can't send POST data).
My preference, and the strategy that I've used in Anyterm and Decimail Webmail, is to not use cookies. To me it actually seems easier to put the session ID in the request, rather than to mess around with cookies.
The advisory, which explains it all but is a bit waffly at the start, is at http://www.fortifysoftware.com/servlet/downloads/
On the upside... (Score:1)
(http://technical-writing.dionysius.com/ | Last Journal: Monday November 05, @03:35PM)
i told that EVERY time AJAX - 2.0 hype was posted (Score:4, Interesting)
(http://www.webgeekworld.com/ | Last Journal: Thursday April 27 2006, @07:47AM)
XML is so last week. What's really wrong. (Score:5, Informative)
(http://www.animats.com)
XML is now so last week. Really l33t web apps use JSON, which is yet another way to write S-expressions like those of LISP, but now in Javascript brackets.
There are several security problems with JSON. First, some web apps parse JSON notation by feeding it into JavaScript's "eval" [json.org]. Now that was dumb. Some JSON support code "filters" the incoming data before the EVAL, but the most popular implementation missed filtering something and left a hole. Second, there's an attack similar to the ones involving redefining XMLHttpRequest: redefining the Array constructor. [getahead.org] (Caution, page contains proof of concept exploit.)
The real problem is JavaScript's excessive dynamism. Because you can redefine objects in one script and have that affect another script from a different source, the language is fundamentally vulnerable. It's not clear how to allow "mashups" and prevent this. The last attempt to fix this problem involved adding restrictions to XMLHttpRequest, but that only plugged some of the holes.
As a minimum, it's probably desirable to insist in the browser that, on secure pages, all Javascript and data must come from the main page of the domain. No "mashups" with secure pages.
Re:XML is so last week. What's really wrong. (Score:4, Interesting)
You don't say. My first thought on hearing about the entire idea was "why would you want to let a foreign server run its code on your page?"
The real problem is JavaScript's excessive dynamism. Because you can redefine objects in one script and have that affect another script from a different source, the language is fundamentally vulnerable.
Err... if I don't let foreign code execute (e.g. by doing 'var e = document.createElement("script"); e.src = "http://www.someotherserver.com/potential-securit
The last attempt to fix this problem involved adding restrictions to XMLHttpRequest, but that only plugged some of the holes.
The fix seems obvious to me:
* cookies in subrequests must be tied to the domain of the page that initiated the request as well as the domain the request goes to; this reduces the possibility of CSRF. So if www.a.com has a web page that requests data from www.b.com, it will only send a cookie if www.b.com set one in response to a previous request from www.a.com. This applies to SCRIPT tags, to IFRAME tags, to IMG tags, to LINK tags, etc.
* XMLHttpRequest must not be tied to the same-domain policy. Attempts to access a different domain should result in a request for confirmation from the user for the first time any particular requester/receiver domain pair is used. This means mashups (and other applications that need cross-domain access) can be written that do not need to use JSON. JSON parsing through script insertion or eval() is insecure, and should be deprecated.
As a minimum, it's probably desirable to insist in the browser that, on secure pages, all Javascript and data must come from the main page of the domain. No "mashups" with secure pages.
Scripts, yes. I don't see the need to ensure that data originates in the same domain.
Old truths new truths... (Score:2)
(http://slashdot.org/)
That is, when ANY new technique or code module is to be used in a production environment, it should not be considered ready until it has been thoroughly attacked by a person who has the kind of mind-set that will expose code vulnerabilities before a user (or set of users) finds them.
Trouble is, most IT organizations have a hard sell to get that type of person within the company -- first, because an "inside the firewall" attacker is counter-intuitive to the idea that a company should trust their employees, and second, the position seems redundant IF the programmers are up to speed on writing secure applications. Which -- catch 22 here -- they won't know until it is too late. Secondarily, inside the wire attackers are much more dangerous than outside attackers, because the inside the wire person comes to know exactly what is vulnerable, and what can be done with that knowledge.
Any thoughts?
Executing 3rd party code by default is insecure? (Score:1)
Fortunately the web development community has learned so much from the ongoing ramifications of Microsoft's "features first, security later" approach in the 90's that we would never recreate such a mess. Oh wait - automatic, default execution of third party code on the client browser, INSIDE THE FIREWALL? What could possibly go wrong with that?
The arguments today also mirror what went on with Windows and Outlook in the 90's. A few wild haired prophets screaming doom and gloom but 99.9% of the IT community was/is hypnotized by the glamour of "features, features, features" and security is relegated to patching. Like building a submarine out of swiss cheese. You'll spend the rest of your life patching but if everyone does it, it's normal. A few weirdos will look up and say "why don't we just start with a less porous base material?" but they will be shouted down by the masses.
Javascript, Flash and Applets are insecure by concept. Oh, pardon me, sandboxes will take care of everything? Append an image to the DOM from your server. If that "image" is actually a program which reads the query string you can pass it any information you want. Sandbox jumped. Not a bug, a feature.
It's not enough to patch websites. It only takes one popular compromised site to infect thousands or even millions of users. Do I trust every site on the internet to be 100% invulnerable 24/7? Not really. Not even the sites I work on.
Most BANKS and financial services require Javascript to log in. Nice to know such critical web services are designed by people who "care about customer security." (cough, cough)
NoScript [noscript.net] seems to be a reasonable compromise. No browser I'm aware of takes this approach by default.
I'm still waiting! (Score:1)
I'm out for justice
I give up. (Score:2)
First the MS cursor exploit [slashdot.org], now this. How are we supposed to surf the web, anymore? That's it! I'm going back to Morse Code:
_-_- ___ __ - __- - _ --- ___ __ - --- _ ___ -__-
Examples? (Score:2)
cookie still needs to be stolen doesn't it? (Score:1)
(http://www.resplect.com/)
Where is my understanding flawed?
Where's the actual hole? (Score:1)
Under Siege (Score:1)
(http://www.precio-venta.com/)
Good news for "Web 2.0" douchebags (Score:1)
xajax (Score:1)
Interestingly the article says that xajax is vunerable, but then in the PDF report mentions that xajax isn't vunerable because it doesn't use JSON
Stop misusing this term, okay? (Score:2)
(Last Journal: Saturday March 08 2003, @03:00PM)
“Web 2.0” is not AJAX and “AJAX” is not Web 2.0. These terms are not synonyms nor does one necessarily imply the other. Yes, AJAX is an important participant, but Web 2.0 is really about service architecture [oreillynet.com] that is equally consumable by machines and people—a notion that somewhat embodies the original vision of the Web. The article title “Web 2.0 Under Siege” is misleading nonsense. It is analogous to stating that programming is “under siege” because a library exists that contains a vulnerability.
nonsense (Score:2)
require_once("include/session.inc");
Where session.inc reads the user cookie (or whatever the authentication mechanism your app uses), and sets up a validated user.
There is NO DIFFERENCE in the way users are authenticated between server side code that renders a regular page, and server side code that is called by ajax. One generally returns HTML, the other generally returns javascript or XML, but as far as authentication goes, they should use the same mechanism.
If your ajax code is capable of returning data that is not authorised, then the problem exists entirely between keyboard and chair. If that is the case with your app right now, then its something you should be able to fix entirely during your lunch break.
I have said it before on slashdot (re the Delphi/PHP thing) - ajax is not rocket science, its just a few extra lines of javascript to your program to call another program and get the results asynchronously. There is NO NEED to buy into some bloated third party 'pointy clicky enterprisey ajax' framework that cannot possibly know anything about your existing authentication methods.
It's simple to defend against. Don't be a wimp (Score:1)
ASP.NET Ajax is not affected (Score:2)
Re:...allows an unauthorized attacker... (Score:1)
(http://www.geocities...wers/7210/index.html)
Re:Enough (Score:3, Informative)
enough semantics! (Score:1)
Given that the article was not aimed directly at web developers, but at people interested in computing in general, it's appropriate for them to use buzzwords to convey their message.
If I'm talking with another web developer, I'll get upset if he/she uses "web 2.0" in a sentence -- when it comes to my profession, I hate the word. When dealing with non-web tech savvy people, it's a helpful tool to refer to dynamic websites of the type that may have this vulnerability.
Very few news articles are ever written for the
Re:Enough (Score:2)
Seriously, when they said Web 2.0, I knew what they were talking about (it's the "Under Seige" part that I felt was dumb). I knew they were talking about javascript and XMLHttpRequest stuff that is frequently called AJAX (another term which some people whine about). Do you even know what a buzzword is? It's something you add to a product because it's popular. Like "object oriented" or "xml" when it's irrelevant to the actual functioning of the product. On the other hand Web 2.0/AJAX defines web applications that function in quite a different manner than non Web 2.0/AJAX ones.
Re:Enough (Score:1)
(http://www.aaronmillercomputer.com/)
Re:Enough (Score:2)
My company lost a client last year, because we were realistic with telling him what we could achieve over his web site. Meanwhile a "Web 2.0 consultant" told him that using the power of Web 2.0 he could keep my client's web site in the top google spot for search terms of his choice. My client was gullible enough to believe him.
Re:Enough (Score:2)
(Last Journal: Friday January 30 2004, @06:40PM)