CVEReports
CVEReports

Automated vulnerability intelligence platform. Comprehensive reports for high-severity CVEs generated by AI.

Product

  • Home
  • Sitemap
  • RSS Feed

Company

  • About
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 CVEReports. All rights reserved.

Made with love by Amit Schendel & Alon Barad



CVE-2026-24905
7.80.11%

CVE-2026-24905: Command Injection in Inspektor Gadget Image Builder

Amit Schendel
Amit Schendel
Senior Security Researcher

Apr 22, 2026·5 min read·6 visits

PoC Available

Executive Summary (TL;DR)

A flaw in Inspektor Gadget's build manifest parser allows command injection via the cflags parameter, leading to arbitrary code execution during the image build process.

Inspektor Gadget versions prior to 0.48.1 contain a command injection vulnerability in the `ig image build` command. The parsing logic for the `build.yml` manifest file improperly sanitizes the `cflags` field before passing it to an underlying `make` process. This allows attackers who control the manifest file to execute arbitrary OS commands within the context of the build environment.

Vulnerability Overview

Inspektor Gadget is a system inspection framework for Linux and Kubernetes that utilizes eBPF programs. The framework includes a command-line utility, ig, which provides functionalities for building and packaging custom eBPF programs into OCI images. The ig image build subcommand processes user-supplied configuration through a YAML manifest file named build.yml.

CVE-2026-24905 is a command injection vulnerability located in the parsing and execution logic of this build process. The vulnerability arises because user-controlled input from the manifest is passed directly into a shell execution context without adequate sanitization. Specifically, the cflags field within the build.yml file is vulnerable to OS command injection (CWE-78).

The vulnerability carries a CVSS 3.1 score of 7.8, reflecting a high-severity local attack vector. Exploitation requires the attacker to supply a malicious build.yml file to the ig image build command. Successful exploitation grants the attacker arbitrary command execution privileges within the context of the build process.

Root Cause Analysis

The root cause of CVE-2026-24905 lies in the interaction between the Go-based CLI and the underlying make build system. When a developer invokes ig image build, the binary reads the build.yml manifest to configure the eBPF compilation process. The vulnerable code in cmd/common/image/build.go extracts the cflags value and appends it to a command arguments array.

This arguments array constructs a make command invocation. The cflags string is passed verbatim as a variable override in the format CFLAGS=.... The make utility then processes the Makefile.build template to compile the eBPF source code.

Within Makefile.build, the CFLAGS variable is expanded inside a compilation recipe. Because make executes recipes by passing the entire evaluated command string to a system shell, any shell metacharacters included in the CFLAGS variable are interpreted by the shell. The application fails to neutralize these special elements, resulting in a classic command injection condition.

Code Analysis

The vulnerable implementation in inspektor-gadget/cmd/common/image/build.go explicitly passed the unsanitized cflags value to the build command. The buildCmd function constructed the execution arguments by directly concatenating the user input with the CFLAGS= prefix.

// Vulnerable implementation in build.go
func buildCmd(options buildOptions) []string {
    cmd := []string{
        "make", "-f", filepath.Join(options.outputDir, "Makefile.build"),
        "-j", fmt.Sprintf("%d", runtime.NumCPU()),
        "OUTPUTDIR=" + options.outputDir,
        "CFLAGS=" + options.cFlags, // Input directly appended
        "FORCE_COLORS=" + options.forceColorsFlag,
    }
    return cmd
}

The make process then utilized this variable in the Makefile.build compilation step. The variable expansion occurred directly within the shell command that invoked the Clang compiler.

# Vulnerable Makefile.build recipe
$(OUTPUTDIR)/%.bpf.o: $(EBPFSOURCE)
	$(CLANG) $(BASECFLAGS) $(subst @ARCH@,$*,$(CFLAGS)) -D __TARGET_ARCH_...

