Skip to content
XSS Write-up Intermediate

Unpatched (0day) jQuery Mobile XSS

jQuery Mobile fetches any URL in the location hash and inserts the response into the page as HTML, so an attacker can achieve cross-site scripting if the site has an open redirect. The vendor considers the open redirect to be the vulnerability and will not patch the library.

sirdarckcat.blogspot.in

Published on sirdarckcat.blogspot.in

jQuery Mobile is a cool jQuery UI system that makes building mobile apps easier. It does some part of what other frameworks like Ember and Angular do for routing.

The author, on sirdarckcat.blogspot.in

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the library treats the location hash as a URL, fetches it, and inserts the response into the page without sanitisation, relying on the same-origin policy that an open redirect can bypass.

Impact

Any website using jQuery Mobile that has an open redirect anywhere is vulnerable to XSS, and even CSP with nonces can be bypassed by stealing the nonce first.

What the attacker needed

Site uses jQuery Mobile; site has an open redirect; victim clicks a crafted link

The fix

The vendor will not patch it; they suggest blocking cross-origin XHR requests that might redirect, and the author suggests fixing open redirects or using CSP with hashes or whitelists.

How it was found

  1. Put a URL in the location hash that points to an open redirect on the same site.
  2. The open redirect forwards to an attacker-controlled page.
  3. jQuery Mobile fetches the redirected page and inserts its content into the current page as HTML.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

jQuery Mobile is a tool for building mobile websites. It takes the part of the web address after the # symbol and, if it looks like a link, loads that page and inserts its content directly into the current page. If the site also has an 'open redirect' (a link that sends you to another site), an attacker can use that to make the inserted content contain harmful code, which then runs in the victim's browser.

What is XSS?

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.

Similar reports

View all

Same bug class and techniques, clearest first.

Cross-site scripting (XSS)

The lesson behind this report.

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.