Android Wireless Adb And Tls Auth Architecture And The Root Of The Vulnerability
A missing equality check on the return value of OpenSSL's key comparison function meant that a key type mismatch (returning -1) was treated as a successful match. An attacker on the same network could bypass mutual TLS authentication and gain adb shell access to a device with wireless debugging enabled.
Published on systemweakness.com
Imagine a factory. The factory manager (the developer) needs to directly connect to the machines on the production line (Android devices) and issue commands.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
The code used the multi-valued return of EVP_PKEY_cmp() directly as a boolean, so a type-mismatch error (-1) was treated as a successful match instead of being rejected.
Impact
An attacker on the same network could gain full adb shell access (UID shell), install APKs, capture screen and sensor data, and read logs, potentially harvesting credentials.
What the attacker needed
Wireless debugging enabled on target; Attacker on same network segment; At least one paired RSA key on device
The fix
The fix was to compare the return value explicitly against 1, so only an exact key match authenticates; the text says this was patched in the May 2026 Android Security Bulletin.
How it was found
- Enable wireless debugging on the target device so adbd listens on a TCP port and advertises via mDNS.
- Ensure at least one previously paired RSA key fingerprint exists on the device.
- From the same network, connect to the advertised port using an EC key instead of an RSA key.
- The device's key comparison returns -1 (type mismatch), which the vulnerable code treats as a match, granting access.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
Android's wireless debugging lets a computer connect to a phone over Wi-Fi, and it checks the computer's identity using a cryptographic key. The check used a function that returns several different numbers to mean different things, but the code only tested whether the number was zero or not. So when the keys were of different types, the function returned a non-zero error code, and the phone wrongly let the connection through.
What is Access control?
A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.