# CVE-2022-31103: Improper handling of CSS at-rules in lettersanitizer

> Attackers can cause a denial of service in applications using lettersanitizer by sending emails with specific CSS at-rules.

- **Severity:** High 7.5 (`CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 27 Jun 2022
- **Updated:** 23 Apr 2025
- **Also known as:** GHSA-7r3r-gq8p-v9jj

## What is CVE-2022-31103?

CVE-2022-31103 is a high-severity denial of service vulnerability in mat-sz lettersanitizer, published on 27 Jun 2022. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

lettersanitizer is a DOM-based HTML email sanitizer for in-browser email rendering. All versions of lettersanitizer below 1.0.2 are affected by a denial of service issue when processing a CSS at-rule `@keyframes`. This package is depended on by [react-letter](https://github.com/mat-sz/react-letter), therefore everyone using react-letter is also at risk. The problem has been patched in version 1.0.2.

Weakness: CWE-754 (Improper Check for Unusual or Exceptional Conditions)

## Which versions are affected by CVE-2022-31103?

2 open source packages ship an affected version, including lettersanitizer. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `lettersanitizer` | npm | All versions | 1.0.2 |
| `lettersanitizer` | npm | All versions | 1.0.2 |

Products: Lettersanitizer Project Lettersanitizer.

## How do I fix CVE-2022-31103?

Upgrade lettersanitizer to 1.0.2 or later.

## Is CVE-2022-31103 being exploited?

There is no known exploitation of CVE-2022-31103 in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2022-31103 and fix it if it is affected.

What it is: CVE-2022-31103 is a high-severity denial of service vulnerability in mat-sz lettersanitizer, published on 27 Jun 2022. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: There is no known exploitation of CVE-2022-31103 in the wild and no public exploit code.

Affected packages and fixed versions:
- lettersanitizer (npm): affected all versions; fixed in 1.0.2
- lettersanitizer (npm): affected all versions; fixed in 1.0.2

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2022-31103/ (Markdown: https://insights.sbomify.com/CVE-2022-31103/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2022-31103
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2022-31103
- OSV: https://osv.dev/vulnerability/CVE-2022-31103

---
From sbomify Insights: https://insights.sbomify.com/CVE-2022-31103/
Summaries are generated and may contain mistakes; the official description above is the record.
