PyPI: djangorestframework

CVE-2026-114136

Safety vulnerability ID: SFTY-20261022-34776

Affected versions of the Django REST framework package are vulnerable to Improper Handling of Highly Compressed Data (Data Amplification) due to `JSONParser.parse` decoding the request body using a client-supplied charset without verifying it names an actual text encoding. The `JSONParser.parse` method passes the `Content-Type` charset parameter directly to `codecs.getreader`, which, unlike other codec-resolution paths in Django, does not check `CodecInfo._is_text_encoding` and therefore accepts byte-transform codecs such as `bz2_codec` and `zlib_codec`; because Django's `DATA_UPLOAD_MAX_MEMORY_SIZE` check is enforced against the raw wire bytes before this decoding occurs, the subsequent decompression inside the parser happens after the size guard and is uncounted. An unauthenticated attacker can send a small request body (as little as 108 bytes) to any endpoint using DRF's default JSON parser with a `Content-Type: application/json; charset=bz2_codec` header, causing the server to decompress it into tens of megabytes of data in memory, achieving amplification ratios exceeding 400,000x and allowing a modest number of concurrent requests to exhaust worker memory and cause a Denial of Service.

Created at: Oct 22, 2026Updated at: Oct 22, 2026

Overview

Django REST framework: JSONParser applies an attacker-named codec to the request stream

Advisory

djangorestframework – Improper Handling of Highly Compressed Data (Data Amplification)

Affected Package

Affecting djangorestframework package, versions>= 3.6.4, < 3.18.2

Also affects

---

How to Fix

Upgradedjangorestframeworkto3.18.2or higher.

Mitigation and Workarounds

---

Vulnerable Functions

Functions linked to known vulnerabilities.

Vulnerable function data is available for Enterprise customers

Book a call with us to see Safety in action.

Safety

Verified by Safety

Our Cybersecurity Intelligence Team reviewed this vulnerability. We combine public data with our own research to find issues not yet reported to public sources.

Learn more