CVE-2026-5958
published 2026-04-20CVE-2026-5958: 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…
PriorityP414low2.1CVSS 4.0
AVLACLATPPRNUINVCNVILVANSCNSINSANEXCRXIRXARXMAVXMACXMATXMPRXMUIXMVCXMVIXMVAXMSCXMSIXMSAXSXAUXRXVXREXUX
EPSS
0.14%
3.9th percentile
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.
Affected
3 ranges
| Vendor | Product | Version range | Fixed in |
|---|---|---|---|
| gnu | sed | — | — |
| gnu | sed | >= 4.1e < 4.10 | 4.10 |
| ubuntu | sed | — | — |
CVSS provenance
nvdv4.02.1LOWCVSS:4.0/AV:L/AC:L/AT:P/PR:N/UI:N/VC:N/VI:L/VA:N/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X
vendor_redhat2.1LOW
Stop checking back — get the weekly exploitation signal.
Every Monday: what got weaponized or added to CISA KEV in the last seven days — each CVE cross-linked to its PoC, Nuclei template, and detection rule. Free, one email a week, unsubscribe in one click.
Ubuntu
sed vulnerability
vendor_ubuntu·2026-05-28
CVE-2026-5958 sed vulnerability
Title: sed vulnerability
Summary: sed could be made to overwrite files.
USN-8229-1 fixed a vulnerability in sed. This update provides the
corresponding update for Ubuntu 18.04 LTS and Ubuntu 20.04 LTS.
Original advisory details:
Michał Majchrowicz and Marcin Wyczechowski discovered that sed
incorrectly handled symbolic links when performing in-place edits.
A local attacker could possibly use this issue to overwrite
arbitrary files.
Instructions: In general, a standard system update will make all the necessary changes.
Ubuntu
sed vulnerability
vendor_ubuntu·2026-05-04
CVE-2026-5958 sed vulnerability
Title: sed vulnerability
Summary: sed could be made to overwrite files.
Michał Majchrowicz and Marcin Wyczechowski discovered that sed incorrectly
handled symbolic links when performing in-place edits. A local attacker
could possibly use this issue to overwrite arbitrary files.
Instructions: In general, a standard system update will make all the necessary changes.
Red Hat
sed: GNU sed TOCTOU race condition
vendor_redhat·2026-04-19·CVSS 2.1
CVE-2026-5958 [LOW] CWE-367 sed: GNU sed TOCTOU race condition
sed: GNU sed TOCTOU race condition
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 vers
VulDB
GNU sed up to 4.9 open_next_file toctou (EUVD-2026-23834)
vuldb·2026-04-20·CVSS 2.1
CVE-2026-5958 [LOW] GNU sed up to 4.9 open_next_file toctou (EUVD-2026-23834)
A vulnerability described as problematic has been identified in GNU sed up to 4.9. This affects the function open_next_file. Executing a manipulation can lead to time-of-check time-of-use.
This vulnerability is registered as CVE-2026-5958. The attack needs to be launched locally. No exploit is available.
Upgrading the affected component is recommended.
GHSA
GHSA-9r7w-j29g-xqx8: When sed is invoked with both -i (in-place edit) and --follow-symlinks, the function open_next_file() performs two separate, non-atomic filesystem ope
ghsa_unreviewed·2026-04-20
CVE-2026-5958 [LOW] CWE-367 GHSA-9r7w-j29g-xqx8: When sed is invoked with both -i (in-place edit) and --follow-symlinks, the function open_next_file() performs two separate, non-atomic filesystem ope
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.
No detection rules found.
No public exploits indexed.
2026-04-20
Published