Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Yandex Decrypt #483

Open
TechForBad opened this issue Mar 27, 2020 · 30 comments
Open

Yandex Decrypt #483

TechForBad opened this issue Mar 27, 2020 · 30 comments

Comments

@TechForBad
Copy link

Why is the yandex browser not completed? Hope to update :-)

@AlessandroZ
Copy link
Owner

Hmm I don't remember the problem I encountered. Some test should be done here: https://github.com/AlessandroZ/LaZagne/blob/master/Windows/lazagne/softwares/browsers/chromium_based.py#L130

@qwerty-w
Copy link

I agree, it would be very cool if the new version showed passwords from Yandex Browser

@rynnz
Copy link

rynnz commented Apr 14, 2020

sup, yandex will be completed, or your knowledge of encryption is insufficient to correct current errors?

@qwerty-w
Copy link

Yes, I’m also wondering if there will be a decryption of Yandex browser passwords?

@AlessandroZ
Copy link
Owner

I have tried to add it recently but I don't know why something does not work and right now I cannot understand why. I have commented everything on the code if someone wants to take a look.

I will check it again if I have time but it's not my priority so if you want to take a look, check my comments: https://github.com/AlessandroZ/LaZagne/blob/master/Windows/lazagne/softwares/browsers/chromium_based.py#L120

I'm missing a little thing to get it to work but no idea what.

@rynnz
Copy link

rynnz commented Apr 16, 2020

If you are interested, you could read an article by Russian developers about how their encryption system works, it is quite complex and looking at your code does not at all match what you were trying to do, it may help you.

https://habr.com/ru/company/yandex/blog/344382/

@Papotito123
Copy link

Papotito123 commented May 24, 2020

Hello:
From Yandex:
If the user didn't create a master password, the passwords are encrypted in the browser in these steps:
The browser generates a random 256-bit EncKey.
The browser uses this key to protect site passwords using AES-256 GCM encryption. GCM mode is enabled during encryption to ensure data integrity during subsequent syncing. GCM is used for hashing and validating the URL, login and field markup.
The EncKey is encrypted using the browser's built-in OSCrypt function, and is then stored on the computer. The OSCrypt function uses various encryption algorithms depending on the operating system (see the table).

EncKey encryption in Windows without the master password::
The original password encryption key (EncKey):
Mh6lu1xRuZFo/qJ2yktfJch2nAzlgY4+OPADyLQYfrkbR0hxae9M5nVdafthJa2QHG18sZbf2VOxveH87naRb3vq3oJykfxlVHX4bllYDCcLISzHZVnxF2yMM0r4BXl8Uq+nuINiWx8kaKtrULrdwnMGU6eOuOLZvv/wLDzQvz74iuQUgoR3NSpOByFnY/BkAmGWbQ5KXTYqqIcrcqkG1xb3EAQGEG8KGPtQsTvLsHL1QdjteMZ9CBBLAWjYd/kdrZsx+MU96XMEA+ViBU0ot35cAPVBeWgAyMZhvM9sYy4zB2HrCg+n14kSc85OjNEqAChQDeHVtcbBfyshnKB0Qg==

The key that is used for encrypting EncKeyis generated by the CryptProtectData function and is located in the directory:
C:\Users\Account name\AppData\Local\Microsoft\Protect

EncKey* (in base64), encrypted by the key generated by the CryptProtectData function:
AQAAANCMnd8BFdERjHoAwE/Cl+sBAAAApRUs2Bmwq0O4LpCRrIGKQAAAAAACAAAAAAADZgAAwAAAABAAAAAttmGwtWQIgR+ugd6cMwB1AAAAAASAAACgAAAAEAAAAKXn3AtX945aXjv2nFEYf6soAAAAFoZEF0y2DY4+JtCPwkZb68tXEHiZHMPRhJIrMzQA+QF6E6iJBGZD+RQAAAAnmL25O/Rbm8JaMS9cwZZAWtjEGA==

When the user wants to enter a password in a login form, the browser decrypts the EncKey via the OS, then decrypts the necessary password.

