Credential access · Windows · LOLBAS
cmdkey.exe
Credential Manager command line
Lists, adds and deletes credentials saved in Windows Credential Manager. Listing saved credentials shows which hosts the user can reach without a password prompt.
Legitimate use
Used by scripts to save credentials for mapped drives and RDP.
Switches
Lists saved credential targets and the user names stored for them. Passwords are not shown.
LowAdds a credential for a target.
MediumAdds a generic credential for a target.
MediumDeletes a saved credential.
LowUser name to save.
LowPassword to save. It appears in clear text in the command line.
HighCommand lines to worry about
- Low
Saved credential listing
Shows saved credential targets. Low risk alone, but check whether RDP or SMB to those targets follows.
Detection regex
cmdkey(\.exe)?\s+.*\/list\b
Where it is recorded
- Security4688Process creation with the full command line, when command-line auditing is enabled.
- Sysmon1Process creation with command line, hashes and parent process.
Community detections
3 SigmaHQ rules for cmdkey.exe. The explainer checks every pasted command line against all of them.
- HighPotential Reconnaissance For Cached Credentials Via Cmdkey.EXE
Detects usage of cmdkey to look for cached credentials on the system
T1003.005by jmallette, Florian Roth (Nextron Systems), Nasreddine Bencherchali (Nextron Systems)
- MediumNew Generic Credentials Added Via Cmdkey.EXE
Detects usage of "cmdkey.exe" to add generic credentials. As an example, this can be used before connecting to an RDP session via command line interface.
T1003.005by frack113, Nasreddine Bencherchali (Nextron Systems)
- LowLocal Accounts Discovery
Local accounts, System Owner/User discovery using operating systems utilities
T1033T1087.001by Timur Zinniatullin, Daniil Yugoslavskiy, oscd.community
Rules from SigmaHQ (rules/windows/process_creation), Detection Rule License (DRL) 1.1. Each rule links to its source and credits its authors.