Framework Overview
CharmingKitten developed a dedicated Python & Webshells Framework for managing compromised systems. The framework consists of:- Python Command Interface - Attacker-side command management system
- Webshells - Victim-side command execution engines
- Communication Protocol - Custom encoding and header-based command delivery
Python Command Management Interface
The Python script (connect.py) provides an interactive shell interface for managing webshell-compromised systems.
Features
Interactive Command Line:- Tab completion for commands
- Command history
- Target selection menu
- Custom encoding for command obfuscation
help- Display available commandsexit- Exit the current session- Any system command - Executed remotely on victim
Custom Encoding Scheme
The framework uses a character substitution cipher to obfuscate commands:Target Configuration
The Python interface includes hardcoded victim targets: Example Target:HTTP Communication
Commands are transmitted via HTTP headers:- Commands are placed in the
Accept-Languageheader - Custom
Accept-Captchaheader may serve as authentication token - Response contains command output in HTTP response body
ASP Webshells
The framework includes multiple ASP webshells designed for IIS server deployment.Core Webshell (webshell.asp)
Functionality:
- Executes commands passed via
Accept-Languageheader - Returns 404 status if header is missing (stealth)
- Executes arbitrary Windows commands via
cmd /c - Minimal code footprint for reduced detection
Webshell Variants
The framework includes multiple webshell files:webshell.asp- Basic command executionm0s.asp- Variant with additional capabilitiesfile.asp- File management operationsrce5.py- Python-based remote code executionRCE4.py- Alternative Python RCE implementation
TAGHEB System
The “TAGHEB System” (سامانه ثاقب) is a comprehensive Windows malware platform developed by Department 40.TAGHEB (ثاقب) translates to “penetrating” or “piercing” in Persian, reflecting its purpose as a penetration tool.
Technical Documentation
The exposed technical documentation reveals a sophisticated multi-module malware system:Architecture
Core Components:- Main Module - Primary control program
- Keylogger Module (klg.dll) - Keyboard monitoring
- Ransomware Module (rns.dll) - File destruction capability
- Stealer Module (stler.dll) - Firefox password extraction
- Telegram Module (telg.dll) - Telegram session theft
Module Loading System
The malware uses a sophisticated module loading system: Encoded Modules:- Modules stored as
.binfiles on server - Hex-encoded to evade AV detection during transfer
- Decoded on victim system to
.datfiles - Loaded via
LoadLibrary()orrundll32.exe
Communication Architecture
TAGHEB supports both direct and relay-based C2: Direct Communication:- Agent connects directly to control panel server
- Agent sends data to relay servers
- Relay forwards to control panel
- “Change home” capability for relay failover
- All traffic encrypted with XOR cipher
- String obfuscation using
obfuscator.pyscript - Random timing intervals for beacon traffic
Keylogger Module
Supports Hebrew and English keyboard layouts:- Captures all keystrokes
- Records active window titles
- Encrypted storage on disk
- Start/stop capability from control panel
Ransomware Module
Destructive file encryption capability: Operation:- Targets first and last few kilobytes of files
- Randomized character replacement algorithm
- Irreversible destruction
- Excludes AV installation directories
- BitDefender installation path
- Kaspersky installation path
- Other major AV products
Stealer Module
Extracts saved passwords from Firefox: Method:- Loads Firefox’s
nss3.dlllibrary - Uses
PK11SDR_Decrypt()to decrypt passwords - Extracts from
logins.jsonprofile file - Supports Firefox 64-bit only
Telegram Module
Steals Telegram Desktop session files: Target Files:D877F783D5D3EF8Cs- Session datakey_datas- Encryption keysmaps- Configuration file
- Searches disk for session files
- Base64 encodes file contents
- Transmits to C2 server
- Enables account takeover (without cloud password)
Anti-Virus Evasion Testing
The documents include extensive AV testing results, demonstrating systematic evasion development.Tested AV Products
- Microsoft Defender
- Kaspersky
- Avira
- ESET
- BitDefender
- Others
FUD Techniques (Fully Undetectable)
The technical documentation describes multiple techniques used to evade AV detection:1. Modular Architecture
Breaking malware into multiple files:- Main executable (
.exe) - Plugin modules (
.dll) - Reduces detection surface
2. String Storage as Arrays
In C++, storing strings as character arrays instead of string literals:3. String Obfuscation
Usingobfuscator.py to shift characters:
4. Avoiding Sensitive Operations
- Minimal registry modifications
- Reduced network connections
- No process injection
- Limited file system operations
5. BAT File Execution
Using.bat scripts as intermediary:
6. Module Encoding
Hex encoding modules during storage:- Stored as
.binfiles (hex-encoded) - Downloaded to victim
- Decoded to
.datfiles (non-standard extension) - Avoids detection during download and storage
7. Traffic Encryption
XOR encryption of C2 traffic:- Prevents network signature detection
- Makes traffic analysis difficult
Deployment Strategy
For different AV products, different execution methods: BitDefender & Kaspersky:- Use
LoadLibrary()for module loading
- Use
rundll32.exevia BAT file
Real-World Victim Evidence
FlyDubai Compromise
The Python script reveals a successful compromise: Target:uniforms.flydubai.comWebshell Path:
/images/flash/test9/m0s.phtoCompany: FlyDubai (UAE aviation company) This represents a significant compromise of aviation industry infrastructure.
Turkish Foreign Ministry (Cross-Reference)
As documented in the BellaCiao analysis, the webshell framework was also used against Turkish government infrastructure.Training Materials
The documents include training programs for Department 40 operatives:- Technical malware development
- AV evasion techniques
- Target reconnaissance
- Infrastructure management
Intelligence Value
This framework exposure provides:- Detection Signatures - For identifying compromised systems
- TTPs - Tactics, techniques, and procedures for threat hunting
- Infrastructure Indicators - Domains, paths, and patterns
- Capability Assessment - Understanding attacker skill level
Indicators of Compromise
File Indicators
Network Indicators
- HTTP requests with encoded commands in
Accept-Languageheader - Custom
Accept-Captchaheader values - XOR-encrypted C2 traffic
Behavioral Indicators
- Webshells returning 404 for normal requests
rundll32.exeexecuting from temporary directories- Suspicious
.batfiles in system directories - Module files with
.datextension in unusual locations