CVE-2024-27454: Orjson Orjson Does Not Limit Recursion Vulnerability

HIGH
Advisory Identifier: GHSA-pwr2-4v36-6qpr
CVSS 7.5
CWE-674
Published
Advisory Summary

CVE-2024-27454 is a HIGH (CVSS 7.5) orjson does not limit recursion vulnerability (CWE-674: Uncontrolled Recursion) affecting Orjson libraries in the PyPI ecosystem. The issue involves orjson does not limit recursion for deeply nested json documents. Remediation is available by upgrading affected packages to version 3.9.15.

CVE-2024-27454 at a Glance

CVE Identifier CVE-2024-27454
GHSA Identifier GHSA-pwr2-4v36-6qpr
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-674: Uncontrolled Recursion
Affected Product Orjson
Package Ecosystem PyPI
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-2024-27454

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

orjson fixed: 3.9.15
pip install orjson>=3.9.15
Verify Direct and Transitive Dependencies

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

pip show orjson

How to Check if You Are Affected

To determine whether your Python environment is affected by CVE-2024-27454, inspect your installed packages using pip:

pip show orjson

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

Note: The pip show orjson command checks currently installed packages in your active Python environment.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-674: Uncontrolled Recursion, where the product does not properly control the amount of recursion that takes place, consuming excessive resources, such as allocated memory or the program stack. In Orjson, 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

orjson.loads in orjson before 3.9.15 does not limit recursion for deeply nested JSON documents.

CVE-2024-27454 Affected Orjson Versions

1 component(s)
Fixed Versions:
3.9.15
Product / Package Ecosystem Affected Versions Fixed Version
orjson
PyPI
< 3.9.15
3.9.15

References

Frequently Asked Questions

What is CVE-2024-27454?
CVE-2024-27454 is a security vulnerability in Orjson involving orjson does not limit recursion for deeply nested JSON documents under CWE-674: Uncontrolled Recursion.
Which Orjson versions are affected?
Affected versions include releases prior to 3.9.15 across affected packages: orjson.
What version fixes CVE-2024-27454?
Upgrading to 3.9.15 (or the latest patched release for your respective branch) resolves the vulnerability.
Is orjson affected?
Yes, orjson is affected in releases prior to 3.9.15. Upgrade your dependency to 3.9.15 or later.
What is the CVSS score of CVE-2024-27454?
CVE-2024-27454 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-2024-27454?
CVE-2024-27454 is classified under CWE-674: Uncontrolled Recursion (The product does not properly control the amount of recursion that takes place, consuming excessive resources, such as allocated memory or the program stack.).
How can I check PyPI dependencies for CVE-2024-27454?
Run the dependency tree command: 'pip show orjson'. 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-pwr2-4v36-6qpr",
  "modified" : "2024-02-26T22:06:16Z",
  "published" : "2024-02-26T18:30:31Z",
  "aliases" : [ "CVE-2024-27454" ],
  "summary" : "orjson does not limit recursion for deeply nested JSON documents",
  "details" : "orjson.loads in orjson before 3.9.15 does not limit recursion for deeply nested JSON documents.",
  "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" : "PyPI",
      "name" : "orjson"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "3.9.15"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-27454"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/ijl/orjson/issues/458"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/ijl/orjson/commit/b0e4d2c06ce06c6e63981bf0276e4b7c74e5845e"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/ijl/orjson"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/ijl/orjson/blob/master/CHANGELOG.md#3915"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pypa/advisory-database/tree/main/vulns/orjson/PYSEC-2024-40.yaml"
  }, {
    "type" : "WEB",
    "url" : "https://monicz.dev/CVE-2024-27454"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-674" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-02-26T21:31:06Z",
    "nvd_published_at" : "2024-02-26T16:28:00Z"
  }
}