cmdkey.exe
- File Path:
C:\Windows\system32\cmdkey.exe
- Description: Credential Manager Command Line Utility
Hashes
Type | Hash |
---|---|
MD5 | 2C6DFF18B542601CC6EF0B64AEC48A95 |
SHA1 | 4E4A61B185DC1140FAAFC4E4A37A79AC97D3072E |
SHA256 | 2B9A9B9F93369BF0A4F2616398FB4A20C89567807FBFDDB9AA9257EE7A0CA241 |
SHA384 | 3F39A2332323765803A8F143FA373F3C0F94A7067F7CC37D530BE8E0A272455DE5CC2481A6E93134DD324B80745E0E46 |
SHA512 | 3B03605F778AD6CEDEED5D830BADD29E46435A56A34847C35EE5E9D0594597310E539C6A5761B2458056901522F14C90088D61E54E86B0BB35F4A5EC2723F83B |
SSDEEP | 384:Rv3K4N9/4sTPWtvuKlmPiELHONDLXHJqBG3QOdWswW:coQrm6akD7cG3z9 |
IMP | 03AD7A1AF78BF7A500FB199CABE4C34A |
PESHA1 | 836EE25A5A4ED02EBF077CF3522E498A8DC77911 |
PE256 | 872F7C28B29DA294985622040522E0660DB7FEB50BB06C138C1B79D9D68250C8 |
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
Signature
- Status: Signature verified.
- Serial:
33000001C422B2F79B793DACB20000000001C4
- Thumbprint:
AE9C1AE54763822EEC42474983D8B635116C8452
- 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.17763.1 (WinBuild.160101.0800)
- Product Version: 10.0.17763.1
- Language: English (United States)
- Legal Copyright: Microsoft Corporation. All rights reserved.
- Machine Type: 64-bit
File Scan
- VirusTotal Detections: 0/70
- VirusTotal Link: https://www.virustotal.com/gui/file/2b9a9b9f93369bf0a4f2616398fb4a20c89567807fbfddb9aa9257ee7a0ca241/detection/
File Similarity (ssdeep match)
File | Score |
---|---|
C:\WINDOWS\system32\cmdkey.exe | 66 |
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.