Detection rules › Elastic
Potential Process Masquerading via Exec
This rule detects process masquerading through the use of the exec command. The exec command can be used in conjunction with the -a flag to change the name of the process in the process table. This technique is used by malware to hide the true identity of a process from security tools and analysts.
MITRE ATT&CK coverage
| Tactic | Techniques |
|---|---|
| Execution | |
| Stealth |
Rule body
[rule]
description = """
This rule detects process masquerading through the use of the `exec` command. The `exec` command can be used in
conjunction with the `-a` flag to change the name of the process in the process table. This technique is used by malware
to hide the true identity of a process from security tools and analysts.
"""
id = "e6669bc3-cb75-4fb3-91e0-ddaa06dd59b2"
license = "Elastic License v2"
name = "Potential Process Masquerading via Exec"
os_list = ["linux"]
version = "1.0.20"
query = '''
process where event.type == "start" and event.action == "exec" and process.parent.executable != null and
process.name in ("bash", "dash", "sh", "tcsh", "csh", "zsh", "ksh", "fish") and
process.args == "-c" and process.command_line : "* exec -a *" and not (
process.executable like ("/nix/store/*", "/tmp/newroot/*") or
process.parent.executable in (
"/opt/warpdotdev/warp-terminal/warp", "/opt/sp/serverpilot/stats/bin/sp-stats", "/bin/bcompare", "/bin/su",
"/usr/NX/bin/nxnode.bin", "/usr/bin/gnome-shell", "/var/lib/dpkg/info/udev.postinst", "/usr/bin/bcompare",
"/usr/bin/su", "/usr/bin/claude-bin"
) or
process.parent.executable like (
"/home/*/.local/share/claude/*", "/home/*/.local/bin/klaude", "/usr/local/*/claude-bin",
"/home/*/.claude/remote/ccd-cli/*", "/home/*/.claude/remote/ccd-cli", "/claude-cli/versions/*",
"/usr/scratch/*/git/*/atl/src/aitools/claude/claude-bin", "/opt/forticlient/epctrl",
"/root/.claude/remote/ccd-cli/*", "/root/.local/share/claude/versions/*", "/mnt/fast/*/.local/share/claude/versions/*",
"/opt/warpdotdev/warp-terminal/warp (deleted)", "/opt/local/share/claude/versions/*",
"/usr/share/cursor/cursor", "/home/*/.grok/downloads/grok*linux-x86_64", "/home/*/.codex/*/bin/codex"
) or
process.parent.args == "claude" or
process.parent.name == "claude" or
process.command_line like (
"*/tmp/fzf-args*", "/opt/sp/serverpilot/*", "*/opt/forticlientems/*", "*WarpTerminal*", "/bin/bash -c exec -a bash*",
"/bin/bash -c exec -a sp-agent /opt/sp/serverpilot/agent/bin/sp-agent", """bash -c exec -a "$0" "$@" reboot /usr/sbin/reboot.no-molly-guard""",
"bash -c exec -a auto_upgrade_fcems /opt/forticlientemstmp/upgradeworker_linux_amd64 -config ./goEMS.conf",
"bash -c exec -a cubin_gpu_pool_worker sleep *", "bash -c exec -a chroma sleep 7200",
"bash -c exec -a 'oes-mfa-agent' /usr/bin/node* --enable-source-maps /opt/novell/oes-mfa-agent/app/mfa-agent/main",
"bash -c exec -a auto_upgrade_fcems /opt/forticlientemstmp/emsworkers_linux_amd64 -worker_name=upgrade -config ./goEMS.conf",
"/bin/bash -c exec -a /usr/bin/heidisql /usr/share/heidisql/heidisql > /dev/null 2>&1 /usr/bin/heidisql",
"/usr/bin/bash -c exec -a ems:uninstall /opt/forticlient/epctrl uninstall",
"bash -c exec -a \"apt-get update\" /var/cache/apt/cdroms.list",
"/bin/bash -c exec -a nvsm_apis_mosquitto /usr/sbin/mosquitto -c /etc/nvsm/nvsm-mqtt.config",
"*SNAPSHOT_FILE=/home/*/.claude/shell-snapshots/snapshot*"
) or
process.working_directory in ("/opt/novell/umc/apps/umc-server", "/opt/novell/umc/apps/oes-rest", "/usr/share/epoptes-client") or
process.args in (
"exec -a sp-monitor /opt/sp/serverpilot/monitor/bin/monitor",
"exec -a sp-stats /opt/sp/serverpilot/stats/bin/sp-stats",
"/usr/bin/bcompare", "/usr/lib64/beyondcompare/BCompare"
) or
process.parent.command_line == "runc init" or
process.command_line == """bash -c exec -a "$0" "$@" shutdown /usr/sbin/shutdown.no-molly-guard -r now""" or
(process.command_line == "bash -c exec -a '[sleep router failover]' sleep 1" and process.parent.command_line == "/bin/bash /init.sh")
)
'''
min_endpoint_version = "7.15.0"
optional_actions = []
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0
[[actions]]
action = "kill_process"
field = "process.parent.entity_id"
state = 0
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1059"
name = "Command and Scripting Interpreter"
reference = "https://attack.mitre.org/techniques/T1059/"
[[threat.technique.subtechnique]]
id = "T1059.004"
name = "Unix Shell"
reference = "https://attack.mitre.org/techniques/T1059/004/"
[threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1564"
name = "Hide Artifacts"
reference = "https://attack.mitre.org/techniques/T1564/"
[threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
[internal]
min_endpoint_version = "7.15.0"
Stages and Predicates
Stage 1: process
process where event.type == "start" and event.action == "exec" and process.parent.executable != null and
process.name in ("bash", "dash", "sh", "tcsh", "csh", "zsh", "ksh", "fish") and
process.args == "-c" and process.command_line : "* exec -a *" and not (
process.executable like ("/nix/store/*", "/tmp/newroot/*") or
process.parent.executable in (
"/opt/warpdotdev/warp-terminal/warp", "/opt/sp/serverpilot/stats/bin/sp-stats", "/bin/bcompare", "/bin/su",
"/usr/NX/bin/nxnode.bin", "/usr/bin/gnome-shell", "/var/lib/dpkg/info/udev.postinst", "/usr/bin/bcompare",
"/usr/bin/su", "/usr/bin/claude-bin"
) or
process.parent.executable like (
"/home/*/.local/share/claude/*", "/home/*/.local/bin/klaude", "/usr/local/*/claude-bin",
"/home/*/.claude/remote/ccd-cli/*", "/home/*/.claude/remote/ccd-cli", "/claude-cli/versions/*",
"/usr/scratch/*/git/*/atl/src/aitools/claude/claude-bin", "/opt/forticlient/epctrl",
"/root/.claude/remote/ccd-cli/*", "/root/.local/share/claude/versions/*", "/mnt/fast/*/.local/share/claude/versions/*",
"/opt/warpdotdev/warp-terminal/warp (deleted)", "/opt/local/share/claude/versions/*",
"/usr/share/cursor/cursor", "/home/*/.grok/downloads/grok*linux-x86_64", "/home/*/.codex/*/bin/codex"
) or
process.parent.args == "claude" or
process.parent.name == "claude" or
process.command_line like (
"*/tmp/fzf-args*", "/opt/sp/serverpilot/*", "*/opt/forticlientems/*", "*WarpTerminal*", "/bin/bash -c exec -a bash*",
"/bin/bash -c exec -a sp-agent /opt/sp/serverpilot/agent/bin/sp-agent", """bash -c exec -a "$0" "$@" reboot /usr/sbin/reboot.no-molly-guard""",
"bash -c exec -a auto_upgrade_fcems /opt/forticlientemstmp/upgradeworker_linux_amd64 -config ./goEMS.conf",
"bash -c exec -a cubin_gpu_pool_worker sleep *", "bash -c exec -a chroma sleep 7200",
"bash -c exec -a 'oes-mfa-agent' /usr/bin/node* --enable-source-maps /opt/novell/oes-mfa-agent/app/mfa-agent/main",
"bash -c exec -a auto_upgrade_fcems /opt/forticlientemstmp/emsworkers_linux_amd64 -worker_name=upgrade -config ./goEMS.conf",
"/bin/bash -c exec -a /usr/bin/heidisql /usr/share/heidisql/heidisql > /dev/null 2>&1 /usr/bin/heidisql",
"/usr/bin/bash -c exec -a ems:uninstall /opt/forticlient/epctrl uninstall",
"bash -c exec -a \"apt-get update\" /var/cache/apt/cdroms.list",
"/bin/bash -c exec -a nvsm_apis_mosquitto /usr/sbin/mosquitto -c /etc/nvsm/nvsm-mqtt.config",
"*SNAPSHOT_FILE=/home/*/.claude/shell-snapshots/snapshot*"
) or
process.working_directory in ("/opt/novell/umc/apps/umc-server", "/opt/novell/umc/apps/oes-rest", "/usr/share/epoptes-client") or
process.args in (
"exec -a sp-monitor /opt/sp/serverpilot/monitor/bin/monitor",
"exec -a sp-stats /opt/sp/serverpilot/stats/bin/sp-stats",
"/usr/bin/bcompare", "/usr/lib64/beyondcompare/BCompare"
) or
process.parent.command_line == "runc init" or
process.command_line == """bash -c exec -a "$0" "$@" shutdown /usr/sbin/shutdown.no-molly-guard -r now""" or
(process.command_line == "bash -c exec -a '[sleep router failover]' sleep 1" and process.parent.command_line == "/bin/bash /init.sh")
)
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.command_line | eq | bash -c exec -a '[sleep router failover]' sleep 1 | excludes:process.command_line field:"process.command_line" value:"bash -c exec -a '[sleep router failover]' sleep 1" |
process.parent.command_line | eq | /bin/bash /init.sh | excludes:process.parent.command_line field:"process.parent.command_line" value:"/bin/bash /init.sh" |
process.args | in | /usr/bin/bcompare, /usr/lib64/beyondcompare/BCompare, exec -a sp-monitor /opt/sp/serverpilot/monitor/bin/monitor, exec -a sp-stats /opt/sp/serverpilot/stats/bin/sp-stats | excludes:process.args |
process.command_line | eq | bash -c exec -a "$0" "$@" shutdown /usr/sbin/shutdown.no-molly-guard -r now | excludes:process.command_line |
process.command_line | wildcard | */tmp/fzf-args*, /opt/sp/serverpilot/*, */opt/forticlientems/*, *WarpTerminal*, /bin/bash -c exec -a bash*, /bin/bash -c exec -a sp-agent /opt/sp/serverpilot/agent/bin/sp-agent, bash -c exec -a "$0" "$@" reboot /usr/sbin/reboot.no-molly-guard, bash -c exec -a auto_upgrade_fcems /opt/forticlientemstmp/upgradeworker_linux_amd64 -config ./goEMS.conf, bash -c exec -a cubin_gpu_pool_worker sleep *, bash -c exec -a chroma sleep 7200, bash -c exec -a 'oes-mfa-agent' /usr/bin/node* --enable-source-maps /opt/novell/oes-mfa-agent/app/mfa-agent/main, bash -c exec -a auto_upgrade_fcems /opt/forticlientemstmp/emsworkers_linux_amd64 -worker_name=upgrade -config ./goEMS.conf, /bin/bash -c exec -a /usr/bin/heidisql /usr/share/heidisql/heidisql > /dev/null 2>&1 /usr/bin/heidisql, /usr/bin/bash -c exec -a ems:uninstall /opt/forticlient/epctrl uninstall, bash -c exec -a "apt-get update" /var/cache/apt/cdroms.list, /bin/bash -c exec -a nvsm_apis_mosquitto /usr/sbin/mosquitto -c /etc/nvsm/nvsm-mqtt.config, *SNAPSHOT_FILE=/home/*/.claude/shell-snapshots/snapshot* | excludes:process.command_line |
process.executable | starts_with | /nix/store/, /tmp/newroot/ | excludes:process.executable field:"process.executable" value:"/nix/store/" field:"process.executable" value:"/tmp/newroot/" |
process.parent.args | eq | claude | excludes:process.parent.args field:"process.parent.args" value:"claude" |
process.parent.command_line | eq | runc init | excludes:process.parent.command_line field:"process.parent.command_line" value:"runc init" |
process.parent.executable | in | /bin/bcompare, /bin/su, /opt/sp/serverpilot/stats/bin/sp-stats, /opt/warpdotdev/warp-terminal/warp, /usr/NX/bin/nxnode.bin, /usr/bin/bcompare, /usr/bin/claude-bin, /usr/bin/gnome-shell, /usr/bin/su, /var/lib/dpkg/info/udev.postinst | excludes:process.parent.executable |
process.parent.executable | wildcard | /home/*/.local/share/claude/*, /home/*/.local/bin/klaude, /usr/local/*/claude-bin, /home/*/.claude/remote/ccd-cli/*, /home/*/.claude/remote/ccd-cli, /claude-cli/versions/*, /usr/scratch/*/git/*/atl/src/aitools/claude/claude-bin, /opt/forticlient/epctrl, /root/.claude/remote/ccd-cli/*, /root/.local/share/claude/versions/*, /mnt/fast/*/.local/share/claude/versions/*, /opt/warpdotdev/warp-terminal/warp (deleted), /opt/local/share/claude/versions/*, /usr/share/cursor/cursor, /home/*/.grok/downloads/grok*linux-x86_64, /home/*/.codex/*/bin/codex | excludes:process.parent.executable |
process.parent.name | eq | claude | excludes:process.parent.name field:"process.parent.name" value:"claude" |
process.working_directory | in | /opt/novell/umc/apps/oes-rest, /opt/novell/umc/apps/umc-server, /usr/share/epoptes-client | excludes:process.working_directory field:"process.working_directory" value:"/opt/novell/umc/apps/oes-rest" field:"process.working_directory" value:"/opt/novell/umc/apps/umc-server" field:"process.working_directory" value:"/usr/share/epoptes-client" |
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | eq |
| field:"EventType" kind:eq value:"exec" |
event.type | eq |
| field:"event.type" kind:eq value:"start" |
process.args | eq |
| field:"process.args" kind:eq value:"-c" |
process.command_line | wildcard |
| field:"CommandLine" kind:wildcard value:"* exec -a *" |
process.name | in |
| field:"process_name" kind:in |
process.parent.executable | is_not_null | field:"ParentImage" kind:is_not_null |