CVE-2026-102342: Ammonia Package Vulnerability Leading to Cross-site Scripting (XSS)

ammonia Updated 30 Sep 2026

Summary

29/09/2026
Yes i
Moderate
5.4

CVE-2026-102342: Ammonia: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting'). Affects ammonia across 3 version ranges.

< 3.3.3 >= 4.0.0, < 4.0.3 >= 4.1.2, < 4.1.4

Fixed in 3.3.3, 4.0.3 or 4.1.4, depending on the release line you run. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Your last release was probably never penetration tested Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

Ammonia is a Rust library designed for sanitizing HTML and SVG content to prevent security vulnerabilities such as XSS. It is widely used in web applications to ensure that user-generated content is safe for rendering in browsers. However, a recent vulnerability has been discovered that allows improper neutralization of input during web page generation, specifically through the use of SVG tags.

Vulnerability Detail

The vulnerability arises from the improper handling of SVG elements, particularly the 'animate' and 'set' tags. An attacker can craft an SVG that includes a link with a 'javascript' scheme, which, when clicked by a user, executes arbitrary JavaScript code. This can lead to stored XSS attacks, allowing attackers to execute scripts in the context of the user's session, potentially compromising sensitive information or performing actions on behalf of the user.

How To Fix

Latest published version: 4.2.4 as of 22 Oct 2026

Upgrading to it may include breaking changes; the versions below are the minimum fixed release for this vulnerability.

If you can't move to the latest

The minimum fixed version depends on the release line you run.

  • < 3.3.3 3.3.3
  • >= 4.0.0, < 4.0.3 4.0.3
  • >= 4.1.2, < 4.1.4 4.1.4

Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →

Workaround

As a temporary measure, do not enable the 'animate' or 'set' tags in your SVG content. This can help mitigate the risk of XSS until you can update to a patched version.

Conclusion

The Ammonia package has a vulnerability that allows for cross-site scripting through specific SVG tags. It is crucial to update to the patched versions to safeguard your applications. Additionally, using Vulert can help you monitor for such vulnerabilities in real-time.

See every vulnerability recorded for ammonia →

Share this vulnerability

FAQ

The vulnerability allows for stored XSS through improperly handled SVG elements in the Ammonia package.

You can use Vulert to monitor and alert for open-source vulnerabilities in your software. Check your application against the vulnerability using the Vulert playground at Vulert Scanner.

If exploited, this vulnerability can lead to unauthorized script execution in the user's browser, potentially compromising user data and session integrity.

Yes, you can temporarily disable the use of 'animate' and 'set' tags in your SVG content to reduce the risk of exploitation.

The CVSS score for this vulnerability is 5.4, indicating a moderate severity level.

Related vulnerabilities

Recent vulnerabilities recorded for ammonia.

How To Fix

Latest published version: 4.2.4 as of 22 Oct 2026

Upgrading to it may include breaking changes; the versions below are the minimum fixed release for this vulnerability.

If you can't move to the latest

The minimum fixed version depends on the release line you run.

  • < 3.3.3 3.3.3
  • >= 4.0.0, < 4.0.3 4.0.3
  • >= 4.1.2, < 4.1.4 4.1.4

Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback