Android Lock Screen Bypass with ADB: What Still Works?

Deepak Prasad
Tested on Kali GNU/Linux Rolling 2026.2 (kali-rolling)
Package adb 1.0.41 / 34.0.5-debian
Genymotion Android 10 / API 29 (x86); ro.genymotion.version=3.1.0
Guest ADB 192.168.56.104:5555 (root adbd)
Applies to Kali with adb; rooted Genymotion or similar Android emulator labs
Lab environment Pentest lab
Genymotion Android pentest lab
Privilege Normal user on Kali; Genymotion adbd ran as root in this lab
Cert prep CompTIA PenTest+ (mobile specialized systems)
Scope What still works for Android lock-screen bypass claims via ADB, why gesture.key tutorials fail, a rooted Genymotion lab that tests those claims, Gatekeeper/Weaver/FBE at a practical level, and supported owner recovery. Does not unlock third-party phones or teach unauthorized bypass.
Related guides Android Studio AVD lab
Android insecure data storage testing
Short on time?Beta Get the gist of this 16-minute read in seconds, then ask follow-up questions

ADB cannot normally bypass the PIN, pattern, or password on a modern Android phone. The well-known method of deleting /data/system/gesture.key applies to much older Android versions and does not work as a general unlock method today.

This tutorial tests that legacy method on a rooted Android 10 Genymotion device, then explains how Gatekeeper, Weaver, and file-based encryption changed Android lock-screen security.

Android Debug Bridge (ADB) is Google's command-line tool for communicating with an Android device from a computer. It can open a shell, transfer files, install apps, and run debugging commands when the device allows that connection.

On a normal production phone, ADB is not a recovery method for a forgotten lock-screen PIN. USB debugging must already have been enabled, and the host computer normally needs to have been authorized while the device was unlocked. Genymotion provides root ADB access in this setup, which gives the shell much more access than ADB normally has on a locked production phone.

Can ADB bypass an Android PIN or pattern?

Usually not on a modern production Android phone. Modern Android no longer relies on a simple gesture.key file for lock-screen security. PINs, patterns, and passwords are tied into Android's secure credential-verification and encryption systems, which are explained later in this guide.

If you forgot the PIN on a current phone, Google's supported recovery path is normally to erase the device and set it up again. Google still documents account-based pattern reset only for Android 4.4 and older.

The commands below use a rooted Android 10 Genymotion device to test the old ADB claims directly. You will see that gesture.key does not even exist, and that deleting locksettings.db is unreliable and does not prove that encrypted user data has been recovered. The test shows why that method fails on this Android 10 image and why the same approach should not be treated as a general modern Android bypass.

IMPORTANT
Use only devices and images you own or have written authorization to assess. Deleting lock-related files can brick a lab guest, destroy cryptographic material, or leave data permanently inaccessible. Put client work in your rules of engagement before you touch a handset.

Which Android Lock Screen Bypass Methods Still Work?

Method Modern Android? What actually happens
Delete gesture.key with ADB Generally no Legacy technique; the file often does not exist
Delete password.key Generally no Legacy storage model
Delete locksettings.db Not a reliable bypass May corrupt or desync lock state; CE data can remain protected
locksettings clear --old <known PIN> Yes, with required privileged access Clears the lock when the current PIN/password is already known and the caller has sufficient privileges; it is not an unknown-PIN bypass
Google "Forgot pattern" Android 4.4 or earlier only Legacy account-based reset
Google Find Hub / factory reset Yes Removes the lock by erasing local data
Manufacturer recovery Device-specific Often reset/erase depending on vendor
Root ADB alone No general PIN bypass Root access alone does not reveal the PIN or automatically unlock credential-protected data

Genymotion gives ADB more privileges than a normal production phone. On a physical device, USB debugging must normally have been enabled beforehand, the computer must already be authorized, and root ADB is generally unavailable.

If you forgot the PIN on your own phone

For a current Android phone, Google's supported path is normally to erase the device through Find Hub or recovery mode and restore from backup. A factory reset removes local data rather than recovering the forgotten PIN, and Factory Reset Protection may require the previously associated Google account during setup. The detailed recovery notes are later in this article.


Why the Old gesture.key ADB Bypass Is Outdated

