add Custom Reflective Loader support for #228#277
Open
dbghex wants to merge 1 commit intoAdaptix-Framework:dev-v1.2from
Open
add Custom Reflective Loader support for #228#277dbghex wants to merge 1 commit intoAdaptix-Framework:dev-v1.2from
dbghex wants to merge 1 commit intoAdaptix-Framework:dev-v1.2from
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add Custom Reflective Loader support for #228, enabling in-memory reflective DLL loading.
The loader compiles to a standalone position-independent shellcode stub, which is prepended to the RC4-encrypted beacon payload. Inspired by BokuLoader and KaynLdr.
Features
Custom Reflective Loader
stub.x64.bin/stub.x86.bin)NtAllocateVirtualMemory,NtProtectVirtualMemory,NtFreeVirtualMemory,LdrLoadDlle_oemidflag:e_oemid == 0: CRT-compatible mode (maps PE headers)e_oemid == 1: IAT Hiding mode (skips PE headers, first 0x1000 bytes are zeroed)DllMain— frees the reflective loader stub and DLL copy viaNtFreeVirtualMemoryafter loading, preventing memory forensics and in-memory scanning by AV/EDRShellcode Entry Point Refactoring
AgentMain(LPVOID)entry point, acceptsKAYN_ARGScontext from reflective loaderKaynFree()cleanup in shellcode mode — frees loader and DLL copy memory viaNtFreeVirtualMemoryPayload Format (Shellcode Mode)
[Stub .text section][RC4 Key (2 bytes)][Encrypted Size (4 bytes)][Encrypted PE DLL]
Loading Flow:
start.asm) → callsEntry()MZsignaturee_oemidfor mapping mode (CRT-compatible / IAT Hiding)NtAllocateVirtualMemory— allocate image memoryNtProtectVirtualMemory— set per-section page protectionsDllMainwithKAYN_ARGScontext (loader address, DLL copy, text base/size)New Files
shellcode/asm/x64/start.asmshellcode/asm/x86/start.asmshellcode/src/Entry.cshellcode/src/Import.cshellcode/src/Utils.cshellcode/src/Win32.cshellcode/include/Core.hshellcode/include/Macro.hshellcode/scripts/extract.pyshellcode/scripts/Linker.ldshellcode/MakefileBuild
Prerequisites: install
nasmShellcode stubs are built automatically as part of the standard build process.
Credits / References