[Hack] remove a lockscreen pin via adb with sqlite3

Search This thread

PAulyhoffman

Senior Member
Jul 25, 2010
509
154
Brooklyn Park, MN
There are a couple other ways posted for folks who have forgotten lockscreen password or pattern, but this methods REMOVES the PIN. for pattern and password follow other methods

This method requires root access and debugging enabled.
*if debugging is not enabled it can be done from any custom recovery
-reboot recovery and follow code

PIN

Code:
adb shell
# sqlite3 /data/data/com.android.providers.settings/databases/settings.db
sqlite> update secure set value=65536 where name='lockscreen.password_type';
sqlite> .exit
# exit
adb reboot

step one
Code:
adb shell
make sure you have # in the command prompt/terminal (if not type su)

step two
Code:
sqlite3 /data/data/com.android.providers.settings/databases/settings.db
you will now see sqlite>in command prompt/terminal

step 4
Code:
update secure set value=65536 where name='lockscreen.password_type';
still sqlite>

step 5
Code:
.exit
you will see the # again

step 6
Code:
exit
you will now be in the path/to/adb command prompt/terminal again

step 7
Code:
adb reboot

Enjoy full access to the device

Now lets say you think your wife is cheating on you (which she probably is) and you want to check her sext messages but return the PIN back when you are done.



Code:
adb shell
# sqlite3 /data/data/com.android.providers.settings/databases/settings.db
sqlite> update secure set value=131072 where name='lockscreen.password_type';
sqlite> .exit
# exit
adb reboot
 
Last edited:

mDroidd

Senior Member
Aug 27, 2011
1,844
1,361
mappz-development.com
I find this a bit scary, how would you normally prevent ADB or Recovery hacking like this if your device gets stolen?

I recommend Avast Anti Theft.

When your device gets stolen, the new owner will take the sim card out and put his in huh?

Well, anti theft sends a pre-entered number a warning that an other SIM is in it. Via sms commands, you can turn GPS on, send the location, block root and stuff.

It wont be deleted as it is a system app :D
I use it.

Thanks for the job, needed this for hacking my bros phone xD

Greets!
 
  • Like
Reactions: need4steer

BrotherG

Senior Member
Aug 12, 2007
180
12
Looks like CyanogenMod is working on securing ADB

Security and You
March 16th, 2012
jeagoss
1
Many of you may not give it a second glance, but among all the furor and concern about permissions requested by market apps and privacy, all Custom ROMs (CyanogenMod included) ship with one major security risk — root!

We have been struggling with how to handle this for quite a bit, and took a first step with the first public CyanogenMod 9 alpha builds, by disabling the previously-default root access over USB. You can still get adb root access by running “adb root” in terminal, should you ever need it.

We recently merged 3 patches into CyanogenMod 9, to further address this: http://goo.gl/eCjDV http://goo.gl/oWAFI and http://goo.gl/34vai.

What follows is an explanation of the changes, how they affect you and our reasoning behind them.

What do the patches do?
They disable root selectively and in a configurable way. Users will be able to configure their exposure to root as:

Disabled
Enabled for ADB only
Enabled for Apps only
Enabled for both
How does this change affect the usage of your device, and root apps you have installed?
On a default CyanogenMod installation, root usage will have to be explicitly enabled by the user. This means that the user is fully aware that any application that uses root may perform actions that could compromise security, stability and data integrity. Once enabled, the process mirrors that of the current process, apps that request root will be flagged by the SuperUser.apk and the user will have to grant selective access.

Why the change?
At CyanogenMod, security has always been one of our primary concerns, however, we were hesitant to make a change that might disrupt the current root ecosystem. With CyanogenMod 9 we have the opportunity to do things better, whether its the code in the OS, UI/UX, or security – we are taking this time to do things with a fresh approach.

Shipping root enabled by default to 1,000,000+ devices was a gaping hole. With these changes we believe we have reached a compromise that allows enthusiasts to keep using root if they so desire but also provide a good level of security to the majority of users.

What concerns remain?
Many of you reading this are savvy enough to note a remaining hole in this approach – recovery and unlocked bootloaders. The bootloaders are out of our hands, there is little to nothing we can do on that front.

Regarding recovery – with unlocked bootloaders, a malicious user could just flash a new recovery image (without any potential security we could apply) or just dump the data partition. This however, requires physical access to the device. As such, the security standards for this are highly reliant on you, the device owner. Data encryption is available in ICS to safeguard your data. (Warning for emmc only users – encrypted /data means recovery will be non-functional.)

The onus is on you to secure your device; take care of your possessions, and this risk is minimal. Always make sure you take devices out of your car before you go into the mall and remove them from pockets before washing laundry. Common sense is a basic security tool.

But Why?
We honestl

