cve.bz

CVE-2026-5958 gnu sed

2.1 lowEPSS 0.1%

Low (2.1) in gnu sed. EPSS 0.1% estimated probability of exploitation activity in the next 30 days.

On this page
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.

Severity

CVSS 4.0

2.1 low
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
EPSS
0.1% (unchanged from 0.1% a week ago; 0.1% 30 days ago) estimated probability of exploitation activity in the next 30 days; 4th percentile. Scored 2026-11-15. A forecast for this CVE across the internet, not for your own systems.
CISA's assessment (SSVC)
Exploitation: none · Automatable: no · Technical impact: partial, assessed 2026-04-20. From CISA's Vulnrichment in the CVE List: whether it is exploited, whether exploiting it can be automated, and how much control it gives.
CWE
CWE-367 Time-of-check Time-of-use (TOCTOU) Race Condition
Published
Modified
NVD analysis
Deferred: the NVD does not plan to analyze it
Record from
the NVD, synced

Fix and patched versions

Ask an AI about this CVE

Show the promptExplain CVE-2026-5958 for an engineer deciding whether to act. Use https://cve.bz/api/public/cves/CVE-2026-5958?via=ask-ai-copy and https://cve.bz/cve/CVE-2026-5958?via=ask-ai-copy as the source of truth: what is affected and which versions fix it, whether it is in CISA KEV, public exploits, and its EPSS (an internet-wide 30-day estimate of exploitation activity, not a forecast for my systems). If they give no fixed versions, use the CVE record https://cveawg.mitre.org/api/cve/CVE-2026-5958 or the vendor advisory, not third-party mirrors. Tell me how to check whether I am affected and how to verify a fix. Cite the sources and say where they are uncertain.

Opens a third-party assistant; its answer is its own, not cve.bz's. The prompt holds only this CVE's id and public links.

Badge for a README or a site

CVE-2026-5958

An image that stays current: it is drawn from the data each time it is fetched (a host that proxies images, as GitHub does, may show its copy for a while). Markdown:

[![CVE-2026-5958](https://cve.bz/cve/badge/CVE-2026-5958.svg)](https://cve.bz/cve/CVE-2026-5958)

HTML:

<a href="https://cve.bz/cve/CVE-2026-5958"><img src="https://cve.bz/cve/badge/CVE-2026-5958.svg" alt="CVE-2026-5958"></a>

Affected

Versions

From the CNA's record in the CVE List.

ProductAffected
GNU Sedfrom 4.1e before 4.10

Linux distributions

DistributionReleasePackageFixed inAdvisory
Debian12sed4.9-1+deb12u1DEBIAN-CVE-2026-5958
Debian13sed4.9-2+deb13u1DEBIAN-CVE-2026-5958
Debian14sed4.9-3DEBIAN-CVE-2026-5958
Ubuntu22.04:LTSsed4.8-1ubuntu2.1UBUNTU-CVE-2026-5958
Ubuntu24.04:LTSsed4.9-2ubuntu0.24.04.1UBUNTU-CVE-2026-5958
Ubuntu25.10sed4.9-2ubuntu0.25.10.1UBUNTU-CVE-2026-5958
Ubuntu26.04:LTSsed4.9-2ubuntu1UBUNTU-CVE-2026-5958
UbuntuPro:18.04:LTSsed4.4-2ubuntu0.1~esm1UBUNTU-CVE-2026-5958 USN-8229-2
UbuntuPro:20.04:LTSsed4.7-1ubuntu0.1~esm1UBUNTU-CVE-2026-5958 USN-8229-2
Red Hathummingbird:1sed0:4.10-1.hum1RHSA-2026:10995
SUSELinux Enterprise Server 16.0, Linux Enterprise Server for SAP applications 16.0sed4.9-160000.3.1SUSE-SU-2026:22325-1
SUSELinux Micro 6.2sed4.9-160000.3.1SUSE-SU-2026:22256-1
openSUSELeap 16.0sed4.9-160000.3.1openSUSE-SU-2026:21024-1
openSUSETumbleweedsed4.10-1.1openSUSE-SU-2026:10649-1
Azure Linux3sed4.9-2AZL-83102

From the distributions' data via OSV.dev: the Debian Security Tracker; Ubuntu Security Notices © Canonical Ltd., CC BY-SA 4.0; Red Hat Security Data © Red Hat, Inc., CC BY 4.0; SUSE security data, CC BY 4.0; Microsoft's Azure Linux vulnerability data, MIT. Modified: reformatted and linked to CVE records. Credits. On the distributions' own pages: Debian · Ubuntu · Red Hat · SUSE · openSUSE.

Red Hat

Red Hat rates this Moderate.

Red Hat's statement

This is a Moderate severity flaw in GNU sed that allows for arbitrary file overwrite. The vulnerability is a Time-of-Check Time-of-Use (TOCTOU) race condition in the `--follow-symlinks` option, enabling an attacker to cause `sed -i --follow-symlinks` to read attacker-controlled content and write it to an unintended file. Exploitation requires a privileged process to execute `sed` on a path that an attacker can influence.

Red Hat's mitigation

To mitigate this vulnerability, avoid using the `sed -i --follow-symlinks` command in privileged contexts or on paths that can be influenced by untrusted users. This flaw specifically affects the `--follow-symlinks` option, which, when used by a privileged process on an attacker-controlled path, can lead to arbitrary file overwrite. Restricting the use of this specific option in sensitive operations can reduce the risk of exploitation.

ProductPackageStateAdvisory
Red Hat Hardened Imagessed-main-4.10-1.hum1Fixed 2026-04-27RHSA-2026:10995
Red Hat Enterprise Linux 10sedFix deferred
Red Hat Enterprise Linux 6sedFix deferred
Red Hat Enterprise Linux 7sedFix deferred
Red Hat Enterprise Linux 8sedFix deferred
Red Hat Enterprise Linux 9sedFix deferred
Red Hat OpenShift Container Platform 4openshift/ose-rhel-coreos-8Fix deferred
Red Hat OpenShift Container Platform 4openshift/ose-rhel-coreos-9Fix deferred

Contains Red Hat Security Data © Red Hat, Inc., licensed under CC BY 4.0. Source: https://access.redhat.com/security/data. Modified: reformatted. Red Hat's page for CVE-2026-5958.

Attack patterns (CAPEC)

  • CAPEC-27 Leveraging Race Conditions via Symbolic Links Likelihood: Medium · Severity: High
  • CAPEC-29 Leveraging Time-of-Check and Time-of-Use (TOCTOU) Race Conditions Likelihood: High · Severity: High

The attack patterns MITRE's CAPEC relates to this record's weaknesses, as MITRE names them. Credits.

References

Check your stackJSON