Skip to content
WETNav

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.

Worst caseHigh

Switches

/list

Lists saved credential targets and the user names stored for them. Passwords are not shown.

Low
/add<value>

Adds a credential for a target.

Medium
/generic<value>

Adds a generic credential for a target.

Medium
/delete<value>

Deletes a saved credential.

Low
/user<value>

User name to save.

Low
/pass<value>

Password to save. It appears in clear text in the command line.

High

Command 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 regexcmdkey(\.exe)?\s+.*\/list\b

    T1555.004

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.

  • High
    Potential 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)

  • Medium
    New 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)

  • Low
    Local 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.