The patch resolves this by completely removing the cflags field from the manifest parser. Instead of allowing arbitrary compiler flags, the developers introduced a boolean flag named USE_IN_TREE_HEADERS. The CFLAGS variable was replaced by an internally populated INCLUDEFLAGS variable in the Makefile, eliminating the injection vector.

Exploitation Methodology

Exploiting this vulnerability requires the attacker to inject shell metacharacters into the cflags field of the build.yml manifest. An attacker must have the ability to supply this file to a system running the ig image build command. This scenario frequently occurs in CI/CD pipelines or shared build environments where automated systems compile repository code.

The following proof-of-concept demonstrates the injection technique. The payload uses semicolons to terminate the preceding command and initiate a new one.

ebpfsource: "program.bpf.c"
metadata: "gadget.yaml"
cflags: "; touch /tmp/pwned ;"

When the ig utility processes this file, the resulting shell command executed by make expands to include the injected payload. The shell evaluates clang ... ; touch /tmp/pwned ; -D __TARGET_ARCH_..., executing the attacker's command before attempting to evaluate the remainder of the original compilation string.

Impact and Variant Analysis

Successful exploitation yields arbitrary command execution within the context of the user or service account running the ig image build command. If the build process runs in an isolated container, the execution is constrained to that container environment. If the build runs directly on a developer workstation or build server, the attacker gains host-level access.

In a CI/CD environment, this access provides a pathway for lateral movement or credential theft. The attacker can extract environment variables, access build secrets, or tamper with the resulting OCI image artifact. This tampering facilitates supply chain attacks by embedding malicious code into the compiled eBPF gadget.

While the primary cflags injection vector is patched, structural risks remain in the codebase. Other fields such as ebpfsource and wasm are still passed as variables to the make process. If these fields are not rigorously validated for path safety and shell metacharacters by the ig binary, they represent theoretical secondary injection vectors.

Remediation Guidance

The definitive remediation for CVE-2026-24905 is upgrading Inspektor Gadget to version 0.48.1 or later. This release removes the vulnerable code paths and transitions to a safer boolean-based configuration for include headers.

If immediate patching is not feasible, administrators must ensure that the ig image build command is only executed against trusted build.yml manifests. Organizations should prohibit the automated building of gadgets from untrusted external sources or community repositories until the software is updated.

Security teams should also review CI/CD pipeline configurations to enforce principle-of-least-privilege. Build environments should operate in isolated, ephemeral containers with restricted network access. This defense-in-depth approach limits the impact if an attacker successfully triggers the vulnerability or discovers a variant injection path.

Official Patches

Inspektor GadgetOfficial Security Advisory

Fix Analysis (2)

Technical Appendix

CVSS Score
7.8/ 10
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
EPSS Probability
0.11%
Top 71% most exploited

Affected Systems

Inspektor GadgetCI/CD build pipelines using Inspektor GadgetDeveloper workstations building eBPF gadgets

Affected Versions Detail

Product
Affected Versions
Fixed Version
Inspektor Gadget
Linux Foundation
< 0.48.10.48.1
AttributeDetail
CWE IDCWE-77, CWE-78
Attack VectorLocal / Context-dependent
CVSS v3.17.8
CVSS v4.06.6
EPSS Score0.00106
Exploit StatusProof of Concept
ImpactArbitrary Command Execution

MITRE ATT&CK Mapping

T1059.004Command and Scripting Interpreter: Unix Shell
Execution
T1195.001Supply Chain Compromise: Compromise Software Dependencies and Development Tools
Initial Access
CWE-78
Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')

The software constructs all or part of an OS command using externally-influenced input, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended command.

Vulnerability Timeline

Vulnerability reported and fix committed
2026-01-26
Security advisory published and CVE assigned
2026-01-29

References & Sources

  • [1]GHSA-79qw-g77v-2vfh Security Advisory
  • [2]Fix Commit 7c83ad84ff7a68565655253e2cf1c5d2da695c1a
  • [3]NVD Vulnerability Record CVE-2026-24905

Attack Flow Diagram

Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.