Source: http://www.cyanogenmod.com/blog/security-and-you
 
  • Like
Reactions: GlennBrownie

jaibar

Senior Member
Feb 2, 2011
1,723
1,047
Underwater, no Sh!t
picasaweb.google.com
I recommend Avast Anti Theft.

When your device gets stolen, the new owner will take the sim card out and put his in huh?

Well, anti theft sends a pre-entered number a warning that an other SIM is in it. Via sms commands, you can turn GPS on, send the location, block root and stuff.

It wont be deleted as it is a system app :D
I use it.

Thanks for the job, needed this for hacking my bros phone xD

Greets!

All true, if speaking of a casual thief- maybe you left the phone on the bar and someone couldn't resist the temptation. A couple of months ago my wife's phone was recovered in such an occasion- got an sms from Avast Theft Aware with the new number, contacted the rather surprised "honest finder" and he decided to return it back to us.

Anyway, two weeks ago went scubadiving and when returning to the car found the window broken and sure, among other stuff (wallets, scuba gear etc) also both our phones were stolen. However, this time it looks like the thieves were not quick to put their own sim card. Actually, it looks like they've removed the batteries, thrown the sim cards away (the're useless anyway as the carrier blocks the sim).

Since then, no signs whatsoever that the phones have been turned on, sims replaced or that someone has tried to type wrong security pin or whatever- no sms notifications, no emails, no webtracking, nothing.

My guess- the thieves sell them for a small fee (20% of street price?) to some lab or someone who knows "how to deal with it"- do a good wipe (not just factory reset) and remove whatever stuff was installed- system app or not- then put them on market for sale as second hand. Or maybe they just wait with patience a few weeks until you stop looking for it?

So, sometimes these apps like Avast, Cerberus and the such work, sometimes not. Better to keep the phone safe and not rely on it being stolen by a stup!d thief... :rolleyes:

On the bright side, one can consider it as an opportunity for upgrade :D
 
Last edited:

Mr.Oug

Senior Member
Dec 5, 2011
505
92
Pune
irst I typed in :

sqlite3 /data/data/com.android.providers.settings/databases/settings.db
However, in spite of what he stated, sqlite>in command prompt doesn't appear.

Instead, I get

/system/bin/sh: sqlite3: not found

how do i set sqlite working?

I'm unable to launch sqlite3 from adb shell

I can manually launch sqlite from the folder but not in cmd
 
  • Like
Reactions: ummarrkhan

holm94

Senior Member
Mar 5, 2011
61
1
Is there another way to bypass the pin code lockscreen? Cus´ I´m always stucking on:

" /sbin/sh: sqlite3: not found "

I have installed sqlite from market
 

ltdanno360

Senior Member
Jun 27, 2011
886
96
usa
www.paypal.com
this is a scary concept if you value your android device consider installing a paid service like dyndns and install the paid version of real vnc onto the device and have ssh setup as well this would help to recover your phone in the event it becomes stolen you could ssh into it launch apps view and control the phone remotely via vnc hell even take pictures ,, turn on gps all sorts of cool things
 

petesimon

Senior Member
Aug 5, 2013
84
26
Oklahoma
www.facebook.com
Is there another way to bypass the pin code lockscreen? Cus´ I´m always stucking on: " /sbin/sh: sqlite3: not found " I have installed sqlite from market

your phone is root enabled? Superuser or SuperSU app installed? Connect USB and run "adb root" and that works?
Try this installer app again https://play.google.com/store/apps/details?id=ptSoft.util.sqlite3forroot&hl=en
I flashed the root feature with SuperSU update zip file in recovery mode, and rebooted.

I grabbed a 'sqlite3' binary made for ARM cpu from the 'net and manually pushed it to my phone's /system/xbin/ directory.

1. unzip this sqlite3 file
2. power on device in custom recovery mode, ('factory mode' also may work, such as in some chinese phones, including my Jiayu)
3. connect USB cable, and in recovery mode, mount the /system directory and any other directorys you will use (see screenshot)

4. open a command prompt (terminal) on computer and run these commands
Code:
[I]adb root[/I]
[I]adb remount[/I]
[I]adb push sqlite3 /system/xbin/sqlite3[/I]
[I]adb shell[/I]
[I]chmod 755 /system/xbin/sqlite3[/I]
[I]sqlite3 -h[/I]
...
exit
adb reboot

* alternate method: if #4 'adb root' does not work, then turn on phone to normal running mode and do:
Code:
adb push sqlite3 /data/local/tmp/sqlite3
adb shell
su
mount -o rw,remount /system
cp /data/local/tmp/sqlite3 /system/xbin/
rm /data/local/tmp/sqlite3
chmod 755 /system/xbin/sqlite3
sqlite3 -h
...
exit
exit
adb reboot
"exit" twice for alternate method.

