Detection rules › Sigma

Potential Container Discovery Via Inodes Listing

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

Detects listing of the inodes of the "/" directory to determine if the we are running inside of a container.

MITRE ATT&CK coverage

TacticTechniques
DiscoveryT1082 System Information Discovery

Event coverage

Rule body yaml

title: Potential Container Discovery Via Inodes Listing
id: 43e26eb5-cd58-48d1-8ce9-a273f5d298d8
status: test
description: Detects listing of the inodes of the "/" directory to determine if the we are running inside of a container.
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
modified: 2025-11-24
logsource:
    category: process_creation
    product: linux
detection:
    selection_ls_img:
        Image|endswith: '/ls'    # inode outside containers low, inside high
    selection_ls_cli:
        - CommandLine|endswith: ' /'
        - CommandLine|contains: ' / '
    selection_regex_inode:
        CommandLine|re: '(?:\s-[^-\s]{0,20}i|\s--inode\s)'      # -i finds inode number
    selection_regex_dir:
        CommandLine|re: '(?:\s-[^-\s]{0,20}d|\s--directory\s)'  # -d gets directory itself, not contents
    condition: all of selection_*
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

all of selection_*

Stage 1: selection_ls_img

selection_ls_img:
    Image|endswith: '/ls'

Stage 2: selection_ls_cli

selection_ls_cli:
    - CommandLine|endswith: ' /'
    - CommandLine|contains: ' / '

Stage 3: selection_regex_inode

selection_regex_inode:
    CommandLine|re: '(?:\s-[^-\s]{0,20}i|\s--inode\s)'

Stage 4: selection_regex_dir

selection_regex_dir:
    CommandLine|re: '(?:\s-[^-\s]{0,20}d|\s--directory\s)'

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
  • /
CommandLinematch
  • /
CommandLineregex_match
  • (?:\s-[^-\s]{0,20}d|\s--directory\s)
  • (?:\s-[^-\s]{0,20}i|\s--inode\s)
Imageends_with
  • /ls