Container Environment: Suspicious Fileless Payload Execution via Shell Piping
Detection of fileless execution patterns within Linux containers where remote payloads are fetched via curl or wget and immediately passed to a shell or scripting interpreter to bypass filesystem-based controls.
Triage facts
Revision 1- Applicability
- Linux
- Evidence
- Unknown
- Severity
- Medium
- Action
- Elevated
- Sources
- 2 public sources
- Freshness
- Revision 1Nov 3, 21:48 UTC
- Source quality
- A2Likely
This alert identifies potentially malicious fileless execution in Linux containers. Attackers often leverage the pattern of piping network-downloaded content directly into a shell (e.g., curl <url> | sh) to achieve code execution without writing artifacts to the container filesystem. This technique is primarily used during initial foothold or lateral movement to evade forensic analysis and disk-based security controls.
Attack Chain
- Initial access or lateral movement phase within a container.
- Execution of a downloader utility (curl or wget).
- Fetching of an external payload from a remote malicious server.
- Piping of the remote payload output directly into a local shell or script interpreter (e.g., bash, sh, python, or perl).
- Execution of the code in memory, bypassing persistent file scanning.
- Potential follow-on activities, such as reverse shell spawning, crypto-miner installation, or container runtime socket access.
Recommendation
- Implement runtime monitoring to detect the chaining of downloader processes (
curl/wget) and scripting interpreters. - Restrict interactive container access (exec sessions) via RBAC and just-in-time privilege requests.
- Apply egress network policies to limit container communication to known-good internal or external endpoints.
- Harden container images to remove unnecessary utilities like
curlandwgetwhere possible. - Review and deploy the provided Elastic Defend for Containers rule logic to monitor for ephemeral pipe execution patterns.
Immediate actions
Deploy the detection logic for curl/wget piped to shell within Linux container environments.
Threat Hunt
Identify container exec sessions where curl or wget is followed immediately by a shell interpreter invocation.
Data: Process creation events (Sysmon/Auditd/Cloud Defend), Command line arguments, Parent-child process relationship
Mitigations
Enforce network policies to restrict outbound traffic from containers to untrusted external infrastructure.
T1105