Skip to content
OpenAdvisories
Low · 2.1 CVE-2026-5958 EUVD-2026-23834GHSA-9r7w-j29g-xqx8

Race Condition in GNU Sed

Published Apr 20, 2026 · Updated May 13, 2026 · Assigned by CERT-PL

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.

Affected products

VendorProductAffectedFixed
GNU Sed 4.1e – < 4.10 4.10

Fixed in Linux distributions

Distributions backport fixes, so the version that fixes this vulnerability differs per release — upgrade to at least the version shown. From the distributions' security trackers and advisories.

ReleasePackageFixed inAdvisory
Debian 14 sed 4.9-3 —
Debian 13 sed 4.9-2+deb13u1 —
Debian 12 sed 4.9-1+deb12u1 —
ReleasePackageFixed inAdvisory
Ubuntu 26.04 LTS sed 4.9-2ubuntu1 —
Ubuntu 25.10 sed 4.9-2ubuntu0.25.10.1 —
Ubuntu 24.04 LTS sed 4.9-2ubuntu0.24.04.1 —
Ubuntu 22.04 LTS sed 4.8-1ubuntu2.1 —
Show 2 more (older releases, extended support, other products)
ReleasePackageFixed inAdvisory
Ubuntu Pro 20.04 LTS sed 4.7-1ubuntu0.1~esm1 USN-8229-2
Ubuntu Pro 18.04 LTS sed 4.4-2ubuntu0.1~esm1 USN-8229-2
ReleasePackageFixed inAdvisory
Red Hat Hardened Images 1 sed 4.10-1.hum1 RHSA-2026:10995
ReleasePackageFixed inAdvisory
SLES for SAP 16.0 sed 4.9-160000.3.1 SUSE-SU-2026:22325-1
SLES 16.0 sed 4.9-160000.3.1 SUSE-SU-2026:22325-1
SLE Micro 6.2 sed 4.9-160000.3.1 SUSE-SU-2026:22256-1
ReleasePackageFixed inAdvisory
openSUSE Tumbleweed sed 4.10-1.1 openSUSE-SU-2026:10649-1
openSUSE Leap 16.0 sed 4.9-160000.3.1 openSUSE-SU-2026:21024-1

Azure Linux

ReleasePackageFixed inAdvisory
Azure Linux 3 sed 4.9-2 —

Advisories 6

References