Описание
Inspektor Gadget uses unsanitized ANSI Escape Sequences In columns Output Mode
Description
String fields from eBPF events in columns output mode are rendered to the terminal without any sanitization of control characters or ANSI escape sequences.
Therefore, a maliciously forged – partially or completely – event payload, coming from an observed container, might inject the escape sequences into the terminal of ig operators, with various effects.
The columns output mode is the default when running ig run interactively.
PoC
Attachments
run.sh
escape_inject.c
- Setup a Linux host and build/install
igversion0.48.0 - Run the attached
run.shon a terminal - Run
sudo ig run trace_open -c poc-escape-injecton another terminal - Press "Enter" on the terminal attached to
run.sh - Observe the events traced by
ig - Notice that, at some point, the line where
/etc/shadowis logged is overwritten/etc/bashrc, demonstrating the log injection
Impact
The impact depends on the injection point – mostly due to length limitations – and on the terminal used by the operator when running displaying columns output.
At the very least, the injection can be used for Log Injection, by inserting new lines or deleting existing ones.
However, by leveraging Operating System Command (OSC) ANSI escape sequences, the impact on modern terminal can vary, possibly allowing an attacker to:
- lead to DoS (Denial of Service)
- write to the system clipboard
- create hyperlinks to attacker-controlled servers
- change window title
- potentially execute code (see referenced resources)
Resources
Notes
The json output mode was already sanitizing the content.
Ссылки
- https://github.com/inspektor-gadget/inspektor-gadget/security/advisories/GHSA-34r5-6j7w-235f
- https://nvd.nist.gov/vuln/detail/CVE-2026-25996
- https://github.com/inspektor-gadget/inspektor-gadget/commit/d59cf72971f9b7110d9c179dc8ae8b7a11dbd6d2
- https://github.com/inspektor-gadget/inspektor-gadget/releases/tag/v0.49.1
Пакеты
github.com/inspektor-gadget/inspektor-gadget
< 0.49.1
0.49.1
Связанные уязвимости
Inspektor Gadget is a set of tools and framework for data collection and system inspection on Kubernetes clusters and Linux hosts using eBPF. String fields from eBPF events in columns output mode are rendered to the terminal without any sanitization of control characters or ANSI escape sequences. Therefore, a maliciously forged – partially or completely – event payload, coming from an observed container, might inject the escape sequences into the terminal of ig operators, with various effects. The columns output mode is the default when running ig run interactively.