Sensitive File Compression Detected in Linux Containers for Credential Access
Elastic Defend for Containers detects the use of compression utilities like tar or zip within Linux containers to collect sensitive files such as SSH keys, AWS credentials, or system configurations, indicating potential credential access and data collection attempts by adversaries.
What's new
This brief describes a detection mechanism implemented by Elastic Defend for Containers aimed at identifying credential access and collection activities within Linux container environments. Adversaries often exploit compromised containers to locate and gather sensitive information, including cloud provider credentials (AWS, Azure, GCP), SSH keys, Docker configurations, and system configuration files (e.g., /etc/passwd, /etc/shadow). The detection focuses on the use of common compression utilities such as zip, tar, gzip, hdiutil, 7z, rar, 7zip, or p7zip, either executed directly or via shell processes (bash, sh, zsh), when their command-line arguments target known sensitive file paths. This activity signals an attacker's attempt to stage data for exfiltration after gaining access to a container. The detection was reintroduced with Elastic Stack version 9.3.0.
Attack Chain
- Initial Access: An adversary gains unauthorized access to a Linux container instance, potentially through a vulnerable application, misconfiguration, or compromised credentials for a management interface.
- Discovery: Within the compromised container, the adversary enumerates the file system to locate sensitive files containing credentials, configuration data, or other valuable information.
- Collection - Locate Sensitive Data: The attacker specifically targets files and directories known to store credentials or critical system configurations, such as
~/.ssh/,~/.aws/,~/.docker/,/etc/passwd,/etc/shadow, or cloud-specific credential files (e.g.,application_default_credentials.json). - Collection - Archive Sensitive Data: To consolidate and prepare for exfiltration, the adversary executes a compression utility (e.g.,
tar,zip,gzip,7z) directly or via a shell script, specifying the previously identified sensitive files as input. - Staging: The compression utility creates an archive file containing the collected sensitive data, typically in a temporary or accessible location within the container's file system, ready for the next phase.
- Exfiltration (Implied): The adversary then moves the compressed archive out of the container environment to an external command and control server or storage location, completing the data theft objective.
Impact
Successful sensitive file compression and subsequent exfiltration from a compromised container can lead to significant data breaches and further attacks. Attackers can leverage stolen SSH keys, cloud provider API credentials, or Docker configuration files to gain access to other systems, cloud resources, or orchestrate lateral movement within the victim's infrastructure. This can result in unauthorized cloud resource provisioning, data theft from cloud storage, disruption of services, and a broader compromise of the organization's environment, potentially incurring severe financial, reputational, and regulatory consequences.
Recommendation
- Deploy the Sigma rule provided in this brief to your SIEM to detect suspicious compression activities targeting sensitive files within Linux containers.
- Ensure Elastic Defend for Containers is properly configured and enabled on all Linux container hosts to collect process execution logs.
- Review the investigation steps outlined in this brief for any triggered alerts to identify the container, process, and files involved.
- Isolate affected containers immediately upon detection to prevent further data exfiltration or unauthorized access, as recommended in the remediation section.
- Rotate any credentials (SSH keys, cloud API keys) potentially exposed by the collected sensitive files.
Detection coverage 3
Sensitive File Compression Detected via Defend for Containers
mediumDetects the use of compression utilities to collect known files containing sensitive information, such as credentials and system configurations, inside a Linux container.
Detect Suspicious Network Tool Launch in Linux Containers
lowDetects commonly abused network utilities (e.g., nc, nmap, tcpdump) running inside Linux containers, which can be used for malicious purposes such as reconnaissance, monitoring, or exploitation. This rule covers direct execution and invocation via common shells.
Detect Suspicious Tool Installation in Linux Containers
lowDetects the installation of common adversary tools (e.g., netcat, curl, python interpreters) using Linux package managers within container environments. This indicates potential post-exploitation activity like reconnaissance, ingress tool transfer, or C2 establishment.
Detection queries are available on the platform. Get full rules →
Indicators of compromise
1
filepath
| Type | Value |
|---|---|
| filepath | /var/lib/kubelet/pki/ |