All this can be done over Wifi instead of USB via a SSH server app.

^_^

I can run all the commands fine, but the PIN lock is still there on my phone after reboot. Android 4.2.1, Jiayu Chinese ROM. So method does not work.
 

Attachments

  • sqlite3.static.android.bin.zip
    571.8 KB · Views: 845
  • adb-all.zip
    1,000.5 KB · Views: 501
Last edited:
  • Like
Reactions: Gonca007 and aicts

saf4xdadev

Senior Member
Mar 14, 2013
608
240
Space Coast
I know this is super old thread but I used this method and combination with other commands I found on internet to bypass my lockscreen on att samsung galaxy s7 phone I had forgotten pin code on.

I was using fingerprint for a couple of months and rebooted phone for an update and it requires pin code first time before using fingerprint again and I had flat out forgot it. When it got to 1 hour wait between input retrys I searched and found this and other methods. I read no methods work unless rooted.

Luckily and thank God I'm rooted and usb debugging turned on and I have adb installed configured and have used with phone before....thank God. Because pretty much every and anything else on the phone is turned off on phone so I keep off the grid.

I know I'm dragging this out but I want to document and reiterate the value of xda. I will try and remember exactly what I did and may just redo it to be sure and list my exact steps.

One thing, I don't have sqlite3 curser when connecting with adb....I have hero2qltatt or something like that .....I'll get corrected with an edit when I go thru again to make sure.

Also, once I got past lockscreen, when I went into setting/lockscreen&security/ on the phone it still showed pin,fingerprint as security but somehow which still baffles me there was a pick for 'swipe' available....but I still don't know how that happened or how it appeared but I kept trying different pin codes to try to reset that which now there were no limits or time delays but still couldn't remember and then I saw a pick for 'swipe' and that solved it all. I rebooted again to be sure and perfect. Then I went in to recovery and wiped cache and now my phone is back exactly as before.

I wrote down the pin code this time.

Eventually soon I will rerun my steps and document exactly and maybe there is already a more recent account but I found this one first and it pretty much worked....thanks.

OK this is what I used:
adb shell
cd data/system
su
rm *.key

reboot
 
Last edited:
  • Like
Reactions: elmowaldo

