Summary
Enumerates all running processes with detailed information including process metadata, user context, architecture, integrity levels, and command-line arguments using parallel processing for optimal performance.- Needs Admin: False
- Version: 3
- Author: @djhohnstein
Arguments
NoneUsage
Detailed Summary
Agent Execution Flow
1. API Function Resolution
- Attempts to resolve modern
IsWow64Process2API, falls back toIsWow64Process - Resolves token and process information APIs
- Uses Apollo’s dynamic API resolution framework
2. Parallel Process Enumeration
- Uses parallel processing with degree equal to processor count
- Supports cancellation through cancellation token
- Processes all system processes concurrently for performance
3. Process User Extraction
- Opens process token with maximum allowed access
- Creates WindowsIdentity to extract username
- Handles access denied exceptions gracefully
4. Parent Process ID Retrieval
- Uses
NtQueryInformationProcesswith information class 0 (basic information) - Extracts parent process ID from
ProcessBasicInformationstructure - Returns -1 on failure
5. Architecture Detection
- Prefers modern
IsWow64Process2for detailed architecture information - Falls back to
IsWow64Processon older systems - Maps machine types to readable architecture strings
6. Integrity Level Extraction
- Opens process token for query access
- Retrieves token integrity level information
- Converts integrity level SID to string format
- Maps to integer levels (0=Untrusted, 1=Low, 2=Medium, 3=High)
7. Command Line Retrieval
- Uses WMI to query process command line
- Handles processes without command line information
- URL-decodes command line for proper display
8. Comprehensive Metadata Collection
- Extracts file version information from main module
- Captures window title for GUI applications
- Records session ID for session tracking
- Handles exceptions for protected processes
Data Structures
ProcessInformation
ProcessBasicInformation (Native)
Integrity Level Mapping
Performance Optimization
- Parallel Processing: Uses all available CPU cores
- Exception Handling: Graceful degradation for inaccessible processes
- Thread Safety: Thread-safe collections for concurrent access
- Cancellation Support: Honors cancellation requests during enumeration
APIs Used
| API | Purpose | DLL |
|---|---|---|
Process.GetProcesses() | Enumerate all processes | System.Diagnostics |
OpenProcessToken | Open process token | advapi32.dll |
NtQueryInformationProcess | Get process basic information | ntdll.dll |
GetTokenInformation | Get token details | advapi32.dll |
IsWow64Process2 | Determine process architecture | kernel32.dll |
IsWow64Process | Determine WoW64 status (fallback) | kernel32.dll |
ConvertSidToStringSid | Convert integrity SID | advapi32.dll |
ManagementObjectSearcher | WMI query for command lines | System.Management |
MITRE ATT&CK Mapping
- T1106 - Native API
- T1057 - Process Discovery
Security Considerations
- Information Disclosure: Reveals detailed process information
- System Reconnaissance: Provides comprehensive system state view
- Process Monitoring: Shows all running processes and their relationships
- User Context: Exposes process ownership and privilege levels
Limitations
- Some process information requires appropriate privileges
- Protected processes may deny access to certain metadata
- WMI queries for command lines may be slow on some systems
- Integrity level extraction requires token query access
- Parallel processing may impact system performance temporarily
Error Conditions
- Access Denied: Insufficient privileges for protected processes
- Process Termination: Processes may exit during enumeration
- WMI Failures: Management queries may fail for some processes
- Token Access: Token operations may fail for system processes
- API Unavailability: Some APIs may not exist on older systems