Opened 9 years ago

Closed 9 years ago

#5292 closed (fixed)

CsrfMiddleware does not protect from forged POST request with no data

Reported by: Jakub Wilk <django@…> Owned by: Adrian Holovaty
Component: Contrib apps Version: master
Severity: Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

django.contrib.csrf.CrsfMiddleware permits any POST request with no data. This is entirely wrong.

Attachments (1)

csrf-empty-post.diff (418 bytes) - added by Jakub Wilk <django@…> 9 years ago.

Download all attachments as: .zip

Change History (5)

Changed 9 years ago by Jakub Wilk <django@…>

Attachment: csrf-empty-post.diff added

comment:1 Changed 9 years ago by Simon G. <dev@…>

Component: UncategorizedContrib apps
Owner: changed from Jacob to Adrian Holovaty
Summary: CrsfMiddleware does not protect from forged POST request with no dataCsrfMiddleware does not protect from forged POST request with no data
Triage Stage: UnreviewedReady for checkin

comment:2 Changed 9 years ago by James Bennett

Out of curiosity, what's the security impact of a CSRF that doesn't post any data?

comment:3 Changed 9 years ago by Chris Beaven

A POST request, even an empty one, could potentially be all a view was looking for to do a delete or something.

comment:4 Changed 9 years ago by Adrian Holovaty

Resolution: fixed
Status: newclosed

(In [6038]) Fixed #5292 -- Changed CSRF middleware to check for request.method == 'POST' instead of request.POST dictionary not being empty. Thanks, Jakub Wilk

Note: See TracTickets for help on using tickets.
Back to Top