Skip to content
Access control Write-up Advanced

Executive Summary

The Linux kernel failed to check that a process writing to the cgroups v1 release_agent file had administrative privileges, allowing a root process in a container to set a release agent that runs with full root privileges on the host. This could let a malicious container escape to the host if it runs without AppArmor, SELinux or Seccomp and in a root cgroup.

unit42.paloaltonetworks.com

Published on unit42.paloaltonetworks.com

On Feb. 4, Linux announced CVE-2022-0492, a new privilege escalation vulnerability in the kernel.

Yuval Avrahami, on unit42.paloaltonetworks.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the kernel did not verify that the process writing to the release_agent file had the CAP_SYS_ADMIN capability in the initial user namespace.

Impact

A malicious container could escape to the host and gain full root privileges, but only if it runs without AppArmor or SELinux, without Seccomp, as root, on a host with unprivileged user namespaces enabled, and in a root v1 cgroup.

What the attacker needed

Container runs as root; no AppArmor or SELinux; no Seccomp; host enables unprivileged user namespaces

The fix

The vulnerability was fixed in the Linux kernel by adding a capability check, and users should upgrade to a fixed kernel version and enable Seccomp and AppArmor or SELinux.

How it was found

  1. Create a new user and cgroup namespace where the container has CAP_SYS_ADMIN.
  2. Mount a writable cgroupfs for a subsystem where the container runs in the root cgroup.
  3. Write a path to a malicious binary into the release_agent file.
  4. Enable notify_on_release for a child cgroup.
  5. Trigger the release agent by terminating a process in that cgroup, causing the binary to run with host root privileges.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

Control groups (cgroups) are a Linux feature that limits and isolates resources for processes, and they are a basic building block of containers. The release_agent file lets an administrator choose a program that the kernel runs with full root rights when a process in the cgroup exits. The kernel forgot to check that only privileged users could set that file, so in some container setups a root process inside the container could make the host run its own program and break out of the container.

What is Access control?

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.

Similar reports

View all

Same bug class and techniques, clearest first.

Broken access control

The lesson behind this report.

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.