-
-
Notifications
You must be signed in to change notification settings - Fork 30.9k
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
Support for httponly/secure cookies reintroduced lax parsing behavior #66985
Comments
As noted in the comments of bpo-22758 by Georg Brandle:
(The change for bpo-16611 reintroduces "lax" parsing behavior that the security fix [1] was supposed to prevent.) |
This test still exists, so the change didn't cause it to trigger. What is the security bug? The commit doesn't say, and doesn't reference an issue number. So if that test still passes, what's the bug? |
Well, with this change you can again (e.g.) pass "Set-cookie: foo=bar" which isn't a valid cookie. It doesn't reintroduce the same vulnerability, but it will still silently consume invalid cookies (i.e. such with attribute-like tokens upfront) and return a seemingly valid one. IMO this is questionable behavior of the kind that can enable exploits, which is also why it was disallowed by the fix of the first vulnerability. |
The security issue isn't easy to explain, it involves an elaborated set of services (browser, Web site...) each having a slightly different notion of cookie parsing to mount an attack allowing to bypass CSRF protection on certain Python-powered frameworks. It's from a report made to security@p.o. |
This qualification isn't really accurate:
since the bpo-16611 changes were committed *before* the security fix. |
Note that f81846c2b746 adds an explicit test for acceptance of invalid cookie strings ("test_bad_attrs"). |
These are unknown attributes after a key=value pair. What this issue is about is accepting attributes *before* any key=value pair. |
Well, if we want to become stricter, I don't it makes sense to stop at the middle of the road. |
Django's test suite passes with the proposed patch after some updates: django/django#3455 |
The patch looks good. One nit, please change "items" to "typed_items" or somesuch. That will make it clear why there are 3-tuples instead of the traditional 2-tuple used for normal mappings. |
Paul, Tim, do you think there's a real risk of regression with the proposed patch? |
Security-wise? I don't know, I haven't really been in the loop on the original issue. |
No, I meant functionality-wise. |
Django's test suite doesn't reveal any regressions. All the changes there are expected as far as I can see. |
New changeset a065ab1c67a8 by Antoine Pitrou in branch 'default': |
Thank you, I've committed the patch to 3.5 now. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: