Penetration Techniques - Information Retrieval from Windows Credential Manager

Onedaysec
4 min read
0 views
docx image 1770017975541 0 1b71a9606f

0x00 Preface

---

During the post-exploitation phase, after gaining access, it is necessary to collect information from the target system. The more comprehensive the information, the more it aids in further penetration.

For Windows systems, the Credential Manager contains crucial information.

What specific types of information does it include, and what methods are available for retrieval? This article will introduce them one by one.

0x01 Introduction

---

This article will cover the following topics:

  • Different types of credentials in Credential Manager
  • Methods for retrieving plaintext passwords of different credentials
  • Practical testing

0x02 Introduction to Credential Manager

---

Credential Manager, translated as Credential Manager in Chinese, is used to store credentials (such as usernames and passwords for website logins and remote host connections).

If users choose to store credentials, the system will automatically fill in the credentials when they perform corresponding operations again, enabling automatic login.

Credentials are saved in a specific location known as the vault (located at %localappdata%/Microsoft\Vault).

Credential categories:

There are two types: Domain Credentials and Generic Credentials.

Domain Credentials:

Only the local Local Security Authority (LSA) can read and write to them.

This means that normal permissions cannot read the plaintext passwords of Domain Credentials.

Generic Credentials:

Can be read and written by user processes.

This means that normal permissions can read the plaintext passwords of Generic Credentials.

Reference:

https://msdn.microsoft.com/en-us/library/aa380517.aspx

0x03 Practical Testing

---

Test 1:

Test System: Win7

Access file share \\192.168.62.130

As shown in the figure below

Test 1: — technical illustration 1

Enter the correct username and password, select 'Remember my credentials'

Next time when accessing, there is no need to enter the username and password again

Added credentials can be found through Control Panel at Control Panel - User Accounts and Family Safety - Credential Manager

As shown in the figure below

Test 1: — technical illustration 2

Password is encrypted and cannot be viewed directly

Note:

The credential type for file sharing defaults to Domain Credentials

Test 2:

Test System: Win8

Use IE browser to access the website https://github.com/, after successful login, choose to save the username and password

Access the Credential Manager through the Control Panel, as shown in the figure below

Test 2: — technical illustration 3

Note:

Starting from Win8, the Credential Manager interface has been redesigned (different from Win7), adding Web Credentials

Displaying credential passwords requires entering the current username and password, as shown in the figure below

Test 2: — technical illustration 4

Note:

The credential type for Internet Explorer defaults to Generic Credentials

Test 3:

Test system: Win7

Add a generic credential through the Control Panel, with Internet or network address as Generi1, username as test1, and password as pass1, as shown in the figure below

Test 3: — technical illustration 5

The plaintext password of this generic credential cannot be obtained through the Control Panel

0x04 Exporting Plaintext Passwords from Credentials

---

1. Obtain basic information of system credentials

Tool 1: vaultcmd (built-in Windows system)

Common commands:

List vaults:

vaultcmd /list

Note:

Different types of credentials are stored under different vaults

List vault summary, credential names and GUIDs:

vaultcmd /listschema

Note:

GUID corresponds to files under the path %localappdata%/Microsoft\Vault\{GUID}, as shown in the figure below

Tool 1: vaultcmd (built-in Windows system) — technical illustration 6

List all credential information under the vault named "Web Credentials":

vaultcmd /listcreds:"Web Credentials"

Note:

If using a Chinese operating system, you can replace the name with the corresponding GUID using the following command:

List all credentials under the vault with GUID {4BF4C442-9B8A-41A0-B380-DD4A704DDB28}:

vaultcmd /listcreds:{4BF4C442-9B8A-41A0-B380-DD4A704DDB28}

List the properties of the vault with GUID {4BF4C442-9B8A-41A0-B380-DD4A704DDB28}, including file location, number of credentials contained, and protection method:

vaultcmd /listproperties:{4BF4C442-9B8A-41A0-B380-DD4A704DDB28}

Tool 2: cmdkey

Entering cmdkey /list in the command line can list the Windows credentials in the system.

2. Obtain the plaintext password of Domain Credentials

Tool: mimikatz

Parameter:

sekurlsa::logonpasswords

Corresponding to the previousTest 1, displayed at the credman location, as shown in the figure below

2. Obtain the plaintext password of Domain Credentials — technical illustration 7

Note:

mimikatz can not only export plaintext passwords of Domain Credentials but also plaintext passwords of the Generic Credentials type, but it cannot export plaintext passwords of the Generic Credentials type saved by the IE browser.

