CVE-2022-41854: Snakeyaml Denial of Service Vulnerability

MODERATE
Advisory Identifier: GHSA-w37g-rhq8-7m4j
CVSS 6.5
CWE-121 CWE-787
Published
Advisory Summary

CVE-2022-41854 is a MODERATE (CVSS 6.5) denial of service vulnerability (CWE-121: Stack-based Buffer Overflow) affecting Snakeyaml libraries in the Maven ecosystem. The issue involves snakeyaml vulnerable to stack overflow leading to denial of service. Remediation is available by upgrading affected packages to version 1.32.

CVE-2022-41854 at a Glance

CVE Identifier CVE-2022-41854
GHSA Identifier GHSA-w37g-rhq8-7m4j
Severity MODERATE
CVSS v3.1 Base Score 6.5
CWE Classification CWE-121: Stack-based Buffer Overflow
Affected Product Snakeyaml
Package Ecosystem Maven
Published Date
Last Updated

Security Impact

CVSS: 6.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:R/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 Required (UI:R)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity None (I:N)
Availability High (A:H)

How to Fix CVE-2022-41854

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

org.yaml:snakeyaml fixed: 1.32
<dependency>
    <groupId>org.yaml</groupId>
    <artifactId>snakeyaml</artifactId>
    <version>1.32</version>
</dependency>
Verify Direct and Transitive Dependencies

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

mvn dependency:tree -Dincludes=org.yaml

How to Check if You Are Affected

To determine whether your Java application is affected by CVE-2022-41854, inspect your build dependencies using the Maven Dependency Plugin:

mvn dependency:tree -Dincludes=org.yaml

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

Note: The mvn dependency:tree -Dincludes=org.yaml command inspects the resolved dependency graph declared in your project's POM files; it does not perform automated security scanning or inspect runtime dynamic classpaths. Always verify runtime container classpaths and shaded JARs.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-121: Stack-based Buffer Overflow, where a stack-based buffer overflow condition is a condition where the buffer being overwritten is allocated on the stack (i.e., is a local variable or, rarely, a parameter to a function). In Snakeyaml, 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

Those using Snakeyaml to parse untrusted YAML files may be vulnerable to Denial of Service attacks (DOS). If the parser is running on user supplied input, an attacker may supply content that causes the parser to crash by stack overflow. This effect may support a denial of service attack.

CVE-2022-41854 Affected Snakeyaml Versions

1 component(s)
Fixed Versions:
1.32
Product / Package Ecosystem Affected Versions Fixed Version
org.yaml:snakeyaml
Maven
< 1.32
1.32

References

NVD — CVE-2022-41854 NVD
https://nvd.nist.gov/vuln/detail/CVE-2022-41854
bitbucket.org/snakeyaml/snakeyaml PACKAGE
https://bitbucket.org/snakeyaml/snakeyaml
bitbucket.org/snakeyaml/snakeyaml... WEB
https://bitbucket.org/snakeyaml/snakeyaml/commits/e230a1758842beec93d28eddfde568c21774780a
bitbucket.org/snakeyaml/snakeyaml... WEB
https://bitbucket.org/snakeyaml/snakeyaml/issues/531
bugs.chromium.org/p/oss-fuzz/issues/d... WEB
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=50355
lists.fedoraproject.org/archives/list/packa... WEB
https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/3DDXEXXWAZGF5AVHIPGFPXIWL6TSMKJE
lists.fedoraproject.org/archives/list/packa... WEB
https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/7MKE4XWRXTH32757H7QJU4ACS67DYDCR
lists.fedoraproject.org/archives/list/packa... WEB
https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/KSPAJ5Y45A4ZDION2KN5RDWLHK4XKY2J
lists.fedoraproject.org/archives/list/packa... WEB
https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/3DDXEXXWAZGF5AVHIPGFPXIWL6TSMKJE
lists.fedoraproject.org/archives/list/packa... WEB
https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/7MKE4XWRXTH32757H7QJU4ACS67DYDCR
lists.fedoraproject.org/archives/list/packa... WEB
https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/KSPAJ5Y45A4ZDION2KN5RDWLHK4XKY2J
Snakeyaml Security Information SECURITY
https://security.netapp.com/advisory/ntap-20240315-0009
Snakeyaml Security Information SECURITY
https://security.netapp.com/advisory/ntap-20240621-0006

Frequently Asked Questions

What is CVE-2022-41854?
CVE-2022-41854 is a security vulnerability in Snakeyaml involving Snakeyaml vulnerable to Stack overflow leading to denial of service under CWE-121: Stack-based Buffer Overflow.
Which Snakeyaml versions are affected?
Affected versions include releases prior to 1.32 across affected packages: org.yaml:snakeyaml.
What version fixes CVE-2022-41854?
Upgrading to 1.32 (or the latest patched release for your respective branch) resolves the vulnerability.
Is snakeyaml affected?
Yes, org.yaml:snakeyaml is affected in releases prior to 1.32. Upgrade your dependency to 1.32 or later.
What is the CVSS score of CVE-2022-41854?
CVE-2022-41854 has a CVSS v3.1 base score of 6.5 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H.
What CWE is associated with CVE-2022-41854?
CVE-2022-41854 is classified under CWE-121: Stack-based Buffer Overflow (A stack-based buffer overflow condition is a condition where the buffer being overwritten is allocated on the stack (i.e., is a local variable or, rarely, a parameter to a function).).
How can I check Maven dependencies for CVE-2022-41854?
Run the dependency tree command: 'mvn dependency:tree -Dincludes=org.yaml'. 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-w37g-rhq8-7m4j",
  "modified" : "2024-06-21T21:33:52Z",
  "published" : "2022-11-11T19:00:31Z",
  "aliases" : [ "CVE-2022-41854" ],
  "summary" : "Snakeyaml vulnerable to Stack overflow leading to denial of service",
  "details" : "Those using Snakeyaml to parse untrusted YAML files may be vulnerable to Denial of Service attacks (DOS). If the parser is running on user supplied input, an attacker may supply content that causes the parser to crash by stack overflow. This effect may support a denial of service attack.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "org.yaml:snakeyaml"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.32"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-41854"
  }, {
    "type" : "PACKAGE",
    "url" : "https://bitbucket.org/snakeyaml/snakeyaml"
  }, {
    "type" : "WEB",
    "url" : "https://bitbucket.org/snakeyaml/snakeyaml/commits/e230a1758842beec93d28eddfde568c21774780a"
  }, {
    "type" : "WEB",
    "url" : "https://bitbucket.org/snakeyaml/snakeyaml/issues/531"
  }, {
    "type" : "WEB",
    "url" : "https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=50355"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/3DDXEXXWAZGF5AVHIPGFPXIWL6TSMKJE"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/7MKE4XWRXTH32757H7QJU4ACS67DYDCR"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/KSPAJ5Y45A4ZDION2KN5RDWLHK4XKY2J"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/3DDXEXXWAZGF5AVHIPGFPXIWL6TSMKJE"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/7MKE4XWRXTH32757H7QJU4ACS67DYDCR"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/KSPAJ5Y45A4ZDION2KN5RDWLHK4XKY2J"
  }, {
    "type" : "WEB",
    "url" : "https://security.netapp.com/advisory/ntap-20240315-0009"
  }, {
    "type" : "WEB",
    "url" : "https://security.netapp.com/advisory/ntap-20240621-0006"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-121", "CWE-787" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-11-21T22:27:27Z",
    "nvd_published_at" : "2022-11-11T13:15:00Z"
  }
}