Just to share some info about my experience with Yandex.
Yandex 20.4.3.257 first time installation with a new Saved login and no Master password.
While not using Master Password for Yandex,Saved logins are saved in computer in Credential Manager under Windows Credentials generic.
But,for Login/name,will keep a blank space and for Password will display asterisks.

Yandex doesn't have Default\Login Data file .
Instead, Saved passwords are saved in \AppData\Local\Yandex\YandexBrowser\User Data\Default\Ya Passman Data

Still has User Data\Local State;
"os_crypt":{"checker_state":{"counter":0,"encrypted_data":"xxxxxxxxxxxxxxxxxxxxxxxxx="},"encrypted_key":"RFBBUxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx......."}

RFBBU = DPAPI word

With a tool named NTHASH-FPC @erwan I can:
Local State {GUID} can be grabbed.
user SHA1 can be calculated.
Masterkey{GUID} SHA1 can be calculated.

So ,with this MKsha1 should decode blob to get encrypted_key decrypted key(AES local state key).
Then use this AES key to decrypt Logins.
I don't see what is missing.

Ya Passman Data login entry:
https://live.com/https://login.live.com/ppsecure/[email protected]£Áþšê�tè¹\•…ÕÈ;¢¡þ&¬¸xÄyA¹uuí»’”�Ý

  • maybe, passw ,entry has some chars at start that are some placeholder/ID that should be taken out

Login Data login entry:
��� �https://login.live.com/login.srfhttps://login.live.com/ppsecure/[email protected]ÏA’°ùžºN�eá�NXUô˜‘µ¨Ž�A��‰3Ш¯[f"Ì��

lazagne can recover Yandex blob data under :

1:
------------------- Credman passwords -----------------

[+] Password found !!!
URL: Yandex.Browser
Login: None
Password: b'\x08.................................................'

And,

2:
------------------- Yandexbrowser passwords -----------------

[+] Password found !!!
URL: https://login.live.com/ppsecure/post.srf
Login: [email protected]
Password: b'D\xc2...........................................................................................'

@Papotito123 Papotito123 mentioned this issue Aug 14, 2020
@nneekkiitt
Copy link

Does anyone know, how yandex stores encrypted passwords without the master passord?

Chrome uses folowing scheme:
The main key is protected with DPApi and stored in "Local State" json file. This key is used for password encryption. Passwords are stored in the "Login Data" database in table "logins" in field "password value". They are stored using the fofowing format:
"v10" (3 bytes) + AES GCM IV (12 bytes) + Encrypted Password + AES GCM Auth Tag (16 bytes).

Yandex browser also uses the file "Local State" with main key proteected with DPApi. Passwords are stored in the "Ya Passman Data" database, which is similar to Chrome's "Login Data".

I tried to use the Crome's algorithm to decrypt them, but if was unsuccessful.

Then I exported Chrome's passwords to Yandex and noticed, that the Yandex's encrypted passwords are shorter by 3 bytes then Chrome's. I supposed that Yandex uses the Chrome's format except "v10". I tried to decrypt passwords using AES-GCM, tried to rearrange AES GCM IV, Encrypted Password and AES GCM Auth Tag within the blob, tried to invert the blob to Little-endian and tried to decrypt the passwords using DPApi. All theese attempts were unsuccessful.

At the developer's site it is said that Yandex uses exactly this algorithm. And that's why I think that Yandex uses some special password storage format, which is not described at the developer's site.

Errors in the code are impossible, since the code works for chrome

@Papotito123
Copy link

@B011111000000
Copy link

Is there anything new?

@bviyesbfvwiye
Copy link

I think, there are some different prefixes in the encrypted password. For example, in Chrome it's 'v10' or 'v11'.

@bviyesbfvwiye
Copy link

bviyesbfvwiye commented Dec 8, 2021

I think, the problem is in the AES-encrypted password, not in the DPAPI+base64 encrypted key.

@Miracle-doctor
Copy link

I checked with chrome v10 algorithm and saw that after decryption length of password same of original password. I think there is next step for decryption password

@Miracle-doctor
Copy link

Miracle-doctor commented Jan 6, 2022

