Keepass Recover Password

0 views
Skip to first unread message

Ogier Dudley

unread,
Aug 4, 2024, 5:55:49 PM8/4/24
to merovipun
Ifyou forget this master password, all your other passwords in the database are lost, too. There isn't any backdoor or a key which can open all databases. There is no way of recovering your passwords.

If its correctly built (and by all accounts it is), your chances of recovering your password are very limited - luck, knowledge about yourself and your behaviour, you may be able to narrow down the key space and brute force it. There are tools to brute force Keepass files - see here. That said, its likely easier and faster to simply reset all your passwords.


Massive data dumps such as these become treasure troves for research of human behavior in the context of security. The US Company Preempt revealed that a staggering 35% of the passwords in the dump could already be found in password dictionaries available prior to the breach. Statistics like these remind us to keep our passwords as strong as possible.


Today we are going to perform a simple attack on a KeePass database file and attempt to break a master password. For those unfamiliar with the software, KeePass is a popular open source password manager. Say you have 50 different passwords for different purposes that you need to remember, how do you go about remembering them all? Some people will write them down in a book. Others may store them in a plain text file - definitely not recommended! A third approach is to use a software application like KeePass. What it does is encrypt all passwords provided to the tool using AES in combination with a master password and optionally a key file. When a user then wishes to recall any particular password they will provide their master password to the tool; in response, the tool will decrypt all passwords in plain text allowing the user to check the entry of their interest.


For the software system to verify the validity of the master password provided it will apply a hashing algorithm to the string given in concatenation with other data. All those who have meddled in the password cracking world know that whenever a hash is available a brute force or dictionary attack can be launched.


So how can we do this? The first step is to extract the hash out of the KeePass database file. Here is a KeePass database we created with a very simple password that we will use for the course of this tutorial.


We now have our extracted hash file ready to be cracked. The next step is to download a password cracking utility. The greatest by far is Hashcat available from here. What makes Hashcat the leader of such tools is its massive collection of predefined hashing algorithms and its ability to utilize a computers GPU to increase cracking speeds by an enormous degree.


As of Hashcat version 3.0 the software supports KeePass with no custom algorithms needed to be defined. We can run a quick grep command to learn the switch value of 13400 needed for our invocation of the binary.


Next, we need to make an edit to our hash file. The hashcat binary does not expect the name of our KeePass database to be pre-pended to our hash so we will have to trim the string with a text editor; after doing so our hash file will look as follows.


Plenty of "passwords in memory" and "keepass" related (old) topics in here, but most of them are about how to harden key protection ; plus it seems protection mechanisms by Keepass have evolved for the last couple of years.


