Connecting to the Dev Tools debugging server on a remote device (like B2G) via USB (which requires ADB) is too complex to setup and use. Dealing with ADB is confusing, especially on Windows and Linux where there are driver issues / udev rules to set up first. We have made various attempts to simplify this and probably will continue to try our best, but it doesn't seem like the UX will ever be great with ADB involved.
We're interested in making the debugging server available over Wi-Fi, mainly in an attempt to simplify the UX. This of course presents new security challenges to address, but we must also keep in mind that if our plan to address security results in a complex UX, then it may not be a net gain over the USB & ADB route.
To be clear, we are not trying to expose ADB over Wi-Fi at all, only the Dev Tools debugging server.
TLS is used to provide encryption of the data in transit. Both parties use self-signed certs to identify themselves. There is a one-time setup process to authenticate a new device. This is explained in many more details later on in this document.
This proposal uses TLS with self-signed certs to allow Clients to connect to Servers through an encrypted, authenticated channel. After the first connection from a new Client, the Client is saved on the Server (if the user wants to always allow) and can connect freely in the future (assuming Wi-Fi debugging is still enabled).
The device does not listen over Wi-Fi at all by default.
User checks "DevTools over Wi-Fi" to enable the feature
Device begins listening on random TCP socket via Wi-Fi only
Device announces itself via service discovery
The Device remains listening as long as the feature is enabled.
Here are the details of connecting from a new computer to the device:
User is shown an Allow / Deny / Always Allow prompt on the Device with Computer name and hash(ComputerCert)
Device waits for out-of-band data
Computer verifies that Device's cert matches hash(DeviceCert) from the advertisement
Computer creates hash(ComputerCert) and K(random 128-bit number)
Out-of-band channel is used to move result of step 8 from Computer to Device
Device verifies that Computer's cert matches hash(ComputerCert) from out-of-band channel
Device sends K to Computer over the TLS connection
Computer verifies received value matches K
Debugging begins
Here are the details of connecting from a known computer (saved via Always Allow) to the device:
This design seems convenient and of relatively low burden on the user. If they choose to save the Computer for future connections, it becomes a one click connection from Computer to Device, as it is over USB today.
Someone could try to DoS the phone via many connection attempts. The exponential backoff should mitigate this concern. (bug 1022692)
While it would be nice if we could instead leverage ADB here, that doesn’t seem viable because: