Skip to content
CORS Write-up Advanced

A Tale Of Another SOP Bypass In Android Browser < 4.4

The Android stock browser before version 4.4 failed to enforce the same-origin policy correctly, so a page on one origin could read content from another origin. An attacker could use this to steal data from other sites the victim was logged into.

Rafay Baloch Follow

Published on rafaybaloch.com

The original lives on rafaybaloch.com

We do not hold its text, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

The original is short, so this covers everything it reports, then explains this kind of bug in general: how it works, how to test for it and how it is fixed. The general sections are about the bug class, not this target. Written with AI and checked against the original; the original is the record. 4 min read.

What the report shows

The write-up is titled "A Tale Of Another SOP Bypass In Android Browser < 4.4" and concerns the stock Android browser on versions below 4.4. The write-up is titled "A Tale Of Another SOP Bypass In Android Browser < 4.4" and is organised as short sections: a proof of concept, the vulnerable code, the fix, a proof of concept using a postMessage call, a proof of concept to steal data across domains, and results on individual devices.

From the original on rafaybaloch.com

The report's sections are headings, with the payloads and code not reproduced in the body text shown here. The sections are headings only; the payloads, the vulnerable snippet and the fix are not reproduced in the body. So the only concrete claims are the title, the affected browser range (Android browser below 4.4), and the fact that the researcher demonstrated the bypass in several ways: a basic proof of concept, one driven through postMessage, and one aimed at reading data across domains.

Root cause

The report does not describe the underlying defect in the text shown here. The report itself does not name the component, the parsing step or the check that failed, so treat that as an inference from the title rather than a finding stated in the text.

Impact

The report includes a section titled "Proof Of Concept To Steal Data Across Domains". The report does not state which data, under which conditions, or with what user interaction. No severity rating, CVSS score or bounty amount appears in the text.

Device results

The write-up lists named devices and browsers, each with a screenshot:

Section What it records
Sony Xperia result of the test on this device
LGNexus4 result of the test on this device
Samsung Galaxy S3 result of the test on this device
Safari Browser 5.0 result of the test in this browser
From the original on rafaybaloch.com

The text does not spell out pass or fail for each entry; the screenshots carry that information.

Google's response

The report ends with sections titled "Google's Response" and "In Closing".

From the original on rafaybaloch.com

The Google's Response section is present, with a screenshot, but the response text is not reproduced here. The report includes a section titled "The fix".

How this kind of bug works

The same-origin policy is the browser rule that lets scripts from one origin read and manipulate documents from the same origin while blocking access to other origins. An origin is the scheme, host and port together. Bypasses usually come from one of a few places: the check being applied to a string that the browser later reinterprets (encoding, case, trailing dots, userinfo in the URL), the check being skipped on a code path such as a redirect, a document.domain relaxation, a legacy API that returns a cross-origin object without the wrapper, or a parser differential between how the URL is validated and how it is fetched. Older engines with hand-written checks and less mature test suites are where these differences survive longest.

How to test for it

  1. Identify the browser and engine versions in scope. Legacy or embedded WebViews are the interesting surface; modern engines have had these paths hardened.
  2. Set up two origins you control, for example a page on one host that frames or opens a page on another, and try to read the second page's DOM, cookies or storage from the first.
  3. Vary the URL forms: different encodings of the host, extra dots, mixed case, credentials in the authority, redirects that change origin mid-navigation, and document.domain set to a parent domain on both sides.
  4. Exercise the messaging and window APIs: postMessage handlers that do not check event.origin, window.opener access, window.name reuse, and named frame targeting.
  5. A positive result is script on origin A reading a value that only origin B should expose, reproduced from a clean profile with no extensions.

Common false positives: the two pages actually share an origin because of a document.domain assignment, the data was already public or reflected into the attacker page by the server, a proxy or debugging tool rewrote the response, or the test relied on a browser flag that normal users do not enable. Always confirm with a second, independent read of the protected value.

How it is fixed

Fixes live in the browser: correct origin comparison after URL canonicalisation, consistent checks on every navigation and frame path, origin checks enforced on postMessage delivery, and deprecation of legacy relaxations such as document.domain. On the application side, defensive measures help even when the engine is patched: validate event.origin in message handlers, avoid relying on framing for security, and use X-Frame-Options or frame ancestors directives where isolation matters.

Hunting notes

This class hides in old or unusual browsers, embedded WebViews inside mobile apps, and any product that ships its own rendering engine. Recon signals include a stated minimum browser version, support pages for legacy Android or iOS, and apps that render remote content in an in-app browser. Because the bug is in the client, impact is shown by a working page that reads another origin's data on a real affected device, with the version recorded.

The original is short, so this covers everything it reports, then explains this kind of bug in general: how it works, how to test for it and how it is fixed. The general sections are about the bug class, not this target. Written with AI and checked against the original; the original is the record. 5 min read.

What happened, in plain words

This write-up is titled "A Tale Of Another SOP Bypass In Android Browser < 4.4". It is about the browser that came built into older Android phones, specifically versions below 4.4. The researcher, Rafay Baloch, describes it as a same-origin policy bypass.

