Skip to content

Commit

Permalink
ignore JSON requests in mod_csrf
Browse files Browse the repository at this point in the history
  • Loading branch information
devl00p committed Apr 20, 2024
1 parent c21e85a commit 6bee660
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions wapitiCore/attack/mod_csrf.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,11 @@ async def must_attack(self, request: Request, response: Optional[Response] = Non
if request.method != "POST":
return False

# JSON requests can only be sent using JS with same-origin policy in place
# so, it is unlikely that a CSRF is possible. Let's filter those requests to prevent false positives
if request.is_json:
return False

if (request.url, request.post_keys) in self.already_vulnerable:
return False

Expand Down

0 comments on commit 6bee660

Please sign in to comment.