Skip to content
Access control Write-up Intermediate

Post-Exploitation: Abusing the KeePass Plugin Cache

KeePass compiles PLGX plugins into DLLs stored in a user-writable cache folder, allowing an attacker with user-level access to replace a cached DLL and execute arbitrary code in the KeePass process. This enables extraction of all stored passwords without requiring administrative rights or process injection.

Kevin Minacori Follow

Published on blog.quarkslab.com

Posted Tue 07 February 2023 Author Kevin Minacori Category Exploitation Tags KeePass, PLGX, post-exploitation, Windows, exploitation, vulnerability, 2023

Kevin Minacori, on blog.quarkslab.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

The plugin cache folder is located in a user-writable directory (%LocalAppData%), allowing a low-privileged user to overwrite compiled plugin DLLs.

Impact

An attacker with user-level access could execute code in the KeePass process and decrypt all stored passwords once the database is unlocked, bypassing security products that look for process injection.

What the attacker needed

Attacker has access to the user account; KeePass installed with admin rights; a PLGX plugin is present in Plugins folder

How it was found

  1. Install KeePass with administrative rights so the Plugins folder is not writable by users.
  2. Place a PLGX plugin in the Plugins folder (requires high privileges).
  3. KeePass compiles the PLGX plugin into a DLL stored in %LocalAppData%\KeePass\PluginCache.
  4. An attacker with user access overwrites the cached DLL with malicious code.
  5. When KeePass starts, it loads the malicious DLL and executes the attacker's code.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

KeePass is a password manager that can load plugins. Some plugins are compiled into a cache folder that the normal user can write to. An attacker who already has access to the user's account can replace a file in that cache with malicious code, and when KeePass starts, it runs that code, giving the attacker all the passwords.

What is Access control?

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.

More from KeePass

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Broken access control

The lesson behind this report.

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.