Writable And Executable Directory Probe

medium Single event T1059.004T1083 Discovery, Execution

The bot creates an empty dot-file in a directory and runs it with sh, for example `echo > /dev/shm/.b && sh /dev/shm/.b`. It repeats this across /tmp, /var/run, /dev/shm and others to find a directory that is both writable and not mounted noexec, then drops its payload there. A variant creates the file with a bare redirect, makes it executable and runs it directly: `>/tmp/d && chmod 777 /tmp/d && /tmp/d`.

Tested

Matches all 4 attack events in match.jsonl and none of the 5 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 1,113 sessions (13,447 matching commands), first on 2026-11-08 and last on 2026-12-05.

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

>/var/.f && chmod 777 /var/.f && /var/.f && cd /var/;

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

False positives

Sigma

title: Writable And Executable Directory Probe
id: 92b9d317-840c-40f1-b833-19392ae8a98d
status: experimental
description: |
  The bot creates an empty dot-file in a directory and runs it with sh, for example
  `echo > /dev/shm/.b && sh /dev/shm/.b`. It repeats this across /tmp, /var/run, /dev/shm and others to
  find a directory that is both writable and not mounted noexec, then drops its payload there. A variant
  creates the file with a bare redirect, makes it executable and runs it directly:
  `>/tmp/d && chmod 777 /tmp/d && /tmp/d`.
references:
  - https://attack.mitre.org/techniques/T1083/
author: Estul Lachin
date: 2026-11-08
tags:
  - attack.discovery
  - attack.t1083
  - attack.execution
  - attack.t1059.004
logsource:
  product: cowrie
detection:
  selection:
    eventid: cowrie.command.input
    input|re: '(echo\s*)?>\s*\S+/\.?\w+\s*&&\s*(sh\s+|chmod\s+\S+\s+\S+\s*&&\s*)\S+/\.?\w+'
  condition: selection
falsepositives:
  - Unlikely; legitimate scripts do not test directories this way
level: medium

rules/writable_dir_probe.yml

Splunk SPL

``` Writable And Executable Directory Probe. Generated from rules/writable_dir_probe.yml by tools/build.py; do not edit. ```
index=honeypot sourcetype=cowrie:json eventid="cowrie.command.input"
| regex input="(echo\\s*)?>\\s*\\S+/\\.?\\w+\\s*&&\\s*(sh\\s+|chmod\\s+\\S+\\s+\\S+\\s*&&\\s*)\\S+/\\.?\\w+"

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

Microsoft Sentinel KQL

// Writable And Executable Directory Probe. Generated from rules/writable_dir_probe.yml by tools/build.py; do not edit.
Cowrie_CL
| where eventid =~ "cowrie.command.input" and input matches regex "(echo\\s*)?>\\s*\\S+/\\.?\\w+\\s*&&\\s*(sh\\s+|chmod\\s+\\S+\\s+\\S+\\s*&&\\s*)\\S+/\\.?\\w+"

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/writable_dir_probe.kql · analytics rule