bof-dev
Installation
SKILL.md
bof-dev
Goal: Write stealthy, production-ready Beacon Object Files (BOFs) in C or C++ for Cobalt Strike, Sliver, Havoc, or custom COFF loaders.
Cognitive Stance
A BOF is just an unlinked object file (.o / .obj).
The loader maps sections into memory and links it at runtime. It has no OS loader, no runtime (CRT/STL), and exits via go().
Strict Rules
- No Standard Library / Runtime: No
printf,malloc,new,std::string,try/catch. - DFR (Dynamic Function Resolution): You must declare
DECLSPEC_IMPORTand useKERNEL32$VirtualAllocformat so the loader can resolve Win32 APIs statically. Do not link againstkernel32.lib. - Global State: Global initialized variables (
int x = 5;) are mapped but remain persistent across BOF executions in the same process. Use them cautiously. Global C++ constructors (Foo f;) will fail to link. - C++ Specifics: Strip all C++ features that require runtime support. Disable RTTI (
-fno-rtti) and exceptions (-fno-exceptions). The entry pointgomust be declaredextern "C". - Memory Safety: You are executing inside the C2 agent's process. A segfault kills the payload. Check all pointers. Use
BeaconPrintffor output.