60 seconds to summarize for you about DIRTPIPE (Dirty Pipe) security vulnerability.
The TL;DR (10 Seconds)
|
Question |
Answer |
|
What is it? |
Linux kernel privilege escalation vulnerability |
|
CVE ID |
CVE-2022-0847 (publicly disclosed March 2022) |
|
CVSS Score |
7.8 (High) |
|
Local or Remote? |
Local only (attacker needs existing low-privileged access) |
|
Privilege result |
Unprivileged user → Full root access |
|
Containers? |
Affects containers. Can break out to host. |
|
Patch available? |
Yes (Linux 5.16.11, 5.15.25, 5.10.102) |
How Dirty Pipe works (15 Seconds)
The Dirty Pipe vulnerability is a flaw in the Linux kernel that allows improper communication between some versions of Linux and applications or processes that run on a Linux system. The Dirty Pipe vulnerability permits unauthorized access (modifications) to the memory pages of applications (programs) that are currently being executed.
As a result, an attacker who does not have any special privileges is able to create multiple instances of normally read-only files, read or view files while they are being written or otherwise modify protected system memory.
Some actions that can be taken by a hacker or "user" with no special rights include:
1. Updating binary files (e.g., changing system user or privilege configuration files).
2. Insert malicious code into running processes.
3. Gain elevated (root-level) access without additional authentication.
4. Break container isolation and access the host system.
No authentication required and only needs a foothold on the target machine (even a low-level account) to turn all subsequent access into root access via Dirty Pipe.
Impact of Dirty Pipe on Your Security (15 Seconds):
In most cases of a Linux privilege escalation by an attacker, they will get at least root access level privileges on the physical host machine itself,
However, the Dirty Pipe exploit is a little different in that it provides the following:
1. It allows you to write into read-only memory.
Most privilege escalation vulnerabilities allow you to read from places you should not have access to. Dirty Pipe allows you to write to places you should not have access to, making it much more severe.
2. It allows the offender to be able to exploit the vulnerability of being able to write files as a result of using Dirty Pipe and being able to gain access to containers running on your cluster even if those containers are not running by the attacker’s account.
As an example, if an attacker works their way into a container running on your Kubernetes cluster and takes advantage of the Dirty Pipe vulnerability to gain root-level access to the actual physical machine they can then disrupt the confidentiality and integrity of the entire containerization strategy you have put in place.
3. Dirty Pipe leaves no indicators of an exploit.
The Dirty Pipe exploit operates by writing directly to a process in memory instead of files on the filesystem; as a result, any changes made to the process state by this exploit will not be traceable using today’s methods of monitoring file integrity/changes, even with the use of digital signature verification methods, attackers could change the current state of a running process without leaving an indicator of any change made to the filesystem.
Versions of the Linux Kernel Exposed (10 Seconds):
1. All versions of Linux Kernel between 5.8 through to 5.16 have been exposed to Dirty Pipe exploits.
2. Certain Backported versions of the kernel in some enterprise Linux distributions.
Distribution status:
|
Distribution |
Status |
|
Ubuntu 20.04 LTS (Focal) |
Vulnerable (kernel 5.4+ with backports) |
|
Ubuntu 21.10 (Impish) |
Vulnerable (kernel 5.13) |
|
Ubuntu 22.04 LTS (Jammy) |
Patched (kernel 5.15.0-25+) |
|
Debian 11 (Bullseye) |
Vulnerable (kernel 5.10 with backports) |
|
RHEL 8 / CentOS 8 |
Not vulnerable (older kernel 4.18) |
|
RHEL 9 |
Vulnerable (kernel 5.14) |
|
Amazon Linux 2 |
Not vulnerable (kernel 4.14) |
|
Alpine Linux 3.13-3.15 |
Vulnerable |
Container images that were built against susceptible kernel versions will be affected by this vulnerability. Base images included within the baseline snapshot for Ubuntu, Debian, or Alpine (during the affected time period) may contain this vulnerability as well.
Exploit Availability (Approx. 5 Seconds)
There are public exploits available. A proof of concept (PoC) has been released within days of the vulnerability being disclosed, and there are scripts available on GitHub. Attackers are now using Dirty Pipe in existing tools in their automated tool kits.
Assume that attackers have functioning exploits - do not assume that you remain safe through obscurity.
Immediate Actions - Do These (Approx. 5 Seconds)
Complete these steps in order, immediately.
1. Immediately update your operating system's Linux kernel to one of the following levels:
1. 5.16.11 or higher
2. 5.15.25 or higher
3. 5.10.102 or higher
If you cannot perform these specific kernel updates, apply your vendor's “Distro-patch” or similar type of OS patch (if available).
2. If you cannot perform an OS upgrade or update immediately, you must:
1. Restrict user local access to critical systems and domains.
2. Please inform users of any unexpected outcomes (e.g., writing data to their home directory or changing a line in /etc/sudoers).
3. Increase container security through layered defence methods including seccomp, AppArmor, and SELinux during run time.
4. Research live kernel patching products that can work together with kpatch and livepatch.
3. Check for signs of exploitation:
Look for the below items as indicators of potential exploitation
1. Unexpected modification to system user or credential files.
2. Creation of new privileged user accounts or change in privilege level.
3. Unexpected process running as root, where that process was spawned from a non-root user.
4. Inconsistencies in container logs for unexpected access by the host.
The One-Page Explainer for Your Team
Print this. Hand it to your security engineers.
Technical Details
Root cause was the splice() system call incorrectly setting the PIPE_BUF_FLAG_CAN_MERGE flag for pipe buffers which allowed arbitrary data to be written on pages of memory that should be read-only.
Prerequisites for Attack
1. Users may attach locally as any user with equal or lesser privileges.
2. Any version of the Linux kernel that is older than version 5.10.17 (and possibly 5.10.18, but there are conflicting opinions about whether or not it is also exploitable) can be exploited by an attacker.
Attack Outcomes
1. Any read-only file could be written upon.
2. Any arbitrary page in memory could be overwritten.
3. Full root privileges via escalation of privileges.
Detection Challenge: The exploit writes to memory, not disk. Traditional File Integrity Monitoring (FIM) would not garner any indication of change, and therefore Runtime Detection would be necessary.
Containers: The vulnerability exists at the Kernel. A compromised container can breach the host system by using the exploit through shared kernel between the compromised container and the host. Container isolation will NOT provide sufficient protection by itself.
Patching Guidance
Critical Systems to patch first.
1. Multi-tenant environments.
2. Kubernetes Workers.
3. Hosts for containers.
4. Untrusted local user machines.
5. Developer Workstation's.
6. CI/CD build runners.
Verifying Patch Status
To check if you are running a Patch Kernel, perform the following command:
`uname -r` (check kernel version)
Common Misconceptions (30 Seconds)
|
Misconception |
Reality |
|
"We have no local users, so we are safe." |
Every process is a local user. Compromised web applications, SSH users, or cron jobs all count as local access. |
|
"Containers protect us." |
Containers share the host kernel. Dirty Pipe breaks container isolation. |
|
"We are on RHEL, so safe." |
RHEL 9 is vulnerable. Check your specific version. |
|
"We have SELinux enabled." |
SELinux reduces impact but does not prevent the vulnerability. Attackers can write to files that SELinux permits. |
|
"The exploit requires knowledge of file paths." |
Public exploits include path discovery. This is not a barrier. |
Dirty Pipe Action Plan
Print this out. Mark it done.
The following are steps to respond to the Dirty Pipe vulnerability:
First 24 hours
1. Identify any systems using Linux kernel version 5.8 through 5.16.10.
2. Prioritize: multi-tenant systems > containers > developer workstations > servers.
3. Patch all critical systems with a live patch if they can be live patched.
4. Block unexpected physical access to device if you are unable to patch.
Within 5 days
1. Patch all other systems that are still identified as vulnerable.
2. Update base images for all of your containers.
3. Check build pipelines for vulnerable runner images.
4. Review kernel version of your CI/CD.
Within 2 weeks
1. Audit for any indicators of exploit (for example, changes in privileges, unexpected root processes, etc...).
2. Update your incident response plan to include Dirty Pipe indication as part of how to respond to Dirty Pipe.
3. Apply Kernel live patching for any new possible Dirty Pipe vulnerabilities.
4. Review security controls on container runtime.
Final Word to CISOs
A dirty pipe exploit is not an attack you can exploit remotely, or through the Internet. Attackers will typically look to gain access to your system to exploit this vulnerability, usually through another method such as a Web-based application, or, more rarely, through accessing another source, such as a stolen SSH key. After successfully gaining access to a workstation, an attacker can quickly and easily leverage the vulnerability to gain elevated privileges equal to that of a super user in very short order.
What types of security controls did you establish on your developer machines, CI/CD runners, and hosted containers once your public facing servers were patched, and secured your Edge devices?
As the attackers move laterally through their environments, Dirty Pipe is their means of escalation.
Patch now. Trust nothing. Verify everything.
FAQ Section
1. Can the Dirty Pipe Vulnerability be accessed from afar?
The Dirty Pipe vulnerability is a local privilege escalation issue therefore requires the attacker to have a level of access to the system (i.e., through being an SSH user or through a compromised web application etc.) There is no way to exploit the Dirty Pipe remotely without having some level of access to the local machine. When combined with a remote exploit, however, an exploit using the dirty pipe could have significant impact.
2. Is Dirty Pipe an issue for containers?
Yes. Containers utilize the same host kernel as the host itself and with proper exploitation of the dirty pipe vulnerability, the attacker may utilize a compromised container to gain entryway to the host by first gaining access to the host through the dirty pipe exploit.
3. How to determine if the kernel you run has dirty pipe vulnerability?
Run uname -r and look at the kernel version number that are between kernel version 5.8 and 5.16.10 (not including point releases) will show that you are affected. In addition, look at your distros security advisory notices for back port patches.
4. Possible Mitigation Strategies for the (dirty Pipe) if you cannot (Dirty Pipe) patch?
There are many (dirty pipes) are mitigated using the following: 1) Limiting users' access to the data files or folders that contain sensitive information on the machine where it exists. 2) Enforcing mandatory access to programs with sensitive data and storing these files with write permissions in trusted locations. 3) Checking the live patching capabilities of kernels. 4) Implementing run-time detection of privilege escalation attempts. These options cannot (dirty pipe) correct dirty pipes unless the operating system is being regularly patched and maintained regularly as a top priority by IT security personnel.
5. Why is it called ‘Dirty Pipe’?
‘Dirty Pipe’ follows the naming convention of the vulnerabilities found within the Linux kernel (Dirty COW, Dirty Pipe) because of where it resides within the Linux kernel – Linux kernel pipe subsystem. And because it is an indicator of an attempt to gain the ability to modify what would normally be read only memory (aka – a ‘dirty’ write, since writing to read only memory).