Exploiting a Bug in Google's Glass
A race condition in Android's backup restore process allowed a symlink to be created during extraction, causing files to be written outside the intended directory. An attacker with adb access could exploit this to write to a root-owned file and gain root privileges on Google Glass.
saurik.com
Published on saurik.com
A few days ago, I posted to Twitter a picture I took of a Google Glass unit running software that I had modified. I did this while in the Bay Area after picking it up from Google's headquarters in Mountain View.
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
Likely the backup restore process did not properly validate or prevent symlink traversal during extraction, allowing a race condition to redirect file writes to arbitrary locations.
Impact
An attacker with adb access could gain root privileges on the device, allowing full control over the operating system.
What the attacker needed
USB debugging enabled; physical USB access; adb installed
How it was found
- Back up the data of the Glass Logging service using adb backup.
- Run a command in adb shell to repeatedly attempt to create a symlink until it succeeds.
- Start the restore process using adb restore with a modified backup payload.
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.
This is about a flaw in how Android restores backups. When you restore a backup, the system deletes old data and then unpacks new files. If an attacker can quickly create a special link (a symlink) during that unpacking, the files can end up in the wrong place, letting them overwrite important system files and take control of the device.
What is Race condition?
Parallel requests reach a state the code assumed could not happen: a coupon used twice, a limit overrun, a check skipped.