Логотип exploitDog
Консоль
Логотип exploitDog

exploitDog

redhat логотип

CVE-2026-5958

Опубликовано: 19 апр. 2026
Источник: redhat
CVSS3: 6.3

Описание

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.

    A Time-of-Check Time-of-Use (TOCTOU) race condition was found in GNU sed. When the -i (in-place) and --follow-symlinks options are used together, sed resolves the symlink but reopens the path for writing. An attacker with write access to the directory containing the symlink can swap it between the check and the open operations. If a privileged user executes sed in this manner on a path influenced by the attacker, it can lead to arbitrary file overwrites and potential privilege escalation.

Отчет

This is a Moderate severity flaw in GNU sed that allows for arbitrary file overwrite. The vulnerability is a Time-of-Check Time-of-Use (TOCTOU) race condition in the --follow-symlinks option, enabling an attacker to cause sed -i --follow-symlinks to read attacker-controlled content and write it to an unintended file. Exploitation requires a privileged process to execute sed on a path that an attacker can influence.

Меры по смягчению последствий

To mitigate this vulnerability, avoid using the sed -i --follow-symlinks command in privileged contexts or on paths that can be influenced by untrusted users. This flaw specifically affects the --follow-symlinks option, which, when used by a privileged process on an attacker-controlled path, can lead to arbitrary file overwrite. Restricting the use of this specific option in sensitive operations can reduce the risk of exploitation.

Затронутые пакеты

ПлатформаПакетСостояниеРекомендацияРелиз
Red Hat Enterprise Linux 10sedFix deferred
Red Hat Enterprise Linux 6sedFix deferred
Red Hat Enterprise Linux 7sedFix deferred
Red Hat Enterprise Linux 8sedFix deferred
Red Hat Enterprise Linux 9sedFix deferred
Red Hat OpenShift Container Platform 4rhcosFix deferred
Red Hat Hardened Imagessed-main-4.10-1.hum1FixedRHSA-2026:1099527.04.2026

Показывать по

Дополнительная информация

Статус:

Moderate
Дефект:
CWE-367
https://bugzilla.redhat.com/show_bug.cgi?id=2458960sed: GNU sed TOCTOU race condition

6.3 Medium

CVSS3

Связанные уязвимости

ubuntu
3 месяца назад

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.

nvd
3 месяца назад

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.

msrc
3 месяца назад

Race Condition in GNU Sed

debian
3 месяца назад

When sed is invoked with both -i (in-place edit) and --follow-symlinks ...

suse-cvrf
около 1 месяца назад

Security update for sed

6.3 Medium

CVSS3