WhaleRAT: A Stealthy Android Remote Access Trojan (RAT).

Telegram & web-based Android RAT for security research, without port forwarding.

WhaleRAT Architecture & Telemetry C2
Outbound WebSocket Telemetry • Telegram Bot • WebAuthn Passkeys

1. What is WhaleRAT & Who Made It?

WhaleRAT is a powerful, lightweight Android Remote Administration Tool (RAT) and Command & Control (C2) framework developed for authorized defensive security testing, mobile malware research, and laboratory emulation — built from scratch with zero port forwarding required.

Created & Engineered by Sidharth S (@zidhuxd)

WhaleRAT was developed by Sidharth S (@zidhuxd), recognized as the youngest cybersecurity researcher in Kerala.

Why WhaleRAT is Different: No Port Forwarding Needed

Traditional Android RATs have always been painful to deploy. They depend on reverse TCP connections or inbound ports that constantly break behind Carrier-Grade NAT (CGNAT), corporate cellular APNs, or dynamic IP changes. In the past, researchers had to configure router port forwarding, pay for static IPs, or maintain fragile dynamic DNS daemons.

WhaleRAT eliminates all of that friction:

  • Outbound-Only WebSockets: The Android client connects outward to your C2 server over a secure TLS WebSocket (wss://). Because the connection originates from the device, routers and cellular firewalls allow it through automatically — no router configuration needed.
  • Zero-Recompile Mobile Patching: The client APK reads its server address from an internal config file (assets/config.json). You can change server URLs in 10 seconds right on your phone using MT Manager without Android Studio or Gradle.

Dual-Mode Control Planes

WhaleRAT gives security operators two synchronized ways to manage connected test devices:

  1. 📲 Telegram Bot: Issue commands on the move directly from your phone. Take photos, record microphone clips, retrieve GPS coordinates, or dump SMS messages — all delivered straight into your private Telegram chat.
  2. 🖥️ Web C2 Dashboard: A full-featured browser control panel for desktop operators. Watch live screen streams, browse remote files, view device locations on Leaflet maps, and log in securely with WebAuthn Passkeys (TouchID, FaceID, or hardware security keys).
Live Demonstration
WhaleRAT Live Demonstration

Web C2 Dashboard & Authentication Interface

Take a look inside the WhaleRAT Web C2 panel used by operators for high-speed device administration and hardware-backed biometric authentication:

WhaleRAT Server Device Monitor & Real-time Operations Dashboard
Device Monitor & Ctrl Hub

Live Android screen mirroring, active target status (battery, IP, connection state), quick operational modules (SMS, Calls, Contacts, Camera, GPS, Logs), and synchronized activity streams.

WhaleRAT Admin Passkey and PIN Authentication Interface
Passkey & PIN Authentication

Protected administration gateway utilizing WebAuthn hardware passkeys (TouchID, FaceID, YubiKey) and secret credentials to prevent credential theft and unauthorized access.

2. Architecture & Data Flow Breakdown

The WhaleRAT backend is designed to be lightweight and rock-solid. Powered by Node.js (v20+) and Express, it coordinates device WebSocket connections, Telegram Bot API polling, and browser web panels simultaneously.

End-to-End WebSocket & Dual-Control Architecture

How outbound WebSocket connections bypass CGNAT and synchronize Telegram and Web interfaces in real time.

┌─────────────────────────────────────┐
│          Android Device (APK)        │
│  Outbound WebSocket  ──────────────► │
└─────────────────────────────────────┘
                                        │
                               ┌────────▼──────────────────────┐
                               │   WhaleRAT Server (Node.js)    │
                               │                                │
                               │  ┌─────────┐  ┌────────────┐  │
                               │  │ Express │  │  WS Server │  │
                               │  │  HTTP   │  │  (device)  │  │
                               │  └────┬────┘  └─────┬──────┘  │
                               │       │              │          │
                               │  ┌────▼──────────────▼──────┐  │
                               │  │       Core Logic          │  │
                               │  │  (device map, log store,  │  │
                               │  │   command dispatch, etc.) │  │
                               │  └────┬──────────┬──────────┘  │
                               │       │          │              │
                               │  ┌────▼────┐  ┌──▼──────────┐  │
                               │  │Telegram │  │  Web Panel  │  │
                               │  │  Bot    │  │  (HTML/JS)  │  │
                               │  └─────────┘  └─────────────┘  │
                               └────────────────────────────────┘
                                        │             │
                               Telegram API       Browser
                               (admin's phone)    (admin's PC)
📱 Android Client
drop.apk (Outbound WS)
wss://
Keepalive Ping
⚡ WhaleRAT Server
Node.js + Express + WS Engine
Dual C2
Commands & Data
🛡️ Admin Controls
Telegram Bot & Web Panel
How Communication Works (In 4 Simple Steps)
  • Device → Server (WebSocket ws/wss): The Android app connects outbound to the server URL. No incoming ports needed on the phone or router.
  • Server → Telegram (Telegram Bot API): The server handles commands sent from the admin's Telegram account via node-telegram-bot-api and delivers instant alerts.
  • Server → Web Browser: The C2 web panel displays live device status, screen streams, and logs over WebSockets without manual page refreshes.
  • State & Audit Logs: Active sessions are managed in an in-memory Map and backed by a disk-based logs.jsonl file with 7-day automatic retention and deduplication.

3. Capabilities & Feature Breakdown

WhaleRAT includes over 20 discrete surveillance, telephony, file management, and device control capabilities. Every module can be triggered on-the-go from the Telegram Bot or dispatched from the browser Web C2 Dashboard:

Category Capability How It Works Telegram Command What It Does
Media Camera Snapshot Base64 image stream /cam1 / /cam2 Captures a silent selfie or rear-camera high-resolution photo and sends it to you instantly.
Media Screen Streaming MediaProjection stream /screen Watch live foreground screen activity in real time on the web dashboard.
Media Microphone Audio Background AAC recording /mic <seconds> Records room audio via device microphone for your specified number of seconds.
Media Gallery Grabber DCIM camera roll scan /gallery Automatically retrieves recent photos and saves them to the C2 gallery.
Telephony GPS Coordinates FusedLocationProvider /loc Retrieves exact device coordinates with an instant Google Maps link and Leaflet pin.
Telephony SMS Dumping & Intercept Telephony Provider /sms Dumps complete SMS inbox and automatically forwards new incoming SMS messages in real time.
Telephony Call Log Dumper CallLog Provider /calls Extracts full call history with contact names, phone numbers, durations, and timestamps.
Telephony Contacts Export ContactsContract API /contacts Exports all saved phone contacts in structured format.
Control Remote File Manager Storage filesystem walker /files <path> Browse folders, download files, upload payloads, or remove files on internal storage.
Control Keylogger Engine AccessibilityService hook /keylogger on|off Captures keystrokes, typed messages, and text inputs for behavioral analysis.
Control Installed Apps Scanner PackageManager resolver /apps Lists all user-installed applications and system packages with permissions.
Control Clipboard Interceptor ClipboardManager API /clipboard Inspects currently copied text, passwords, or verification codes.
Control Remote Screen Lock DevicePolicyManager /lock Instantly turns off and locks the device screen remotely.
Control Device Vibration Vibrator service /vibrate Triggers physical vibration on the phone for auditory or physical location tracking.
Control Clear Notifications NotificationListenerService /notifications Dismisses and clears all status bar notifications remotely.
Control Factory Wipe (Reset) DevicePolicyManager /wipe Performs complete device factory reset (safeguarded with confirmation).
Security WebAuthn Passkey Auth FIDO2 / SimpleWebAuthn Panel Only Log in to the web C2 panel using biometric FaceID, TouchID, or hardware security keys.
Security Device Nicknames & Tags Metadata state store Panel Only Assign custom names and tags to test devices for easy identification in large labs.
Security Persistent Audit Logs JSONL rolling journal Panel Only Automatic 7-day retention, deduplication, and auto-compacting event log.
Security Telegram Admin Gate UserID whitelist check ADMIN_ID check Silently ignores and drops any command sent from unauthorized Telegram accounts.
Security Dark & Light UI Dynamic CSS theming Panel Only Web C2 panel supports both sleek dark mode and clean light mode themes.

4. Step-by-Step Server Deployment (Railway)

WhaleRAT is engineered for zero-friction cloud deployment. With Railway, you can bring up a fully TLS-secured public C2 instance in under 2 minutes:

  1. Fork the WhaleRAT GitHub repository to your personal account.
  2. Log in to Railway.app and click New Project → Deploy from GitHub repo.
  3. Select your forked WhaleRAT repository.
  4. Navigate to the Variables tab and configure the 4 core environment variables:
Variable Source / Explanation Example Value
BOT_TOKEN Obtained by messaging @BotFather on Telegram 718293849:AAFXyZ...
ADMIN_ID Your numerical Telegram user ID from @userinfobot 184729103
ADMIN_CODE A strong password used for logging into the Web C2 Dashboard YourSecurePassword123!
ADMIN_USERNAME Admin username for the Web C2 Dashboard zidhuxd

5. Under Settings → Networking, click Generate Domain to receive your unique HTTPS domain (e.g. https://whalerat-production.up.railway.app).

Automatic TLS & Port Forwarding

Railway automatically provisions TLS certificates and handles port routing. Your WebSocket and HTTP endpoints will both run seamlessly on standard ports 443/80 without manual reverse-proxy setup!

5. Patching the Client APK with MT Manager

The client application inside app/drop.apk is architected to read its server coordinates dynamically from an internal JSON asset. This enables operators to re-target the APK directly on their Android phone or tablet without compiling from source:

drop.apk/assets/config.json
{
  "server_url": "https://your-whalerat.up.railway.app/",
  "webview_url": "https://google.com/"
}

Step-by-Step MT Manager Guide:

  1. Install MT Manager on your Android testing device.
  2. Transfer app/drop.apk to your internal storage.
  3. Open MT Manager, tap drop.apk, and select "View" (do not extract).
  4. Navigate into the assets/ folder and open config.json.
  5. Update server_url to your exact Railway URL (must end with a trailing slash /).
  6. Optionally change webview_url to any legitimate URL used as a foreground decoy screen.
  7. Save the file. When MT Manager asks to "Auto-sign the APK", tap Yes.
  8. Install the newly signed APK onto the target test device.
Trailing Slash Requirement

Always ensure server_url begins with https:// and ends with /. The Android client appends the WebSocket path relative to this root origin.

6. Security Hardening & OPSEC Guidelines

WhaleRAT is deliberately powerful. When setting up a research lab or testing infrastructure, adhere strictly to these operational security guidelines:

Production Hardening Checklist
  • Change Default Credentials: Never deploy with default passwords like ADMIN_CODE: 123456. Choose a strong, secret administrative password.
  • Enforce HTTPS / TLS: Railway provides automated SSL/TLS out of the box. Never run WhaleRAT over unencrypted HTTP on public networks.
  • Restrict Telegram ADMIN_ID: Your bot token and numerical Telegram ADMIN_ID are the primary gatekeepers. The bot automatically drops commands from unauthorized Telegram accounts.
  • Keep Configuration Private: Never commit your config.json with live tokens to public GitHub repositories. Use environment variables or add it to .gitignore.
  • Use WebAuthn Passkeys: Register a biometric passkey (TouchID, FaceID, or hardware YubiKey) in the Web C2 panel to resist credential harvesting.
  • Log Retention & Auto-Compaction: Operational logs are recorded in logs.jsonl with automatic 7-day retention and deduplication to safeguard sensitive lab telemetry.

7. Conclusion & Legal Disclaimer

WhaleRAT is intended exclusively for authorized security research, academic studies, and defensive engineering.

Using this software against targets without explicit, prior, written consent is strictly illegal and subject to severe criminal liability under applicable law (CFAA, Computer Misuse Act, Indian IT Act, etc.). The developers assume zero responsibility for misuse, damage, or malicious actions executed via this codebase. You are solely responsible for how you use it.

Open Source License & Development
WhaleRAT is open-source and distributed under the MIT License. Made with ❤️ by Sidharth S (@zidhuxd).
GitHub Repository

Community & Lab Discussion

Leave technical questions, bug reports, or feature proposals regarding WhaleRAT.