Linux Script Execution from /tmp via Shell -c
Alerts when a Linux shell runs a command with -c that references a script under /tmp/.
FreeUnreviewedSigmamediumv1
linux-script-execution-from-tmp-via-shell-c-30bcce26
title: Linux Script Execution from /tmp via Shell -c
id: b0e482b1-615d-40f9-b3fd-1a5298cc1c74
status: test
description: This rule flags Linux process executions where the command line includes a script path under /tmp/ and is invoked through a shell interpreter with the -c option. Attackers often use temporary directories like /tmp to stage payloads and execute them via common shells, reducing persistence and blending with normal activity. It relies on process creation telemetry including the executed image path (e.g., /bash, /sh) and command-line content containing both '-c' and '/tmp/'.
references:
- https://blogs.jpcert.or.jp/en/2023/05/gobrat.html
- https://jstnk9.github.io/jstnk9/research/GobRAT-Malware/
- https://www.virustotal.com/gui/file/60bcd645450e4c846238cf0e7226dc40c84c96eba99f6b2cffcd0ab4a391c8b3/detection
- https://www.virustotal.com/gui/file/3e44c807a25a56f4068b5b8186eee5002eed6f26d665a8b791c472ad154585d1/detection
- https://github.com/SigmaHQ/sigma/blob/master/rules/linux/process_creation/proc_creation_lnx_susp_shell_script_exec_from_susp_location.yml
author: Joseliyo Sanchez, @Joseliyo_Jstnk, Huntrule Team
date: 2023-06-02
tags:
- attack.execution
logsource:
product: linux
category: process_creation
detection:
selection_img:
Image|endswith:
- /bash
- /csh
- /dash
- /fish
- /ksh
- /sh
- /zsh
selection_flag:
CommandLine|contains: " -c "
selection_paths:
CommandLine|contains: /tmp/
condition: all of selection_*
falsepositives:
- Unknown
level: medium
license: DRL-1.1
related:
- id: 30bcce26-51c5-49f2-99c8-7b59e3af36c7
type: derived
What it detects
This rule flags Linux process executions where the command line includes a script path under /tmp/ and is invoked through a shell interpreter with the -c option. Attackers often use temporary directories like /tmp to stage payloads and execute them via common shells, reducing persistence and blending with normal activity. It relies on process creation telemetry including the executed image path (e.g., /bash, /sh) and command-line content containing both '-c' and '/tmp/'.
Known false positives
- Unknown
Detection content is published as a reviewed draft. Tune thresholds and exclusions against your own telemetry before enabling this rule for alerting.