Runc Container Escape Vulnerability Alert

Runc Container Escape Vulnerability Alert

fevereiro 2, 2024 | NSFOCUS

Overview

Recently, NSFOCUS CERT detected that the runc officially issued a security notice and fixed a container escaping vulnerability (CVE-2024-21626). Since the internal file descriptor of runc is leaked during initialization and the final working directory is not verified to be located in the mount namespace of the container, attackers can conduct container escaping in various ways:

1. As runc leaks some file descriptors including the host /sys/fs/cgroup handle to runc init, if the container is configured as process.cwd, when a privileged user executes malicious container mirroring, the generated PID1 process will have a working directory in the namespace of the host mount, resulting in that the generated process can access the entire host file system.

2. Since runc exec also suffers from file descriptor leakage and lack of working directory validation, if a malicious process in the container knows that a management process will call runc exec with the –cwd parameter and the given path, it can replace this path with /proc/self/fd/7/ using a symbolic link. Once the container process executes a binary in the container image, PR_SET_DUMPABLE protection can be bypassed causing an attacker to access the host file system by opening /proc/$exec_pid/cwd.

3. Attacks 1 and 2 can overwrite host binaries by using a path like /proc/self/fd/7/../../bin/bash as the process.args binary parameter.

Since binaries like /bin/bash can be overwritten, an attacker may gain full access to the host once a privileged user executes the target binary on it.

Runc is a CLI tool for building and running containers on Linux according to the OCI specification. Runc runs in containers such as Docker, containerd, Podman and CRI-O by default. It has a wide range of applications and supports multiple container formats. Containers can be directly run without the docker engine.

Reference link: https://github.com/opencontainers/runc/security/advisories/GHSA-xr7r-f8xq-vfvv

Scope of Impact

Affected version

1.0.0-rc93 <= runc <= 1.1.11

Unaffected version

runc >= 1.1.12

Mitigation

Official upgrade

At present, this vulnerability has been officially fixed in the latest version. Please upgrade the version for protection as soon as possible. The official download link: https://github.com/opencontainers/runc/releases

Statement

This advisory is only used to describe a potential risk. NSFOCUS does not provide any commitment or promise on this advisory. NSFOCUS and the author will not bear any liability for any direct and/or indirect consequences and losses caused by transmitting and/or using this advisory. NSFOCUS reserves all the rights to modify and interpret this advisory. Please include this statement paragraph when reproducing or transferring this advisory. Do not modify this advisory, add/delete any information to/from it, or use this advisory for commercial purposes without permission from NSFOCUS.

About NSFOCUS

NSFOCUS, Inc., a global network and cyber security leader, protects enterprises and carriers from advanced cyber attacks. The company’s Intelligent Hybrid Security strategy utilizes both cloud and on-premises security platforms, built on a foundation of real-time global threat intelligence, to provide multi-layered, unified and dynamic protection against advanced cyber attacks.

NSFOCUS works with Fortune Global 500 companies, including four of the world’s five largest financial institutions, organizations in insurance, retail, healthcare, critical infrastructure industries as well as government agencies. NSFOCUS has technology and channel partners in more than 60 countries, is a member of both the Microsoft Active Protections Program (MAPP), and the Cloud Security Alliance (CSA).

A wholly owned subsidiary of NSFOCUS Technologies Group Co., Ltd., the company has operations in the Americas, Europe, the Middle East and Asia Pacific.