A two-stage, DNS-triggered reverse-shell framework that uses encrypted (Fernet/AES) stage-2 channels and heartbeat-based multi-target management for stealthy, on-demand command execution in lab/red-team environments.
This project implements a two-stage, beacon-driven remote control framework designed for offensive security research and red-team lab use. The goal is to minimize exposure by using a low-profile trigger channel (DNS TXT in the initial design) to instruct a target to establish a secure, bidirectional stage-2 connection only when needed. All communications are encrypted and targets send periodic heartbeats so operators can safely monitor live sessions.
- Two-Stage Architecture: Stage-1 (stealthy beacon/trigger) + Stage-2 (robust encrypted command channel).
- DNS-trigger capability: Stage-1 can use DNS TXT responses as a low-bandwidth trigger mechanism (lab / controlled DNS server required).
- Encrypted communications: Uses Fernet (AES + HMAC) for authenticated symmetric encryption of triggers, commands, and outputs.
- On-demand RCE: Commands are executed on the target only when the operator requests them; otherwise the target remains in a low-profile beaconing state.
- Heartbeat / Liveness: Targets periodically send encrypted “alive” pings; operator UI lists active targets and last-seen times.
- Multi-target management: Menu-driven interface to list targets, select a target, and send commands with structured output.
- Cross-platform: Prototype works on Linux and Windows; target can be packaged to an EXE for Windows testing with PyInstaller.
- Lab-oriented & configurable: Beacon intervals, encryption keys, and stage-2 listener settings are configurable for testing.
- The two-stage model balances stealth (small, infrequent beacons) with functionality (an encrypted interactive channel for commands and data).
- Encryption prevents passive eavesdropping and ensures integrity of commands and responses.
- Heartbeats give visibility without requiring a permanent, noisy connection.
This framework is a research / lab tool meant for authorized penetration testing, red-team exercises, and defensive research. Do not deploy on production systems or networks where you do not have explicit permission. Unauthorized use is illegal and unethical. Use the tool only in controlled environments and follow responsible disclosure and organizational policies.
- Python 3.10+ (tested)
- cryptography, dnspython, dnslib (optional), pyinstaller (for EXE packaging)
- Network environment that allows outbound DNS and the configured stage-2 listener port (for lab testing)
- Configure the attacker listener IP and stage-2 port.
- Generate an encrypted trigger payload (IP:PORT) and serve it via your lab DNS server (or provide it directly in lab tests).
- Deploy the target agent (Python or compiled EXE) in a controlled environment.
- Use the attacker interface to monitor heartbeats, select targets, and execute commands on-demand.
Encrypted and staged frameworks can evade signature-based AV detection but create artifacts that defenders can detect (e.g., repeated DNS TXT requests, DNS→TCP correlation, suspicious process behavior). Use DNS logging, egress controls, and endpoint telemetry to detect such patterns.