Skip Links

XSS web attacks could live forever, researcher warns

Cleaning up a website after a cross-site scripting attack may no longer be enough to protect its users

By Lucian Constantin, IDG News Service
October 04, 2011 11:05 AM ET
  • Print

Websites that accidentally distribute rogue code could find it harder to undo the damage if attackers exploit widespread browser support for HTML5 local storage and an increasing tendency for heavy users of Web apps never to close their browser.

If browsers don't provide a mechanism for websites to securely recover from certain cross-site scripting attacks, the attacks could become invincible and the site at the origin of the attack remain compromised indefinitely, warned vulnerability researcher and Google security engineer Michal Zalewski in a blog posting on Saturday.

The scope of client-side programming languages such as JavaScript within browsers is limited by a critical security concept known as the same-origin policy. This prevents scripts running on certain Web pages from interfering with websites opened in separate tabs or windows.

In the case of cross-site scripting (XSS), attackers manage to insert rogue JavaScript code in targeted pages, where it is then executed in the context of their origin, defined by the domain, the protocol and the port number.

JavaScript is very powerful and is used in most types of Web-based attacks. Despite this, browsers don't currently provide a mechanism that can be used to invalidate such code, something that would provide compromised websites with a way to request a clean slate once they had resolved the problem.

A normal response to XSS attacks is to patch the vulnerability, invalidate session cookies so that everyone is forced to re-authenticate, and optionally force a password change. But this is not enough, because, according to Zalewski, once compromised a Web origin can stay tainted indefinitely.

"At the very minimum, the attacker is in full control for as long as the user keeps the once-affected website open in any browser window; with the advent of portable computers, it is not uncommon for users to keep a single commonly used website open for weeks," he said. "During that period, there is nothing the legitimate owner of the site can do -- and in fact, there is no robust way to gauge if the infection is still going on."

In essence, there is no way for websites to ensure that their users are no longer affected by an XSS attack. Still, one would be inclined to think that such an attack would stop at some point without the website's intervention, such as when closing the tab or the browser, but as it turns out, that's not necessarily the case.

There are several methods that attackers can use to extend their hold on a compromised origin pretty much indefinitely, according to Zalewski.

One such scenario would involve inserting rogue JavaScript code into a popular webmail service or social networking site. This code could run in the background with the ability to obtain window handles for every new tab opened as a result of clicking on a link from the compromised page. If the newly opened pages had the same origin as the original page, or loaded a piece of code from the same domain, the rogue code could copy itself over to them and the process could begin again.

  • Print
What is Tech Briefcase?
TechBriefcase is a new, free service where IT Professionals can Search, Store and Share IT white papers and content like this. Learn more
Bookmark content
Speed up your research efforts with content across the web.
Search and Store
Find the white papers you need. Create folders for any topic.
View Anywhere
Open your briefcase on your iPhone, tablet or desktop. Share with colleagues.
Don't have an account yet?

Videos

rssRss Feed