The legacy ADB method removes lock-related files under /data/system/:

  1. Get a root shell over ADB
  2. cd /data/system
  3. Delete gesture.key, password.key, and sometimes locksettings.db*
  4. Reboot and walk past the lock screen

This method comes from older Android lock-screen implementations, where pattern/password verification relied on files such as gesture.key and password.key. AOSP later moved enrollment toward Gatekeeper-backed handles and then toward synthetic-password and Weaver-backed designs.

On the Genymotion Android 10 guest used here, after a PIN was set:

  • gesture.key, password.key, gatekeeper.password.key, and gatekeeper.pattern.key were missing under /data/system
  • locksettings.db still existed and recorded a numeric PIN type
  • Gatekeeper enrollment material lived under /data/misc/gatekeeper/ as small files named 0 and 100000
  • No Weaver service was exposed

On this Android 10 image, gesture.key does not exist, so deleting it cannot change the lock state.


How Modern Android Protects the Lock Screen

Modern Android does not treat the PIN as just a hash stored in one removable file. The PIN, pattern, or password participates in a chain that verifies the credential and unlocks encryption keys.

Android documentation refers to the user's PIN, pattern, or password as a Lock Screen Knowledge Factor (LSKF). The framework uses it during enrollment and verification, then unlocks credential-bound storage and authentication-bound Keystore keys.

At a high level:

  • LockSettingsService manages lock-screen settings and coordinates setting and verifying the credential
  • Synthetic password is a randomly generated internal secret used by modern Android's lock system. The user's PIN/password helps unlock this secret, which Android can then use when protecting credential-encrypted data
  • Gatekeeper / Weaver help Android verify the credential securely and slow down repeated incorrect guesses
  • File-based encryption (FBE) separates Device Encrypted (DE) and Credential Encrypted (CE) storage

A Trusted Execution Environment (TEE) is an isolated part of the processor designed to handle sensitive operations separately from normal Android.

Android uses the lock-screen credential to help protect the synthetic password. It also needs a secure way to verify attempts and prevent unlimited guessing.

When supported, Weaver provides hardware-backed secret storage with rate limiting. Other devices use Gatekeeper for secure credential verification and throttling. The exact arrangement depends on the Android version and hardware.

Component Role Effect of deleting related files
Gatekeeper Securely verifies the lock credential and limits repeated failed attempts May break enrollment state; does not reveal the PIN
Weaver Rate-limited secure storage tied to the lock credential Often absent on simple emulators; not a delete-to-unlock trick
locksettings.db Framework metadata (types, handles, flags) On some emulators, wiping it can desync UI state after reboot
Legacy gesture.key Old pattern hash file Often absent on Android 10+ images

File-based encryption and CE vs DE

Android 7 and later support FBE. Devices launching with Android 10 or higher must use it. Each user gets:

  • Device Encrypted (DE) storage — data Android can access after the device boots, even before the user enters the PIN
  • Credential Encrypted (CE) storage — private user data that normally becomes available only after the user successfully unlocks the device after boot

Apps should keep private user data in CE storage whenever possible. That is why "the lock UI disappeared" is not the same as "I recovered the owner's private app data."

The most important time is immediately after a reboot, before the PIN has been entered for the first time. Once the user has successfully unlocked the device, CE keys are normally loaded and CE data remains available while that Android session stays running, even if the screen is later locked again. This means root access obtained after the user has already unlocked the phone may expose more data than root access immediately after a reboot.

Root access controls the normal Android operating system, but it does not automatically give access to secrets protected inside the TEE or Secure Element. Wiping a SQLite metadata file does not mean you recovered an unknown PIN.

This Genymotion guest reported ro.crypto.type=file and ro.crypto.state=encrypted. Emulator cryptography is still not a substitute for OEM TEE/Weaver deployments on physical hardware.


Build the Rooted Genymotion Lab

Use a disposable emulator. Finish the Genymotion Android pentest lab first so Kali can reach the guest over the host-only adapter. The commands below use Genymotion Android 10 / API 29 with root ADB at 192.168.56.104:5555.

Confirm ADB sees the guest:

bash
adb connect 192.168.56.104:5555
output
connected to 192.168.56.104:5555

Confirm that ADB lists the emulator with the status device, which means the connection is ready:

