document.cookie does not reject invalid control characters
Categories
(Core :: Networking: Cookies, defect, P2)
Tracking
()
People
(Reporter: haxatron1, Unassigned)
References
(Blocks 1 open bug)
Details
(Keywords: reporter-external, sec-moderate, Whiteboard: [reporter-external] [client-bounty-form] [verif?][necko-triaged])
A sibling domain or a MITM can set cookies containing invalid control characters such as \f. On most server technology, such as Apache, requests containing illegal control characters will return a 400 Bad Request. As such attacker that can control sibling domain (eTLD+1) can inject such cookies into the cookie store and cause a situation where the Firefox client can no longer communicate with the main domain
Steps to reproduce:
- Set cookie using document.cookie = "a=b\f"
- Visit a website running Apache httpd.
- Receive 400 Bad request. The Firefox client can no longer communicate with the Apache server so long as there is a current cookie store.
For reference, Chrome will now reject cookies set via document.cookie containing such control characters.
Notes: May be regarded as an annoyance, as a user can clear the cookie store containing the illegal cookie via a click of a button, but am submitting here just in case.
the current illegal charset also doesn't include the \x7f character which also causes problems with Apache, while chrome rejects \x7f from cookies.
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Comment 3•3 years ago
|
||
There's been a big difference between early HTTP specs (headers must be only ASCII!) and what browsers and servers have accepted because we want to support a world audience has been pretty vast. But there are more modern specs (converging on allowing UTF-8) and we definitely shouldn't be allowing control characters.
Not sure this needs to be a hidden bug -- its been known for a while.
Comment 4•3 years ago
|
||
If we don't already have this on file as part of our efforts to match RFC 6265bis then we can use this for it.
Relevant part of the spec: https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-rfc6265bis/#section-5.4
Updated•3 years ago
|
Comment 6•3 years ago
|
||
I'm sorry, we lost track of this one (my fault, see comment 4). We will match the bounty of the bug that was filed after yours
Updated•2 years ago
|
Updated•1 year ago
|
Description
•