Documentation Index
Fetch the complete documentation index at: https://docs.specterops.io/llms.txt
Use this file to discover all available pages before exploring further.
Artifacts Generated: Registry Read
Summary
Queries Windows registry keys and values usingMicrosoft.Win32.RegistryKey APIs. Enumerates subkeys and values within a specified registry path, handling multiple data types and generating registry access artifacts.
- Needs Admin: False
- Version: 2
- Author: @djhohnstein
Arguments
- hive (ChooseOne) - Registry hive (HKLM, HKCU, HKU, HKCR, HKCC)
- key (String, Optional) - Registry key path within the hive
Usage
Raw Output:
Detailed Summary
Agent Execution Flow
1. Parameter Processing
- Deserializes registry hive and key path
- Supports both full and abbreviated hive names
2. Subkey Enumeration
- Uses
RegistryUtils.GetRegistryKey()to open registry key - Calls
GetSubKeyNames()to enumerate child keys - Constructs full path for each subkey
- Marks entries as “key” type
3. Registry Value Enumeration
- Enumerates value names within the registry key
- Retrieves actual value data for each name
- Processes value types for proper display
4. Value Type Processing
- Handles multiple registry data types
- Converts binary data to hex string representation
- Provides fallback for unknown types
5. Artifact Generation
- Creates registry read artifact for each key access
- Generates separate artifacts for value reads
- Tracks all registry access operations
6. Error Handling
- Separates subkey and value enumeration errors
- Continues processing if one operation fails
- Reports errors only if no results obtained
Registry Hive Mapping
Supported Hives
| Abbreviation | Full Name | Description |
|---|---|---|
| HKLM | HKEY_LOCAL_MACHINE | System-wide settings |
| HKCU | HKEY_CURRENT_USER | Current user settings |
| HKU | HKEY_USERS | All user profiles |
| HKCR | HKEY_CLASSES_ROOT | File associations and COM |
| HKCC | HKEY_CURRENT_CONFIG | Current hardware profile |
Hive Resolution
- Accepts both full and abbreviated hive names
- Normalizes to abbreviated format for consistency
Data Structures
RegQueryResult
Registry Data Types
Supported Types
- String: REG_SZ and REG_EXPAND_SZ values
- Integer: REG_DWORD values
- Binary: REG_BINARY displayed as hex
- Null: Empty or null values
- Unknown: Fallback for unsupported types
Binary Data Handling
- Converts byte arrays to hex string format
- Uses hyphen-separated hex representation
Registry Access Patterns
Key Enumeration
- Open registry key with read access
- Call
GetSubKeyNames()to list child keys - Build full paths for navigation
- Mark as “key” type results
Value Enumeration
- Open same registry key
- Call
GetValueNames()to list values - Retrieve value data with
GetValue() - Process data types appropriately
- Mark as “value” type results
APIs Used
| API | Purpose | Namespace |
|---|---|---|
RegistryUtils.GetRegistryKey() | Open registry key | Apollo Utils |
RegistryKey.GetSubKeyNames() | Enumerate subkeys | Microsoft.Win32 |
RegistryKey.GetValueNames() | Enumerate value names | Microsoft.Win32 |
RegistryKey.GetValue() | Retrieve value data | Microsoft.Win32 |
BitConverter.ToString() | Convert binary to hex | System |
MITRE ATT&CK Mapping
- T1012 - Query Registry
- T1552 - Unsecured Credentials (registry stored credentials)
Security Considerations
- Information Disclosure: Reveals registry structure and sensitive values
- Credential Exposure: May expose stored passwords or keys
- System Configuration: Shows security settings and configurations
- Attack Planning: Provides reconnaissance for privilege escalation
Limitations
- Access depends on current user privileges
- Some registry keys require elevated permissions
- Large registry trees may impact performance
- Binary data displayed as hex strings only
- No write or modification capabilities
Error Conditions
- Access Denied: Insufficient permissions for registry key
- Key Not Found: Specified registry path doesn’t exist
- Invalid Hive: Unsupported or malformed hive name
- Path Too Long: Registry path exceeds maximum length
- System Error: Underlying registry API failures
Common Use Cases
System Information
HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion- OS version infoHKLM\SYSTEM\CurrentControlSet\Services- Service configurationsHKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall- Installed programs
User Settings
HKCU\Software- User application settingsHKCU\Environment- User environment variablesHKCU\Software\Microsoft\Windows\CurrentVersion\Run- User startup programs
Security Settings
HKLM\SYSTEM\CurrentControlSet\Control\Lsa- LSA settingsHKLM\SOFTWARE\Policies- Group policy settingsHKCU\Software\Policies- User policy settings