bash
adb devices -l
output
List of devices attached
192.168.56.104:5555    device product:vbox86p model:Phone device:vbox86p transport_id:3

If your guest uses another host-only address, substitute that IP. Check the Android version, API level, and encryption state:

bash
adb -s 192.168.56.104:5555 shell getprop ro.build.version.release
adb -s 192.168.56.104:5555 shell getprop ro.build.version.sdk
adb -s 192.168.56.104:5555 shell getprop ro.crypto.type
adb -s 192.168.56.104:5555 shell getprop ro.crypto.state
output
10
29
file
encrypted

Android 10 maps to API 29. file and encrypted mean the guest reports file-based encryption.

Genymotion returns uid=0 for adb shell in this setup, meaning the shell already has root privileges. That root access allows the shell to modify files that would normally be inaccessible through ADB on a production phone.

WARNING
Prefer a snapshot or a throwaway Genymotion device. Destructive lock-metadata experiments can leave a guest stuck during boot. Do not run them on a phone that holds real data.

Inspect the PIN and Lock State with ADB

Set a known lab PIN with the locksettings tool. Use a disposable value such as 2468, never a personal PIN:

bash
adb -s 192.168.56.104:5555 shell locksettings set-pin 2468
output
Pin set to '2468'

Inspect Android's current lock-settings state:

bash
adb -s 192.168.56.104:5555 shell dumpsys lock_settings
output
Current lock settings service state:
SP Enabled = false
    User 0
        SP Handle = 3e3a66d9915f1151
        SID = c141c2d871b98a99

The exact fields vary by Android build. The important point here is that Android created lock-related state after the PIN was set; it did not create the old gesture.key or password.key files.

Confirm wrong and right credentials:

bash
adb -s 192.168.56.104:5555 shell locksettings verify --old 9999
output
Old password '9999' didn't match

Verify the PIN you just set:

bash
adb -s 192.168.56.104:5555 shell locksettings verify --old 2468
output
Lock credential verified successfully

The successful and failed verification results confirm that the emulator is enforcing the PIN. Next, look for the legacy key files named by the old bypass method:

bash
adb -s 192.168.56.104:5555 shell ls -la /data/system/gesture.key /data/system/password.key /data/system/gatekeeper.password.key /data/system/gatekeeper.pattern.key
output
ls: /data/system/gesture.key: No such file or directory
ls: /data/system/password.key: No such file or directory
ls: /data/system/gatekeeper.password.key: No such file or directory
ls: /data/system/gatekeeper.pattern.key: No such file or directory

Inspect the database and Gatekeeper directory that did exist:

bash
adb -s 192.168.56.104:5555 shell ls -la /data/system/locksettings.db*
output
-rw-rw---- 1 system system 20480 2026-09-13 10:26 /data/system/locksettings.db
-rw-rw---- 1 system system 32768 2026-09-13 10:27 /data/system/locksettings.db-shm
-rw-rw---- 1 system system 41232 2026-09-13 10:27 /data/system/locksettings.db-wal

The Gatekeeper directory contains numeric enrollment files rather than the legacy gesture.key file:

bash
adb -s 192.168.56.104:5555 shell ls -la /data/misc/gatekeeper/
output
total 36
drwx------  2 system system 4096 2026-09-13 10:27 .
drwxrwx--t 45 system misc   4096 2026-09-13 10:24 ..
-rw-------  1 system root      0 2026-09-13 10:25 .coldboot
-rw-------  1 system root      8 2026-09-13 10:27 0
-rw-------  1 system root      8 2026-09-13 10:27 100000

Query the framework database for the password type and synthetic-password handle fields:

bash
adb -s 192.168.56.104:5555 shell "sqlite3 /data/system/locksettings.db \"SELECT name,value FROM locksettings WHERE name IN ('lockscreen.password_type','sp-handle');\""
output
lockscreen.password_type|131072
sp-handle|4484009463633613137

lockscreen.password_type identifies the configured credential type, while sp-handle is lock-framework state associated with Android's newer synthetic-password design. Neither value contains the PIN itself.

Check which lock-related Android services are running:

bash
adb -s 192.168.56.104:5555 shell service list | grep -iE 'lock_settings|gatekeeper|weaver'
output
80	lock_settings: [com.android.internal.widget.ILockSettings]
145	android.service.gatekeeper.IGateKeeperService: [android.service.gatekeeper.IGateKeeperService]

