用于 Cobalt Strike 的 Beacon 对象文件,可在 Beacon 中执行 .NET 程序集,并采用逃避技术。
用于 Cobalt Strike 的 Beacon 对象文件,可在 Beacon 中执行 .NET 程序集,并采用逃避技术。
Beacon Object File for Cobalt Strike that executes .NET assemblies in beacon with evasion techniques.
…| Method | Description |
|---|---|
None |
Direct API calls |
Draugr |
Stack spoofed API calls via Draugr |
Regwait |
RegisterWaitForSingleObject callback execution |
Timer |
Timer Queue callback execution |
| Method | Description |
|---|---|
None |
No AMSI bypass |
Patch |
Memory patch of AMSI!AmsiScanBuffer (xor rax,rax; ret) |
HWBP |
Hardware breakpoint hook on AMSI!AmsiScanBuffer via VEH |
| Method | Description |
|---|---|
None |
No ETW bypass |
Patch |
Memory patch of NTDLL!NtTraceEvent (xor rax,rax; ret) |
| Parameter | Description | Example |
|---|---|---|
| PipeName | Named pipe name for capturing assembly output | P1p3N4m3 |
| AppDomain | Custom .NET AppDomain name for assembly isolation | Tot4lL3g1t |
LoadLibraryA("amsi.dll") → Direct callDRAUGR_API(LoadLibraryA, "amsi.dll")
│
├─ Synthetic Stack Construction
├─ Return Address Spoofing
└─ Indirect ExecutionCreateTimerQueue() → CreateTimerQueueTimer(
callback = LoadLibraryA,
parameter = "amsi.dll",
dueTime = 100ms
) → Wait → DeleteTimerQueueEx()CreateEvent() → RegisterWaitForSingleObject(
event,
callback = LoadLibraryA,
context = "amsi.dll"
) → SetEvent() → UnregisterWait()Before Patch: After Patch:
AmsiScanBuffer: AmsiScanBuffer:
4C 8B DC mov r11, rsp 48 31 C0 xor rax, rax
49 89 5B 08 mov [r11+8], rbx C3 ret
... ...
Result: All scans return S_OK (clean)Method:
xor rax, rax; ret Setup:
1. AddVectoredExceptionHandler
2. RtlCaptureContext
3. Set DR0 = AmsiScanBuffer address
4. Enable DR7 breakpoint flag
5. NtContinue (apply context)
Execution Flow:
AmsiScanBuffer called
│
▼
#BP Exception (EXCEPTION_SINGLE_STEP)
│
▼
VEH Handler intercepts
│
├─ Verify RIP == AmsiScanBuffer
├─ Set RIP = FindRetInstruction(AmsiScanBuffer)
├─ Set RAX = 0 (S_OK)
└─ Set TF (Trap Flag)
│
▼
Return with RAX=0Before: After:
NtTraceEvent: NtTraceEvent:
4C 8B D1 mov r10, rcx 48 31 C0 xor rax, rax
B8 XX XX mov eax, syscall C3 ret…| Technique | Bypasses |
|---|---|
| Indirect Syscalls | Userland API hooks (EDR/AV) |
| Draugr Stack Spoofing | Call stack inspection tools |
| AMSI Patch/HWBP | .NET assembly scanning |
| ETW Patching | Event-based monitoring |
| Proxy DLL Loading | LoadLibrary stackframe monitoring |
| Named Pipe Malleable | Pipe monitoring |
| Custom AppDomain | Default AppDomain monitoring |
Memory Protection Changes:
NtProtectVirtualMemory calls logged via EtwTiLogReadWriteVmamsi.dll .text sectionntdll.dll .text sectionDetection: Memory protection changes on loaded modules are strong indicators.
Named Pipe Creation:
NtCreateFile with \\.\pipe\* path visible to minifilter driversModule Loading:
LdrLoadDll events logged by EDR kernel driversThread Context Manipulation (HWBP method):
AllocConsole + ShowWindow(SW_HIDE))Cobalt Strike → Script Manager → Load → BOF_ExecuteAssembly.cnaMenu: Additionals postex → Execute-Assembly ConfigBOF_ExecuteAssembly --assembly /tmp/Ghostpack-CompiledBinaries/Rubeus.exe --args helpbeacon> help BOF_ExecuteAssemblWith Dockerfile:
sudo docker build -t ubuntu-gcc-13 .
sudo docker run --rm -it -v "$PWD":/work -w /work ubuntu-gcc-13:latest makeOr, if you have nasm, make, and mingw-w64 (compatible with gcc-13) on your system:
makeOutput: Bin/BOF_ExecuteAssembly.o
暂无开放 Issues,或尚未同步最近议题。