Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unhandled invalid HTTP_ORIGIN #701

Closed
1 task done
minusf opened this issue Nov 2, 2021 · 2 comments · Fixed by #715
Closed
1 task done

unhandled invalid HTTP_ORIGIN #701

minusf opened this issue Nov 2, 2021 · 2 comments · Fixed by #715

Comments

@minusf
Copy link

minusf commented Nov 2, 2021

Understanding CORS

  • I have read the resources.

Python Version

3.9.7

Django Version

3.2.8

Package Version

3.10.0

Description

it seems that an unparsable, invalid HTTP_ORIGIN header is a trivial way to exception/mail spam a django instance:

Internal Server Error: /

ValueError at /
Invalid IPv6 URL
...
HTTP_ORIGIN = 'https://example.com].evil.com'
HTTP_REFERER = 'https://example.com].evil.com'

https://github.com/adamchainz/django-cors-headers/blob/main/src/corsheaders/middleware.py#L135

this was generated by a security scanner btw.

i think in this case HTTP_ORIGIN should be simply ignored and the library should behave as if there was no header at all.

@adamchainz
Copy link
Owner

Thank you for the report. I've fixed this in #715 and released the fix in version 3.10.1. If you could check this with your security scanner again, that would be great.

@minusf
Copy link
Author

minusf commented Dec 7, 2021

thank you for looking into this. the security scanner is not managed by us, so i can't request another scan, but fuzzing ORIGIN: is more than enough and it fixes it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants