Linux Docker Container Discovery via .dockerenv File Listing or Reads

Detects Linux process executions using common utilities to read or list .dockerenv, indicating potential container environment discovery.

FreeReviewedSigma · Low · v2
Product
linux
Category
process_creation
Author
Seth Hanford (SigmaHQ), DRL 1.1
Published
2023-08-23
Updated
2026-07-31
title: Linux Docker Container Discovery via .dockerenv File Listing or Reads
id: 7980b30e-34d1-40e9-8083-9d9e72b56a5f
status: test
description: Identifies process executions where the command line ends with “.dockerenv” and is invoked via common file discovery or inspection utilities (e.g., cat/ls/find/stat/test/grep). This behavior can indicate an attacker is determining whether a process is running inside a Docker container by probing for the special “.dockerenv” file. The rule relies on Linux process creation telemetry, matching both the invoked image/utility name and the command line ending pattern.
references:
  - https://blog.skyplabs.net/posts/container-detection/
  - https://stackoverflow.com/questions/20010199/how-to-determine-if-a-process-runs-inside-lxc-docker
  - https://github.com/SigmaHQ/sigma/blob/master/rules/linux/process_creation/proc_creation_lnx_susp_dockerenv_recon.yml
tags:
  - attack.discovery
  - attack.t1082
author: Seth Hanford, Huntrule Team
date: 2023-08-23
logsource:
  category: process_creation
  product: linux
detection:
  selection:
    Image|endswith:
      - /cat
      - /dir
      - /find
      - /ls
      - /stat
      - /test
      - grep
    CommandLine|endswith: .dockerenv
  condition: 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
license: DRL-1.1
related:
  - id: 11701de9-d5a5-44aa-8238-84252f131895
    type: derived