CVE-2026-5958Race Condition in GNU Sed
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.
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
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.
| Release | Package | Status | Fixed version | Advisory |
|---|---|---|---|---|
| Ubuntu 26.04 | sed | Fixed | 4.9-2ubuntu1 | UBUNTU-CVE-2026-5958 |
| Ubuntu 25.10 | sed | Fixed | 4.9-2ubuntu0.25.10.1 | UBUNTU-CVE-2026-5958 |
| Ubuntu 24.04 | sed | Fixed | 4.9-2ubuntu0.24.04.1 | UBUNTU-CVE-2026-5958 |
| Ubuntu 22.04 | sed | Fixed | 4.8-1ubuntu2.1 | UBUNTU-CVE-2026-5958 |
| Ubuntu 20.04 | sed | Fix pending | 4.7-1ubuntu0.1~esm1 (Ubuntu Pro) | UBUNTU-CVE-2026-5958 |
| Ubuntu 18.04 | sed | Fix pending | 4.4-2ubuntu0.1~esm1 (Ubuntu Pro) | UBUNTU-CVE-2026-5958 |
| Debian 14 | sed | Fixed | 4.9-3 | DEBIAN-CVE-2026-5958 |
| Debian 13 | sed | Fixed | 4.9-2+deb13u1 | DEBIAN-CVE-2026-5958 |
| Debian 12 | sed | Fixed | 4.9-1+deb12u1 | DEBIAN-CVE-2026-5958 |
| Red Hat Enterprise Linux 10 | sed | Fix pending Fix deferred | ||
| Red Hat Enterprise Linux 9 | sed | Fix pending Fix deferred | ||
| Red Hat Enterprise Linux 8 | sed | Fix pending Fix deferred | ||
| Red Hat Enterprise Linux 7 | sed | Fix pending Fix deferred | ||
| Red Hat Enterprise Linux 6 | sed | Fix 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.
- GNU Sed: affected: 4.1e to before 4.10; fixed in
4.10
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.