No ContentProcessHasCookie check in HttpChannelParent::RecvSetCookies
Categories
(Core :: Networking: Cookies, defect, P1)
Tracking
()
People
(Reporter: kerberoasting, Assigned: valentin)
References
Details
(Keywords: ai-involved, reporter-external, sec-moderate, Whiteboard: [client-bounty-form][necko-triaged][necko-priority-queue][adv-main152+])
Attachments
(3 files, 1 external file)
Cookie READ — RecvGetCookieList (CookieServiceParent.cpp:268)
aHost is entirely child-controlled with zero validation against the process's assigned site. The parent calls GetCookiesForURI(aHost) and returns full cookie data. Non-HttpOnly cookie values are fully exposed. The child also controls aIsForeign and aStorageAccessPermissionGranted, bypassing all ETP filtering.
Side effect: UpdateCookieInContentList(aHost) at line 283 auto-adds the host to mCookieKeysInContent, unlocking RecvSetCookies for that domain.
Cookie WRITE — two paths completely bypass ContentProcessHasCookie:
-
HttpChannelParent::RecvSetCookies(HttpChannelParent.cpp:1055) callscs->SetCookies()directly at line 1070 — the internal method, notRecvSetCookies. ContentProcessHasCookie is never called. Any content process with an active PHttpChannel can write cookies for any domain. -
WindowGlobalParent::RecvSetCookies(WindowGlobalParent.cpp:1792) — same pattern, callscs->SetCookies()directly at line 1809. Added in Bug 1839918 (Firefox 119) for bounce tracking. Every content process has a WindowGlobalParent.
Both paths call the internal SetCookies() (line 322), which only validates cookie syntax, not whether the content process is authorized for the target domain.
Impact: Compromised renderer on evil.com reads bank.com session cookies, then writes session-fixation cookies via HttpChannelParent or WindowGlobalParent and bypassing the defense built in Bug 1484026. No FIXME or TODO in any of these handlers idenfified.
Fix: Validate aHost base domain against ContentParent::GetRemoteType() in RecvGetCookieList. Route HttpChannelParent and WindowGlobalParent SetCookies through RecvSetCookies (or add equivalent origin check). Long-term: complete Bug 1491018.
See attached analysis
=== HOW DID YOU FIND THIS BUG ===
Manual source code audit of parent-side IPC cookie handlers. Traced child-controlled parameters through RecvGetCookieList and RecvSetCookies, found ContentProcessHasCookie is only enforced on 1 of 4 write paths, and the read path has no host validation at all.
=== POC & README TO BE ATTACHED ===
- submission_cookie_ipc_crossorigin.md — full code trace with all 4 vectors
- poc_cookie_ipc.py — Marionette PoC demonstrating parent-side cookie leak and content-process IPC access
| Reporter | ||
Comment 1•9 months ago
|
||
| Reporter | ||
Comment 2•9 months ago
|
||
Updated•9 months ago
|
Updated•9 months ago
|
Updated•9 months ago
|
Updated•9 months ago
|
Comment 4•6 months ago
|
||
AFAICT, this bug is the first report we got of missing validation specifically in the method HttpChannelParent::RecvSetCookies, so I'm going to undupe it. I'll mark it sec-moderate because that's what the other bugs have been. I'll find somebody to re-sec-bounty? this.
Updated•6 months ago
|
Comment 6•6 months ago
|
||
Simon, could you please move this back to sec-bounty?? It wasn't actually a dupe after all. Thanks.
Comment 7•6 months ago
|
||
Valentin, could you please find somebody to work on this and the myriad other cookie principal validation issues that remain? We keep getting dupes of these and they seem to be among the more serious of the principal validation issues. Thanks.
Updated•6 months ago
|
| Assignee | ||
Updated•6 months ago
|
| Assignee | ||
Comment 8•6 months ago
|
||
(In reply to Andrew McCreight [:mccr8] from comment #4)
AFAICT, this bug is the first report we got of missing validation specifically in the method
HttpChannelParent::RecvSetCookies, so I'm going to undupe it. I'll mark it sec-moderate because that's what the other bugs have been. I'll find somebody to re-sec-bounty?this.
The impact is the same as the other code paths.
The only reason it's not mentioned in other reports is that the code path is not used since bug 1977221.
Fortunatelly this is much easier to fix - we just remove the unused IPC message.
| Assignee | ||
Comment 9•6 months ago
|
||
Comment 10•6 months ago
|
||
Comment 11•6 months ago
|
||
https://hg-edge.mozilla.org/mozilla-central/rev/10d8b190e65b
Do we need to do something for ESR140 still?
| Assignee | ||
Comment 12•6 months ago
|
||
Bug 1977221 landed in 143, and bug 1989488 in 144. These would also need to be uplifted if we wanted to fix 140.
It would be possible to add a ContentProcessHasCookie for ESR140 only, but that's also a bit risky since it's not riding the trains.
Updated•6 months ago
|
Updated•6 months ago
|
| Assignee | ||
Comment 13•5 months ago
|
||
I think we should wontfix this for 140.
Uplifting to bug 1977221 and bug 1989488 140 wouldn't be too risky, but I don't think it's worth it unless we also fix bug 1788109.
Updated•5 months ago
|
Updated•5 months ago
|
Updated•2 months ago
|
Description
•