Security/Reviews/B2G/WebNFC: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
Line 117: Line 117:


===Parent/Child Communication===
===Parent/Child Communication===
https://github.com/svic/mozilla-central/blob/master/dom/system/gonk/Nfc.js
IPC NFC:* messages
Parent listens to
  const NFC_IPC_MSG_NAMES = [
    "NFC:SendToNfcd",
    "NFC:NdefDetails",
    "NFC:NdefRead",
    "NFC:NdefWrite",
    "NFC:NdefPush",
    "NFC:NfcATagDetails",
    "NFC:NfcATagTransceive",
    "NFC:Connect",
    "NFC:Close"
  ];


===Code Review Notes===
===Code Review Notes===


==== 1. Content/Chrome Segregation ====
==== 1. Content/Chrome Segregation ====
* See comment https://bugzilla.mozilla.org/show_bug.cgi?id=674741#c199
* Potential issues in ndefPush & ndefWrite trusting using values from content without validation them. Could lead to origin bypass. Switching to WebIDL should fix this though.


==== 2. Process Segregation ====
==== 2. Process Segregation ====


NFS.js largely just passes values it recieves striaght down to NFCd. Maybe we want to do more validation here, but not sure what the implication of not doing this is.
* "NFC:SendToNfcd" : debug method only
  * "NFC:NdefDetails": sessionid is the only interesting parameter here. Probably should be validated by NFC.js?
  "NFC:NdefRead": same comment as NdefDetails
  "NFC:NdefWrite": same comment as NdefDetails
  "NFC:NdefPush": Should message.records be validated? What is impact if it isn't?
  "NFC:NfcATagDetails": message.params assigned but not used
  "NFC:NfcATagTransceive": again, should message.params be sanitized?
  "NFC:Connect": compromised app could fake message.techType?
  "NFC:Close": any app could just continuely call close dossing NFC ? (since session is automatically sent?)


==== 3. Data validation & Sanitization ====
==== 3. Data validation & Sanitization ====
 
No issues apart from others raised


====4. Denial of Service ====
====4. Denial of Service ====
NFC apps could continually call close to


=== Security Risks & Mitigating Controls ===


====5. Use of Privileged APIs ====
==== Malicious NFC Tag ====
 
*  Mainly concern of firmware & drivers
* Could possibly pass up a malformed message to nfcd or even gecko
* Mitigated by validation of input, fuzz testing


====6. Interfaces with other Apps/Content====


==== Attack against chrome worker ====
Can a process connect directly to chrome worker?
Can a process kill nfcd and put itself in its place?
* validate nfcd<-> gecko protocol (JSON based?)


==== Attack from compromised child process (no permission) ====
* Can compromised child process talk directly to NFC without parent?
* Possible to spoof message, or escalate privilege, DoS other apps etc
* Mitigation: review messages


=== Security Risks & Mitigating Controls ===
==== Malicious app with NFC permissions ====
* malicious app could be granted nfc (failure in review process) or vulnerability in legitimate app
* What damage could a rogue app with NFC permissions do to the system


=== Actions & Recommendations ===
==== Malicious NFC NDEF message ====
* Is it possible to attacks through ndef messages?
* Treat all input as untrusted as usual.
* Require user interaction before performing actions


==== Actions & Recommendations====
* move to webIDL
* ensure data from content is validated (wrappers can help with this)
* Ignore messages from apps which arent currently chosen for using NFC API


[[Category:SecReview]]
[[Category:SecReview]]
canmove, Confirmed users
1,220

edits

Navigation menu