CVE-2023-27075
Description
A cross-site scripting vulnerability (XSS) in the component microbin/src/pasta.rs of Microbin v1.2.0 allows attackers to execute arbitrary web scripts or HTML via a crafted payload.
AI Insight
LLM-synthesized narrative grounded in this CVE's description and references.
Affected packages
Versions sourced from the GitHub Security Advisory.
| Package | Affected versions | Patched versions |
|---|---|---|
microbincrates.io | < 1.2.1 | 1.2.1 |
Affected products
2- Microbin/Microbindescription
Patches
Vulnerability mechanics
Root cause
"Missing HTML entity encoding of user-controlled pasta content before embedding it in a JavaScript context allows stored XSS."
Attack vector
An attacker creates a pasta (a text paste) containing a malicious payload, such as HTML tags or JavaScript event handlers. When a victim views that pasta, the content is rendered in the browser without proper HTML entity encoding [patch_id=1640960]. The `content_escaped()` function in `src/pasta.rs` only escaped backticks and dollar signs, leaving the content vulnerable to script injection. The attacker does not need authentication if the application allows public paste creation, and the payload executes in the victim's browser session.
Affected code
The vulnerability is in `src/pasta.rs` in the `content_escaped()` method, which only escaped backticks and dollar signs but not HTML-special characters. The template `templates/pasta.html` embeds the pasta content directly into a JavaScript context without HTML entity decoding safeguards. The `Cargo.toml` and `Cargo.lock` files show the addition of the `html-escape` crate as part of the fix [patch_id=1640960].
What the fix does
The patch adds the `html-escape` crate and wraps the output of `content_escaped()` with `html_escape::encode_text()` in `src/pasta.rs` [patch_id=1640960]. This converts HTML-special characters (e.g., `<`, `>`, `&`, `"`, `'`) into their corresponding HTML entities, preventing the browser from interpreting attacker-controlled content as markup. Additionally, the JavaScript in `templates/pasta.html` now decodes HTML entities via a `decodeEntity` function before writing content to the clipboard, ensuring the user still receives the original text when copying. The `copyURLBtn` null-check also prevents a potential JavaScript error on non-URL pastes.
Preconditions
- inputAttacker must be able to create a pasta (text paste) containing a malicious XSS payload.
- networkVictim must visit the page displaying the attacker's pasta content.
Generated on May 23, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.
References
5News mentions
0No linked articles in our index yet.