3. Obtain plaintext passwords of Generic Credentials

(1) Generic Credentials saved by the IE browser

Tool: Get-VaultCredential.ps1

Download link:

https://github.com/PowerShellMafia/PowerSploit/blob/master/Exfiltration/Get-VaultCredential.ps1

Corresponding to the previousTest 2The plaintext password was successfully exported on the Win8 system, as shown in the figure below

(1) Generic Credentials saved by the IE browser — technical illustration 8

Note:

This script can also obtain credential information under the vault named Windows Credential, but it cannot obtain the plaintext password of the credentials.

Supplement:

The Credential Manager in the Win7 system differs from Win8, with an additional option to prompt for permission when a program uses this password, as shown in the figure below

(1) Generic Credentials saved by the IE browser — technical illustration 9

When selected, a prompt will appear (cannot be bypassed) when using PowerShell scripts to read plaintext passwords, as shown in the figure below

(1) Generic Credentials saved by the IE browser — technical illustration 10

(2) Other types of regular tickets

Tool: Invoke-WCMDump.ps1

Download address:

https://github.com/peewpw/Invoke-WCMDump/blob/master/Invoke-WCMDump.ps1

Corresponding toTest 3, regular user permissions are sufficient to export plaintext passwords of regular tickets, as shown in the figure below

(2) Other types of regular tickets — technical illustration 11

Note:

This script can also export Domain Credentials information (excluding plaintext passwords)

0x05 Summary

---

This article introduces methods for obtaining plaintext passwords of various types of credentials, tests multiple tools, and helps everyone better understand this content.

Related Questions & Answers

How does the Credential Manager differ between Windows 7 and Windows 8+ from a penetration testing perspective?

Starting from Windows 8, the Credential Manager interface was redesigned and added a separate 'Web Credentials' vault for credentials saved by Internet Explorer. Windows 7 does not have this distinction and instead has a 'Prompt for permission' option that can block automated extraction. Testers should be aware that the Get‑VaultCredential.ps1 script works on Win8+ for IE‑stored credentials, while on Windows 7, other methods like mimikatz or Invoke‑WCMDump may be needed. Understanding these differences is crucial during [information retrieval from Windows Credential Manager](/news/penetration-techniques-information-retrieval-from-windows-credential-manager).

Why might a penetration tester need to use a PowerShell script like Invoke-WCMDump.ps1 instead of mimikatz for extracting credential passwords?

Invoke‑WCMDump.ps1 is effective for extracting plaintext passwords from Generic Credentials that are not stored by Internet Explorer, such as manually added credentials. While mimikatz can also handle Generic Credentials, it cannot extract those saved by IE. Invoke‑WCMDump can also export Domain Credentials information (excluding plaintext). Additionally, on Windows 7, when the 'Prompt for permission when a program uses this password' option is enabled, PowerShell scripts trigger a prompt that cannot be bypassed, whereas mimikatz might still work silently.

What built-in Windows command-line tools can be used to list credential information, and how do they differ?

Windows provides two built-in tools: `vaultcmd` and `cmdkey`. `vaultcmd` offers more detailed operations, such as listing vaults (`/list`), credential names with GUIDs (`/listschema`), and properties including file location and protection method (`/listproperties`). `cmdkey /list` simply lists all stored Windows credentials. Both are useful for initial reconnaissance during the [post‑exploitation phase](/news/penetration-techniques-information-retrieval-from-windows-credential-manager) to identify available credentials.

How can penetration testers extract plaintext passwords from Domain Credentials stored in the Windows Credential Manager?

Plaintext passwords for Domain Credentials can be extracted using the mimikatz tool with the `sekurlsa::logonpasswords` command, which displays credential information at the credman location. Mimikatz can also extract plaintext passwords for Generic Credentials, but it cannot extract those saved by Internet Explorer. For IE‑stored Generic Credentials, the Get‑VaultCredential.ps1 PowerShell script from PowerSploit is effective.

What are the two main categories of credentials stored in Windows Credential Manager, and what is the key difference between them in terms of access permissions?

The two main categories are Domain Credentials and Generic Credentials. Domain Credentials can only be read and written by the Local Security Authority (LSA), meaning normal user permissions cannot extract their plaintext passwords. Generic Credentials, however, can be read and written by user processes, so regular permissions can often extract their plaintext passwords. This distinction guides tool selection during [information retrieval from Windows Credential Manager](/news/penetration-techniques-information-retrieval-from-windows-credential-manager).

Continue Reading