cmdkey.exe

  • File Path: C:\Windows\system32\cmdkey.exe
  • Description: Credential Manager Command Line Utility

Hashes

Type Hash
MD5 F9C20642B4CFCE4517F4F26B6305607C
SHA1 B0DE4D5F0E178002E02C66DAF064DFD3FF1DBDE6
SHA256 14BCC1901C5CCA8E91A6400050308752916AC861BDD52CF3A44DC7EF46830282
SHA384 45F38A585851501FAA095A9374AEC160DB3800B9AC9196D0D64AA1DF74E449D97A1C542737072B169DEAA2493F3C2862
SHA512 8EB98B07E17EF8B0891F79C5248F3A59EEBA41F190746C4407AC401329225A17051401A82807CBACDB265784EEA4D38BD8BF89E3080C30FAFFE4C3F5691D1A13
SSDEEP 384:MXKDF3y+4BMfcDv2ZtqjXR/1RvOiDVwJxCGsVW3wW:5Jd4qShzTDSCGsK
IMP 03AD7A1AF78BF7A500FB199CABE4C34A
PESHA1 F98AF9D1CC63F9DFED9EC2FF7AD8A5C407B7808C
PE256 06D8A0BCD59D55E87AF90D582B9FE43A45AA00FFE121B469E2139AFD8DEDC6F1

Runtime Data

Usage (stdout):


Creates, displays, and deletes stored user names and passwords.

The syntax of this command is:

CMDKEY [{/add | /generic}:targetname {/smartcard | /user:username {/pass{:password} }} | /delete{:targetname | /ras} | /list{:targetname}]

Examples:

  To list available credentials:
     cmdkey /list
     cmdkey /list:targetname

  To create domain credentials:
     cmdkey /add:targetname /user:username /pass:password
     cmdkey /add:targetname /user:username /pass
     cmdkey /add:targetname /user:username
     cmdkey /add:targetname /smartcard
     
  To create generic credentials:
     The /add switch may be replaced by /generic to create generic credentials

  To delete existing credentials:
     cmdkey /delete:targetname

  To delete RAS credentials:
     cmdkey /delete /ras
     

Loaded Modules:

Path
C:\Windows\system32\cmdkey.exe
C:\Windows\System32\KERNEL32.DLL
C:\Windows\System32\KERNELBASE.dll
C:\Windows\SYSTEM32\ntdll.dll

Signature

  • Status: Signature verified.
  • Serial: 3300000266BD1580EFA75CD6D3000000000266
  • Thumbprint: A4341B9FD50FB9964283220A36A1EF6F6FAA7840
  • Issuer: CN=Microsoft Windows Production PCA 2011, O=Microsoft Corporation, L=Redmond, S=Washington, C=US
  • Subject: CN=Microsoft Windows, O=Microsoft Corporation, L=Redmond, S=Washington, C=US

File Metadata

  • Original Filename: cmdkey.exe.mui
  • Product Name: Microsoft Windows Operating System
  • Company Name: Microsoft Corporation
  • File Version: 10.0.19041.1 (WinBuild.160101.0800)
  • Product Version: 10.0.19041.1
  • Language: English (United States)
  • Legal Copyright: Microsoft Corporation. All rights reserved.
  • Machine Type: 64-bit

File Scan

  • VirusTotal Detections: 0/75
  • VirusTotal Link: https://www.virustotal.com/gui/file/14bcc1901c5cca8e91a6400050308752916ac861bdd52cf3a44dc7ef46830282/detection

Possible Misuse

The following table contains possible examples of cmdkey.exe being misused. While cmdkey.exe is not inherently malicious, its legitimate functionality can be abused for malicious purposes.

Source Source File Example License
sigma proc_creation_win_cmdkey_recon.yml title: Cmdkey Cached Credentials Recon DRL 1.0
sigma proc_creation_win_cmdkey_recon.yml description: Detects usage of cmdkey to look for cached credentials DRL 1.0
sigma proc_creation_win_cmdkey_recon.yml - https://www.peew.pw/blog/2017/11/26/exploring-cmdkey-an-edge-case-for-privilege-escalation DRL 1.0
sigma proc_creation_win_cmdkey_recon.yml Image\|endswith: '\cmdkey.exe' DRL 1.0
sigma proc_creation_win_local_system_owner_account_discovery.yml - Image\|endswith: '\cmdkey.exe' DRL 1.0
sigma proc_creation_win_mstsc.yml Image\|endswith: \cmdkey.exe DRL 1.0
LOLBAS Cmdkey.yml Name: Cmdkey.exe  
LOLBAS Cmdkey.yml - Command: cmdkey /list  
LOLBAS Cmdkey.yml - Path: C:\Windows\System32\cmdkey.exe  
LOLBAS Cmdkey.yml - Path: C:\Windows\SysWOW64\cmdkey.exe  
LOLBAS Cmdkey.yml - Link: https://www.peew.pw/blog/2017/11/26/exploring-cmdkey-an-edge-case-for-privilege-escalation  
LOLBAS Cmdkey.yml - Link: https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/cmdkey  
atomic-red-team T1021.001.md cmdkey /generic:TERMSRV/$Server /user:$User /pass:$Password MIT License. © 2018 Red Canary
atomic-red-team T1087.001.md cmdkey.exe /list MIT License. © 2018 Red Canary

Additional Info*

*The information below is copied from MicrosoftDocs, which is maintained by Microsoft. Available under CC BY 4.0 license.


cmdkey

Applies to: Windows Server 2022, Windows Server 2019, Windows Server 2016, Windows Server 2012 R2, Windows Server 2012

Creates, lists, and deletes stored user names and passwords or credentials.

Syntax

cmdkey [{/add:<targetname>|/generic:<targetname>}] {/smartcard | /user:<username> [/pass:<password>]} [/delete{:<targetname> | /ras}] /list:<targetname>

Parameters

Parameters Description
/add:<targetname> Adds a user name and password to the list.<p>Requires the parameter of <targetname> which identifies the computer or domain name that this entry will be associated with.
/generic:<targetname> Adds generic credentials to the list.<p>Requires the parameter of <targetname> which identifies the computer or domain name that this entry will be associated with.
/smartcard Retrieves the credential from a smart card. If more than one smart card is found on the system when this option is used, cmdkey displays information about all available smart cards, and then prompts the user to specify which one to use.
/user:<username> Specifies the user or account name to store with this entry. If <username> isn’t supplied, it will be requested.
/pass:<password> Specifies the password to store with this entry. If <password> isn’t supplied, it will be requested. Passwords are not displayed after they’re stored.
/delete:{<targetname> \| /ras} Deletes a user name and password from the list. If <targetname> is specified, that entry is deleted. If /ras is specified, the stored remote access entry is deleted.
/list:<targetname> Displays the list of stored user names and credentials. If <targetname> isn’t specified, all stored user names and credentials are listed.
/? Displays help at the command prompt.

Examples

To display a list of all user names and credentials that are stored, type:

cmdkey /list

To add a user name and password for user Mikedan to access computer Server01 with the password Kleo, type:

cmdkey /add:server01 /user:mikedan /pass:Kleo

To add a user name and password for user Mikedan to access computer Server01 and prompt for the password whenever Server01 is accessed, type:

cmdkey /add:server01 /user:mikedan

To delete a credential stored by remote access, type:

cmdkey /delete /ras

To delete a credential stored for Server01, type:

cmdkey /delete:server01

Additional References


MIT License. Copyright (c) 2020-2021 Strontic.