Binary Written With Hex-Escaped Echo

high Single event T1027T1105 Command and Control, Stealth

echo -e / echo -ne with \xNN escapes redirected into a file: the attacker writes a binary or script chunk by chunk because the device has no wget, curl or tftp. A Mirai-style dropper seen on the honeypot wrote an ELF file in 412 such chunks within seconds of logging in.

Tested

Matches all 2 attack events in match.jsonl and none of the 4 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 162 sessions (2,412 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):

/bin/busybox echo -ne "\x23\x21\x2F\x62\x69\x6E\x2F\x73\x68 \x66\x6F\x72\x20\x70\x72\x6F\x63\x5F\x64\x69\x72\x20\x69\x6…

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

False positives

Sigma

title: Binary Written With Hex-Escaped Echo
id: e7422729-a8c4-4a2e-a231-6308e91246af
status: experimental
description: |
  echo -e / echo -ne with \xNN escapes redirected into a file: the attacker writes a binary or script
  chunk by chunk because the device has no wget, curl or tftp. A Mirai-style dropper seen on the
  honeypot wrote an ELF file in 412 such chunks within seconds of logging in.
references:
  - https://attack.mitre.org/techniques/T1105/
  - https://attack.mitre.org/techniques/T1027/
author: Estul Lachin
date: 2026-11-08
tags:
  - attack.command-and-control
  - attack.t1105
  - attack.stealth
  - attack.t1027
logsource:
  product: cowrie
detection:
  selection:
    eventid: cowrie.command.input
    input|re: 'echo\s+-[a-z]*e[a-z]*\s+["'']?(\\x[0-9a-fA-F]{2}){4}'
  redirect:
    input|contains: '>'
  condition: selection and redirect
falsepositives:
  - Administrators printing escape sequences to a file (rare, and never in hundreds of chunks)
level: high

rules/hex_echo_binary_drop.yml

Splunk SPL

``` Binary Written With Hex-Escaped Echo. Generated from rules/hex_echo_binary_drop.yml by tools/build.py; do not edit. ```
index=honeypot sourcetype=cowrie:json eventid="cowrie.command.input" input="*>*"
| regex input="echo\\s+-[a-z]*e[a-z]*\\s+[\"']?(\\\\x[0-9a-fA-F]{2}){4}"

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

Microsoft Sentinel KQL

// Binary Written With Hex-Escaped Echo. Generated from rules/hex_echo_binary_drop.yml by tools/build.py; do not edit.
Cowrie_CL
| where (eventid =~ "cowrie.command.input" and input matches regex "echo\\s+-[a-z]*e[a-z]*\\s+[\"']?(\\\\x[0-9a-fA-F]{2}){4}") and input contains ">"

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