Code injection in ReaderMode (CVE-2026-106189)
iOS Reader Mode loads distilled article HTML with the original site's URL as the base URL, which drops the site's HTTP CSP headers and provides no viewer-level CSP. A stored HTML injection on a site can therefore execute inline event handlers in Reader Mode with access to the victim origin's cookies and local storage.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 6 months
Project Fortify, an experimental security project, has identified the following potential security issue. If you're a feature owner CC-ed on this bug, please do your best to review these reports without the Chrome Security team.
Overview: iOS Reader Mode renders distilled content using LoadData with the original URL as the base URL, which drops the site's original HTTP CSP headers. Because the distilled template lacks its own CSP and the distillation engine does not strip inline event handlers, a stored HTML injection on a site will execute in Reader Mode with full access to the victim origin's cookies.
Affected files:
components/dom_distiller/core/viewer.ccios/chrome/browser/reader_mode/model/reader_mode_distiller_viewer.mmios/chrome/browser/reader_mode/model/reader_mode_content_tab_helper.mmcomponents/dom_distiller/core/javascript/dom_distiller_viewer_main.jscomponents/dom_distiller/core/html/dom_distiller_viewer.html
Estimated timestamp from git blame: 2026-01-23
Description
Chrome for iOS Reader Mode is vulnerable to a Content Security Policy (CSP) bypass that allows arbitrary JavaScript execution in the context of a victim site's origin.
This issue occurs because Reader Mode renders distilled HTML at the victim's first-party origin while simultaneously stripping the site's original HTTP-delivered CSP and failing to inject its own viewer-level CSP.
Technical Details
- Unprotected Template Generation: The HTML template for the viewer is generated by calling
dom_distiller::viewer::GetArticleTemplateHtmlinios/chrome/browser/reader_mode/model/reader_mode_distiller_viewer.mm. This is called withuse_offline_data=false. Incomponents/dom_distiller/core/viewer.cc, whenuse_offline_datais false, the restrictive<meta http-equiv="Content-Security-Policy">block is omitted, leaving the viewer HTML with no CSP. - CSP Stripping via LoadData: The distilled document is loaded using
web_state()->LoadData(data, @"text/html", page_url)inios/chrome/browser/reader_mode/model/reader_mode_content_tab_helper.mm.LoadDatacalls[WKWebView loadData:MIMEType:characterEncodingName:baseURL:], using the original article's URL as thebaseURL. Because the content is loaded as data rather than a network response, the original site's HTTP response headers (including its CSP) are lost. However, the document executes within the security origin of the original site. - Incomplete Sanitization: On iOS, DOM distillation defaults to a modified
Readability.js. While this script removes<script>tags, it clones attributes when changing node tags and usesinnerHTML/appendChildwithout stripping inline event handlers (e.g.,onerror,onload). - Unsafe Insertion: The distilled HTML is inserted into the live DOM using
innerHTMLwithinaddToPageincomponents/dom_distiller/core/javascript/dom_distiller_viewer_main.js. This synchronously executes any surviving inline event handlers before any post-processing can occur. - Shared Data Store: The Reader Mode
WebStateuses the sameBrowserState(ProfileIOS) as the original tab. Therefore, any executed script has full access to the victim origin'sWKWebsiteDataStore(cookies,localStorage, etc.).
Potential Exploitation Steps
Note: These are suggested steps based on static analysis.
- An attacker identifies a target site (
https://victim.example) with a strict CSP (e.g.,script-src 'self') and finds a stored markup injection point (e.g., a comment section) where they can inject{{media:0}}. - On the normal page, the site's CSP blocks the
onerrorhandler from executing. - The victim opens the injected article in Chrome for iOS and activates Reader Mode.
- Reader Mode distills the page, preserving the
onerrorpayload, and loads it viaLoadDatainto a permissive context athttps://victim.example. - The payload executes with full access to the victim's session data.
Suggested Fix
Ensure that a strict CSP is applied to the iOS Reader Mode viewer. This can be achieved by calling GetArticleTemplateHtml with use_offline_data=true to inject the restrictive CSP <meta> tag, or by modifying the iOS Reader Mode implementation to supply an equivalent CSP to the WKWebView context. Additionally, hardening Readability.js to strip on* attributes during extraction would provide defense-in-depth.
Evaluated with Chrome root at commit: 096fc8fdbfacf2546485756d03f160a3d04fcc9b
Results so far have been promising, but there can be wrong deductions. If this proves to be a false positive, please close as WAI; data from false positives will be used to improve accuracy over time. And please feel free to reach out to me directly if you have concerns or feedback on the project.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the iOS Reader Mode viewer generates its HTML template without a CSP and loads it via LoadData with the original URL as base URL, so the site's HTTP CSP is lost while the document still runs in the site's origin, and the distillation step does not strip inline event handlers.
Impact
An attacker could execute JavaScript in the victim site's origin and read the victim's cookies and local storage, but the report notes these are suggested steps from static analysis and may be a false positive.
What the attacker needed
Chrome for iOS; victim opens injected article in Reader Mode; attacker can store markup on the site
The fix
A strict CSP should be applied to the iOS Reader Mode viewer, for example by generating the template with the restrictive CSP meta tag or supplying an equivalent CSP to the WKWebView, and Readability.js should strip inline event handler attributes as defence in depth.
How it was found
- Find a target site with a strict CSP and a stored markup injection point where an inline event handler can be placed.
- Confirm the site's CSP blocks the handler on the normal page.
- Open the injected article in Chrome for iOS and activate Reader Mode.
- Reader Mode distils the page, keeps the handler, and loads it via LoadData at the victim origin.
- The handler executes with access to the victim's session data.
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 report has not been written yet. The Original tab links to the source.
A website can tell the browser which scripts are allowed to run using a rule called Content Security Policy (CSP). Reader Mode is a feature that shows a cleaned-up version of an article, and on iOS it loads that cleaned-up page as if it came from the original website, but without the website's CSP rules. If an attacker can leave a small piece of HTML in an article, that piece can run JavaScript when someone opens the article in Reader Mode, and the script can read the person's cookies for that site.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.