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

CVE-2026-114137: Django REST Framework Auth Bypass Flaw

CVE-2026-114137 is an authentication bypass vulnerability in Django REST framework affecting token revocation. Failed deletions allow tokens to remain active indefinitely. This article covers technical details, affected versions, and mitigation.

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-114137 Overview

CVE-2026-114137 affects Django REST framework (DRF), a widely deployed toolkit for building Web APIs on top of Django. The flaw resides in the TokenProxy.delete() method defined in rest_framework/authtoken/models.py. The proxy incorrectly uses the user-id primary key instead of the concrete Token token-string primary key when issuing the deletion query. Django executes the DELETE against a non-matching row, returns zero deletions, and raises no error. Applications that revoke credentials through a TokenProxy instance believe revocation succeeded while the token continues to authenticate. DRF tokens do not expire automatically, so the stale credential can remain valid indefinitely. The issue is fixed in version 3.18.2.

Critical Impact

Credential revocation workflows invoked through TokenProxy.delete() silently fail, leaving authentication tokens live and usable by any party that holds them.

Affected Products

  • Django REST framework versions 3.12.0 through 3.18.1
  • Applications and admin integrations calling TokenProxy.delete() to revoke user tokens
  • Operational scripts and background jobs that rotate or invalidate DRF auth tokens via the proxy model

Discovery Timeline

  • 2026-10-21 - CVE-2026-114137 published to NVD
  • 2026-10-22 - Last updated in NVD database

Technical Details for CVE-2026-114137

Vulnerability Analysis

The TokenProxy model in DRF is a proxy over the concrete Token model, intended to surface tokens in the Django admin against a user-oriented primary key. The concrete Token model uses the token string itself as its primary key, while the proxy exposes the related user's id. When TokenProxy.delete() is invoked, Django builds a DELETE statement using the proxy instance's pk attribute, which resolves to the user id rather than the token string. The query matches zero rows and completes successfully, so Python code checking the return value or relying on exception handling sees no sign of failure. This is an instance of incorrect behavior order and silent failure in deletion logic, classified as [CWE-390] Detection of Error Condition Without Action.

Root Cause

The root cause is a mismatch between the proxy's primary key semantics and the concrete model's primary key column. DRF's own TokenAdmin.delete_model is not affected because it operates on the underlying Token instance directly. Any caller that holds a TokenProxy instance and calls .delete() triggers the broken path.

Attack Vector

This is not a direct remote exploitation primitive. The impact materializes when a token holder (an attacker who previously captured a token, a terminated employee, or a compromised integration) continues to authenticate after an administrator or script believes the token was revoked. The attacker leverages the stale credential across the network against any endpoint protected by TokenAuthentication.

python
# Patch excerpt - rest_framework/authtoken/admin.py
 from django.urls import reverse
 from django.utils.translation import gettext_lazy as _
 
-from rest_framework.authtoken.models import Token, TokenProxy
+from rest_framework.authtoken.models import TokenProxy
python
# Patch excerpt - rest_framework/authtoken/models.py
 import secrets
 
 from django.conf import settings
-from django.db import models
+from django.db import models, router
 from django.utils.translation import gettext_lazy as _

Source: GitHub Commit af3fabf. The fix routes deletion through the correct database and primary key, ensuring the DELETE targets the Token row keyed by the token string.

Detect Identity Attacks the Moment Authentication Fails

Singularity™ Identity surfaces credential misuse, lateral movement, and privilege escalation in real time, so you can contain the breach before it spreads.

Stop Identity Attacks

Detection Methods for CVE-2026-114137

Indicators of Compromise

  • Successful API authentications using tokens that application logs show as revoked or deleted
  • authtoken_token table rows that persist after administrative revocation events in audit logs
  • Discrepancies between application-level revocation events and the actual contents of the authtoken_token table

Detection Strategies

  • Audit application code for callers of TokenProxy.delete() and compare the recorded revocation events against the current state of authtoken_token
  • Correlate administrative revocation actions with subsequent authentication activity for the affected user to identify tokens that continued to work
  • Scan dependency manifests (requirements.txt, Pipfile.lock, poetry.lock) for djangorestframework versions below 3.18.2

Monitoring Recommendations

  • Alert on API authentications from user accounts that have had a revocation event logged within a recent time window
  • Enable Django query logging for DELETE statements against authtoken_token and verify affected row counts
  • Ingest Django and application logs into a centralized data lake and alert when revocation workflows report success but the token record is still present

How to Mitigate CVE-2026-114137

Immediate Actions Required

  • Upgrade djangorestframework to version 3.18.2 or later across all services
  • Enumerate active rows in authtoken_token and cross-check against your authoritative list of revoked users, deleting any orphaned token strings directly
  • Audit any custom revocation code paths and replace TokenProxy.delete() calls with deletion of the concrete Token instance keyed by the token string

Patch Information

The fix is included in Django REST framework 3.18.2. See the GitHub Release 3.18.2 and the GitHub Security Advisory GHSA-xw6w-gcfp-cf8m for full remediation details.

Workarounds

  • Delete tokens through the concrete Token model (Token.objects.filter(user=user).delete()) instead of the TokenProxy instance
  • Mirror DRF's TokenAdmin.delete_model approach in custom admin or management code until the upgrade is deployed
  • Add a post-revocation verification step that queries authtoken_token and raises if a matching row still exists
bash
# Upgrade Django REST framework to the patched release
pip install --upgrade "djangorestframework>=3.18.2"
pip show djangorestframework | grep -i version

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.