To understand that, start with the same-origin policy. Every website has an "origin", which is the combination of three things: the scheme (http or https), the host name (the site's address) and the port number. Think of it like a building where each flat has its own locked door: the browser lets a page from one flat read and change things in its own flat, but not in the flat next door. That rule is what stops a random website you visit from reading your bank's pages in another tab. A bypass means finding a way around that locked door.

From the original on rafaybaloch.com

The post is organised as a series of short sections: a proof of concept, the vulnerable code, the fix, a proof of concept using a postMessage call, a proof of concept to steal data across domains, then results on individual devices, Google's response and a closing section. The sections are headings in the text shown here, with the payloads and code not reproduced.

A "proof of concept" is simply a small demonstration that shows a problem is real rather than theoretical. postMessage is a browser feature that lets two pages talk to each other by sending messages, even when they come from different origins. It exists precisely so pages can cooperate without breaking the same-origin rule, but only if the receiving page checks who sent the message. The report does not explain how the postMessage demonstration worked.

The report includes a section titled "Proof Of Concept To Steal Data Across Domains". The report does not say which data, under what conditions, or what the user would have to do. It also gives no severity rating, CVSS score or bounty amount.

Device results

The write-up lists named devices and browsers, each with a screenshot:

Section What it records
Sony Xperia result of the test on this device
LGNexus4 result of the test on this device
Samsung Galaxy S3 result of the test on this device
Safari Browser 5.0 result of the test in this browser
From the original on rafaybaloch.com

Testing on several real devices is what turns a claim into evidence: a browser bug can behave differently depending on the phone and the exact build. The text does not spell out pass or fail for each entry; the screenshots carry that information.

Google's response

The report ends with sections titled "Google's Response" and "In Closing".

From the original on rafaybaloch.com

The report includes sections titled "Google's Response" and "The fix", but their content is not reproduced here.

In general, how this kind of bug works

Same-origin policy bypasses usually come from one of a few places: the browser checking one form of a web address but then loading a slightly different form (through encoding, letter case, extra dots or credentials embedded in the address), the check being skipped on some path such as a redirect, a legacy relaxation called document.domain that lets related subdomains share an origin, an old interface that hands back another site's content without the usual wrapper, or a disagreement between the part that validates an address and the part that fetches it. Older browsers with hand-written checks and fewer tests are where such differences survive longest.

If you wanted to test for this yourself, the general approach is:

  1. Identify the browser and engine versions in scope. Old or embedded browsers are the interesting surface; modern ones have had these paths hardened.
  2. Set up two origins you control, one page that frames or opens a page on the other, and try to read the second page's content, cookies or storage from the first.
  3. Vary the address forms: different encodings of the host, extra dots, mixed case, credentials in the address, redirects that change origin mid-navigation, and document.domain set to a parent domain on both sides.
  4. Exercise the messaging and window features: postMessage handlers that do not check event.origin, window.opener access, window.name reuse, and named frame targeting.
  5. A positive result is script on one origin reading a value that only the other origin should expose, reproduced from a clean browser profile with no extensions.

Common false positives: the two pages actually share an origin because of a document.domain assignment, the data was already public or was reflected into the attacker page by the server, a proxy or debugging tool rewrote the response, or the test relied on a browser setting that normal users do not enable. Always confirm with a second, independent read of the protected value.

Fixes live in the browser: correct origin comparison after the address is normalised, consistent checks on every navigation and frame path, origin checks enforced when postMessage delivers a message, and removal of legacy relaxations such as document.domain. On the website side, defensive measures help even when the browser is patched: validate event.origin in message handlers, avoid relying on framing for security, and use X-Frame-Options or frame ancestors directives where isolation matters.

This class of bug hides in old or unusual browsers, embedded browsers inside mobile apps, and any product that ships its own rendering engine. Signals worth watching for include a stated minimum browser version, support pages for legacy Android or iOS, and apps that render remote content in an in-app browser. Because the bug is in the browser itself, impact is shown by a working page that reads another origin's data on a real affected device, with the version recorded.

Glossary

  • Same-origin policy: the browser rule that lets a page read and change its own origin's content but blocks access to other origins.
  • Origin: the scheme, host and port of a web address taken together.
  • SOP bypass: a way of getting around the same-origin policy so one site can reach another site's content.
  • Proof of concept (PoC): a small demonstration showing that a problem is real.
  • postMessage: a browser feature that lets pages send messages to each other across origins.
  • event.origin: the value in a received message that says which origin sent it, used to decide whether to trust the message.
  • document.domain: a legacy setting that lets related subdomains treat themselves as the same origin.
  • window.opener: a reference a page can hold to the window that opened it.
  • window.name: a string property of a window that can persist across navigations.
  • Redirect: a server instruction that sends the browser to a different address.
  • CVSS: a standard scoring system for rating the severity of a security issue.
  • X-Frame-Options: a response header that tells the browser whether a page may be shown inside a frame.
  • Frame ancestors: a content security policy directive that restricts which pages may embed a page in a frame.
  • WebView: an embedded browser component inside a mobile app.
  • False positive: a test result that looks like a problem but is not one.

More by Rafay Baloch

View all

4 more disclosed reports, best first.

More from Google

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

CORS misconfiguration

The lesson behind this report.

A permissive cross-origin policy lets another site read responses with the user's credentials.