RUSTSEC-2021-0158 XSS in ammonia via SVG `animateMotion`, `animateTransform`, and/or `animateColor` tags

Not scored Published

Attackers can execute arbitrary JavaScript via unsanitized SVG animation tags if specific tags are explicitly allowed, requiring user interaction.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Over the internet
Victim action needed
A user has to click or open something
Fix
Available

What is RUSTSEC-2021-0158?

RUSTSEC-2021-0158 is a cross-site scripting vulnerability in ammonia, published on 10 Oct 2021. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.

Official description

The neutralization that ammonia applied to animate and set was not applied to other forms of SVG animation, which can be used for XSS.

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>
    <animateMotion attributeName="href" to="javascript:alert('SET_XSS')"></animateMotion>
    <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 any of these tags should not be affected, since none are allowed by default.


This vulnerability was reported by ucsurf.

Which versions are affected by RUSTSEC-2021-0158?

1 open source package ship an affected version, including ammonia.

PackageAffectedFixed in
ammonia crates.ioFrom 0.0.0-04.1.7, 4.2.3

How do I fix RUSTSEC-2021-0158?

Upgrade ammonia to a fixed version for your release line: 4.1.7 or 4.2.3.

Escape output for the context it lands in and set a strict Content Security Policy. Upgrading the affected component is the real fix. More about Cross-site scripting.

Is RUSTSEC-2021-0158 being exploited?

There is no known exploitation of RUSTSEC-2021-0158 in the wild and no public exploit code.

Sources

Also known as GHSA-f2pc-rwv3-69mv.

Is RUSTSEC-2021-0158 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free