nsIPrincipal.origin mishandles IPv6 host literals
Categories
(Core :: Security: CAPS, defect, P2)
Tracking
()
People
(Reporter: ma1, Assigned: ckerschb)
Details
(Keywords: sec-moderate, Whiteboard: [post-critsmash-triage][adv-main76+])
Attachments
(2 files)
![]() |
||
Comment 1•10 years ago
|
||
Comment 2•10 years ago
|
||
Comment 3•10 years ago
|
||
Reporter | ||
Comment 4•10 years ago
|
||
Comment 5•10 years ago
|
||
Updated•9 years ago
|
Assignee | ||
Comment 6•5 years ago
|
||
We handle this correctly, I'll upload a test to make sure we don't regress that.
Assignee | ||
Comment 7•5 years ago
|
||
Assignee | ||
Comment 8•5 years ago
|
||
Dragana,
Tom pointed out that in the test (see attachment) prinicpal.host is not canonicalized, e.g.
"http://[20D1:0000:3238:DFE1:63:0000:0000:FEFB]/"
"http://[20D1:0:3238:DFE1:63::FEFB]/"
are the exact same, which implies that storage from one could be accessed by the other.
I tried to trace down the problem, and I think the problem happens within the creation of an nsIURI. Anyway, all the code within nsIURI seems critical. Is there even an easy fix to account for canonicalized IPV6 addresses?
Comment 9•5 years ago
|
||
Valentin, can you help Christoph here?
Comment 10•5 years ago
|
||
I'm not sure I understand. The URL parser turns the IPv6 into canonicalized versions, and principal.origin reflects the same canonical form.
Since "http://[20D1:0000:3238:DFE1:63:0000:0000:FEFB]/" always gets parsed as "http://[20d1:0:3238:dfe1:63::fefb]/", that shouldn't really be a problem. Or is there something else I'm missing?
Comment 11•5 years ago
|
||
That may the answer then. "The Principal object will construct a principal based on the url it is given; if the url is not canonicalized, it won't be a canonicalized principal. But there should be no way to construct a principal with a non-canonicalized url, so that behavior is okay."
In which case we ought to be able to assert in Principal if we receive a non-canonicalized url.
I'd propose sending a try run with a moz_assert, and then land a diagnostic assert behind a pref (on by default, but this enables people to turn the assert off), and monitor crashes and be prepared to backout. If Nightly is clean w.r.t this we could make it a release assert.
![]() |
||
Comment 12•5 years ago
|
||
![]() |
||
Comment 13•5 years ago
|
||
Updated•5 years ago
|
Updated•5 years ago
|
Comment 14•5 years ago
|
||
As per my discussion on slack with Christoph, there's nothing actionable here, in terms on manual testing. Thanks!
I'll remove the qe+ flag.
Updated•5 years ago
|
Comment 15•5 years ago
|
||
Updated•5 years ago
|
Updated•4 years ago
|
Description
•