Linux Restricted Shell Breakout via the expect commandedit

Identifies Linux binary expect command abuse to break out from restricted environments by spawning an interactive system shell. The expect utility allows us to automate control of interactive applications such as Telnet, FTP, SSH and others. The activity of spawning shell is not a standard use of this binary for a user or system administrator and could potentially indicate malicious actor attempting to improve the capabilities or stability of their access.

Rule type: eql

Rule indices:


Severity: medium

Risk score: 47

Runs every: 5m

Searches indices from: now-9m (Date Math format, see also Additional look-back time)

Maximum alerts per execution: 100



  • Elastic
  • Host
  • Linux
  • Threat Detection
  • Execution
  • GTFOBins

Version: 2

Rule authors:

  • Elastic

Rule license: Elastic License v2

Rule queryedit

process where event.type == "start" and in ("bash", "sh", "dash") and == "expect" and process.parent.args == "-c" and
  process.parent.args in ("spawn /bin/sh;interact", "spawn /bin/bash;interact", "spawn /bin/dash;interact", "spawn sh;interact", "spawn bash;interact", "spawn dash;interact")