Also in Yandex browser Local State file has checker_state that base64 encoded. After decoding this same as v10 algorithm and decrypted with chrome algorithm:
"os_crypt": {
"checker_state": {
"counter": 0,
"encrypted_data": "djEwszZEY8gkj3Ot6chEYS+kMl8FRAKu0OALjhgw41k="
},

@Miracle-doctor
Copy link

I think "encrypted_key" successfully decrypted "encrypted_data" in Local State file.

@QGB
Copy link

QGB commented Aug 3, 2022

DeduplicateFormsImpl@../../components/password_manager/core/browser/passman/passman_password_store.cc:2471
DeduplicateFormsImpl@../../components/password_manager/core/browser/passman/passman_password_store.cc:2473
OnLoginSuccessful@../../components/password_manager/core/browser/password_manager.cc:1251
RequestEncryptionImpl@../../components/password_manager/core/browser/passman/passman_password_store.cc:1979
SaveOrUpdateProvisionallySavedForm@../../components/password_manager/core/browser/password_manager.cc:1360
PromptUserToSaveOrUpdatePassword@../../chrome/browser/password_manager/chrome_password_manager_client.cc:458
UpdatePassmanLoginImpl@../../components/password_manager/core/browser/passman/passman_password_store.cc:4306
UpdateLoginImpl@../../components/password_manager/core/browser/passman/passman_password_store.cc:3427
RemovePassmanLoginsImpl@../../components/password_manager/core/browser/passman/passman_password_store.cc:2549
RemovePassmanLoginsImpl@../../components/password_manager/core/browser/passman/passman_password_store.cc:2600
RemoveLoginImpl@../../components/password_manager/core/browser/passman/passman_password_store.cc:3440
AddPassmanLoginsImpl@../../components/password_manager/core/browser/passman/passman_password_store.cc:2656
AddLoginImpl@../../components/password_manager/core/browser/passman/passman_password_store.cc:3414
DeduplicateFormsImpl@../../components/password_manager/core/browser/passman/passman_password_store.cc:2366
DeduplicateFormsImpl@../../components/password_manager/core/browser/passman/passman_password_store.cc:2382
DeduplicateFormsInternal@../../components/password_manager/core/browser/passman/passman_password_store.cc:2270
SaveOrUpdateProvisionallySavedForm@../../components/password_manager/core/browser/password_manager.cc:1375
TryCreateOpenKeyEncryptor@../../components/password_manager/core/browser/passman/passman_password_store.cc:3101
PostActOnChangesSync@../../components/password_manager/core/browser/passman/passman_password_store.cc:3683
CheckMasterPasswordAndUnlockImpl@../../components/password_manager/core/browser/passman/passman_password_store.cc:827
DecryptPasswordFormsImpl@../../components/password_manager/core/browser/passman/passman_password_store.cc:2089
UpdatePassmanLoginImplFromPassmanSync@../../components/password_manager/core/browser/passman/passman_password_store.cc:4240
UpdatePassmanLoginImplFromPassmanSync@../../components/password_manager/core/browser/passman/passman_password_store.cc:4296
AddPassmanLoginImplFromPassmanSync@../../components/password_manager/core/browser/passman/passman_password_store.cc:4079
AddPassmanLoginImplFromPassmanSync@../../components/password_manager/core/browser/passman/passman_password_store.cc:4131
ActOnChangesSync@../../components/password_manager/core/browser/passman/passman_password_store.cc:5382
RemovePassmanLoginImplFromPassmanSync@../../components/password_manager/core/browser/passman/passman_password_store.cc:4505
PromptUserToSaveOrUpdatePassword@../../chrome/browser/password_manager/chrome_password_manager_client.cc:477
PromptUserToSaveOrUpdatePassword@../../chrome/browser/password_manager/chrome_password_manager_client.cc:473
PromptUserToSaveOrUpdatePassword@../../chrome/browser/password_manager/chrome_password_manager_client.cc:465
OnLoginSuccessful@../../components/password_manager/core/browser/password_manager.cc:1266
DeduplicateFormsSync@../../components/password_manager/core/browser/passman/passman_password_store.cc:3965
UnlockAndSetKeyStoreEncryptor@../../components/password_manager/core/browser/passman/passman_password_store.cc:2055
AddLoginSync@../../components/password_manager/core/browser/passman/passman_password_store.cc:3729
AddPassmanLoginImplFromPasswordSync@../../components/password_manager/core/browser/passman/passman_password_store.cc:3999
AddPassmanLoginImplFromPasswordSync@../../components/password_manager/core/browser/passman/passman_password_store.cc:4063
AddLoginSync@../../components/password_manager/core/browser/passman/passman_password_store.cc:3771
SaveOrUpdateProvisionallySavedForm@../../components/password_manager/core/browser/password_manager.cc:1320
RemoveLoginsImpl@../../components/password_manager/core/browser/passman/passman_password_store.cc:2219

@kokolbin
Copy link

Hi, AlessandroZ. I have looked inside YaBrowser:
when you get aes_gcm key(from DPAPI decryption of ) you can verify that this key is valid, you can decrypt "checker_state":{"encrypted_data"} with this key and the plain text should be "0x00". So the key is valid.
But looking in YaPassmanData.logins.password_value and playing with length of saved password we can conclude that they(Ya) use the same algorithm AES_GCM to protect saved passwords: {nonce[12], ciphertext[SavedPasswordLength], tag[16]}, but when you try to decrypt cipher ciphertext with valid key - you get binary waste.
First idea was to play with positions: {nonce, ciphertext, tag} ->{ciphertext, nonce, tag} ->... - no result
So, the real action that can help us to understand how password are encrypted and stored is reversing the YaBrowser application, try to find the place where decrypting begin, breakepoint it and debug step by step.

@LimerBoy
Copy link

Any solutions?

@KushMaD
Copy link

KushMaD commented May 12, 2023

Does anyone know, how yandex stores encrypted passwords without the master passord?

Chrome uses folowing scheme: The main key is protected with DPApi and stored in "Local State" json file. This key is used for password encryption. Passwords are stored in the "Login Data" database in table "logins" in field "password value". They are stored using the fofowing format: "v10" (3 bytes) + AES GCM IV (12 bytes) + Encrypted Password + AES GCM Auth Tag (16 bytes).

Yandex browser also uses the file "Local State" with main key proteected with DPApi. Passwords are stored in the "Ya Passman Data" database, which is similar to Chrome's "Login Data".

I tried to use the Crome's algorithm to decrypt them, but if was unsuccessful.

Then I exported Chrome's passwords to Yandex and noticed, that the Yandex's encrypted passwords are shorter by 3 bytes then Chrome's. I supposed that Yandex uses the Chrome's format except "v10". I tried to decrypt passwords using AES-GCM, tried to rearrange AES GCM IV, Encrypted Password and AES GCM Auth Tag within the blob, tried to invert the blob to Little-endian and tried to decrypt the passwords using DPApi. All theese attempts were unsuccessful.

At the developer's site it is said that Yandex uses exactly this algorithm. And that's why I think that Yandex uses some special password storage format, which is not described at the developer's site.

Errors in the code are impossible, since the code works for chrome

Hi! Any solutions?

@Sovenok-Hacker
Copy link

Any solutions?

As I see, no. Yandex Encryption have many layers and can be encrypted with cloud key, so no it is not hacked.

@bviyesbfvwiye
Copy link

Yandex Browser is 100% hacked on the dark boards though

@bviyesbfvwiye
Copy link

bviyesbfvwiye commented May 14, 2023

But they don't provide any source code unfortunately

@ghost
Copy link

ghost commented May 15, 2023

Any solutions?

you could use this link as it has Yandex source https://news.ycombinator.com/item?id=34526431

@Giawa86
Copy link

Giawa86 commented May 18, 2023 via email

@sea256
Copy link

sea256 commented Apr 15, 2024

any news?

@LimerBoy
Copy link

LimerBoy commented Aug 5, 2024

i reversed yandex and got the algo >:D anyone wanna buy it?

@Sovenok-Hacker
Copy link

i reversed yandex and got the algo >:D anyone wanna buy it?

Of course no

@Sovenok-Hacker
Copy link

It is publicly available

@LimerBoy
Copy link

It is publicly available

nope

@reg499
Copy link

reg499 commented Oct 31, 2024

Has anyone found the method yet? If so, show how it was solved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests