RUSTSEC-2021-0074

Source
https://rustsec.org/advisories/RUSTSEC-2021-0074
Import Source
https://github.com/rustsec/advisory-db/blob/osv/crates/RUSTSEC-2021-0074.json
JSON Data
https://api.osv.dev/v1/vulns/RUSTSEC-2021-0074
Aliases
Published
2021-07-08T12:00:00Z
Modified
2023-11-08T04:06:26.105627Z
Summary
Incorrect handling of embedded SVG and MathML leads to mutation XSS
Details

Affected versions of this crate did not account for namespace-related parsing differences between HTML, SVG, and MathML. Even if the svg and math elements are not allowed, the underlying HTML parser still treats them differently. Running cleanup without accounting for these differing namespaces resulted in an "impossible" DOM, which appeared "safe" when examining the DOM tree, but when serialized and deserialized, could be exploited to inject arbitrary markup.

To exploit this, the application using this library must allow a tag that is parsed as raw text in HTML. These [elements] are:

  • title
  • textarea
  • xmp
  • iframe
  • noembed
  • noframes
  • plaintext
  • noscript
  • style
  • script

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

Database specific
{
    "license": "CC0-1.0"
}
References

Affected packages

crates.io / ammonia

Package

Affected ranges

Type
SEMVER
Events
Introduced
0.0.0-0
Fixed
2.1.3
Introduced
3.0.0
Fixed
3.1.0

Ecosystem specific

{
    "affected_functions": null,
    "affects": {
        "os": [],
        "functions": [],
        "arch": []
    }
}

Database specific

{
    "cvss": null,
    "informational": null,
    "categories": [
        "format-injection"
    ]
}