mirror of
https://codeberg.org/smukx/Rust-for-Malware-Development
synced 2026-06-06 20:22:59 +00:00
28e7fac1d3
Rust-for-Malware-Development is an collection of proof of concepts with techniques and advanced evasion methods
PPID Spoofing
Overview
PPID (Parent Process ID) spoofing is a technique used to make a newly created process appear as if it was spawned by a specified parent process, rather than the actual process creating it.
This Rust program uses the Windows API to perform PPID spoofing by leveraging InitializeProcThreadAttributeList and UpdateProcThreadAttribute to set a custom parent process handle for a new process.
Requirements
- Admin Privileges: Required for enabling
SeDebugPrivilegeand accessing process handles.
Usage
-
Compile:
cargo build --release -
Run:
cargo run --release -- <ppid> <commandline><ppid>: The Process ID of the desired parent process (e.g.,explorer.exe).<commandline>: The command to execute (e.g.,"notepad.exe"or"cmd.exe /c dir").
Example:
cargo run --release -- 1234 "notepad.exe" -
Find a PPID:
tasklist | findstr explorer -
Run as Administrator:
- The program prompts for elevation if not run as admin.
- Use an elevated Command Prompt or PowerShell.
How It Works
- Elevation: Checks if running as admin; if not, relaunches with
runas. - SeDebugPrivilege: Enables debug privileges for process handle access.
- PPID Spoofing:
- Opens the target parent process using
OpenProcess. - Allocates and initializes a process attribute list with
InitializeProcThreadAttributeList. - Sets the parent process handle using
UpdateProcThreadAttribute. - Creates the new process with
CreateProcessW, spoofing the PPID.
- Opens the target parent process using
- Cleanup: Closes handles and frees memory.
Download
Download this PoC: Download
