# CVE-2026-4878: Libcap: libcap: privilege escalation via toctou race condition in cap_set_file()

> Local attackers can exploit a race condition in libcap to inject capabilities into executables, leading to privilege escalation.

- **Severity:** Medium 6.7 (`CVSS:3.1/AV:L/AC:H/PR:L/UI:R/S:U/C:H/I:H/A:H`)
- **Exploited in the wild:** Not known
- **Login needed:** Any signed-in user
- **Attackable:** Local or same network only
- **Victim action needed:** A user has to click or open something
- **Fix available:** Yes
- **Published:** 9 Apr 2026
- **Updated:** 14 Oct 2026
- **Also known as:** ALPINE-CVE-2026-4878, ALSA-2026:12423, ALSA-2026:12441, ALSA-2026:13285, ALSA-2026:19130, ALSA-2026:19346, AZL-82425, BELL-CVE-2026-4878, CLEANSTART-2026-QJ20877, CLSA-2026-1777941636, CLSA-2026-1777941808, CLSA-2026-1777944214, CLSA-2026-1778081089, CLSA-2026-1778599539, CLSA-2026-1778599722, CLSA-2026-1778662651, CLSA-2026-1792443899, DEBIAN-CVE-2026-4878, ECHO-beb9-6eea-f967, MGASA-2026-0221, MINI-2gpr-cw8q-9r9p, OESA-2026-1929, RHSA-2026:12423, RHSA-2026:12441, RHSA-2026:13285, RHSA-2026:19130, RHSA-2026:19346, RHSA-2026:19456, RHSA-2026:19458, RHSA-2026:20595, RHSA-2026:21254, RHSA-2026:22957, RHSA-2026:24346, RHSA-2026:7473, RLSA-2026:12423, RLSA-2026:12441, RLSA-2026:13285, RLSA-2026:19130, RLSA-2026:19346, ROOT-OS-ALPINE-315-CVE-2026-4878, SUSE-SU-2026:1432-1, SUSE-SU-2026:1433-1, SUSE-SU-2026:21243-1, SUSE-SU-2026:21257-1, SUSE-SU-2026:21274-1, SUSE-SU-2026:21373-1, UBUNTU-CVE-2026-4878, USN-8193-1, USN-8193-2, openSUSE-SU-2026:10536-1, openSUSE-SU-2026:20613-1

## What is CVE-2026-4878?

CVE-2026-4878 is a medium-severity vulnerability in Redhat Enterprise Linux, published on 9 Apr 2026. It can only be exploited from the same machine or local network, and only if a user opens a file or follows a link.

### Official description

A flaw was found in libcap. A local unprivileged user can exploit a Time-of-check-to-time-of-use (TOCTOU) race condition in the `cap_set_file()` function. This allows an attacker with write access to a parent directory to redirect file capability updates to an attacker-controlled file. By doing so, capabilities can be injected into or stripped from unintended executables, leading to privilege escalation.

Weakness: CWE-367 (Time-of-check Time-of-use (TOCTOU) Race Condition)

## Which versions are affected by CVE-2026-4878?

