Skip to main content

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

None

Usage

Raw Output:
Formatted Output: ps

Detailed Summary

Agent Execution Flow

1. API Function Resolution

  • Attempts to resolve modern IsWow64Process2 API, falls back to IsWow64Process
  • 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 NtQueryInformationProcess with information class 0 (basic information)
  • Extracts parent process ID from ProcessBasicInformation structure
  • Returns -1 on failure

5. Architecture Detection

  • Prefers modern IsWow64Process2 for detailed architecture information
  • Falls back to IsWow64Process on 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

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

  1. Some process information requires appropriate privileges
  2. Protected processes may deny access to certain metadata
  3. WMI queries for command lines may be slow on some systems
  4. Integrity level extraction requires token query access
  5. 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