CVE-2022-31103: Lettersanitizer Improper Handling Of CSS At-rules Vulnerability

HIGH
Advisory Identifier: GHSA-7r3r-gq8p-v9jj
CVSS 7.5
CWE-754
Published
Advisory Summary

CVE-2022-31103 is a HIGH (CVSS 7.5) improper handling of css at-rules vulnerability (CWE-754: Improper Check for Unusual or Exceptional Conditions) affecting Lettersanitizer libraries in the npm ecosystem. The issue involves improper handling of css at-rules in lettersanitizer. Remediation is available by upgrading affected packages to version 1.0.2.

CVE-2022-31103 at a Glance

CVE Identifier CVE-2022-31103
GHSA Identifier GHSA-7r3r-gq8p-v9jj
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-754: Improper Check for Unusual or Exceptional Conditions
Affected Product Lettersanitizer
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 7.5

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity None (I:N)
Availability High (A:H)

How to Fix CVE-2022-31103

To remediate this vulnerability, upgrade all affected Lettersanitizer dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

lettersanitizer fixed: 1.0.2
npm install lettersanitizer@1.0.2
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls lettersanitizer

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2022-31103, inspect your project dependencies using npm:

npm ls lettersanitizer

Analyze the terminal output to locate any version of Lettersanitizer in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.0.2), your application is affected.

Note: The npm ls lettersanitizer command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-754: Improper Check for Unusual or Exceptional Conditions, where the product does not check or incorrectly checks for unusual or exceptional conditions that are not expected to occur frequently during day to day operation of the product. In Lettersanitizer, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Impact 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. ### Patches The problem has been patched in version 1.0.2. ### Workarounds There is no workaround besides upgrading. ### References The issue was originally reported in the react-letter repository: https://github.com/mat-sz/react-letter/issues/17 ### For more information If you have any questions or comments about this advisory: * Open an issue in [lettersanitizer](https://github.com/mat-sz/lettersanitizer/issues) * Email me at [contact@matsz.dev](mailto:contact@matsz.dev)

CVE-2022-31103 Affected Lettersanitizer Versions

1 component(s)
Fixed Versions:
1.0.2
Product / Package Ecosystem Affected Versions Fixed Version
lettersanitizer
npm
< 1.0.2
1.0.2

References

Frequently Asked Questions

What is CVE-2022-31103?
CVE-2022-31103 is a security vulnerability in Lettersanitizer involving Improper handling of CSS at-rules in lettersanitizer under CWE-754: Improper Check for Unusual or Exceptional Conditions.
Which Lettersanitizer versions are affected?
Affected versions include releases prior to 1.0.2 across affected packages: lettersanitizer.
What version fixes CVE-2022-31103?
Upgrading to 1.0.2 (or the latest patched release for your respective branch) resolves the vulnerability.
Is lettersanitizer affected?
Yes, lettersanitizer is affected in releases prior to 1.0.2. Upgrade your dependency to 1.0.2 or later.
What is the CVSS score of CVE-2022-31103?
CVE-2022-31103 has a CVSS v3.1 base score of 7.5 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H.
What CWE is associated with CVE-2022-31103?
CVE-2022-31103 is classified under CWE-754: Improper Check for Unusual or Exceptional Conditions (The product does not check or incorrectly checks for unusual or exceptional conditions that are not expected to occur frequently during day to day operation of the product.).
How can I check npm dependencies for CVE-2022-31103?
Run the dependency tree command: 'npm ls lettersanitizer'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-7r3r-gq8p-v9jj",
  "modified" : "2022-07-07T17:15:28Z",
  "published" : "2022-06-23T17:48:19Z",
  "aliases" : [ "CVE-2022-31103" ],
  "summary" : "Improper handling of CSS at-rules in lettersanitizer",
  "details" : "### Impact\n\nAll versions of lettersanitizer below 1.0.2 are affected by a denial of service issue when processing a CSS at-rule `@keyframes`.\n\nThis package is depended on by [react-letter](https://github.com/mat-sz/react-letter), therefore everyone using react-letter is also at risk.\n\n### Patches\n\nThe problem has been patched in version 1.0.2.\n\n### Workarounds\n\nThere is no workaround besides upgrading.\n\n### References\n\nThe issue was originally reported in the react-letter repository: https://github.com/mat-sz/react-letter/issues/17\n\n### For more information\nIf you have any questions or comments about this advisory:\n* Open an issue in [lettersanitizer](https://github.com/mat-sz/lettersanitizer/issues)\n* Email me at [contact@matsz.dev](mailto:contact@matsz.dev)\n",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "lettersanitizer"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.0.2"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/mat-sz/lettersanitizer/security/advisories/GHSA-7r3r-gq8p-v9jj"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-31103"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/mat-sz/react-letter/issues/17"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/mat-sz/lettersanitizer/commit/96d3dfe2ef0465d47324ed4d13e91ba0816a173f"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/mat-sz/lettersanitizer"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-754" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-06-23T17:48:19Z",
    "nvd_published_at" : "2022-06-27T23:15:00Z"
  }
}