Top Liked Posts

  • There are no posts matching your filters.
  • 17
    There are a couple other ways posted for folks who have forgotten lockscreen password or pattern, but this methods REMOVES the PIN. for pattern and password follow other methods

    This method requires root access and debugging enabled.
    *if debugging is not enabled it can be done from any custom recovery
    -reboot recovery and follow code

    PIN

    Code:
    adb shell
    # sqlite3 /data/data/com.android.providers.settings/databases/settings.db
    sqlite> update secure set value=65536 where name='lockscreen.password_type';
    sqlite> .exit
    # exit
    adb reboot

    step one
    Code:
    adb shell
    make sure you have # in the command prompt/terminal (if not type su)

    step two
    Code:
    sqlite3 /data/data/com.android.providers.settings/databases/settings.db
    you will now see sqlite>in command prompt/terminal

    step 4
    Code:
    update secure set value=65536 where name='lockscreen.password_type';
    still sqlite>

    step 5
    Code:
    .exit
    you will see the # again

    step 6
    Code:
    exit
    you will now be in the path/to/adb command prompt/terminal again

    step 7
    Code:
    adb reboot

    Enjoy full access to the device

    Now lets say you think your wife is cheating on you (which she probably is) and you want to check her sext messages but return the PIN back when you are done.



    Code:
    adb shell
    # sqlite3 /data/data/com.android.providers.settings/databases/settings.db
    sqlite> update secure set value=131072 where name='lockscreen.password_type';
    sqlite> .exit
    # exit
    adb reboot
    2
    Is there another way to bypass the pin code lockscreen? Cus´ I´m always stucking on: " /sbin/sh: sqlite3: not found " I have installed sqlite from market

    your phone is root enabled? Superuser or SuperSU app installed? Connect USB and run "adb root" and that works?
    Try this installer app again https://play.google.com/store/apps/details?id=ptSoft.util.sqlite3forroot&hl=en
    I flashed the root feature with SuperSU update zip file in recovery mode, and rebooted.

    I grabbed a 'sqlite3' binary made for ARM cpu from the 'net and manually pushed it to my phone's /system/xbin/ directory.

    1. unzip this sqlite3 file
    2. power on device in custom recovery mode, ('factory mode' also may work, such as in some chinese phones, including my Jiayu)
    3. connect USB cable, and in recovery mode, mount the /system directory and any other directorys you will use (see screenshot)

    4. open a command prompt (terminal) on computer and run these commands
    Code:
    [I]adb root[/I]
    [I]adb remount[/I]
    [I]adb push sqlite3 /system/xbin/sqlite3[/I]
    [I]adb shell[/I]
    [I]chmod 755 /system/xbin/sqlite3[/I]
    [I]sqlite3 -h[/I]
    ...
    exit
    adb reboot

    * alternate method: if #4 'adb root' does not work, then turn on phone to normal running mode and do:
    Code:
    adb push sqlite3 /data/local/tmp/sqlite3
    adb shell
    su
    mount -o rw,remount /system
    cp /data/local/tmp/sqlite3 /system/xbin/
    rm /data/local/tmp/sqlite3
    chmod 755 /system/xbin/sqlite3
    sqlite3 -h
    ...
    exit
    exit
    adb reboot
    "exit" twice for alternate method.

    All this can be done over Wifi instead of USB via a SSH server app.

    ^_^

    I can run all the commands fine, but the PIN lock is still there on my phone after reboot. Android 4.2.1, Jiayu Chinese ROM. So method does not work.
    1
    I find this a bit scary, how would you normally prevent ADB or Recovery hacking like this if your device gets stolen?

    I recommend Avast Anti Theft.

    When your device gets stolen, the new owner will take the sim card out and put his in huh?

    Well, anti theft sends a pre-entered number a warning that an other SIM is in it. Via sms commands, you can turn GPS on, send the location, block root and stuff.

    It wont be deleted as it is a system app :D
    I use it.

    Thanks for the job, needed this for hacking my bros phone xD

    Greets!
    1
    Looks like CyanogenMod is working on securing ADB

    Security and You
    March 16th, 2012
    jeagoss
    1
    Many of you may not give it a second glance, but among all the furor and concern about permissions requested by market apps and privacy, all Custom ROMs (CyanogenMod included) ship with one major security risk — root!

    We have been struggling with how to handle this for quite a bit, and took a first step with the first public CyanogenMod 9 alpha builds, by disabling the previously-default root access over USB. You can still get adb root access by running “adb root” in terminal, should you ever need it.

    We recently merged 3 patches into CyanogenMod 9, to further address this: http://goo.gl/eCjDV http://goo.gl/oWAFI and http://goo.gl/34vai.

    What follows is an explanation of the changes, how they affect you and our reasoning behind them.

    What do the patches do?
    They disable root selectively and in a configurable way. Users will be able to configure their exposure to root as:

    Disabled
    Enabled for ADB only
    Enabled for Apps only
    Enabled for both
    How does this change affect the usage of your device, and root apps you have installed?
    On a default CyanogenMod installation, root usage will have to be explicitly enabled by the user. This means that the user is fully aware that any application that uses root may perform actions that could compromise security, stability and data integrity. Once enabled, the process mirrors that of the current process, apps that request root will be flagged by the SuperUser.apk and the user will have to grant selective access.

    Why the change?
    At CyanogenMod, security has always been one of our primary concerns, however, we were hesitant to make a change that might disrupt the current root ecosystem. With CyanogenMod 9 we have the opportunity to do things better, whether its the code in the OS, UI/UX, or security – we are taking this time to do things with a fresh approach.

    Shipping root enabled by default to 1,000,000+ devices was a gaping hole. With these changes we believe we have reached a compromise that allows enthusiasts to keep using root if they so desire but also provide a good level of security to the majority of users.

    What concerns remain?
    Many of you reading this are savvy enough to note a remaining hole in this approach – recovery and unlocked bootloaders. The bootloaders are out of our hands, there is little to nothing we can do on that front.

    Regarding recovery – with unlocked bootloaders, a malicious user could just flash a new recovery image (without any potential security we could apply) or just dump the data partition. This however, requires physical access to the device. As such, the security standards for this are highly reliant on you, the device owner. Data encryption is available in ICS to safeguard your data. (Warning for emmc only users – encrypted /data means recovery will be non-functional.)

    The onus is on you to secure your device; take care of your possessions, and this risk is minimal. Always make sure you take devices out of your car before you go into the mall and remove them from pockets before washing laundry. Common sense is a basic security tool.

    But Why?
    We honestl

    Source: http://www.cyanogenmod.com/blog/security-and-you
    1
    irst I typed in :

    sqlite3 /data/data/com.android.providers.settings/databases/settings.db
    However, in spite of what he stated, sqlite>in command prompt doesn't appear.

    Instead, I get

    /system/bin/sh: sqlite3: not found

    how do i set sqlite working?

    I'm unable to launch sqlite3 from adb shell

    I can manually launch sqlite from the folder but not in cmd
Our Apps
Get our official app!
The best way to access XDA on your phone
Nav Gestures
Add swipe gestures to any Android
One Handed Mode
Eases uses one hand with your phone