Detection rules › Sigma

Container Residence Discovery Via Proc Virtual FS

Status
test
Severity
low
Log source
product linux, category process_creation
Author
Seth Hanford
Source
github.com/SigmaHQ/sigma

Detects potential container discovery via listing of certain kernel features in the "/proc" virtual filesystem

MITRE ATT&CK coverage

TacticTechniques
DiscoveryT1082 System Information Discovery

Event coverage

Rule body yaml

title: Container Residence Discovery Via Proc Virtual FS
id: 746c86fb-ccda-4816-8997-01386263acc4
status: test
description: Detects potential container discovery via listing of certain kernel features in the "/proc" virtual filesystem
references:
    - https://blog.skyplabs.net/posts/container-detection/
    - https://stackoverflow.com/questions/20010199/how-to-determine-if-a-process-runs-inside-lxc-docker
tags:
    - attack.discovery
    - attack.t1082
author: Seth Hanford
date: 2023-08-23
logsource:
    category: process_creation
    product: linux
detection:
    selection_tools:
        Image|endswith:
            - 'awk'
            - '/cat'
            - 'grep'
            - '/head'
            - '/less'
            - '/more'
            - '/nl'
            - '/tail'
    selection_procfs_kthreadd:  # outside containers, PID 2 == kthreadd
        CommandLine|contains: '/proc/2/'
    selection_procfs_target:
        CommandLine|contains: '/proc/'
        CommandLine|endswith:
            - '/cgroup'  # cgroups end in ':/' outside containers
            - '/sched'   # PID mismatch when run in containers
    condition: selection_tools and 1 of selection_procfs_*
falsepositives:
    - Legitimate system administrator usage of these commands
    - Some container tools or deployments may use these techniques natively to determine how they proceed with execution, and will need to be filtered
level: low

Stages and Predicates

Stage 0: condition

selection_tools and 1 of selection_procfs_*

Stage 1: selection_tools

selection_tools:
    Image|endswith:
        - 'awk'
        - '/cat'
        - 'grep'
        - '/head'
        - '/less'
        - '/more'
        - '/nl'
        - '/tail'

Stage 2: selection_procfs_kthreadd

selection_procfs_kthreadd:
    CommandLine|contains: '/proc/2/'

Stage 3: selection_procfs_target

selection_procfs_target:
    CommandLine|contains: '/proc/'
    CommandLine|endswith:
        - '/cgroup'
        - '/sched'

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
CommandLineends_with
  • /cgroup
  • /sched
CommandLinematch
  • /proc/
  • /proc/2/
Imageends_with
  • /cat
  • /head
  • /less
  • /more
  • /nl
  • /tail
  • awk
  • grep