CVE-2026-5958: Race Condition in GNU Sed

Published Apr 20, 2026
·
Updated

Last updated 27 May 2026

Other sources

When sed is invoked with both -i (in-place edit) and --follow-symlinks, the function opennextfile() 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.

Launchpad

Affected Software

6 affected componentsFixes available
GNU Sed<4.10
Microsoft azl3 sed 4.9-1
Microsoft azl3 sed 4.9-2
debian/sed<=4.7-1
4.9-1+deb12u14.9-2+deb13u14.9-3
Microsoft azl3 sed 4.9-2<4.9-2
4.9-2
Microsoft azl3 sed 4.9-1<4.9-2
4.9-2

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade debian/sed to a version that resolves this vulnerability.

    Fixed in 4.9-1+deb12u1Fixed in 4.9-2+deb13u1Fixed in 4.9-3
  2. Upgrade

    Upgrade to a fixed release to a version that resolves this vulnerability.

    Fixed in 4.9-2
  3. Upgrade

    Upgrade GNU sed to a version that resolves this vulnerability.

    Fixed in 4.10Patch CVE-2026-5958

Event History

Apr 20, 2026
CVE Published
via MITRE·11:59 AM
Data Sourced
via MITRE·11:59 AM
DescriptionWeakness
Data Sourced
via NVD·12:16 PM
DescriptionSeverityWeakness
Apr 22, 2026
Data Sourced
via Microsoft·08:01 AM
DescriptionSeverityWeaknessAffected Software
Updated
via Microsoft·08:01 AM
Affected Software
Updated
via Microsoft·08:01 AM
DescriptionSeverityWeakness
May 28, 2026
Data Sourced
via Ubuntu·09:17 PM
RemedyDescriptionSeverityAffected Software
Data Sourced
via Launchpad·09:18 PM
Description
Data Sourced
via Debian·09:18 PM
DescriptionAffected Software
Free Weekly Intel

Don't miss critical vulnerabilities

Join thousands of security professionals who receive our weekly digest of trending CVEs, zero-days, and exploited vulnerabilities.

No spam. Unsubscribe anytime.

Frequently Asked Questions

1

What is the severity of CVE-2026-5958?

CVE-2026-5958 has been assessed with a medium severity due to the potential for race condition attacks.

2

How do I fix CVE-2026-5958?

To fix CVE-2026-5958, upgrade GNU sed to version 4.10 or later.

3

What versions of GNU sed are affected by CVE-2026-5958?

GNU sed versions prior to 4.10 are affected by CVE-2026-5958.

4

What type of issue is CVE-2026-5958 related to?

CVE-2026-5958 is related to a race condition vulnerability involving filesystem operations.

5

What impact does CVE-2026-5958 have on users?

CVE-2026-5958 can lead to potential data corruption or unintended file modifications for users employing the vulnerable options.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203