Skip to content

Data written to GitHub Actions Cache may expose secrets

High severity GitHub Reviewed Published Apr 28, 2023 in gradle/gradle-build-action • Updated Nov 7, 2023

Package

actions gradle/gradle-build-action (GitHub Actions)

Affected versions

< 2.4.2

Patched versions

2.4.2

Description

Impact

This vulnerability impacts GitHub workflows using the Gradle Build Action that have executed the Gradle Build Tool with the configuration cache enabled, potentially exposing secrets configured for the repository.

Secrets configured for GitHub Actions are normally passed to the Gradle Build Tool via environment variables. Due to the way that the Gradle Build Tool records these environment variables, they may be persisted into an entry in the GitHub Actions cache. This data stored in the GitHub Actions cache can be read by a GitHub Actions workflow running in an untrusted context, such as that running for a Pull Request submitted by a developer via a repository fork.

This vulnerability was discovered internally through code review, and we have not seen any evidence of it being exploited in the wild. However, in addition to upgrading the Gradle Build Action, you should delete any potentially vulnerable cache entries and may choose to rotate any potentially affected secrets (see Remediation).

Patches

Gradle Build Action v2.4.2 (and newer) no longer save this sensitive data for later use, preventing ongoing leakage of secrets via the GitHub Actions Cache. We strongly recommend that all users of the Gradle Build Action upgrade to v2.4.2 (or simply v2) immediately.

Remediation

While upgrading to the latest version of the Gradle Build Action will prevent leakage of secrets going forward, additional actions may be required due to current or previous GitHub Actions Cache entries containing this information.

Current cache entries will remain vulnerable until they are forcibly deleted or they expire naturally after 7 days of not being used. Potentially vulnerable entries can be easily identified in the GitHub UI by searching for a cache entry with key matching configuration-cache-*. We recommend that users of the Gradle Build Action inspect their list of cache entries and manually delete any that match this pattern.

While we have not seen any evidence of this vulnerability being exploited, we recommend cycling any repository secrets if you cannot be certain that these have not been compromised. Compromise could occur if you run a GitHub Actions workflow for a pull request attempting to exploit this data.
Warning signs to look for in a pull request include:

  • Making changes to GitHub Actions workflow files in a way that may attempt to read/extract data from the Gradle User Home or /.gradle directories.
  • Making changes to Gradle build files or other executable files that may be invoked by a GitHub Actions workflow, in a way that may attempt to read/extract information from these locations.

Workarounds

We strongly recommend that all users upgrade to the latest version of the Gradle Build Action as soon as possible, and delete any potentially vulnerable cache entries from the GitHub Actions cache (see Remediation).

If for some reason this is not possible, users can limit the impact of this vulnerability:

  • If the Gradle project does not opt-in to using the configuration cache, then it is not vulnerable.
  • If the Gradle project does opt-in to using the configuration-cache by default, then the --no-configuration-cache command-line argument can be used to disable this feature in a GitHub Actions workflow.

In any case, we recommend that users carefully inspect any pull request before approving the execution of GitHub Actions workflows. It may be prudent to require approval for all PRs from external contributors, as described here.

References

@bigdaz bigdaz published to gradle/gradle-build-action Apr 28, 2023
Published by the National Vulnerability Database Apr 28, 2023
Published to the GitHub Advisory Database May 1, 2023
Reviewed May 1, 2023
Last updated Nov 7, 2023

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
Network
Attack complexity
Low
Privileges required
Low
User interaction
Required
Scope
Changed
Confidentiality
High
Integrity
Low
Availability
None

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:N/AC:L/PR:L/UI:R/S:C/C:H/I:L/A:N

EPSS score

0.078%
(36th percentile)

CVE ID

CVE-2023-30853

GHSA ID

GHSA-h3qr-39j9-4r5v

Credits

Loading Checking history
See something to contribute? Suggest improvements for this vulnerability.