Detection rules › Sigma

Execution Of Script Located In Potentially Suspicious Directory

Status
test
Severity
medium
Log source
product linux, category process_creation
Author
Joseliyo Sanchez, @Joseliyo_Jstnk
Source
github.com/SigmaHQ/sigma

Detects executions of scripts located in potentially suspicious locations such as "/tmp" via a shell such as "bash", "sh", etc.

MITRE ATT&CK coverage

TacticTechniques
ExecutionNo specific technique

Event coverage

Rule body yaml

title: Execution Of Script Located In Potentially Suspicious Directory
id: 30bcce26-51c5-49f2-99c8-7b59e3af36c7
status: test
description: Detects executions of scripts located in potentially suspicious locations such as "/tmp" via a shell such as "bash", "sh", etc.
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
author: Joseliyo Sanchez, @Joseliyo_Jstnk
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:
        # Note: Add more suspicious paths
        CommandLine|contains: '/tmp/'
    condition: all of selection_*
falsepositives:
    - Unknown
level: medium

Stages and Predicates

Stage 0: condition

all of selection_*

Stage 1: selection_img

selection_img:
    Image|endswith:
        - '/bash'
        - '/csh'
        - '/dash'
        - '/fish'
        - '/ksh'
        - '/sh'
        - '/zsh'

Stage 2: selection_flag

selection_flag:
    CommandLine|contains: ' -c '

Stage 3: selection_paths

selection_paths:
    CommandLine|contains: '/tmp/'

Indicators

Each row is a field, operator, and value that the rule matches. The corpus column counts how many other rules in the catalog look for the same combination: high numbers point to widely-used, community-vetted indicators. Blank or 1 shows that the indicator is specific to this rule.

FieldKindValues
CommandLinematch
  • -c
  • /tmp/
Imageends_with
  • /bash
  • /csh
  • /dash
  • /fish
  • /ksh
  • /sh
  • /zsh