HttpChannelParent SetCookies cookie validation bypass
Categories
(Core :: Networking: Cookies, defect)
Tracking
()
People
(Reporter: jmwebdevelopement, Unassigned)
Details
(Keywords: reporter-external)
Steps to reproduce:
While looking at how cookies get set from content processes i noticed theres two paths that end up calling CookieServiceParent::SetCookies
The first path goes through PCookieService. CookieServiceParent::RecvSetCookies in netwerk/cookie/CookieServiceParent.cpp checks ContentProcessHasCookie before calling the internal SetCookies method. if the content process doesnt have cookies for that domain it returns IPC_FAIL
The second path goes through PHttpChannel. HttpChannelParent::RecvSetCookies in netwerk/protocol/http/HttpChannelParent.cpp calls CookieServiceParent::SetCookies directly without going through RecvSetCookies. it skips the ContentProcessHasCookie check entirely
The content process controls all the parameters baseDomain, host URI, the cookie structs. The host URI determines which domain the cookies get stored for. CookieValidation::ValidateForHost checks that the cookies domain attribute matches the supplied host but it doesnt check whether the content process should be allowed to set cookies for that host in the first place
To check if this actually works I called the internal cookie path from a parent process context for domains that werent being visited , example.com, example.org and example.net all three were accepted
could be something i missed but the ContentProcessHasCookie check exists for a reason on the PCookieService path and the PHttpChannel path just goes around it.
tested on Firefox ESR 140.10.1
Actual results:
cookies for example.com, example.org and example.net all accepted through the parent process cookie path with no origin restriction. the PHttpChannel path calls the same internal SetCookies method without the ContentProcessHasCookie check that the PCookieService path has
Expected results:
HttpChannelParent::RecvSetCookies should check ContentProcessHasCookie before calling SetCookies, same as CookieServiceParent::RecvSetCookies does. or the internal SetCookies method should check it itself so both paths are covered
Updated•6 months ago
|
Updated•6 months ago
|
Updated•1 month ago
|
Description
•