CVE-2026-53941

CVE-2026-53941 is a medium-severity uncontrolled resource consumption vulnerability in github.com/inspektor-gadget/inspektor-gadget (go), affecting versions >= 0.27.0, < 0.53.1. It is fixed in 0.53.1.

Does this CVE actually affect you?

Kodem shows which CVEs are reachable and running in your applications, so you fix what's exploitable, not just what's listed.

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.

Runtime intelligence, not another scanner.

Summary

Uprobe gadgets: unprivileged container's ld.so.cache causes high CPU utilization and container startup DoS

An unprivileged container can block all other containers from starting on the
same host by placing a crafted /etc/ld.so.cache file in its filesystem. When
Inspektor Gadget attaches any uprobe-based gadget, it parses this file in the
container startup path. A malicious cache causes ~53 seconds of CPU burn,
during which Docker cannot start any other container. No special capabilities
are required.

Severity

To be assessed, Availability impact, no confidentiality or integrity impact.

Affected Versions

All versions of Inspektor Gadget that support uprobe-based gadgets (trace_malloc, trace_open, trace_ssl, trace_grpc, etc.).

Description

When Inspektor Gadget attaches uprobe-based gadgets to containers, it resolves library paths by parsing the container's /etc/ld.so.cache file (pkg/uprobetracer/ldcache_parser.go). This file is fully controlled by the container.

The parser has three vulnerabilities:

  1. Quadratic string building (pkg/uprobetracer/bytes.go:36-44): The readStringFromBytes function concatenates one byte at a time (res += string(data[i])), which is O(n²) in Go due to string immutability. With a 16MB cache file containing large regions without null terminators, this causes massive CPU and memory churn.

  2. Insufficient entry count validation (pkg/uprobetracer/ldcache_parser.go:120): The EntryCount field is read directly from the untrusted file. While a per-entry bounds check prevents out-of-bounds access, the loop still iterates up to (fileSize - headerSize) / entrySize ≈ 700,000 times, calling readStringFromBytes on each iteration.

  3. Integer overflow in format detection (pkg/uprobetracer/ldcache_parser.go:174): The cache1Len computation uses uint32 arithmetic (ldCache1Size + cache1.EntryCount*ldCache1EntrySize). With a crafted EntryCount, this overflows and produces a small value, causing the parser to misidentify the cache format.

Combined, these cause ~53 seconds of CPU burn per container attachment when a crafted 16MB /etc/ld.so.cache is present.

Root Cause Analysis

In pkg/uprobetracer/ldcache_parser.go, the function readCacheFormat2 is called with the full file content:

for i := uint32(0); i < ldCache.EntryCount; i++ {
    entryOffset := ldEntriesOffset + i*ldCache2EntrySize
    if uint32(len(data)) <= entryOffset+ldCache2EntrySize {
        return nil  // bounds check stops iteration
    }
    // ... reads entry ...
    key := readStringFromBytes(data, keyOffset)    // O(n²) per call
    value := readStringFromBytes(data, valueOffset) // O(n²) per call
}

The per-entry bounds check correctly prevents out-of-bounds access, but:

  • The loop iterates ~700K times (limited by file size, not EntryCount)
  • Each readStringFromBytes call uses quadratic string concatenation

In pkg/uprobetracer/bytes.go:

func readStringFromBytes(data []byte, startPos uint32) string {
    res := ""
    for i := startPos; i < uint32(len(data)); i++ {
        if data[i] == 0 {
            return res
        }
        res += string(data[i])  // O(n²), allocates new string each iteration
    }
    return ""
}

Note on Slice Bounds Checks

The code also performs slice accesses without proper bounds checks (e.g.,
data[:len(cache2Header)] when data may be shorter than 20 bytes, and
ldCacheFile[:len(cache1Header)] when the file may be shorter than 11 bytes).

In practice, a malicious container cannot currently trigger a panic from these
missing checks. This is because Go's io.ReadAll (used to read the file) always
returns slices with cap >= 512 due to its initial buffer allocation
(make([]byte, 0, 512) in Go's standard library). In Go, s[:n] only panics
when n > cap(s), not when n > len(s). Since both header lengths (11 and 20)
are well below 512, the slice expressions succeed, they simply read zero bytes
beyond len, which don't match any valid header magic.

However, this relies on an undocumented implementation detail of io.ReadAll
which could change in future Go versions. The bounds checks are still necessary
for correctness and defense in depth.

Impact

  • Container runtime DoS: IG uses fanotify hooks (pkg/container-hook) to pause container startup until uprobe attachment completes. While IG is blocked processing the malicious cache, this pause is held, and Docker serializes container starts, meaning no other container can start on the host until IG finishes. This effectively causes a denial of service on the entire container runtime, not just on IG itself.
  • Container startup delay: When any uprobe-based gadget is running (trace_malloc, trace_ssl, etc.), starting a container with a crafted ld.so.cache delays startup by ~1 minute.
  • Monitoring degradation: The IG daemon is blocked processing the malicious cache, potentially missing events from other containers.
  • Amplification: Multiple containers with crafted caches can be started simultaneously to amplify the effect.
  • No special privileges required: Any container can include a crafted /etc/ld.so.cache in its image, mount one via a volume, or overwrite it at runtime before IG starts a uprobe gadget. In this last case, IG inspects all already-running containers when the gadget starts, this still burns CPU but does not block other containers from starting (since the fanotify pause only applies to new container starts).

Crafted input forces the application to consume excessive CPU, memory, or other resources, degrading or denying service. Typical impact: denial of service.

Affected versions

github.com/inspektor-gadget/inspektor-gadget (>= 0.27.0, < 0.53.1)

Security releases

github.com/inspektor-gadget/inspektor-gadget → 0.53.1 (go)

Kodem intelligence

Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.

Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter. Kodem's runtime-powered SCA identifies whether this CVE is reachable in your applications.

Already deployed Kodem?

See it in your environmentNew to Kodem? Get a demo →

Remediation advice

Upgrade github.com/inspektor-gadget/inspektor-gadget to 0.53.1 or later to resolve this vulnerability.

Kodem Kai can prioritize this vulnerability in your dependency tree and generate a fix recommendation.

Frequently Asked Questions

  1. What is CVE-2026-53941? CVE-2026-53941 is a medium-severity uncontrolled resource consumption vulnerability in github.com/inspektor-gadget/inspektor-gadget (go), affecting versions >= 0.27.0, < 0.53.1. It is fixed in 0.53.1. Crafted input forces the application to consume excessive CPU, memory, or other resources, degrading or denying service.
  2. Which versions of github.com/inspektor-gadget/inspektor-gadget are affected by CVE-2026-53941? github.com/inspektor-gadget/inspektor-gadget (go) versions >= 0.27.0, < 0.53.1 is affected.
  3. Is there a fix for CVE-2026-53941? Yes. CVE-2026-53941 is fixed in 0.53.1. Upgrade to this version or later.
  4. Is CVE-2026-53941 exploitable, and should I be worried? Whether CVE-2026-53941 is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo
  5. What actually determines whether CVE-2026-53941 is exploitable, and how bad it is? Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.
  6. How do I fix CVE-2026-53941? Upgrade github.com/inspektor-gadget/inspektor-gadget to 0.53.1 or later.

Other vulnerabilities in github.com/inspektor-gadget/inspektor-gadget

Stop the waste.
Protect your environment with Kodem.