Kainefiltrator is a comprehensive post-exploitation exfiltration framework designed for educational purposes and authorized red team engagements. The tool demonstrates modern APT techniques including multiple exfiltration channels, evasion methods, persistence mechanisms, and credential harvesting.
kainefiltrator/
├── include/ # Header files (8 files)
│ ├── kf_types.h # Core types, structures, enums
│ ├── kf_str.h # String obfuscation macros
│ ├── kf_evasion.h # Evasion technique declarations
│ ├── kf_exfil.h # Exfiltration method declarations
│ ├── kf_tui.h # Terminal UI interface
│ ├── kf_toast.h # Toast notification system
│ ├── kf_persist.h # Persistence mechanisms
│ └── kf_stage.h # In-memory staging operations
│
├── src/ # Source files (11 files)
│ ├── main.c # Entry point, TUI logic, menu handlers
│ ├── evasion.c # AMSI bypass, ETW patching, unhooking
│ ├── crypto.c # AES encryption, Base64, compression
│ ├── exfil_doh.c # DNS over HTTPS exfiltration
│ ├── exfil_tcp.c # Raw TCP socket exfiltration
│ ├── exfil_smb.c # SMB share exfiltration
│ ├── exfil_ftp.c # FTP upload exfiltration
│ ├── exfil_lol.c # Cloud API exfiltration (Dropbox, Mega, etc.)
│ ├── tui.c # Terminal UI implementation
│ ├── toast.c # Credential phishing notifications
│ ├── persist.c # Registry, startup, scheduled tasks
│ └── stage.c # PE loading, process hollowing
│
├── docs/ # Documentation (3 files)
│ ├── TECHNICAL.md # Deep technical documentation
│ ├── USAGE.md # User guide and workflows
│ └── POC_EXCERPTS.md # Proof-of-concept code snippets
│
├── Makefile # Build configuration (MinGW/MSVC)
├── README.md # Project overview
├── LICENSE # MIT License with legal notice
├── .gitignore # Git ignore patterns
└── PROJECT_SUMMARY.md # This file
| Component | Files | Approx. Lines |
|---|---|---|
| Headers | 8 | ~800 |
| Source | 11 | ~2,500 |
| Documentation | 4 | ~1,200 |
| Total | 23 | ~4,500 |
- DoH - DNS over HTTPS for bypassing DNS filtering
- SMB - Windows file share uploads
- FTP - File transfer protocol
- TCP - Raw socket communication
- Dropbox - Cloud storage API
- Mega - Encrypted cloud storage
- Mediafire - Anonymous file hosting
- GitHub - Gist API for text storage
- Pastebin - Text paste service
- Userland Unhooking - Restores clean ntdll from disk
- AMSI Bypass - Patches AmsiScanBuffer
- ETW Patching - Disables Event Tracing
- PPID Spoofing - Creates processes under legitimate parents
- DLL Blocking - Prevents non-MS DLL loading
- Clean DLL Loading - Loads fresh DLLs from disk
- Registry Run - HKCU\Software\Microsoft\Windows\CurrentVersion\Run
- Registry RunOnce - One-time execution at login
- Startup Folder - Shortcut in user's startup
- Scheduled Tasks - Task Scheduler integration
- Windows Service - System service (requires elevation)
- Office 365 Prompt - Fake Microsoft authentication
- VPN Prompt - Corporate VPN connection dialog
- Wi-Fi Prompt - Network security key request
- Smart Card Prompt - PIN entry dialog
- PE Loading - Execute PE files without touching disk
- Process Hollowing - Replace legitimate process memory
- APC Injection - Asynchronous procedure call injection
- Thread Injection - CreateRemoteThread-based injection
- MinGW-w64 or Visual Studio
- Windows SDK
- Make (optional)
# Standard build
make
# Debug build
make debug
# MSVC build
make msvc
# Clean build artifacts
make cleanbin/kainefiltrator.exe- Release buildbin/kainefiltrator_debug.exe- Debug build
1. Launch kainefiltrator.exe
↓
2. TUI interface loads
↓
3. Select exfiltration method
↓
4. Configure target/credentials
↓
5. (Optional) Apply evasion
↓
6. (Optional) Install persistence
↓
7. Select files to exfiltrate
↓
8. Data is encrypted and transmitted
- XOR string obfuscation (compile-time)
- Dynamic API resolution
- In-memory operations
- Jittered sleep intervals
- Minimal disk artifacts
- Clean syscall restoration
- AMSI/ETW bypass
- Process masquerading
- Module stomping support
The framework is designed for easy extension:
- Declare in
kf_exfil.h - Implement in
exfil_mymethod.c - Add to enum in
kf_types.h - Wire up in
main.c
- Declare in
kf_evasion.h - Implement in
evasion.c - Call from initialization
Replace crypto.c implementations or add new algorithms
This project demonstrates:
- Windows internals (PE format, syscalls, memory management)
- Network protocols (DNS, SMB, FTP, HTTP/HTTPS)
- Cryptography (AES, Base64, compression)
- Evasion techniques (hooking, patching, injection)
- Persistence mechanisms (registry, WMI, services)
- Social engineering (credential phishing)
- Educational Purpose Only: Designed for learning and authorized testing
- Authorization Required: Only use on systems you own or have permission to test
- Responsible Disclosure: Report vulnerabilities appropriately
- Compliance: Follow all applicable laws and regulations
Potential additions for further learning:
- Hardware breakpoint-based hook bypass
- Kernel driver for advanced evasion
- Domain Fronting support
- WebSocket exfiltration
- ICMP tunneling
- Covert timing channels
- Blockchain-based C2
- Machine learning for detection evasion
- Windows Internals, 7th Edition
- "The Art of Memory Forensics"
- "Practical Malware Analysis"
- Various security research papers and conference presentations
Note: This project is for educational purposes only. The authors assume no liability for misuse. Always obtain proper authorization before security testing.