Closed
Bug 1066570
Opened 11 years ago
Closed 11 years ago
b2g NFC uninitialized memory bug
Categories
(Firefox OS Graveyard :: NFC, defect)
Firefox OS Graveyard
NFC
Tracking
(firefox-esr31 unaffected)
RESOLVED
FIXED
2.1 S5 (26sep)
| Tracking | Status | |
|---|---|---|
| firefox-esr31 | --- | unaffected |
People
(Reporter: bugcatcherchristopher, Assigned: allstars.chh)
References
Details
(Keywords: sec-low, Whiteboard: [p=1])
Attachments
(1 file, 1 obsolete file)
|
1.07 KB,
patch
|
allstars.chh
:
review+
|
Details | Diff | Splinter Review |
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:31.0) Gecko/20100101 Firefox/31.0
Build ID: 20140716183446
Steps to reproduce:
While auditing the NFC service I came across a potential uninitialized pointer in NfcMessageHandler::GeneralResponse.
bool
NfcMessageHandler::GeneralResponse(const Parcel& aParcel, EventOptions& aOptions)
{
const char* type; //type can go uninitalized due to missing default
NS_ENSURE_TRUE(!mPendingReqQueue.IsEmpty(), false);
int pendingReq = mPendingReqQueue[0];
mPendingReqQueue.RemoveElementAt(0);
switch (pendingReq) {
case NfcRequest::WriteNDEFReq:
type = kWriteNDEFResponse;
break;
case NfcRequest::MakeReadOnlyNDEFReq:
type = kMakeReadOnlyNDEFResponse;
break;q
case NfcRequest::ConnectReq:
type = kConnectResponse;
break;
case NfcRequest::CloseReq:
type = kCloseResponse;
break;
}
Actual results:
The switch statement has no default case. If the attacker can send arbitrary NFC messages they could pass over the switch leaving "const char* type" uninitialized. The variable is then accessed here, "aOptions.mType = NS_ConvertUTF8toUTF16(type).
Could lead to DoS and maybe info leak? Working on proof of concept...
Expected results:
The switch statement should have a default case that catches non-existent request types.
Comment 1•11 years ago
|
||
Sandip, Ken: Can you help with verifying and triage?
Component: General → NFC
Comment 2•11 years ago
|
||
CCing a few more people from the NFC team.
Wesley and Howie, can either you help us get some engineers to verify this?
Comment 3•11 years ago
|
||
Yoshi, it's look like you wrote the code, could you have a look at it?
Flags: needinfo?(allstars.chh)
Comment 4•11 years ago
|
||
After a quick search, it's look like to me it's filtered before: http://dxr.mozilla.org/mozilla-central/source/dom/nfc/gonk/NfcMessageHandler.cpp#42
| Assignee | ||
Updated•11 years ago
|
looks like Stephanie is correct.
mPendingReqQueue only adds requests on the client side and Marshall() doesn't give
any opportunity to add an invalid type.
this won't triggerable in real world but may want to add default handling in switch statement just
incase an exploitable condition is born later
| Assignee | ||
Comment 7•11 years ago
|
||
| Assignee | ||
Updated•11 years ago
|
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
| Assignee | ||
Updated•11 years ago
|
Attachment #8493533 -
Flags: review?(dlee)
Comment 8•11 years ago
|
||
Comment on attachment 8493533 [details] [diff] [review]
Patch
Review of attachment 8493533 [details] [diff] [review]:
-----------------------------------------------------------------
::: dom/nfc/gonk/NfcMessageHandler.cpp
@@ +131,5 @@
> type = kCloseResponse;
> break;
> + default:
> + CHROMIUM_LOG("Nfcd, unknown general response %d", pendingReq);
> + return false;
Nits. indention
Attachment #8493533 -
Flags: review?(dlee) → review+
| Assignee | ||
Updated•11 years ago
|
Whiteboard: [p=1]
Target Milestone: --- → 2.1 S5 (26sep)
| Assignee | ||
Comment 9•11 years ago
|
||
nits addressed.
Attachment #8493533 -
Attachment is obsolete: true
Attachment #8493666 -
Flags: review+
| Assignee | ||
Comment 10•11 years ago
|
||
| Assignee | ||
Comment 11•11 years ago
|
||
forgot to paste try
https://tbpl.mozilla.org/?tree=Try&rev=5d146097e2f9
Comment 12•11 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Updated•11 years ago
|
status-firefox-esr31:
--- → unaffected
Updated•10 years ago
|
Group: core-security → core-security-release
Updated•9 years ago
|
Group: core-security-release
You need to log in
before you can comment on or make changes to this bug.
Description
•