Deeply Nested JSON Document Recursion Vulnerability in python-orjson

python-orjson Updated 02 Oct 2025

Summary

26/02/2024
N/A
Yes i
Unrated
Not published

CVE-2024-27454: orjson.loads in orjson before 3.9.15 does not limit recursion for deeply nested JSON documents. Affects python-orjson across 2 version ranges.

< 3.9.15-1 < b0e4d2c06ce06c6e63981bf0276e4b7c74e5845e

Fixed in 3.9.15-1. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Mobile apps built by Devnack Design, build and launch iOS and Android apps with a senior product team. From idea to store release Start a project

Background

python-orjson is a high-performance JSON library for Python, designed to provide fast serialization and deserialization of JSON data. It is widely used in applications that require efficient handling of JSON due to its speed and simplicity. However, prior to version 3.9.15, the library had a vulnerability in the orjson.loads function that did not limit recursion for deeply nested JSON documents, potentially leading to excessive resource consumption and application crashes.

Vulnerability Detail

The vulnerability, identified as CVE-2024-27454, arises from the orjson.loads function in python-orjson versions before 3.9.15. This function lacks a mechanism to limit recursion depth when processing deeply nested JSON documents. As a result, an attacker could craft a malicious JSON payload that, when processed, could cause a stack overflow or excessive memory usage, leading to denial of service (DoS) conditions. This vulnerability can be exploited by sending specially crafted JSON data to applications using the affected version of python-orjson, potentially impacting application availability.

How To Fix

Minimum fixed version

3.9.15-1

This is the first release that contains the fix.

sudo apt-get install --only-upgrade python-orjson

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

If upgrading is not immediately possible, consider implementing a JSON parsing limit in your application logic to restrict the depth of JSON documents being processed. This can be done by validating the JSON structure before passing it to orjson.loads, ensuring that it does not exceed a predefined depth limit.

Conclusion

The CVE-2024-27454 vulnerability in python-orjson poses significant risks due to its potential for causing denial of service through excessive recursion in deeply nested JSON documents. Users are strongly advised to upgrade to version 3.9.15-1 or later to mitigate these risks. Implementing additional validation can also help secure applications until an upgrade is feasible.

See every vulnerability recorded for python-orjson →

Share this vulnerability

FAQ

CVE-2024-27454 is a vulnerability in the python-orjson library that allows for excessive recursion when processing deeply nested JSON documents, potentially leading to denial of service.

You can check if your application is affected by using Vulert, which monitors and alerts for open-source vulnerabilities. Visit Vulert Scanner to analyze your manifest file.

Failing to address this vulnerability can lead to application crashes or unavailability due to denial of service attacks, especially if malicious JSON data is processed.

Yes, you can implement a JSON parsing limit in your application to restrict the depth of JSON documents processed by orjson.loads.

More information about python-orjson can be found in its official documentation on GitHub or the Python Package Index (PyPI).

Related vulnerabilities

Recent vulnerabilities recorded for python-orjson.

How To Fix

Minimum fixed version

3.9.15-1

This is the first release that contains the fix.

sudo apt-get install --only-upgrade python-orjson

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback