Decrypt any Android device with CMD / Power Shell command ! - Xiaomi Redmi 6 Questions & Answers

How to Decrypt Xiaomi REDMI 6 with CMD / Power Shell Commands ???

Just remove your screen lock then it'll be decrypted.

I tried but it's not getting decrypted.

Have you tried using no flash verity encrypt zip file?

I have tried everything! Eg- DM- Verity, Changing the file system to Ext4, Formatting data. When I format data the Internal storage gets decrypted but when I Boot the device and then again Boot in TWRP the device again gets encrypted.

Related

moto g3 lineage os 14.1 bootloop problem

i officially unlocked my moto g3 and flashed it with lineage os 14.1 nightly osprey , twrp 3.1.1-0-osprey and super su v2.79. i also had to change the format of data and cache to f2f. i cheared the cache and factory reset the phone too but the phone is stuck on bootloop.....recovery is perfectly fine , there is no problem opening it but the phone just won't stop booting up. ive waited for nearly 6 hours now
help
r4venfire said:
i officially unlocked my moto g3 and flashed it with lineage os 14.1 nightly osprey , twrp 3.1.1-0-osprey and super su v2.79. i also had to change the format of data and cache to f2f. i cheared the cache and factory reset the phone too but the phone is stuck on bootloop.....recovery is perfectly fine , there is no problem opening it but the phone just won't stop booting up. ive waited for nearly 6 hours now
help
Click to expand...
Click to collapse
Try this:
Go to recovery then wipe everything except internal storage and SD card
Install custom ROM
Don't install anything else(SuperSU or gapps)
Reboot
If above doesn't work, the problem is with custom ROM, download a different rom
ayush4261 said:
Try this:
Go to recovery then wipe everything except internal storage and SD card
Install custom ROM
Don't install anything else(SuperSU or gapps)
Reboot
If above doesn't work, the problem is with custom ROM, download a different rom
Click to expand...
Click to collapse
i solved it. found a thread which helped me. this was the procedure:
Moto g not booting up.
I hope you have an unlocked boot loader.
The first thing you need to find out is that are your phone's partition writable and readable.
1. Download the os you want to your PC rename it to "os.zip" and extract the contents to adb folder (adb folder should be in C drive i.e. C:/adb ). You will get boot. img , system (folder), and others.
1. connect your phone to PC in fastboot mode.
2.In adb type the below commands one by one without quotes. And let one command get processed before typing other.
"fastboot devices" (in response it must show you something like TJ9*****)
"fastboot erase userdata"
"fastboot erase cache"
"fastboot push C:/adb\system /system/"
"fastboot flash boot boot.img"
"fastboot flash recovery recovery.img"(flash the philz recovery now)(not required if you already have a recovery)
"fastboot push C:/adb\boot.img /data/"(to verify whether /data is writable or not)
"fastboot push C:/adb\boot.img /cache/"(to verify whether /cache is writable or not)
"fastboot push C:/adb\os.zip /data/media/0/"(to push the os to sdcard to flash it through recovery)
Then boot your phone to recovery. And see the logs, it should show
/system mounted
/data mounted
/sd-ext error mounting /sd-ext
/cache mounted
If it shows /data can't be mounted or error mounting /data. Then go to wipe and wipe /data and /sdcard and then again push os.zip to /data/media/0/. If you don't see this error, then choose to wipe to install a new rom. After this remount /system /data /cache and flash the os.zip or you can flash stock firmware through mfastboot.
This will work definitely.
r4venfire said:
i solved it. found a thread which helped me. this was the procedure:....
Click to expand...
Click to collapse
Thanks man, I tried only deleting cache and userdata from fastboot and worked too.

Android FDE crypto footer behavior/KeyMaster on Android 8

On a Qualcomm device (OnePlus 3T) running Android vers. 8, (rooted and stock more or less with TWRP), my question is this.
Is the cryptofooter always able to decrypt the device even after being destroyed and recreated (with the same PIN/password), or is there something special/distinctive that happens when the device is encrypted initially (like a random seed is used to encrypt) that is lost after the cryptofooter is destroyed, like the HMAC?
Explicitly, if I were to do the following:
1) set up the phone like new on Android v8.0.0, copy in a file onto the internal storage and then encrypt it with a pin
2) destroy/write over the cryptofooter (like installling a ZIP that overrides it) such that it could no longer be decrypted by TWRP or when booting into OS
3) back up the entire encrypted image of the phone in recovery via an ADB command (adb pull /dev/block/dm-0 file.img) to a PC
4) wipe all partitions on the phone and perform step 1) again with the same pin (generating a new cryptofooter)
5) go into ADB via TWRP, decrypt and mount the device storage/fs and pull the cryptofooter file structure/keys via adb
6) run adb push file.img /dev/block/dm-0 from TWRP to put the encrypted filesystem back
7) restore the cryptofooter from step 5 (via adb push)
8) unlock/mount the device internal storage utilizing the regenerated cryptofooter
would step 8 be possible?

How to decrypt /sdcard from ADB?

Long story short, I screwed up, and now I have an encrypted storage (with my files that I want back) but TWRP and the OS thinks it is not.
It goes like this:
The Magisk v22.0 update screwed up my phone, which stuck in a bootloop.
After countless tries with Magisk (updating, uninstalling. installing, removing mods, adding mods) in TWRP, I read somewhere to dirty flash the ROM.
Due to an HDD failure in my PC, I did not have any storage to back up my internal storage from the phone.
Because I wanted to update the ROM anyways (from MIUI 11 to 12) I decided to flash the newer one. That was the first mistake.
This made the bootloop worse, and now it stuck in fastboot mode, no recovery. After many sleepless nights I found out that not every USB-C cable is equal, and I couldn't reach my phone via fastboot because of the cable itself. Tried it with the original cable, it sure showed up as a fastboot device.
So now I was able to flash an original fastboot ROM which still gave me bootloop, so I went wiping (not formatting, so the /sdcard fs doesn't gets erased) Data and Cache in TWRP.
Then reflashed the fastboot ROM, and somehow it worked. When It booted up, I had to type in my screen lock pin again, and after setup all my files were available.
Now that the phone worked again, I wanted to finish what I started, to update to latest EU (recovery) ROM. This was the second mistake. It did not work (because it required formatting data, which I did not wanted to, and just wiped it), and came bootloop again.
So I went back to the fastboot ROM again, which fixed the phone again.
But this time, it thought the internal storage was not encrypted, so it encrypted it again.
Now I can't access the internal storage. Even the camera app says that first I need an SD Card to take photos.
Its clearly still encrypted because when I browse it in TWRP, the structure and files are there, but the names are like "74t7Z1,dnvgIIexr1QAfhD".
The problem being neither the OS, nor TWRP knows the storage is encrypted double, so it doesn't even tries to decrypt it, and there are no options to do it.
Tried to set encryption in the running OS, but it gave me the same results: even tho TWRP asks for decryption key, and says it successfully decrypted, the storage is still a mess like its in encrypted state.
Is there any way to manually force some flag, so I can access my files again? I have the encryption key, I just need some way to decrypt the storage. I think of something like an ADB command to flag the partition as encrypted, so TWRP and OS would try to decrypt it.
Thanks in advance!
insetta said:
Long story short, I screwed up, and now I have an encrypted storage (with my files that I want back) but TWRP and the OS thinks it is not.
It goes like this:
The Magisk v22.0 update screwed up my phone, which stuck in a bootloop.
After countless tries with Magisk (updating, uninstalling. installing, removing mods, adding mods) in TWRP, I read somewhere to dirty flash the ROM.
Due to an HDD failure in my PC, I did not have any storage to back up my internal storage from the phone.
Because I wanted to update the ROM anyways (from MIUI 11 to 12) I decided to flash the newer one. That was the first mistake. This made the bootloop worse, and now it stuck in fastboot mode, no recovery. After many sleepless nights I found out that not every USB-C cable is equal, and I couldn't reach my phone via fastboot because of the cable itself.
Due to an HDD failure in my PC, I did not have any storage to back up my internal storage from the phone.
So now I was able to flash an original fastboot ROM which still gave me bootloop, but after wiping (not formatting, so the /sdcard fs doesn't gets erased) Data and Cache in TWRP.
Then reflashed the fastboot ROM, and somehow it worked. When It booted up, I had to type in my screenlock pin again, and after setup all my files were available.
Now that the phone worked again, I wanted to finish what I started, to update to latest EU (recovery) ROM. This was the second mistake. It did not work (because it required formatting data, which I did not wanted to, and just wiped it), and came bootloop again.
So I went back to the fastboot ROM again, which fixed the phone again.
But this time, it thinks the internal storage is not encrypted.
Now I can't access the internal storage. Even the camera app says that first I need an SD Card to take photos.
Its clearly still encrypted because when I browse it in TWRP, the structure and files are there, but the names are like "74t7Z1,dnvgIIexr1QAfhD".
The problem being neither the OS, nor TWRP knows the storage is encrypted, so it doesn't even tries to decrypt it, and there are no options to do it.
Tried to set encryption in the running OS, but it gave me the same results: even tho TWRP asks for decryption key, and says it successfully decrypted, the storage is still a mess like its in encrypted state.
Is there any way to manually force some flag, so I can access my files again? I have the encryption key, I just need some way to decrypt the storage. I think of something like an ADB command to flag the partition as encrypted, so TWRP and OS would try to decrypt it.
Thanks in advance!
Click to expand...
Click to collapse
Is twrp permanently installed
Austinredstoner said:
Is twrp permanently installed
Click to expand...
Click to collapse
No, its not.
Also, seems like the option to decrypt is not there because its being encrypted double. One with my original pin, and now with "default_password" since the encryption is forced in this ROM.
Trying to create any backup in TWRP now gives the "required key not available" error.
insetta said:
No, its not.
Also, seems like the option to decrypt is not there because its being encrypted double. One with my original pin, and now with "default_password" since the encryption is forced in this ROM.
Trying to create any backup in TWRP now gives the "required key not available" error.
Click to expand...
Click to collapse
Decryption only works when twrp permanently installed
Austinredstoner said:
Decryption only works when twrp permanently installed
Click to expand...
Click to collapse
Okay, I flashed TWRP.
Now I found that from shell, TWRP has a "decrypt" function, which I called, but no success
tucana:/ # twrp
TWRP openrecoveryscript command line tool, TWRP version 3.5.2_9-0
Allows command line usage of TWRP via openrecoveryscript commands.
Some common commands include:
install /path/to/update.zip
backup <SDCRBAEM> [backupname]
restore <SDCRBAEM> [backupname]
wipe <partition name>
format data
sideload
set <variable> [value]
decrypt <password> [USER ID]
remountrw
fixperms
mount <path>
unmount <path>
print <value>
mkdir <directory>
reboot [recovery|poweroff|bootloader|download|edl]
tucana:/ # twrp decrypt **********
Attempting to decrypt data partition or user data via command line.
Failed to decrypt data.
insetta said:
Okay, I flashed TWRP.
Now I found that from shell, TWRP has a "decrypt" function, which I called, but no success
tucana:/ # twrp
TWRP openrecoveryscript command line tool, TWRP version 3.5.2_9-0
Allows command line usage of TWRP via openrecoveryscript commands.
Some common commands include:
install /path/to/update.zip
backup <SDCRBAEM> [backupname]
restore <SDCRBAEM> [backupname]
wipe <partition name>
format data
sideload
set <variable> [value]
decrypt <password> [USER ID]
remountrw
fixperms
mount <path>
unmount <path>
print <value>
mkdir <directory>
reboot [recovery|poweroff|bootloader|download|edl]
tucana:/ # twrp decrypt **********
Attempting to decrypt data partition or user data via command line.
Failed to decrypt data.
Click to expand...
Click to collapse
Can u partition sd card if not can u install recovery ramdisk
Austinredstoner said:
Can u partition sd card if not can u install recovery ramdisk
Click to expand...
Click to collapse
What would be the purpose of partitioning the fs? Not to mention it would like cause data loss
insetta said:
What would be the purpose of partitioning the fs? Not to mention it would like cause data loss
Click to expand...
Click to collapse
That maybe true I can't think of anything else the only thing I can still think of is dm verify or vbmeta
Austinredstoner said:
That maybe true I can't think of anything else the only thing I can still think of is dm verify or vbmeta
Click to expand...
Click to collapse
"dm verify or vbmeta"
Sound familiar, please elaborate
insetta said:
"dm verify or vbmeta"
Sound familiar, please elaborate
Click to expand...
Click to collapse
How to enable and disable dm verity on android user build
How to enable and disable dm verity on android user build. adb root, adb disable-verity, adb enable-verity. remount failed: permission denied
5gnotes.com
Austinredstoner said:
How to enable and disable dm verity on android user build
How to enable and disable dm verity on android user build. adb root, adb disable-verity, adb enable-verity. remount failed: permission denied
5gnotes.com
Click to expand...
Click to collapse
Encryption / decryption of /sdcard partition relies on PIN/password set and stored in file /data/system/locksetting.db.
Neither AVB 1.0 ( AKA DM-Verity ) nor AVB 2.0 (read: Android Verified Boot - available only on project Treble devices) have anything to do with encryption / decryption of Android partitions: their purpose is the verification of the Android OS through the bootloader when phone gets started.
insetta said:
tucana:/ # twrp decrypt **********
Attempting to decrypt data partition or user data via command line.
Failed to decrypt data.
Click to expand...
Click to collapse
Look into Android's file /cache/recovery/log to get the reason why TWRP's decrypt fails.
Why not pull content of /sdcard to PC ( e.g. TAR-archived ) and then do a factory reset to get rid of the encryption?
jwoegerbauer said:
Look into Android's file /cache/recovery/log to get the reason why TWRP's decrypt fails.
Why not pull content of /sdcard to PC ( e.g. TAR-archived ) and then do a factory reset to get rid of the encryption?
Click to expand...
Click to collapse
Because pulling encrypted /storage is pointless. First I need to be able to decrypt them.
Because pulling encrypted /storage is pointless. First I need to be able to decrypt them.
Looked into the TWRP log, and seems like it uses the native android Keymaster HAL 4 to decrypt the storage, but it ran into some issues:
This is on TWRP boot:
Bash:
I:Setting up '/data' as data/media emulated storage.
I:mount -o bind '/data/media' '/sdcard' process ended with RC=0
I:mount -o bind '/data/media/0' '/sdcard' process ended with RC=0
I:File Based Encryption is present
e4crypt_initialize_global_de
Determining wrapped-key support for /data
fbe.data.wrappedkey = true
Wrapped key supported on /data
calling retrieveAndInstallKey
Key exists, using: /data/unencrypted/key
Using Keymaster HAL: 4 from QTI for encryption. Security level: TRUSTED_ENVIRONMENT, HAL: [email protected]::IKeymasterDevice/default
begin failed, code -62
Upgrading key in memory only: /data/unencrypted/key
upgrade_key failed, code -38
e4crypt_initialize_global_de returned fail
e4crypt_initialize_global_de
Determining wrapped-key support for /data
fbe.data.wrappedkey = true
Wrapped key supported on /data
calling retrieveAndInstallKey
Key exists, using: /data/unencrypted/key
Using Keymaster HAL: 4 from QTI for encryption. Security level: TRUSTED_ENVIRONMENT, HAL: [email protected]::IKeymasterDevice/default
begin failed, code -62
Upgrading key in memory only: /data/unencrypted/key
upgrade_key failed, code -38
e4crypt_initialize_global_de returned fail
And this is after I wanted to decrypt it:
Bash:
I:Command 'decrypt *************' received
I:Set page: 'singleaction_page'
I:operation_start: 'TWRP CLI Command'
Attempting to decrypt data partition or user data via command line.
E:Unexpected value for crypto key location
E:Error getting crypt footer and key
E:Could not get footer
Failed to decrypt data.
I:Done reading ORS command from command line
I:operation_end - status=0
I also would like to decrypt my phone. I have access to adb shell, fastboot and twrp. Is there any news on how to do it?

Is my OP 7Pro permanently broken?

I have an OP 7Pro (GM1917) that was working fine for a long time with OOS 10.3.8.
I hadn't done an upgrade for a long time, and so recently, I did an upgrade to OOS 11.0.5.1.GM21AA. After doing that, my device is unusable, and I fear that there might be something broken or damaged that causes firmware or storage to no longer function properly. All of the explanatory details follow, and please read all of that. What I'm wondering is whether the device is now permanently hosed, or perhaps if there is some way for me to fix it. Here are all of the details:
After the upgrade, my device went into a permanent boot loop when trying to boot to System.
I then did fastboot boot twrp-3.6.0_11-0-guacamole.img, and it indeed put me into TWRP. However, the /data partition is inaccessible. Whenever I try to format /data, I consistently get these messages:
Code:
Failed to mount /data (Invalid argument)
Unable to recreate /data/media folder.
Unable to mount storage
Unable to mount /data/media/TWRP/.twrps
Unable to wipe data
I go back to the bootloader and connect to my PC, and I then run these commands:
Code:
fastboot erase userdata
fastboot format:ext4 userdata
These commands successfully run with no error messages. I then go back into TWRP, but /data is still inaccessible, and I get the same error messages that I listed above when trying to format /data .
I then tried to decrypt /data, but when I do so, it asks for a password, and I have no idea what password to give. I never used any password on the device in the past. I am not allowed to decrypt /data without a password.
So, I decided to use the MsmDownloadTool to reflash my device back to OOS 10.3.8. This works fine with a different GM1917 device that I have (but which I never tried flashing to OOS 11). However, with this particular device, after going into EDL mode, I am told that I am "Connected", but a couple seconds later it gives me the "Sahara Connection Failed" message. I have double-, triple-, and quadruple-checked the device drivers, and it indeed is showing that the "Qualcomm qds 9008" driver is properly installed and active. Furthermore, as I mentioned, I have no problem using MsmDownloadTool on that PC with another GM1917 device.
I went further: I extracted payload.bin from the OOS 11.0.5.1.GM21AA installation bundle, and I extracted all of the *.img files. I flashed boot.img via fastboot and retried everything that I mentioned above, but nothing has changed.
I then went and flashed all of the *.img files. However, still nothing has changed.
When reflashing the set of all *.img files, in some cases, I was told that the file is critical and cannot be reflashed. I then ran these two commands ...
Code:
fastboot flashing unlock
fastboot flashing unlock_critical
... but in both cases, I was told that the device is already unlocked. Trying to reflash all of the *.img files again gave me the same results: i.e., some got flashed, and others were not flashed due to being "Critical".
Also, some of the items I flashed were said to be "sparse" and their flashes were flagged with warnings, but as far as I can tell, they seem to have been flashed anyway.
Do these problems with /data and EDL and everything else mean that my device is somehow permanently damaged? Or are there perhaps one or more additional things that I can try in order to restore it to some sort of working state?
Thank you in advance for any thoughts or ideas.
This has been fixed.
I had forgotten that in the past, I was trying the OrangeFox dual-boot recovery on this device, and it had repartitioned /data.
I fixed this by booting into OrangeFox recovery via fastboot, and then using its adb sideload facility to flash that recovery. OrangeFox's adb sideload mechanism offers options to the user for repartitioning and rebuilding /data. I utilized those options and set /data back to "Stock", and after that, /data was accessible again.
At this point, I flashed OOS 10.3.8, and then flashed the appropriate TWRP and Magisk, now, my device is back up and running in that OOS version.
The EDL problem continues, but given that my device is now usable again, I am not overly concerned about this MsmDownloadTool issue at the moment. In my spare time, I'll continue to look into that.
All's well that ends well!
I think I also have the same issue but the good thing with mine is my device is still working..but every time I access storage via twrp it give me a 0mb or in accessible data no matter if I enter my password to decrypt data. Until now I just leave it as is for I haven't found any solution
I have the same issue but I can't boot at all. I'm only limited to twrp and fastboot. I was previously running 11.0.3 with Magisk and a Magisk module called xXx_nolimit, downloaded the OTA update and went to reboot to recovery before being prompted for a pattern passcode (I hadn't set any fingerprint or password) so I rebooted into twrp and clicked fix bootloader. Now as I reboot it just boots back into twrp.
I'm also getting these same messages:
Failed to mount /data (Invalid argument)
Unable to recreate /data/media folder.
Unable to mount storage
Unable to mount /data/media/TWRP/.twrps
I'm currently running apbf to bruteforce the pattern passcode that I never set in hopes to decrypt my phone. Not even sure it will work though as I don't have FBE user 0 mounted? I have my dad's phone which basically has the exact setup as mine but I didn't update it yet. Anyway to use partition or parts data from his phone to fix mine? I really don't want to wipe my /data or /userdata as it's been a while since I backed anything up.
Edit:
All I have in my /data folder is:
/data/india
/data/recovery
/data/reserve
The edl issue happended to me too and I just needed to use another msmdownloadtool version.

help on twrp "fastboot flash"

Hi all,
i have pure AOSP A.13 installed, and after installation i accidentally flashed twrp 3.7 by fastboot flash.
Now, system boot from slot A works, but seems i corrupted somehting:
- at twrp, /sdcard is always empty, have to re-adb push images
- installing i.e. magisk, get such errors
failed to mount "system_ext" (Block device required)
Unable to mount /data/media/TWRP/.twrps
etc.
Super partition seems anyway ok, since AOSP boots fine.
Also, quite strange, Nord is A/B, but i still have recovery partition.
Is there any chance to recover ?
Thanks

Categories

Resources