CVE-2026-5958 Race Condition in GNU Sed

Low 2.1 Published Updated

An attacker can exploit a race condition in GNU Sed to overwrite arbitrary files when using in-place editing with symlink following.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Local or same network only
Victim action needed
Not needed
Fix
Available

What is CVE-2026-5958?

CVE-2026-5958 is a low-severity vulnerability in GNU Sed, published on 20 Apr 2026. It can only be exploited from the same machine or local network, with no action from the victim.

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.

Weakness: CWE-367

Which versions are affected by CVE-2026-5958?

Linux distribution packages (6)
sed Red Hat:hummingbird:1All versions0:4.10-1.hum1
sed SUSE:Linux Enterprise Server 16.0All versions4.9-160000.3.1
sed SUSE:Linux Enterprise Server for SAP applications 16.0All versions4.9-160000.3.1
sed SUSE:Linux Micro 6.2All versions4.9-160000.3.1
sed openSUSE:Leap 16.0All versions4.9-160000.3.1
sed openSUSE:TumbleweedAll versions4.10-1.1

How do I fix CVE-2026-5958?

Upgrade to a fixed version.

Is CVE-2026-5958 being exploited?

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

Sources

Also known as AZL-83102, DEBIAN-CVE-2026-5958, ECHO-5725-fee5-80cd, GHSA-9r7w-j29g-xqx8, JLSEC-2026-213, MGASA-2026-0128 and 18 more.

Is CVE-2026-5958 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free