It affects 3 products.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `libcap` | AlmaLinux:10 | All versions | 2.69-7.el10_1.1 |
| `libcap` | AlmaLinux:10 | All versions | 2.69-7.el10_2.1 |
| `libcap-devel` | AlmaLinux:10 | All versions | 2.69-7.el10_1.1 |
| `libcap-devel` | AlmaLinux:10 | All versions | 2.69-7.el10_2.1 |
| `libcap` | AlmaLinux:8 | All versions | 2.48-6.el8_10.1 |
| `libcap-devel` | AlmaLinux:8 | All versions | 2.48-6.el8_10.1 |
| `libcap` | AlmaLinux:9 | All versions | 2.48-10.el9_7.1 |
| `libcap` | AlmaLinux:9 | All versions | 2.48-10.el9_8.1 |
| `libcap-devel` | AlmaLinux:9 | All versions | 2.48-10.el9_7.1 |
| `libcap-devel` | AlmaLinux:9 | All versions | 2.48-10.el9_8.1 |
| `libcap` | Red Hat:enterprise_linux:10.1 | All versions | 0:2.69-7.el10_1.1 |
| `libcap-debuginfo` | Red Hat:enterprise_linux:10.1 | All versions | 0:2.69-7.el10_1.1 |
| `libcap-debugsource` | Red Hat:enterprise_linux:10.1 | All versions | 0:2.69-7.el10_1.1 |
| `libcap-devel` | Red Hat:enterprise_linux:10.1 | All versions | 0:2.69-7.el10_1.1 |
| `libcap` | Red Hat:enterprise_linux:10.2 | All versions | 0:2.69-7.el10_2.1 |
| `libcap-debuginfo` | Red Hat:enterprise_linux:10.2 | All versions | 0:2.69-7.el10_2.1 |
| `libcap-debugsource` | Red Hat:enterprise_linux:10.2 | All versions | 0:2.69-7.el10_2.1 |
| `libcap-devel` | Red Hat:enterprise_linux:10.2 | All versions | 0:2.69-7.el10_2.1 |
| `libcap` | Red Hat:enterprise_linux:8::baseos | All versions | 0:2.48-6.el8_10.1 |
| `libcap-debuginfo` | Red Hat:enterprise_linux:8::baseos | All versions | 0:2.48-6.el8_10.1 |
| `libcap-debugsource` | Red Hat:enterprise_linux:8::baseos | All versions | 0:2.48-6.el8_10.1 |
| `libcap-devel` | Red Hat:enterprise_linux:8::baseos | All versions | 0:2.48-6.el8_10.1 |
| `libcap-debuginfo` | Red Hat:enterprise_linux:9::appstream | All versions | 0:2.48-10.el9_7.1 |
| `libcap-debuginfo` | Red Hat:enterprise_linux:9::appstream | All versions | 0:2.48-10.el9_8.1 |
| `libcap-debugsource` | Red Hat:enterprise_linux:9::appstream | All versions | 0:2.48-10.el9_7.1 |
| `libcap-debugsource` | Red Hat:enterprise_linux:9::appstream | All versions | 0:2.48-10.el9_8.1 |
| `libcap-devel` | Red Hat:enterprise_linux:9::appstream | All versions | 0:2.48-10.el9_7.1 |
| `libcap-devel` | Red Hat:enterprise_linux:9::appstream | All versions | 0:2.48-10.el9_8.1 |
| `libcap` | Red Hat:enterprise_linux:9::baseos | All versions | 0:2.48-10.el9_7.1 |
| `libcap` | Red Hat:enterprise_linux:9::baseos | All versions | 0:2.48-10.el9_8.1 |
| `libcap-debuginfo` | Red Hat:enterprise_linux:9::baseos | All versions | 0:2.48-10.el9_7.1 |
| `libcap-debuginfo` | Red Hat:enterprise_linux:9::baseos | All versions | 0:2.48-10.el9_8.1 |
| `libcap-debugsource` | Red Hat:enterprise_linux:9::baseos | All versions | 0:2.48-10.el9_7.1 |
| `libcap-debugsource` | Red Hat:enterprise_linux:9::baseos | All versions | 0:2.48-10.el9_8.1 |
| `libcap` | Red Hat:enterprise_linux_eus:10.0 | All versions | 0:2.69-7.el10_0.1 |
| `libcap-debuginfo` | Red Hat:enterprise_linux_eus:10.0 | All versions | 0:2.69-7.el10_0.1 |
| `libcap-debugsource` | Red Hat:enterprise_linux_eus:10.0 | All versions | 0:2.69-7.el10_0.1 |
| `libcap-devel` | Red Hat:enterprise_linux_eus:10.0 | All versions | 0:2.69-7.el10_0.1 |
| `libcap` | Red Hat:hummingbird:1 | All versions | 0:2.78-1.1.hum1 |
| `libcap-devel` | Red Hat:hummingbird:1 | All versions | 0:2.78-1.1.hum1 |

Products: Libcap Project Libcap, Redhat Enterprise Linux, Redhat Openshift Container Platform.

## How do I fix CVE-2026-4878?

Apply the vendor's patch.

## Is CVE-2026-4878 being exploited?

There is no known exploitation of CVE-2026-4878 in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2026-4878 and fix it if it is affected.

What it is: CVE-2026-4878 is a medium-severity vulnerability in Redhat Enterprise Linux, published on 9 Apr 2026. It can only be exploited from the same machine or local network, and only if a user opens a file or follows a link.
Exploitation: There is no known exploitation of CVE-2026-4878 in the wild and no public exploit code.

Affected product: Redhat Enterprise Linux. No package-level version data is available, so check the vendor advisory linked from the reference page.

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2026-4878/ (Markdown: https://insights.sbomify.com/CVE-2026-4878/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2026-4878
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2026-4878
- OSV: https://osv.dev/vulnerability/CVE-2026-4878

---
From sbomify Insights: https://insights.sbomify.com/CVE-2026-4878/
Summaries are generated and may contain mistakes; the official description above is the record.