Gatekeeper was present. Weaver was not. Genymotion is useful for demonstrating the Android framework, but it does not reproduce every hardware security feature found in a physical phone.


Test the Old ADB Lock-Screen Bypass

Now test the two legacy file-deletion methods against the Android 10 emulator.

Test 1 — Delete gesture.key

The legacy gesture.key method starts by deleting:

bash
adb -s 192.168.56.104:5555 shell rm -v /data/system/gesture.key
output
rm: /data/system/gesture.key: No such file or directory

The command fails because /data/system/gesture.key does not exist on this Android 10 image.

Test 2 — Remove locksettings.db on a disposable emulator

A more destructive variant removes the locksettings.db database files and then reboots. Treat that as a disposable-emulator experiment only, and take a Genymotion snapshot first. Do not run it on a phone with real data.

On this Android 10 image, removing locksettings.db, locksettings.db-shm, and locksettings.db-wal, then rebooting, produced two outcomes in controlled testing:

  • One run cleared the emulator lock UI (locksettings verify reported that the user had no password) while Gatekeeper files under /data/misc/gatekeeper/ were still present
  • A later factory-reset retest left the guest stuck on Genymotion's Starting screen with ADB unreachable until another factory reset

The result was inconsistent across emulator runs, which is enough reason not to treat database deletion as a reliable bypass. A UI clear is a misleading emulator outcome, not PIN recovery and not proof for physical phones. A hung boot shows how fragile the experiment is even on a lab VM.

