GHSA-gj48-438w-jh9v: Bleach clean() / Cleaner() fails to sanitize dangerous URI schemes in allowed formaction attributes
Noroxi assessment
Priority: Monitor (action score 24/100)
- The sources we track (CISA KEV, Exploit-DB, Metasploit, Nuclei, GitHub) show no public exploit code or exploitation in the wild.
- Anyone who can reach it over the internet can trigger it. No account or password is required. A user must open a link or visit a page. No special conditions are required; it is repeatable.
- Fixed version: bleach (PyPI) 6.4.0.
Low priority for now. Upgrade to bleach (PyPI) 6.4.0 or later.
Generated automatically from the record's data: CVSS (NVD and CNA), CISA KEV and SSVC, FIRST EPSS, exploit sources, fixed versions. How we calculate it
Primary sources: OSV
### Summary Bleach `clean()` / `Cleaner()` fails to sanitize dangerous URI schemes in allowed `formaction` attributes. Bleach applies URI protocol sanitization only to attributes listed in `attr_val_is_uri`. While URI-bearing attributes such as `action`, `href`, `src`, and `poster` are included in that set, `formaction` is not. As a result, if a downstream application explicitly allows `formaction` on submit-capable controls in untrusted HTML, Bleach preserves dangerous values such as `javascript:alert(1)` instead of stripping them. This can lead to **submit-triggered JavaScript execution** in applications that rely on Bleach to sanitize untrusted HTML and allow the relevant tag/attribute combination. --- ### Details The issue appears to be a URI-sanitization coverage gap in Bleach’s sanitizer logic. Relevant code paths: * `bleach/sanitizer.py` — `BleachSanitizerFilter.allow_token` (around line 553) * `bleach/_vendor/html5lib/filters/sanitizer.py` — `attr_val_is_uri` (around line 525) In `BleachSanitizerFilter.allow_token`, URI protocol sanitization is only applied when: ```python id="pft79m" if namespaced_name in self.attr_val_is_uri: ``` However, `(None, 'formaction')` is currently missing from `attr_val_is_uri`. This creates an inconsistency where `action` is protocol-sanitized, but `formaction` is not. As a result, if a downstream application allows: * tags such as `<button>` or `<input>` * the `formaction` attribute then Bleach preserves dangerous URI schemes such as `javascript:` in `formaction`. Examples of affected submit-capable controls include: * `<button>` (default submit behavior unless `type="button"` is set) * `<input type="submit">` * `<input type="image">` This appears to be a real library-side sanitizer gap rather than only an application misuse issue, because Bleach already treats similar URI-bearing attributes (such as `action`) as protocol-sensitive and sanitizes them. Suggested minimal fix: Add: ```python id="4v4fkn" (None, 'formaction') ``` to `attr_val_is_uri` in: * `bleach/_vendor/html5lib/filters/sanitizer.py` I also prepared a minimal patch and focused regression tests if helpful. --- ### PoC Below are minimal reproductions using `bleach.clean()`. #### 1) `<button>` ```python id="d3g0v7" from bleach import clean print(clean( '<form><button formaction="javascript:alert(1)">go</button></form>', tags={'form', 'button'}, attributes={'button': ['formaction']}, )) ``` **Actual output:** ```html id="i4nd7s" <form><button formaction="javascript:alert(1)">go</button></form> ``` **Expected output:** ```html id="g4d2r1" <form><button>go</button></form> ``` --- #### 2) `<input type="submit">` ```python id="l4dy0j" print(clean( '<form><input type="submit" formaction="javascript:alert(1)" value="go"></form>', tags={'form', 'input'}, attributes={'input': ['type', 'formaction', 'value']}, )) ``` **Actual output:** ```html id="h8lgbt" <form><input type="submit" formaction="javascript:alert(1)" value="go"></form> ``` **Expected output:** ```html id="6y8mws" <form><input type="submit" value="go"></form> ``` --- #### 3) `<input type="image">` ```python id="g8q0x8" print(clean( '<form><input type="image" formaction="javascript:alert(1)" src="/foo.png"></form>', tags={'form', 'input'}, attributes={'input': ['type', 'formaction', 'src']}, )) ``` **Actual output:** ```html id="fd22kg" <form><input type="image" formaction="javascript:alert(1)" src="/foo.png"></form> ``` **Expected output:** ```html id="z6t6je" <form><input type="image" src="/foo.png"></form> ``` --- ### Impact This is a **client-side HTML sanitization bypass / dangerous URI preservation issue**. If an application relies on Bleach to sanitize untrusted HTML and explicitly allows: * `formaction` * and submit-capable controls such as `<button>` or `<input>` then Bleach can emit sanitized output that still contains a dangerous `javascript:` URI in `formaction`. That can lead to **submit-triggered JavaScript execution** when the user activates the control. Impact is limited to configurations that explicitly allow the relevant tag/attribute combination, but the issue is still security-relevant because: * `formaction` is a real browser sink * Bleach already protocol-sanitizes similar URI-bearing attributes like `action` * the omission creates inconsistent sanitizer coverage for dangerous URI schemes I would currently assess this as **Medium severity**. If useful, I also have: * a minimal patch * focused regression tests for: * `<button formaction="javascript:...">` * `<input type="submit" formaction="javascript:...">` * `<input type="image" formaction="javascript:...">` * a safe control case where `formaction="/submit"` is preserved
- Published
- Jun 16, 2026
- Updated
- Sep 10, 2026
- EPSS
- —
- CWE
- CWE-79
Report tools
Action score
24
Low priority for now.
- CVSS
- 24 / 40 · 6.1 / 10
- CISA KEV
- 0 / 30 · Not listed
- EPSS
- 0 / 30 · —
Get told when this record changes
- Not in KEV: no record of exploitation in the wild
- No public exploit code on record
- A fix has been released
If any of these changes, we'll tell you in the daily email digest.
Limit the impact of XSSCheck security headers
Is your version affected? Check itNoroxi analysis
What does it mean in your environment?
The assessment above is generated automatically from the record's data; it doesn't know your environment. Our team verifies on your systems whether this vulnerability is actually exploitable and which mitigation is enough.
We use this product, ask for helpAffected systems
Is your version affected?
Pick the product and type the version you run. It's compared with this record's version ranges in your browser; the version isn't sent anywhere.
| Vendor | Product | CPE |
|---|---|---|
| PyPI | bleach | pkg:pypi/bleach |
Limit the impact of XSS
This is a cross-site scripting (XSS) vulnerability. A well-configured Content-Security-Policy doesn't fix it, but greatly reduces its impact. Check your site's CSP and other security headers for free.
Check security headersPackage-level exposure
OSV and GitHub Advisory data: ecosystem, package and range. SBOM matching uses this table.
| Ecosystem | Package | Affected range | Fix |
|---|---|---|---|
| PyPI | bleach | before 6.4.0 | 6.4.0 |
Same product
PyPI: all recordsOther highest-scoring records for the same primary product.
- GHSA-g75f-g53v-794xBleach linkify(parse_email=True) CPU exhaustion via unbounded email regex scanning17Monitor
- GHSA-8rfp-98v4-mmr6Bleach: URI sanitization allows disallowed URI schemes with Unicode > U+00A0 in output0Monitor
Remediation
Which version to upgrade to
Fix versions compiled from the vendor, package registries and Microsoft. Verify the vendor's note before upgrading.
| Product / package | Fixed version | Source |
|---|---|---|
| PyPI:bleach | 6.4.0 | Package registry (OSV) |
Exploit status
No known public exploit
No public exploit has been observed yet. That doesn't mean you're safe, only that the bar is a little higher.
Research context
For pentesters and researchers: attack profile, score disagreement, timeline, patch commits, credits, variant and chain candidates, bug bounty scope. All derived from existing data; no exploit code.
Timeline
From publication to today: proof of concept, Metasploit module, CISA KEV and fix record. Dates are as reported by the sources.
No dated events beyond publication.
Not on record for this CVE: EPSS history · patch commit or PR link · researcher credit · variant or chain candidate · public bounty program.
Technical details
Attack conditions
- Anyone who can reach it over the internet can trigger it.
- No account or password is required.
- A user must open a link or visit a page.
- No special conditions are required; it is repeatable.
If successful
- Confidentiality
- low · data can be read
- Integrity
- low · data or configuration can be modified
- Availability
- none
Impact can extend beyond the vulnerable component (scope changes).
- Attack vector
- Network
- Attack complexity
- Low
- Privileges required
- None
- User interaction
- Required
- Scope
- Changed
- Confidentiality impact
- Low
- Integrity impact
- Low
- Availability impact
- None
Weakness class (CWE)
CWE-79 · Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')CVSS vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
osv
Root cause
User content is inserted into the page as HTML. The browser interprets the content as code rather than data.
The bug in code
The whole CWE-79 classA representative example of this vulnerability class. Not the vendor's source code; it shows the faulty pattern and its fix.
Vulnerable
commentEl.innerHTML = comment.body;Fixed
commentEl.textContent = comment.body;Attack context
MITRE CAPEC attack patterns and ATT&CK techniques for this weakness class (CWE). A starting point for detection rules and threat hunting.
Attack patterns (CAPEC)
ATT&CK techniques
—
Change log (1)
- Fix✗ → ✓
For records you follow, these changes also arrive as notifications. →
References
Show all references (2 more)Show less
Vendor advisories and official records. Exploit/PoC links are deliberately left out.