๐Ÿฆ  C ShellcodeFluctuation Port ๐Ÿฆ 

October 14, 2025 ยท View on GitHub

image

A Windows โ€‹โ€‹โ€‹โ€‹๐ŸชŸ shellcode injection ๐Ÿ’‰โ€‹ and memory evasion tool implementing advanced anti-analysis techniques through API hooking and dynamic memory protection manipulation.

โ€‹๐Ÿ”ฌโ€‹ Overview

ShellcodeFluctuation demonstrates proof-of-concept techniques for executing shellcode while evading memory-based detection systems. The tool intercepts Sleep() API calls to trigger memory protection changes and XOR encryption, making the shellcode invisible to memory scanners during dormant periods. 3

๐Ÿ—๏ธโ€‹ Key Features

  • API Hooking: Intercepts Sleep() calls using inline trampolines (fastTrampoline)
  • Memory Fluctuation: Alternates memory protection between PAGE_EXECUTE_READ, PAGE_READWRITE, and PAGE_NOACCESS
  • XOR Encryption: Encrypts shellcode in memory when not executing
  • Exception-Based Execution: Uses Vectored Exception Handlers (VEH) for on-demand decryption
  • Cross-Platform Build: Compiles from Linux to Windows executables using MinGW 4

๐Ÿ”งโ€‹ Operational Modes

The tool supports four execution modes:

ModeDescriptionEvasion Technique
-1No injection, infinite loopTesting/placeholder
0Basic injectionNo evasion
1RW FluctuationXOR encryption + PAGE_READWRITE โ†” PAGE_EXECUTE_READ
2NA Fluctuation (ORCA666)XOR encryption + PAGE_NOACCESS โ†” PAGE_EXECUTE_READ + VEH

๐Ÿ”จโ€‹ Build Instructions

๐Ÿ“‹โ€‹ Prerequisites

  • Linux environment (Debian/Ubuntu recommended)
  • MinGW-w64 cross-compiler
  • Python 3.x

๐Ÿ—œ๏ธโ€‹ Compilation

# Install MinGW toolchain  [header-1](#header-1)
sudo apt install mingw-w64  
  
# Compile  [header-2](#header-2)
x86_64-w64-mingw32-gcc main.c -lkernel32 -lntdll -s -O2 -o ShellcodeFluctuation.exe

๐Ÿช›โ€‹ Usage

ShellcodeFluctuation.exe <shellcode.raw> <mode>

๐Ÿ’ฃโ€‹ Examples

# Basic injection without evasion  [header-3](#header-3)
./ShellcodeFluctuation.exe payload.bin 0  
  
# RW fluctuation with XOR encryption  [header-4](#header-4)
./ShellcodeFluctuation.exe payload.bin 1  
  
# NOACCESS fluctuation with exception handling  [header-5](#header-5)
./ShellcodeFluctuation.exe payload.bin 2

๐Ÿ”ญโ€‹ Technical Details

๐Ÿ—„๏ธโ€‹ Architecture

The tool uses three global structures to manage state:

  • FluctuationMetadata: Tracks shellcode address, size, encryption state, and XOR key
  • HookedSleep: Stores original Sleep() function pointer and prologue bytes
  • TypeOfFluctuation: Enum controlling operational mode main.c:250-261

๐Ÿฉปโ€‹ How It Works

  • Injection: Allocates memory with VirtualAlloc(), copies shellcode, sets PAGE_EXECUTE_READ protection
  • Hooking: Installs inline trampoline on Sleep() API to intercept calls
  • Fluctuation: On each Sleep() call from shellcode thread:
  • Encrypts shellcode with XOR
  • Changes memory protection to PAGE_READWRITE or PAGE_NOACCESS
  • Calls original Sleep()
  • Decrypts and restores PAGE_EXECUTE_READ
  • Exception Handling (Mode 2): VEH catches access violations and decrypts on-demand main.c:93-99
image image image image

๐Ÿ–ฅ๏ธโ€‹ System Requirements

  • Target: Windows 7+ (x64)
  • Build: Linux with MinGW-w64
  • Dependencies: kernel32.dll, ntdll.dll (standard Windows libraries)

โ›”โ€‹๐Ÿšซโ€‹๐Ÿšญโ€‹ Security Notice

โš ๏ธ For educational and authorized security research only. Unauthorized use of shellcode injection tools is illegal. Use only in controlled environments with proper authorization.

๐Ÿ“œโ€‹ License

GPL v3

โœ’๏ธโ€‹ Autor:

mgeeky the original code you can find here: https://github.com/mgeeky/ShellcodeFluctuation

๐Ÿ–‹๏ธ i only ported to C

Python Shell Script Flask License: GPL v3

ko-fi