CVEfocus › CVE database › CVE-2026-5958

CVE-2026-5958Race Condition in GNU Sed

CVSS 2.1 LowEPSS 0.1% (higher than 2% of CVEs)Published 2026-04-20Updated 2026-05-13Assigner: CERT-PL

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.

CWE-367

What to do

Fixed builds are available from Debian, Ubuntu: see the table below for the fixed version per release.

Red Hat, Ubuntu have not shipped a fix for every release yet.

Is your server affected? One read-only command checks every installed package against this CVE and all others, using each vendor's fixed versions. Get started or get a free API key.

curl -sS "https://api.cvefocus.com/v1/check?format=text" -H "Authorization: Bearer $CVEFOCUS_KEY" \
  -H "Content-Type: text/plain" --data-binary @inventory.txt

Vendor status at a glance

7Fixed
7Fix pending

Status by vendor and release

From each vendor's own security data and VEX statements. "Fixed" means a fixed build is published for that release.

ReleasePackageStatusFixed versionAdvisory
Ubuntu 26.04sedFixed4.9-2ubuntu1UBUNTU-CVE-2026-5958
Ubuntu 25.10sedFixed4.9-2ubuntu0.25.10.1UBUNTU-CVE-2026-5958
Ubuntu 24.04sedFixed4.9-2ubuntu0.24.04.1UBUNTU-CVE-2026-5958
Ubuntu 22.04sedFixed4.8-1ubuntu2.1UBUNTU-CVE-2026-5958
Ubuntu 20.04sedFix pending4.7-1ubuntu0.1~esm1 (Ubuntu Pro)UBUNTU-CVE-2026-5958
Ubuntu 18.04sedFix pending4.4-2ubuntu0.1~esm1 (Ubuntu Pro)UBUNTU-CVE-2026-5958
Debian 14sedFixed4.9-3DEBIAN-CVE-2026-5958
Debian 13sedFixed4.9-2+deb13u1DEBIAN-CVE-2026-5958
Debian 12sedFixed4.9-1+deb12u1DEBIAN-CVE-2026-5958
Red Hat Enterprise Linux 10sedFix pending
Fix deferred
Red Hat Enterprise Linux 9sedFix pending
Fix deferred
Red Hat Enterprise Linux 8sedFix pending
Fix deferred
Red Hat Enterprise Linux 7sedFix pending
Fix deferred
Red Hat Enterprise Linux 6sedFix pending
Fix deferred

What the vendor says

As published in the CVE record by CERT-PL, the CVE's assigner (usually the vendor). Check the vendor's advisory before acting.

References

About this page

Compiled by CVEfocus from the CVE List, the security data and VEX statements of Ubuntu, Debian, Red Hat, AlmaLinux, Rocky Linux and Microsoft, CISA's Known Exploited Vulnerabilities catalog and FIRST EPSS, refreshed several times a day (data status). Information only; see the disclaimer. Official record: cve.org · NVD.