Vulnerability · Published Apr 20, 2026 · Assigned by CERT-PL
CVE-2026-5958Race Condition in GNU Sed
Low 2.1
In plain English
A low-severity security flaw in Sed from GNU. There are no confirmed reports of exploitation so far. The chance it is exploited in the next 30 days is estimated at 0.1% (higher than 4% of all known vulnerabilities). Fixed versions are available - upgrade the affected package.
Official description
When sed is invoked with both -i (in-place edit) and --follow-symlinks, the function open_next_file() performs two separate, non-atomic filesystem operations on the same path: 1. resolves symlink to its target and stores the resolved path for determining when output is written, 2. opens the original symlink path (not the resolved one) to read the file. Between these two calls there is a race window. If an attacker atomically replaces the symlink with a different target during that window, sed will: read content from the new (attacker-chosen) symlink target and write the processed result to the path recorded in step 1. This can lead to arbitrary file overwrite with attacker-controlled content in the context of the sed process. This issue was fixed in version 4.10.
Affected packages & fixed versions
| Ecosystem | Package | Fixed in | Advisory |
|---|---|---|---|
| Debian:12 | sed | 4.9-1+deb12u1 | DEBIAN-CVE-2026-5958 |
| Debian:13 | sed | 4.9-2+deb13u1 | DEBIAN-CVE-2026-5958 |
| Debian:14 | sed | 4.9-3 | DEBIAN-CVE-2026-5958 |
| Ubuntu:22.04:LTS | sed | 4.8-1ubuntu2.1 | UBUNTU-CVE-2026-5958 |
| Ubuntu:24.04:LTS | sed | 4.9-2ubuntu0.24.04.1 | UBUNTU-CVE-2026-5958 |
| Ubuntu:25.10 | sed | 4.9-2ubuntu0.25.10.1 | UBUNTU-CVE-2026-5958 |
| Ubuntu:26.04:LTS | sed | 4.9-2ubuntu1 | UBUNTU-CVE-2026-5958 |
Affected products (as reported)
Weakness: CWE-367 · Vector: CVSS:4.0/AV:L/AC:L/AT:P/PR:N/UI:N/VC:N/VI:L/VA:N/SC:N/SI:N/SA:N