Summery
A process is a program that is currently running on an operating system.
A binary is a file containing instructions, while a process is an executing instance of that program.
For example, when you launch Firefox, the operating system creates one or more processes. Each process has its own process ID (PID), memory space, execution state, and allocated resources.
Processes can create child processes, communicate with other processes, and run with different privileges.
From a pentester’s perspective, enumerating processes helps identify running applications, services, users, and potential privilege-escalation opportunities, such as vulnerable services, dumping credentials from memory or processes running as root or SYSTEM.
Commands
Processes enumeration
Get-Process | Select-Object Id, ProcessName, Path or tasklist - View running processes
while ($true) { Clear-Host; Get-Process; Start-Sleep 5 } - View running processes live
Get-Process | Format-List * - View all available information about every running process
Process details
Get-CimInstance <PROCESS> | Select-Object ProcessId,Name,ParentProcessId,ExecutablePath, @{N="User";E={$_.GetOwner().Domain + "\" + $_.GetOwner().User}}, CommandLine - View detailed process information
Get-Process -Name <PROCESS> -IncludeUserName | Select-Object Id, Name, Path, UserName - View the executable path of a specific process
Get-Process -Name explorer | Format-List * - View all available information about a specific process
Exploitation
There are many attacks that revolve around processes which aren’t exactly exploited using processes like vulnerable Windows services, Binary Hijacking, DLL Hijacking. In those cases, checking processes can be helpful in checking if those other concepts are vulnerable and if we can exploit them.
Below I’ll list exploits strictkly related to processes.
Process’s memory dumping
You can dump process memory if you suspect that you might find valuable data in it like old POST requests in a firefox process.
To do so, you can check if you’re in control of a given process with Get-Process -Name <PROCESS> -IncludeUserName | Select-Object Id, Name, Path, UserName, and if applicable, run ProcDump with .\procdump64.exe -accepteula -ma 3940 C:\Users\chase\Desktop\firefox1.dmp to dump the process’s memory.