Overview
The rdg command searches for and decrypts saved RDP passwords from RDCMan.settings files and .rdg/.RDC files. These files contain Remote Desktop connection profiles with saved credentials for administrators managing multiple systems.RDCMan (Remote Desktop Connection Manager) is a popular tool for managing multiple RDP connections. The rdg command can decrypt both the settings file and individual .rdg group files.
Basic Usage
Command Arguments
Decryption Methods
- CryptUnprotectData
- Domain Backup Key
- Masterkey Mappings
- User Credentials
- RPC Decryption
Targeting Options
| Argument | Description |
|---|---|
/target:FILE | Target specific RDCMan.settings, .rdg, or .RDC file |
/target:FOLDER | Target folder containing .rdg files |
/server:SERVER | Triage remote server (requires admin access + pvk/password) |
What Gets Decrypted
The rdg command decrypts passwords from:1
RDCMan.settings File
Located at:
%LOCALAPPDATA%\Microsoft\Remote Desktop Connection Manager\RDCMan.settingsContains:- Credential profiles
- Default logon credentials
- Recent server connections
2
Referenced .rdg Files
Group files referenced by RDCMan.settingsContains:
- Individual server entries
- Per-server credentials
- Connection settings
Execution Context
- Elevated
- Unelevated
When run with administrative privileges:
- Triages all users on the system
- Accesses RDCMan files in all user profiles
- Decrypts all RDP credential profiles
Example: Using /unprotect
Example: Using Masterkey Mappings
Example: Using Domain Backup Key
Common Scenarios
Unprivileged Execution (Recommended)
Unprivileged Execution (Recommended)
Run as the target user without elevation:Benefits:
- No LSASS access required
- No elevation needed
- Minimal detection footprint
- Works from user context
Post-Domain Compromise
Post-Domain Compromise
After obtaining domain admin and backup key:
Using Mimikatz-Extracted Masterkeys
Using Mimikatz-Extracted Masterkeys
Extract masterkeys and decrypt RDG files:
Offline/Forensic Analysis
Offline/Forensic Analysis
Analyzing copied RDG files:
RDCMan File Locations
Settings File:- Typically stored in user’s Documents folder
- Can be anywhere on the file system
- Referenced paths shown in RDCMan.settings output
- Standard RDP connection files
- Can contain saved credentials
- Found in various user locations
Why Use /unprotect?
The/unprotect flag uses CryptUnprotectData() instead of manual masterkey decryption:
No Masterkeys
Doesn’t require extracting or providing masterkeys
Unprivileged
Works without elevation or admin rights
No LSASS
Doesn’t need to access LSASS process
Stealth
Minimal detection footprint
This approach isn’t used for credentials/vaults because of how Windows Credential Manager protects data. See Benjamin’s documentation for details.
Detection Considerations
Host-Based Indicators:- Reading RDCMan.settings file
- Access to .rdg files in user directories
- Non-standard processes accessing RDP credential files
- Bulk enumeration of RDCMan files
- Monitor access to
%LOCALAPPDATA%\Microsoft\Remote Desktop Connection Manager\ - Alert on RDCMan.settings file access by non-RDCMan processes
- Track .rdg file access patterns
- Detect bulk RDP credential file enumeration
- Monitor for LSASS access (when not using /unprotect)
Related Commands
credentials
Decrypt Credential Manager RDP credentials
triage
Comprehensive user DPAPI triage
masterkeys
Decrypt user masterkeys
backupkey
Retrieve domain backup key
Tips
Best Practices
Best Practices
- Prefer
/unprotectwhen running as the target user - Look for RDCMan on administrator workstations and jump boxes
- Check both RDCMan.settings and referenced .rdg files
- Correlate server names with network infrastructure
- Look for privileged account credentials (domain admins, service accounts)
OPSEC Considerations
OPSEC Considerations
- Use
/unprotectfor minimal detection footprint - Run without elevation when possible
- Target specific files instead of bulk enumeration
- Redirect output to file with
/consoleoutfile - Avoid using
/pvkif/unprotectwill work
Troubleshooting
Troubleshooting
No RDCMan files found:
- User may not use RDCMan (check for .rdg files manually)
- Files may be stored in non-standard locations
- Look for .RDC files as alternative
- Check Documents folder for .rdg files
- Must run from the user context who saved passwords
- Try using masterkeys or backup key instead
- Verify you’re running as the correct user
- File may be corrupted or invalid format
- Different credential profiles may use different masterkeys
- Try using domain backup key for complete coverage
- Extract additional masterkeys with Mimikatz