Granted you need local access to modify the config, but generally the .kdbx is stored (securely) on some shared environment. Grabbing that would mean you could export passwords at your leisure in this setup?
Keepass will (by default) not ask for the password a second time before exporting - but you have to decrypt the database once before it can be exported.
So this is not a risk if your threat model is "attacker obtains a copy of my .kdbx", but it is a risk if your threat model is "attacker can modify .kdbx without me noticing, and can access my local computer or a mounted network disk to read the exported passwords".
If an attacker can modify your local install, you've lost anyway....
No, the threat model is "the attacker can modify config file", which for default installation also means "the attacker can modify the executable".
So, the attacker modifies the config file, then the user eventually uses the password manager as usual, and then a file in disk with all plain text passwords is generated and subsequently read by the attacker.
I guess the point here is you don't need a memory read vulnerability.
Can someone more knowledgeable confirm?
Given that dumping a cleartext password list is a legitimate thing you might want to do, and being a plugin (or setting) a somewhat acceptable way of achieving this, the issue here is that, as it is, the user is not being unequivocally made aware of what happened.
So yeah, I agree, in any case the feature, as it is implemented, is completely unacceptable.
They're proposing that the author change the application so that it pops up a dialog whenever the KeePass application is directed to export the decrypted document.
I'm not a KeePass dev, but with a bit of search and pattern recognition, it looks like this export feature is implemented in KeePass-2.53-Source\KeePass\DataExchange\ExportUtil.cs:
public static bool Export(PwExportInfo pwExportInfo, FileFormatProvider fileFormat,
IOConnectionInfo iocOutput, IStatusLogger slLogger)
{
PwDatabase pd = pwExportInfo.ContextDatabase;
...
// [IF CONFIG FILE DOESN'T ALLOW EXPORTING WITHOUT KEY]
if(!AppPolicy.Current.ExportNoKey && (pd != null))
{
// [THEN ASK FOR IT AGAIN]
if(!KeyUtil.ReAskKey(pd, true)) return false;
}
...
Stream s = (bFileReq ? IOConnection.OpenWrite(iocOutput) : null);
try { bResult = fileFormat.Export(pwExportInfo, s, slLogger); }
finally { if(s != null) s.Close(); }
}
They're complaining that an evil maid attack can turn off `AppPolicy.Current.ExportNoKey` and set it up to export the document silently. They want it to read: public static bool Export(PwExportInfo pwExportInfo, FileFormatProvider fileFormat,
IOConnectionInfo iocOutput, IStatusLogger slLogger)
{
PwDatabase pd = pwExportInfo.ContextDatabase;
...
// [ALWAYS ASK FOR MASTER PASSWORD AGAIN BEFORE EXPORTING]
if(!KeyUtil.ReAskKey(pd, true)) return false;
...
Stream s = (bFileReq ? IOConnection.OpenWrite(iocOutput) : null);
try { bResult = fileFormat.Export(pwExportInfo, s, slLogger); }
finally { if(s != null) s.Close(); }
}
They've even gone so far as to ask the author to create a "KeePass Essentials" version, which removes the export feature, plugins, and configuration files entirely:https://sourceforge.net/p/keepass/feature-requests/2704/#b3c...
But they ignore that with write access to the application directory, an attacker can just change the application to not show that dialog at all.
There is a global configuration file at "C:\Program Files\KeePass Password Safe 2\KeePass.config.xml" but by default, this one just contains a directive to use the user's configuration. This one also needs elevated privileges to edit.
The user's configuration file is at "C:\Users\<username>\AppData\Roaming\KeePass\KeePass.config.xml"
So if you want to avoid an attacker being able to change the user's configuration without elevation, then you can just change the security settings of that last file, e.g. by taking away the user write permission.
However, the user is probably launching the KeePass executable via some sort of shortcut. For example, a pinned shortcut on the taskbar. This would also be a user file, at "C:\Users\<username>\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\KeePass 2.lnk"
So if the attacker can modify the user's files, then they can probably also modify that shortcut, e.g. to point at a modified copy of keepass. This shows that the behavior of the "real" KeePass application is probably not very relevant here. It is difficult to defend against an attacker with that level of access.
If an evil maid has access to make such a change, wouldn't it be easier to just replace keepass.exe with custom version? The source is already available. Just call this function after successful login - ignoring XML configuration, "KeePass Essentials" version, etc.