Skip to content
SECFORCEPublic

About

Cobalt Strike BOF that searches running processes by name or PID — locally via direct syscalls, remotely over WMI (x64 + WoW64)

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pgrep BOF

A Cobalt Strike BOF that searches running processes by name or PID and prints the matching process id and image name. Locally, enumeration is done through direct system calls (ZwQuerySystemInformation with SystemProcessInformation), without going through the Win32 API. When a remote host is given, enumeration runs over WMI (Win32_Process on \\host\root\cimv2) using the beacon's current token. Both x64 and WoW64 (x86 on x64) builds are supported.

How to compile

  1. Make sure that Mingw-w64 (including mingw-w64-binutils) has been installed.
  2. From the tool folder (the one containing this README), type make to compile the object files. This produces pgrep.x64.o and pgrep.x86.o in the dist folder.
  3. Use Cobalt Strike's script manager to import the pgrep.cna script.

Usage

Running the tool is straightforward. Once you imported the CNA script using Cobalt Strike's Script Manager, the command is available as a Cobalt Strike command that can be executed within a beacon:

  • pgrep <name|id> [host] — prints <pid> <image name> for every running process whose image name contains <name> (case-insensitive). If the argument consists only of digits, it is treated as a process id and only the process with that exact PID is printed. When nothing matches, it prints process not found. Without [host] the local system is searched via direct syscalls; with [host] the search runs on the remote host over WMI using the beacon's current token (a valid admin token on the remote host is required, e.g. from make_token).

Support

The BOF uses version-aware syscall stubs (Syscalls.h for x64, Syscalls-WoW64.h for WoW64) and supports Windows 7 SP1 (6.1.7601) through Windows 10/11 on both x64 and x86 (WoW64) architectures. Compiling the BOF code works on any system (Linux, macOS, Windows) that has the Mingw-w64 compiler installed.

Credits

Inspired by the TrustedSec tasklist BOF: https://github.com/trustedsec/CS-Situational-Awareness_BOFS

About

Cobalt Strike BOF that searches running processes by name or PID — locally via direct syscalls, remotely over WMI (x64 + WoW64)

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages