{"id":"PYSEC-2026-3828","summary":"Django REST framework: AdminRenderer may disclose GET-protected data when rendering invalid write requests","details":"Summary\n\nAdminRenderer may disclose data that would normally be protected by GET permissions when rendering a 400 Bad Request response for an invalid write request.\n\nIf a view allows POST (or another write method) but denies GET, an invalid request rendered through AdminRenderer can invoke the view's GET handler and include data from the GET representation in the generated HTML response.\n\nThis behavior appears to be specific to AdminRenderer and does not affect the normal JSON rendering path.\n\n\n---\n\nDetails\n\nWhile investigating the AdminRenderer rendering flow, I observed that invalid write requests are rendered by temporarily overriding the request method and invoking the view's GET handler:\n\n```\nwith override_method(view, request, \"GET\") as request:\n    response = view.get(request, *view.args, **view.kwargs)\n\ndata = response.data\n```\n\nThis execution path differs from a normal GET request.\n\nUnder normal request processing, a GET request flows through:\n\n```\nAPIView.dispatch()\n    └── APIView.initial()\n            └── APIView.check_permissions()\n```\n\nHowever, during AdminRenderer rendering, the renderer directly invokes:\n\nview.get(...)\n\nA view whose permission class explicitly allowed POST but denied GET still executed its GET handler while rendering an invalid POST request through AdminRenderer.\n\nAs a result, data intended to be available only through an authorized GET request was included in the generated HTML response.\n\n\n---\n\nProof of Concept\n\nUsing a standard ListCreateAPIView.\n\nPermission class:\n\n```\nclass ProbePermission(BasePermission):\n    def has_permission(self, request, view):\n        return request.method == \"POST\"\n\nView:\n\nclass View(ListCreateAPIView):\n    renderer_classes = (AdminRenderer, JSONRenderer)\n    permission_classes = (ProbePermission,)\n    serializer_class = ProbeSerializer\n\n    def get_queryset(self):\n        return [\n            {\n                \"name\": \"visible\",\n                \"secret\": \"GET-ONLY-SECRET\",\n            }\n        ]\n```\n\nExpected Behaviour\n\n```\nGET request\n→ 403 Forbidden\n\nInvalid POST request\n→ 400 Bad Request\n→ Response should contain only validation errors.\n→ GET-only data should not be rendered.\n\n```\nObserved Behaviour\n\n```\nGET request\n→ 403 Forbidden\n\nInvalid POST request rendered through AdminRenderer\n→ 400 Bad Request\n→ HTML response contains:\n\nGET-ONLY-SECRET\n```\n\nTthe same behavior is shown using a minimal APIView implementation.\n\nObserved results:\n\n```\nminimal.post_400.handler_calls =\n[\n    (\"post\", \"POST\"),\n    (\"get\", \"GET\")\n]\n\nminimal.post_400.contains_secret = True\n```\n\nGeneric view reproduction:\n\n```\ngeneric.direct_get.status = 403\ngeneric.direct_get.contains_secret = False\n\ngeneric.post_400.status = 400\ngeneric.post_400.contains_secret = True\n\ngeneric.post_400.permission_calls =\n[\n    (\"GenericAdminView\", \"POST\"),\n    ...\n    (\"GenericAdminView\", \"OPTIONS\")\n]\n\ngeneric.post_400.queryset_calls =\n[\n    (\"GenericAdminView\", \"GET\"),\n    ...\n]\n```\n\nThese observations indicate that direct GET requests are correctly denied, while the simulated GET used during AdminRenderer rendering can still retrieve the protected representation.\n\n\n---\n\nImpact\n\nThis issue may result in information disclosure when all of the following conditions are met:\n\nAdminRenderer is enabled.\n\nThe client negotiates the HTML renderer (for example using Accept: text/html).\n\nThe application permits POST (or another write method).\n\nGET requests are denied by the configured permission class.\n\nThe invalid write request returns 400 Bad Request.\n\nThe GET representation contains information that the requester would normally not be permitted to access.\n\n\nThis issue does not appear to affect:\n\nJSON rendering\n\nStandard API responses\n\nSuccessful write requests\n\n\nThe behavior appears limited to the HTML rendering path used by AdminRenderer.\n\n\n---\n\nSuggested Fix\n\nPossible approaches include:\n\nPerform equivalent permission checks before executing the simulated GET request.\n\nAvoid invoking view.get() when the corresponding GET request would not be permitted.\n\nFall back to rendering only serializer/form validation errors instead of retrieving the GET representation.\n\n\nA regression test could create a permission class that allows POST while denying GET, then verify that an invalid POST rendered with AdminRenderer does not include data from the protected GET representation.\n\n\n---\n\nEnvironment\n\nRepository:\n\n`encode/django-rest-framework`\n\nBranch tested:\n\n`security-audit-drf`\n\nCommit tested:\n\n`cf582fb58e9e5ffcc8ed78a2cb9aaa8f4865666a`","aliases":["CVE-2026-73229","GHSA-g47c-3xmw-q6m2"],"modified":"2026-09-10T12:15:04.001259003Z","published":"2026-09-10T09:44:58.942329Z","references":[{"type":"WEB","url":"https://github.com/encode/django-rest-framework/security/advisories/GHSA-g47c-3xmw-q6m2"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-73229"},{"type":"WEB","url":"https://github.com/encode/django-rest-framework/pull/10012"},{"type":"WEB","url":"https://github.com/encode/django-rest-framework/commit/71f81946906e52f9dc8e5d22a0f3d2afa50c455e"},{"type":"WEB","url":"https://github.com/encode/django-rest-framework/commit/9e82afc98acfe6fc28c9bf78147f0c5b3f222cb5"},{"type":"PACKAGE","url":"https://github.com/encode/django-rest-framework"},{"type":"WEB","url":"https://github.com/encode/django-rest-framework/releases/tag/3.17.2"},{"type":"PACKAGE","url":"https://pypi.org/project/djangorestframework"},{"type":"ADVISORY","url":"https://github.com/advisories/GHSA-g47c-3xmw-q6m2"}],"affected":[{"package":{"name":"djangorestframework","ecosystem":"PyPI","purl":"pkg:pypi/djangorestframework"},"ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"3.17.2"}]}],"versions":["0.1","0.1.1","0.2.0","0.2.1","0.2.2","0.2.3","0.2.4","0.3.0","0.3.1","0.3.2","0.3.3","0.4.0","2.0.0","2.0.1","2.0.2","2.1.0","2.1.1","2.1.10","2.1.11","2.1.12","2.1.13","2.1.14","2.1.15","2.1.16","2.1.17","2.1.2","2.1.3","2.1.4","2.1.5","2.1.6","2.1.7","2.1.8","2.1.9","2.2.0","2.2.1","2.2.2","2.2.3","2.2.4","2.2.5","2.2.6","2.2.7","2.3.0","2.3.1","2.3.10","2.3.11","2.3.12","2.3.13","2.3.14","2.3.2","2.3.3","2.3.4","2.3.5","2.3.6","2.3.7","2.3.8","2.3.9","2.4.0","2.4.1","2.4.2","2.4.3","2.4.4","2.4.5","2.4.6","2.4.7","2.4.8","3.0.0","3.0.1","3.0.2","3.0.3","3.0.4","3.0.5","3.1.0","3.1.1","3.1.2","3.1.3","3.10.0","3.10.1","3.10.2","3.10.3","3.11.0","3.11.1","3.11.2","3.12.0","3.12.1","3.12.2","3.12.3","3.12.4","3.13.0","3.13.1","3.14.0","3.15.0","3.15.1","3.15.2","3.16.0","3.16.1","3.17.0","3.17.1","3.2.0","3.2.1","3.2.2","3.2.3","3.2.4","3.2.5","3.3.0","3.3.1","3.3.2","3.3.3","3.4.0","3.4.1","3.4.2","3.4.3","3.4.4","3.4.5","3.4.6","3.4.7","3.5.0","3.5.1","3.5.2","3.5.3","3.5.4","3.6.0","3.6.1","3.6.2","3.6.3","3.6.4","3.7.0","3.7.1","3.7.2","3.7.3","3.7.4","3.7.5","3.7.6","3.7.7","3.8.0","3.8.1","3.8.2","3.9.0","3.9.1","3.9.2","3.9.3","3.9.4"],"database_specific":{"source":"https://github.com/pypa/advisory-database/blob/main/vulns/djangorestframework/PYSEC-2026-3828.yaml"}}],"schema_version":"1.9.0","severity":[{"type":"CVSS_V3","score":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:N/A:N"}]}