Advisory Database
  • Advisories
  • Dependency Scanning
  1. golang
  2. ›
  3. github.com/inspektor-gadget/inspektor-gadget
  4. ›
  5. CVE-2026-24905

CVE-2026-24905: Inspektor Gadget: Command Injection via malicious buildOptions manipulation

April 22, 2026 (updated April 30, 2026)

The ig binary provides a subcommand for image building, used to generate custom gadget OCI images.

A part of this functionality is implemented in the file inspektor-gadget/cmd/common/image/build.go.

The following is the code responsible to construct the build command:

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,
"FORCE_COLORS=" + options.forceColorsFlag,
}

if options.ebpfSourcePath != "" {
cmd = append(cmd, "EBPFSOURCE="+options.ebpfSourcePath, "ebpf")
}
if options.wasmSourcePath != "" {
cmd = append(cmd, "WASM="+options.wasmSourcePath, "wasm")
}
if options.btfgen {
cmd = append(cmd, "BTFHUB_ARCHIVE="+options.btfHubArchivePath, "btfgen")
}

return cmd
}

The Makefile.build file is the Makefile template employed during the building process.

This file includes user-controlled data in an unsafe fashion, specifically some parameters are embedded without an adequate escaping in the commands inside the Makefile.

This implementation is vulnerable to command injection: an attacker able to control values in the buildOptions structure would be able to execute arbitrary commands during the building process.

References

  • github.com/advisories/GHSA-79qw-g77v-2vfh
  • github.com/inspektor-gadget/inspektor-gadget
  • github.com/inspektor-gadget/inspektor-gadget/commit/7c83ad84ff7a68565655253e2cf1c5d2da695c1a
  • github.com/inspektor-gadget/inspektor-gadget/commit/d9bf2fe4a180dad33ce57ca793ff4799ee7b8320
  • github.com/inspektor-gadget/inspektor-gadget/security/advisories/GHSA-79qw-g77v-2vfh
  • nvd.nist.gov/vuln/detail/CVE-2026-24905

Code Behaviors & Features

Detect and mitigate CVE-2026-24905 with GitLab Dependency Scanning

Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Learn more about Dependency Scanning →

Affected versions

All versions before 0.51.1

Fixed versions

  • 0.51.1

Solution

Upgrade to version 0.51.1 or above.

Impact 7.8 HIGH

CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H

Learn more about CVSS

Weakness

  • CWE-77: Improper Neutralization of Special Elements used in a Command ('Command Injection')
  • CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')

Source file

go/github.com/inspektor-gadget/inspektor-gadget/CVE-2026-24905.yml

Spotted a mistake? Edit the file on GitLab.

  • Site Repo
  • About GitLab
  • Terms
  • Privacy Statement
  • Contact

Page generated Fri, 08 May 2026 00:21:33 +0000.