In 2021, as KeePass is running and unlocked, I understand the master key is stored in the RAM (obfuscated though). So the only moment you are vulnerable is when your KeePass is kept unlocked for the day and someone could have some kind of control over your device, preferably on a remote session (RDP, C2, TeamViewer, etc.) or physically (unprotected Windows 10 session as I understand you can't easily dump the RAM from USB/FW ports anymore while session is locked).


Question 2: while KeePass is opened and the RAM just dumped, has it become really difficult* to find the master key since KeePass states it's been obfuscated?*By difficult I mean 2 types of scenarios:


That is the only time the key can be extracted from memory. But if someone has the level of access to access memory, they can compromise your system in other ways, and then grab your keys the next time you log in.


In the particular case of KeePass, this is demonstrated by the existence of KeeThief. One person (or a group) reverse engineered the obfuscation, and now state-sponsored and lone hackers alike can extract KeePass keys from memory. However, since KeePass protects the keys with DPAPI, the keys cannot be extracted from an isolated memory dump alone. Instead you would have to be able to execute code on the same device (under the same user account) to decrypt the keys.


Apart from the first password character, it is mostly able to recover the password in plaintext. No code execution on the target system is required, just a memory dump. It doesn't matter where the memory comes from - can be the process dump, swap file (pagefile.sys), hibernation file (hiberfil.sys) or RAM dump of the entire system. It doesn't matter whether or not the workspace is locked. It is also possible to dump the password from RAM after KeePass is no longer running, although the chance of that working goes down with the time it's been since then.


So to answer the question, since a PoC is available it's easy to perform, it's not limited to national agencies, and it also works the DB is locked or even after the processed was killed. Just a memory dump is required.


A proof-of-concept (PoC) has been made available for a security flaw impacting the KeePass password manager that could be exploited to recover a victim's master password in cleartext under specific circumstances.


"Apart from the first password character, it is mostly able to recover the password in plaintext," security researcher "vdohney," who discovered the flaw and devised a PoC, said. "No code execution on the target system is required, just a memory dump."


"It doesn't matter where the memory comes from," the researcher added, stating, "it doesn't matter whether or not the workspace is locked. It is also possible to dump the password from RAM after KeePass is no longer running, although the chance of that working goes down with the time it's been since then."


It's worth noting that successful exploitation of the flaw banks on the condition that an attacker has already compromised a potential target's computer. It also requires that the password is typed on a keyboard, and not copied from the device's clipboard.


vdohney said the vulnerability has to do with how a custom text box field used for entering the master password handles user input. Specifically, it has been found to leave traces of every character the user types in the program memory.


This leads to a scenario whereby an attacker could dump the program's memory and reassemble the password in plaintext with the exception of the first character. Users are advised to update to KeePass 2.54 once it becomes available.


The disclosure comes a few months after another medium-severity flaw (CVE-2023-24055) was uncovered in the open source password manager that could be potentially exploited to retrieve cleartext passwords from the password database by leveraging write access to the software's XML configuration file.


It also follows findings from Google security research that detailed a flaw in password managers such as Bitwarden, Dashlane, and Safari, which can be abused to auto-fill saved credentials into untrusted web pages, leading to possible account takeovers.


The maintainers of the KeePass password management solution have released version 2.54 to fix a severe vulnerability that allows the extraction of the cleartext master password from the application's memory.


Hello, Recently i have updated my master password and now forgot the new password, but I do remember the old password. is there a way i can reset my password to old one or any other way I can recover a password?


Both my brother who I trust completely, and the executor of my estate who I also trust, have copies of my password for Keepass (and a link to a copy of my keepass database), in their password manager. They are both security conscious. If I were to forget for some reason, then I can go to them and they'll look it up and find it for me. Also, if I become incapacitated, either temporarily or permanently, one or both of them will need the information in my keepass. It has everything.


I'm guessing you are younger than me. As we get older and trust our memories less, we tend to feel the need for a backup system for that master password. It really is part of using a password manager. I have been called by an even older friend who forgot his password and I was able to look it up for him in my password manager.


I'm a computer consultant, and have helped relatives get into needed information after a client dies because I had access to their keepass database. It is a procedure that is reasonable for people to consider. Different people will weigh the risks differently.


Using a password manager is smart security. That's nothing new. However, the best password managers like KeePass keep your credentials locked behind a single "master" password that only you know. KeePass is a free, open-source password manager, which helps you manage your passwords securely. Because your passwords are securely stored, KeePass makes maintaining secure, unique passwords easier. But what happens if you forgot your KeePass password?


You need a password for many websites, your email account, your webserver, network logins - the list is endless. Also, you should use a different password for each account because if you use only one password everywhere and someone gets this password, they will have access to all of your accounts.


KeePass lets you secure your password vault with a master password, so you only have to remember one single master key to unlock the whole database. Since your password vault is always stored on your computer, you never have to worry about a third party getting their hands on it. It allows you to keep track of all your usernames and passwords in one location, and it will auto-fill in the passwords for you if you like. You can also sync it across devices using Dropbox or Google Drive.

3a8082e126
Reply all
Reply to author
Forward
0 new messages