Impact
The OpenCost service exposes a POST /serviceKey endpoint that allows unauthenticated clients to submit arbitrary key data. This data is written to the GCP service‑account key.json file used by the application. An attacker can replace the real credentials with attacker‑controlled ones, causing OpenCost to operate under compromised credentials and potentially allowing the attacker to read or modify GCP resources and disrupt cost monitoring. The vulnerability also leaks the service using an Access‑Control‑Allow‑Origin set to a wildcard, which permits browser‑based exploitation when the endpoint is reachable from a browser.
Affected Systems
OpenCost versions earlier than 1.121.0 are affected. The issue exists in the pkg/costmodel/router.go router handling the /serviceKey POST endpoint. Only deployments using the OpenCost cost monitoring component in Kubernetes clusters are impacted. Up to version 1.120.0 vulnerabilities remain; 1.121.0 and newer contain the fix.
Risk and Exploitability
This flaw carries a CVSS score of 8.8, indicating high severity. EPSS is not available, so the current probability of exploitation is unknown. The vulnerability is not listed in CISA's KEV catalog at this time. Attackers can exploit the unauthenticated endpoint over a network or through a web browser if the service is exposed, and can inject arbitrary service‑account keys. Successful exploitation would allow the attacker to assume the identity of a Google Cloud service‑account, potentially leading to data exfiltration or denial of service to other workloads.
OpenCVE Enrichment
Github GHSA