CVE-2026-102342
JSON

5.4medium

ammonia allows stored XSS through unsanitized SVG animate and set attributes

Severity
5.4medium CVSS:3.1 by GitHub_M
Exploit likelihood
0.27% (higher than 20% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
GitHub_M
Also known as
GHSA-m6mh-2hw2-555xRUSTSEC-2026-0213

Description

ammonia is a Rust library for repairing and securing untrusted HTML. Prior to 3.3.3, 4.0.3, and 4.1.4, applications that allow the SVG animate or set elements can retain an animation whose attributeName targets href and whose value uses the javascript scheme. The sanitized SVG can therefore create a script-bearing link, and a user who clicks the link can execute attacker-controlled script in the application's origin, enabling stored cross-site scripting. This issue is fixed in versions 3.3.3, 4.0.3, and 4.1.4.

Affected

Product or packageVersionsReported by
rust-ammonia ammonia< 3.3.3, >= 4.0.0, < 4.0.3, >= 4.1.2, < 4.1.4CVE List
ammonia (crates.io)before 3.3.3, from 4.0.0 before 4.0.3, from 4.1.2 before 4.1.4, from 0.0.0-0 before 3.3.3, from 4.1.0 before 4.1.4GitHub Advisory Database, RustSec Advisory Database

All scores

GitHub_M5.4medium CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N
GitHub5.4medium CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N

Classification

CWE-79

SSVC (CISA-ADP): exploitation none, automatable no, technical impact partial.

What each source says

CVE List

ammonia is a Rust library for repairing and securing untrusted HTML. Prior to 3.3.3, 4.0.3, and 4.1.4, applications that allow the SVG animate or set elements can retain an animation whose attributeName targets href and whose value uses the javascript scheme. The sanitized SVG can therefore create a script-bearing link, and a user who clicks the link can execute attacker-controlled script in the application's origin, enabling stored cross-site scripting. This issue is fixed in versions 3.3.3, 4.0.3, and 4.1.4.

GitHub Advisory Database

The following SVG will produce a link with a javascript scheme. If the user clicks this link, they will run it.

<svg xmlns="http://www.w3.org/2000/svg">
  <a>
    <set attributeName="href" to="javascript:alert('SET_XSS')"></set>
    <text y="30">Click set</text>
  </a>
</svg>
Impact

Allows stored XSS in applications that allow the animate and set tags.

Patches

Fixed in 3.3.3, 4.0.3, and 4.1.4

Workarounds

Do not enable the animate or set tags.

RustSec Advisory Database

The following SVG will produce a link with a javascript scheme. If the user clicks this link, they will run it.

<svg xmlns="http://www.w3.org/2000/svg">
  <a>
    <set attributeName="href" to="javascript:alert('SET_XSS')"></set>
    <text y="30">Click set</text>
  </a>
</svg>

Ammonia did not apply attribute filters based on attributeName, so the contents of the to, from, and values tags were not sanitized as URLs.

Applications that do not explicitly allow either of these tags should not be affected, since neither are allowed by default.


Discovered by: Younghun Ko (@koyokr)

References

https://github.com/rust-ammonia/ammonia/security/advisories/GHSA-m6mh-2hw2-555xweb
https://github.com/rust-ammonia/ammonia/pull/250web
https://github.com/rust-ammonia/ammonia/pull/251web
https://github.com/rust-ammonia/ammonia/pull/252web
https://github.com/rust-ammonia/ammonia/commit/9394bd81179e756cb911314deabd943f1a9c8989web
https://github.com/rust-ammonia/ammonia/commit/9e3335e2dd8ab07346ff7997f20662a3da4023f6web
https://github.com/rust-ammonia/ammonia/commit/d2ae1547f478bd84d158bc5e57f5d31437dc4d8dweb
https://github.com/rust-ammonia/ammonia/releases/tag/v3.3.3
https://github.com/rust-ammonia/ammonia/releases/tag/v4.0.3
https://github.com/rust-ammonia/ammonia/releases/tag/v4.1.4
https://github.com/rust-ammonia/ammoniapackage
https://rustsec.org/advisories/RUSTSEC-2026-0213.htmladvisory, web

Sources

SourceRecordLicence
CVE ListCVE-2026-102342 changed 2026-10-13CVE Terms of Use
GitHub Advisory DatabaseGHSA-m6mh-2hw2-555x changed 2026-09-29CC-BY-4.0
RustSec Advisory DatabaseRUSTSEC-2026-0213 changed 2026-09-30CC0-1.0
NVDCVE-2026-102342 changed 2026-10-16Public domain