Closed Bug 1034672 Opened 9 years ago Closed 9 years ago

CacheFileMetadata::WriteMetadata swaps arguments to memcpy


(Core :: Networking: Cache, defect)

Not set



Tracking Status
firefox30 --- unaffected
firefox31 --- unaffected
firefox32 --- fixed
firefox33 --- fixed
b2g-v1.4 --- unaffected
b2g-v2.0 --- fixed
b2g-v2.1 --- fixed


(Reporter: mayhemer, Assigned: mayhemer)


(Keywords: sec-low)


(1 file)

When WriteMetadata is called from the destructor (which is probably rare) we store to the metadata buffer unitialized (just allocated) memory instead of the real metadata.


Introduced in bug 949250.

Rather reporting as a sec bug since this (very very potentially) could be used for some kind of metadata spoofing.
BTW: credits to Dragana! :)
Attached patch v1Splinter Review
Assignee: nobody → honzab.moz
Attachment #8451763 - Flags: review?(michal.novotny)
Attachment #8451763 - Flags: review?(michal.novotny) → review+
Comment on attachment 8451763 [details] [diff] [review]

[Security approval request comment]
How easily could an exploit be constructed based on the patch?  Probably not very easily, this is low-rate execution code (AFAIK), however we could write cache metadata that are under control of an attacker, since we write an uninitialized just allocated heap memory.  This could lead to bad cache poisoning.

Do comments in the patch, the check-in comment, or tests included in the patch paint a bulls-eye on the security problem?  Could be, the patch is a one liner, pretty obvious what's wrong.

Which older supported branches are affected by this flaw?  Aurora.

If not all supported branches, which bug introduced the flaw?  913806 that enabled this code for ordinary users, but actually landed disabled on Fx 27

Do you have backports for the affected branches? If not, how different, hard to create, and risky will they be?  Super easy to backport, that patch should apply on Aurora (slight merging/fuzz patch only may be needed).

How likely is this patch to cause regressions; how much testing does it need?  Zero (I believe) and not much...  I'll do manual tests, this code is however harder to trigger (pretty corner case).
Attachment #8451763 - Flags: sec-approval?
Comment on attachment 8451763 [details] [diff] [review]

Since this is a sec-low (not a high or critical) security issue, you don't need sec-approval+ to check in. Go ahead and check it into trunk!
Attachment #8451763 - Flags: sec-approval?
Group: network-core-security → core-security
Comment on attachment 8451763 [details] [diff] [review]

Approval Request Comment
[Feature/regressing bug #]: cache2
[User impact if declined]: possible security hole
[Risks and why]:  exceedingly low: just fixing order of 2 args to memcpy
[String/UUID change made/needed]: none

cache 2 is on aurora, it would be worth it to get this simple one line fix on there before we move to beta.
Attachment #8451763 - Flags: approval-mozilla-aurora?
Comment on attachment 8451763 [details] [diff] [review]

Aurora+ Although this doesn't need to it can land concurrently on m-c and aurora.
Attachment #8451763 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla33
Rare condition gleaned from a security audit + sec-low + no test media = marking qe-verify-. 

If you decide you need help with verification, just set needinfo to me and provide more information on how to proceed. Thank you.
Flags: qe-verify-
Group: core-security
You need to log in before you can comment on or make changes to this bug.