# CVE-2026-5958: Race Condition in GNU Sed

CVE-2026-5958 is fixed in sed on 1 platform, first by sed 4.4-2ubuntu0.1~esm1, released April 18, 2026. It is not reported as exploited. Patch Radar priority: Routine.

- Web page: https://patchblox.com/security/cve/CVE-2026-5958
- Priority: Routine
- CVSS: n/a (Low)
- EPSS: 0.0014
- CISA KEV: not listed
- Exploited (vendor report): no
- Publicly disclosed: no
- Published: Apr 18, 2026
- Weakness: Time-of-check Time-of-use (TOCTOU) Race Condition
- Vendor advisory: https://msrc.microsoft.com/update-guide/vulnerability/CVE-2026-5958

## 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.

## Where it's fixed

| Platform | Product | Fixed in | Fix | Released |
|---|---|---|---|---|
| Linux | sed Debian 12.15 (bookworm) | 4.9-1+deb12u1 | [DEBIAN-CVE-2026-5958](https://patchblox.com/security/data/fix/linux/debian-cve-2026-5958.md) | May 15, 2026 |
| Linux | sed Debian 13.5 (trixie) | 4.9-2+deb13u1 | [DEBIAN-CVE-2026-5958](https://patchblox.com/security/data/fix/linux/debian-cve-2026-5958.md) | May 15, 2026 |
| Linux | sed Debian 14 | 4.9-3 | [DEBIAN-CVE-2026-5958](https://patchblox.com/security/data/fix/linux/debian-cve-2026-5958.md) | May 15, 2026 |
| Linux | sed Ubuntu 18.04.6 LTS (bionic) | 4.4-2ubuntu0.1~esm1 | [sed 4.4-2ubuntu0.1~esm1](https://patchblox.com/security/data/fix/linux/ubuntu-bionic-sed-4.4-2ubuntu0.1-esm1.md) | Apr 18, 2026 |
| Linux | sed Ubuntu 20.04 LTS (focal) | 4.7-1ubuntu0.1~esm1 | [sed 4.7-1ubuntu0.1~esm1](https://patchblox.com/security/data/fix/linux/ubuntu-focal-sed-4.7-1ubuntu0.1-esm1.md) | Apr 18, 2026 |
| Linux | sed Ubuntu 22.04.1 LTS (jammy) | 4.8-1ubuntu2.1 | [sed 4.8-1ubuntu2.1](https://patchblox.com/security/data/fix/linux/ubuntu-jammy-sed-4.8-1ubuntu2.1.md) | May 15, 2026 |
| Linux | sed Ubuntu 24.04.5 LTS (noble) | 4.9-2ubuntu0.24.04.1 | [sed 4.9-2ubuntu0.24.04.1](https://patchblox.com/security/data/fix/linux/ubuntu-noble-sed-4.9-2ubuntu0.24.04.1.md) | May 15, 2026 |
| Linux | sed Ubuntu 25.10 (questing) | 4.9-2ubuntu0.25.10.1 | [sed 4.9-2ubuntu0.25.10.1](https://patchblox.com/security/data/fix/linux/ubuntu-questing-sed-4.9-2ubuntu0.25.10.1.md) | May 15, 2026 |
| Linux | sed Ubuntu 26.04.1 LTS (resolute) | 4.9-2ubuntu1 | [sed 4.9-2ubuntu1](https://patchblox.com/security/data/fix/linux/ubuntu-resolute-sed-4.9-2ubuntu1.md) | Apr 18, 2026 |
| Linux | sed opensuse-leap 16.0 | 4.9-160000.3.1 | [OPENSUSE-SU-2026:21024-1](https://patchblox.com/security/data/fix/linux/opensuse-su-2026-21024-1.md) | Jun 22, 2026 |
| Linux | sed sles 16.0 | 4.9-160000.3.1 | [SUSE-SU-2026:22325-1](https://patchblox.com/security/data/fix/linux/suse-su-2026-22325-1.md) | Jun 22, 2026 |

---

Data as of 2026-11-08T06:59:42Z UTC. Source: Patchblox Patch Radar (https://patchblox.com/security/patch-radar). Patchblox finds out-of-date software on Windows, macOS and Linux and updates it through release rings: https://patchblox.com/demo

Free to use with attribution: show "Data: Patchblox Patch Radar" with a link to https://patchblox.com/security/patch-radar. Terms, including what needs a written agreement: https://patchblox.com/security/patch-radar/use-the-data

Product names, logos and trademarks shown on Patch Radar belong to their respective owners. They are used only to identify the software each security fix applies to and to help readers find their platform. Their use does not imply any affiliation with, or endorsement by, those owners, and Patchblox is not affiliated with any of them.
