PyPI: djangorestframework
CVE-2026-114137
Safety vulnerability ID: SFTY-20261022-70955
Affected versions of the Django REST framework package are vulnerable to Detection of Error Condition Without Action due to the `TokenProxy` model silently failing to delete the underlying token row while reporting a successful operation. The `TokenProxy.pk` property returns `user_id` instead of the token's actual primary key (`key`), causing `Model.delete()` to build a `DELETE` query that filters on `key` using the user id value; since no row matches this condition, `delete()` returns `(0, {'authtoken.TokenProxy': 0})` without raising any exception, leaving the token record intact in the `authtoken_token` table. An operator or application that calls `.delete()` on a `TokenProxy` instance to revoke a user's authentication token will receive no indication of failure, while the token remains valid and continues to authenticate requests, resulting in a credential that was believed revoked remaining usable indefinitely by anyone in possession of it.
Overview
Django REST framework: TokenProxy.delete() reports success and revokes nothing
Advisory
djangorestframework – Detection of Error Condition Without Action
How to Fix
Mitigation and Workarounds
---
Vulnerable Functions
Functions linked to known vulnerabilities.
References
- https://getsafety.com/vulnerabilities/SFTY-20261022-70955/CVE-2026-114137
- https://github.com/encode/django-rest-framework/security/advisories/GHSA-xw6w-gcfp-cf8m
- https://nvd.nist.gov/vuln/detail/CVE-2026-114137
- https://github.com/encode/django-rest-framework/commit/af3fabfd517307fbc5d500fba1ab8f6e25f220b0
- https://github.com/encode/django-rest-framework/releases/tag/3.18.2
- https://github.com/advisories/GHSA-xw6w-gcfp-cf8m
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
