Skip to main content
Vulnerability Database/CVE-2026-114136

CVE-2026-114136: Django REST Framework DOS Vulnerability

CVE-2026-114136 is a denial of service flaw in Django REST framework that allows attackers to consume excessive memory through compressed JSON requests. This post explains its impact, affected versions, and mitigation steps.

Published:

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

CVE-2026-114136 Overview

CVE-2026-114136 is a resource exhaustion vulnerability in Django REST framework, a widely used toolkit for building Web APIs on top of Django. The flaw resides in JSONParser.parse within rest_framework/parsers.py and affects versions 3.6.4 through 3.18.1. The parser passes the client-supplied Content-Type charset value to codecs.getreader, which accepts byte-transform codecs such as bz2_codec in addition to text encodings. A remote unauthenticated attacker can submit a compressed JSON body that bypasses Django's DATA_UPLOAD_MAX_MEMORY_SIZE check, which only measures wire bytes. The decompressed payload then consumes substantial per-worker memory. The issue is fixed in version 3.18.2.

Critical Impact

A tiny compressed request can expand without bound after upload size enforcement, enabling unauthenticated denial-of-service against any JSON endpoint.

Affected Products

  • Django REST framework versions 3.6.4 through 3.18.1
  • Any Django application exposing a REST framework endpoint that accepts a JSON body
  • Deployments using the default parser configuration

Discovery Timeline

  • 2026-10-21 - CVE-2026-114136 published to the National Vulnerability Database (NVD)
  • 2026-10-22 - Last updated in NVD database

Technical Details for CVE-2026-114136

Vulnerability Analysis

Django REST framework's JSONParser reads the request body using codecs.getreader(encoding), where encoding is sourced from the request's Content-Type header charset parameter. Python's codec registry resolves not only text encodings such as utf-8 but also byte-transform codecs including bz2_codec, zlib_codec, and base64_codec. When an attacker supplies charset=bz2_codec, the parser decompresses the body during read, inflating a small payload into a large in-memory object.

Django enforces DATA_UPLOAD_MAX_MEMORY_SIZE against the raw wire bytes before the parser executes. Because the expansion happens inside the parser, the limit does not restrain the resulting memory footprint. The result is classified under [CWE-409: Improper Handling of Highly Compressed Data (Data Amplification)].

Root Cause

The root cause is permissive codec resolution. codecs.getreader does not distinguish text codecs from binary-to-binary codecs, so any registered codec name supplied by the client is honored. The parser trusted this interface to produce a text stream and did not validate that the requested encoding was a character encoding.

Attack Vector

An unauthenticated remote attacker sends an HTTP POST to any reachable DRF endpoint accepting JSON. The request body is a bz2-compressed JSON document, and the Content-Type header specifies application/json; charset=bz2_codec. Each request consumes a worker process's memory proportional to the decompressed size, enabling denial of service with minimal bandwidth.

python
 from rest_framework.utils import json
 
 
+def get_encoding(parser_context):
+    """
+    Return the charset to decode the request body with: the one named in the
+    request's `Content-Type` header, or `settings.DEFAULT_CHARSET`.
+
+    Django accepts any charset that `codecs.lookup()` resolves, which includes
+    bytes-to-bytes codecs such as `bz2_codec`. Decoding through one of those
+    decompresses the body after `DATA_UPLOAD_MAX_MEMORY_SIZE` has already been
+    checked against the compressed size, so a tiny request can expand without
+    bound. Only text encodings are accepted here.
+    """
+    encoding = parser_context.get('encoding', settings.DEFAULT_CHARSET)
+    try:
+        # Unlike `codecs.getreader()`, `str.encode()` rejects non-text codecs.
+        ''.encode(encoding)
+    except (LookupError, UnicodeError):
+        raise ParseError(
+            'Unsupported charset "%s" in request Content-Type header.' % encoding
+        )
+    return encoding
+
+
 class DataAndFiles:
     def __init__(self, data, files):
         self.data = data

Source: GitHub commit 3c26345. The patch introduces a get_encoding helper that validates the charset using str.encode(), which rejects non-text codecs, and raises ParseError for unsupported values.

Detection Methods for CVE-2026-114136

Indicators of Compromise

  • HTTP requests with Content-Type headers containing non-text charset values such as charset=bz2_codec, charset=zlib_codec, or charset=base64_codec.
  • Small request bodies (kilobytes) directed at JSON endpoints that correlate with sudden spikes in worker process memory.
  • ParseError exceptions referencing unsupported charsets after upgrading to the patched version.

Detection Strategies

  • Inspect web server and WAF logs for Content-Type charset values outside the expected set of text encodings (utf-8, latin-1, ascii).
  • Correlate per-request memory growth in application servers (gunicorn, uWSGI) against request size to surface amplification patterns.
  • Add application-level logging around JSONParser.parse to record the parsed charset for forensic review.

Monitoring Recommendations

  • Track per-worker Resident Set Size (RSS) and alert on sustained growth or out-of-memory kills on API tiers.
  • Monitor HTTP 500 and gateway timeout rates on JSON endpoints as a secondary signal of resource exhaustion attempts.
  • Ingest reverse proxy access logs into a centralized analytics platform and query for anomalous Content-Type values.

How to Mitigate CVE-2026-114136

Immediate Actions Required

  • Upgrade Django REST framework to version 3.18.2 or later across all environments.
  • Audit WAF and reverse proxy rules to reject requests whose Content-Type charset is not an allowlisted text encoding.
  • Enforce request body size limits at the reverse proxy or load balancer independent of application-level checks.

Patch Information

The fix is published in Django REST framework 3.18.2. Review the GitHub Release 3.18.2 notes and the GitHub Security Advisory GHSA-3547-9m27-7rxg for full details on the patched behavior.

Workarounds

  • Subclass JSONParser to validate parser_context['encoding'] with str.encode() before delegating to the parent implementation.
  • Deploy a reverse proxy rule (NGINX, Envoy, or WAF) that normalizes or strips the charset parameter on inbound Content-Type headers for JSON endpoints.
  • Lower per-worker memory limits via ulimit or container cgroup caps to contain abuse until the patch is applied.
bash
# NGINX example: reject non-text charsets on JSON endpoints
map $http_content_type $bad_charset {
    default                                  0;
    "~*charset=(bz2|zlib|base64|hex|quopri|rot_13|uu)_codec" 1;
}

server {
    location /api/ {
        if ($bad_charset) { return 415; }
        client_max_body_size 1m;
        proxy_pass http://django_upstream;
    }
}

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.