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.
Overview
Django REST framework: JSONParser applies an attacker-named codec to the request stream
Advisory
djangorestframework – Improper Handling of Highly Compressed Data (Data Amplification)
How to Fix
Mitigation and Workarounds
---
Vulnerable Functions
Functions linked to known vulnerabilities.
References
- https://getsafety.com/vulnerabilities/SFTY-20261022-34776/CVE-2026-114136
- https://github.com/encode/django-rest-framework/security/advisories/GHSA-3547-9m27-7rxg
- https://nvd.nist.gov/vuln/detail/CVE-2026-114136
- https://github.com/encode/django-rest-framework/commit/3c2634599b26a9f789b03045118dbc276117611a
- https://github.com/encode/django-rest-framework/releases/tag/3.18.2
- https://github.com/advisories/GHSA-3547-9m27-7rxg
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
