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.
- Product
- linux
- Category
- process_creation
- Author
- Seth Hanford (SigmaHQ), DRL 1.1
- Published
- 2023-08-23
- Updated
- 2026-07-31
ATT&CK techniques
DiscoveryRecon
Resource Dev
Initial Access
Execution
Persistence
Priv Esc
Defense Evasion
Cred Access
Discovery
Lateral Movement
Collection
C2
Exfiltration
Impact
What it detects
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.
Reporting behind it
- blog.skyplabs.nethttps://blog.skyplabs.net/posts/container-detection/
- stackoverflow.comhttps://stackoverflow.com/questions/20010199/how-to-determine-if-a-process-runs-inside-lxc-docker
- github.comhttps://github.com/SigmaHQ/sigma/blob/master/rules/linux/process_creation/proc_creation_lnx_susp_dockerenv_recon.yml
Changelog
v2- v2Candidate ingested via manual entry.2026-07-31
- v1No changelog recorded for this version.2026-07-30
Detection content is published as a reviewed draft. Tune thresholds and exclusions against your own telemetry before enabling this rule for alerting.
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