Do not delete /data/misc/gatekeeper/*. Removing those enrollment files and rebooting previously left this image unreachable and required recovery from the Genymotion host.

Test 3 — locksettings clear with the known lab PIN

In this rooted emulator, locksettings clear provides a cleaner way to remove a known lab PIN without manually deleting lock-related database files:

bash
adb -s 192.168.56.104:5555 shell locksettings clear --old 2468
output
Lock credential cleared

After that clear, verification reported that the user had no password and ADB stayed healthy:

bash
adb -s 192.168.56.104:5555 shell locksettings verify --old 2468
output
Old password provided but user has no password

This command successfully removes the lab PIN because the existing PIN (2468) was supplied. It therefore demonstrates authorized credential clearing, not bypass of an unknown PIN.


Why Root ADB Does Not Mean You Know the PIN

Root ADB gives the shell very high privileges inside Android. It can read or modify many files and control processes. That still does not mean the shell knows the user's PIN or can automatically unlock credential-encrypted data.

Those are different capabilities:

  • Root can read many DE-accessible files and tamper with incorrectly protected app data
  • Root can delete or corrupt lock metadata and brick a device
  • Root does not automatically reveal the lock-screen PIN, pattern, or password
  • Root does not automatically unwrap CE storage until the user successfully unlocks the device on a correctly implemented system

After first unlock in a running session, CE data may already be available to a privileged shell even while the screen is locked again. This is still different from recovering an unknown PIN from a freshly rebooted, locked phone.

Tools such as Andriller still depend on what ADB can reach. They do not turn a locked modern handset into plaintext by deleting a missing legacy file.


Why a Physical Android Phone Is Different

Genymotion lab guest Typical physical phone
Root ADB often available by design Production builds disable or severely restrict root ADB
Emulator does not reproduce all hardware security features Physical phones can use TEE, StrongBox, and hardware-backed Weaver
Easy to snapshot and reset Factory reset and FRP protect account-bound devices
File wipes may clear lock UI or hang boot Deleting lock files can make data inaccessible without revealing the PIN
No Weaver on this Android 10 image Weaver common on devices that meet newer secure-auth requirements

The Genymotion results show why file-deletion behavior on a rooted emulator should not be generalized to physical Android phones.


What to Check on Newer Android Versions

On a newer Genymotion or AVD image in an authorized lab, inspect rather than wipe:

  1. Set a disposable PIN with locksettings set-pin.
  2. Check whether gesture.key or password.key exist rather than assuming the legacy files are present.
  3. List /data/system, /data/system_de/<user>/spblob, and any Weaver-related paths your build exposes.
  4. Run service list and look for Weaver as well as Gatekeeper.
  5. Compare what you see with current AOSP Gatekeeper, Weaver, and FBE documentation.
Check Genymotion Android 10 (this lab) Modern production-oriented builds
gesture.key Missing Missing
Primary credential protection Gatekeeper under /data/misc/gatekeeper/ Modern Android uses synthetic-password-based credential protection with Gatekeeper and, on supported devices, Weaver
locksettings.db wipe Sometimes clears lock UI; sometimes hangs Genymotion on Starting Not a meaningful general bypass
Weaver service Not published Weaver availability depends on device hardware and implementation

Do not assume deleting locksettings.db is meaningful on newer versions merely because an emulator lets you modify the file.


Recover Your Own Android Device If You Forgot the PIN

If you forgot the PIN on your own Android device, the practical recovery options are:

  • Erase the device through Google's Find Hub when available, then restore from backup
  • Use the manufacturer's documented account-recovery or recovery-mode reset process
  • Restore data from Google or OEM backups that were created before the lockout
  • Authorized service centers when hardware failure is involved
  • For enterprise devices, MDM wipe and re-enrollment playbooks

A factory reset removes the lock by erasing local data. It does not recover the forgotten PIN. Factory Reset Protection may still require the previously associated Google account during setup.


Summary

The legacy ADB method of deleting /data/system/gesture.key is not a reliable way to bypass a modern Android lock screen. On the Android 10 Genymotion image used here, the file did not exist after a PIN was set, while Gatekeeper-related enrollment data was stored elsewhere.

Deleting locksettings.db was also unreliable, while locksettings clear --old succeeded only when the existing PIN was supplied.

For a forgotten PIN on a current phone, the normal recovery path is erase and restore rather than deleting Android lock files through ADB.

The main distinction is simple: modern Android lock security depends on credential verification and encryption mechanisms that cannot be replaced by deleting one legacy file.


References


Frequently Asked Questions

Does deleting gesture.key still bypass Android?

Usually no. On this Genymotion Android 10 lab the file was missing after a PIN was set. gesture.key belongs to older Android lock-screen implementations and is not a general modern bypass target.

Where does Android store the PIN?

Android does not store the PIN as readable text in one file. Modern Android uses secure credential-verification mechanisms such as Gatekeeper and, on supported devices, Weaver. Framework metadata may exist in files such as locksettings.db, but those files do not contain a plain-text PIN.

What is Gatekeeper?

Gatekeeper verifies the lock-screen credential inside a Trusted Execution Environment (TEE), an isolated part of the processor used for sensitive operations. It also slows repeated failed attempts and can produce authentication tokens used by other secure Android services.

What is Weaver?

Weaver provides rate-limited secure storage on supported devices. Android can use it as part of protecting the synthetic password, which ultimately helps unlock credential-encrypted data after the correct screen credential is entered.

Can Genymotion simulate Android lock-screen security?

Partially. Genymotion is useful for showing lock UI behavior, ADB inspection, and why old file names disappear. It does not faithfully reproduce OEM Weaver/StrongBox deployments. This Android 10 guest exposed Gatekeeper but not Weaver, and a metadata wipe was unreliable.

Does root automatically decrypt user data?

No. Root can access data that is already unlocked or only DE-protected, and it can destroy lock configuration. Before first unlock after boot, CE data on a correctly implemented FBE device stays wrapped until the user successfully unlocks the device. After first unlock in a running session, CE data may already be available to a privileged shell even if the screen is locked again.

Can ADB bypass a forgotten PIN on a modern phone?

Not as a general technique. ADB usually is not available on a locked production phone unless USB debugging was already enabled and the host was authorized. Google's supported recovery for a forgotten lock on current Android is normally to erase the device and restore from backup.

Finished reading?Beta Get the key takeaways in seconds, then ask follow-up questions
Kennedy Muthii

Information Security Analyst

Accomplished professional proficient in Python, ethical hacking, Linux, cybersecurity, and OSINT. With a track record including winning a national cybersecurity contest, launching a startup in Kenya, and holding a degree in information science, he is currently engaged in cutting-edge research in ethical hacking.

  • Python (programming language)
  • Certified Ethical Hacker
  • White Hat (Computer Security)
  • Linux
  • Penetration Testing