Skip to content
KitploitKITPLOIT
ToolsBlog
Submit
ToolsBlog
Submit

Hacking, PenTest, and Cybersecurity Tools for Your Security Arsenal!

Kitploit is a directory of hacking, cybersecurity, and pentesting tools. Discover the latest project updates to find vulnerabilities, analyze systems, automate testing, and strengthen your security.

··Feeds·Contact·Privacy·© 2026 Kitploit

Tool Directory

Categories

View all categories
Loading categories
BOF_RunPe — BOF to run PE in Cobalt Strike Beacon without console creation | Kitploit
Tools/GitHubGitHub/ntdallas/bof_runpe
Memory ForensicsShellcodePost-ExploitationRed Teaming
GitHubntdallas/bof_runpe

BOF_RunPe

BOF to run PE in Cobalt Strike Beacon without console creation

View Repository
200259 months agoReviewed by Kitploit

Most Popular

View all →

Discover the most used tools by our community.

Explore all tools

Browse our collection of tools

View all tools →
Share

BOF_RunPE

BOF RunPE is a Beacon Object File for Cobalt Strike that executes PE files entirely in-memory within the beacon process. Unlike traditional fork&run, no child process is spawned, no console is created, and no pipe is used - all output is captured via IAT hooking and redirected to the beacon console.

Architecture: x64 only

Overview

root@kitploit:~
┌──────────────────────────────────────────────────────────────┐
│                   Cobalt Strike Beacon                       │
│                    (Current Process)                         │
└────────────────────────┬─────────────────────────────────────┘
                         │
                         │  beacon_inline_execute()
                         │
                         ▼
┌──────────────────────────────────────────────────────────────┐
│                    BOF RunPE                                 │
│  ┌────────────────────────────────────────────────────────┐  │
│  │  VxTable + Draugr Initialization                       │  │
│  │  (Syscall Resolution + Stack Spoofing)                 │  │
│  └──────────────────────┬─────────────────────────────────┘  │
│                         │                                    │
│  ┌──────────────────────▼─────────────────────────────────┐  │
│  │  PE Mapping                                            │  │
│  │  - Section Copy    - IAT Patching (with hooks)         │  │
│  │  - Relocations     - Memory Protection                 │  │
│  └──────────────────────┬─────────────────────────────────┘  │
│                         │                                    │
│  ┌──────────────────────▼─────────────────────────────────┐  │
│  │  Thread Execution                                      │  │
│  │  - Spoofed Start Address                               │  │
│  │  - RIP Hijacking to Entry Point                        │  │
│  │  - Output Redirection via Hooks                        │  │
│  └────────────────────────────────────────────────────────┘  │
└──────────────────────────────────────────────────────────────┘

Key Features

  • No Process Creation: PE runs inside the beacon process
  • No Console/Pipe: Output captured via printf/WriteConsole hooks
  • Multiple Allocation Methods: Heap, VirtualAlloc, Module Stomping
  • Proxy Loading: Timer Queue, RegisterWait, or direct calls
  • Ntdll Unhooking: Optional fresh copy from disk
  • RWX : Optional allocate memory in RWX
  • Thread Start Spoofing: Legitimate start address with RIP hijacking

Configuration Options

The behaviorus of BOF can be edited in Additionals postex -> RunPe Config

Custom BOF

Proxy Methods

MethodDescription
NoneDirect API calls
DraugrStack spoofed API calls
Regwait

Allocation Methods

MethodDescription
HeapPrivate heap via RtlCreateHeap with Draugr
VirtualAllocNtAllocateVirtualMemory with Draugr
Module stompingOverwrites legitimate DLL .text section

General Options

OptionDescription

Thread Spoofing

OptionDescription
ModuleNameLegitimate module for start address (e.g., Kernel32.dll)
ProcedureNameFunction name within module (e.g., )

Output Capture

All PE output is redirected to the beacon console via IAT hooks. No console window or named pipe is created.

Evasion Techniques

Detection Vectors

Kernel Telemetry (ETW-TI)

NtGetContextThread / NtSetContextThread:

  • Thread context manipulation on suspended threads then resume it

Memory Operations:

  • NtAllocateMemory allocation, can be in RWX (depend with config)
  • NtProtectVirtualMemory transitions (RW → RX)
  • Executable memory in heap regions is suspicious (depend with config)
  • Module stomping detectable via section hash mismatch (depend with config)

Behavioral Indicators

  • Suspended thread created, take the context then change the value of RIP
  • Heap memory marked as executable (if memory allocator is heap)
  • DLL loaded with DONT_RESOLVE_DLL_REFERENCES (if memory allocator is module stomping)
  • Ntdll .text section modified (if unhooking enabled)

Usage

Loading the Script

root@kitploit:~
Cobalt Strike → Script Manager → Load → BOF_RunPe.cna

Aggressor Commands

root@kitploit:~
beacon> runpe /path/to/binary.exe --arg1 value1

Mimikatz

root@kitploit:~
beacon> help runpe

Help

Compilation

Requires GCC 13 (mingw-w64). Use provided Dockerfile:

root@kitploit:~
sudo docker build -t ubuntu-gcc-13 .
sudo docker run --rm -it -v "$PWD":/work -w /work ubuntu-gcc-13:latest make

Output: Bin/runpe.o

Limitations

LimitationDescription
CETControl-flow Enforcement Technology may block synthetic stack frames
x64 Only

Credits / Ressources use for dev

Repos/blogpost

  • https://github.com/susMdT/LoudSunRun
  • https://github.com/Octoberfest7/Inline-Execute-PE
  • https://www.coresecurity.com/core-labs/articles/running-pes-inline-without-console
  • https://0xdarkvortex.dev/proxying-dll-loads-for-hiding-etwti-stack-tracing/

Books

  • Windows Native API Programming by Pavel Yosifovich
  • Windows Internals, Part 1 by Pavel Yosifovich
  • Windows Internals, Part 2 by Andrea Allievi
Download Tool
RegisterWaitForSingleObject callback
TimerTimer Queue callback
AllocRWXAllocate as RWX (vs RW→RX transition)
UnhookNtdllReplace ntdll.dll .text with fresh copy from disk
TimeoutExecution timeout in milliseconds (0 = infinite)
StompModuleDLL path for module stomping (e.g., chakra.dll)
BaseThreadInitThunk
OffsetOffset from function start
Hooked FunctionTarget
GetCommandLineA/WReturns spoofed arguments
__getmainargs / __wgetmainargsCRT argument initialization
printf / wprintfBeaconPrintf redirection
WriteConsoleA/WBeaconPrintf redirection
__stdio_common_vfprintfUCRT print functions
ExitProcess / exitConverted to ExitThread
TechniqueBypasses
Indirect SyscallsUserland API hooks (EDR/AV)
Draugr Stack SpoofingCall stack inspection
Thread Start SpoofingThread start address analysis
Module StompingUnbacked memory detection
Private Heap AllocationVirtualAlloc monitoring
Ntdll UnhookingOverwrite in memory ntdll with Ntdll on a disk
IAT Hooking (no pipes)Named pipe monitoring
No x86/WoW64 support
Kernel VisibilityThread creation visible to kernel callbacks
.NETManaged executables not supported