CVE-2023-30853: Gradle/gradle build action Data Written To GitHub Actions Vulnerability

HIGH
Advisory Identifier: GHSA-h3qr-39j9-4r5v
CVSS 7.6
CWE-312 CWE-200
Published
Advisory Summary

CVE-2023-30853 is a HIGH (CVSS 7.6) data written to github actions vulnerability (CWE-312: Cleartext Storage of Sensitive Information) affecting Gradle/gradle build action libraries in the GitHub Actions ecosystem. The issue involves data written to github actions cache may expose secrets. Remediation is available by upgrading affected packages to version 2.4.2.

CVE-2023-30853 at a Glance

CVE Identifier CVE-2023-30853
GHSA Identifier GHSA-h3qr-39j9-4r5v
Severity HIGH
CVSS v3.1 Base Score 7.6
CWE Classification CWE-312: Cleartext Storage of Sensitive Information
Affected Product Gradle/gradle build action
Package Ecosystem GitHub Actions
Published Date
Last Updated

Security Impact

CVSS: 7.6

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:L/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required Low (PR:L)
User Interaction Required (UI:R)
Scope Changed (S:C)
Confidentiality High (C:H)
Integrity Low (I:L)
Availability None (A:N)

How to Fix CVE-2023-30853

To remediate this vulnerability, upgrade all affected Gradle/gradle build action dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

gradle/gradle-build-action fixed: 2.4.2
Upgrade gradle/gradle-build-action to 2.4.2
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for gradle/gradle-build-action

How to Check if You Are Affected

To determine whether your application is affected by CVE-2023-30853, inspect your project dependencies for Gradle/gradle build action:

inspect dependencies for gradle/gradle-build-action

Analyze the terminal output to locate any version of Gradle/gradle build action in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.4.2), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-312: Cleartext Storage of Sensitive Information, where the product stores sensitive information in cleartext within a resource that might be accessible to another control sphere. In Gradle/gradle build action, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Impact This vulnerability impacts GitHub workflows using the [Gradle Build Action](https://github.com/marketplace/actions/gradle-build-action) that have executed the Gradle Build Tool with the [configuration cache](https://docs.gradle.org/current/userguide/configuration_cache.html) 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](#Remediation)). ### Patches [Gradle Build Action v2.4.2](https://github.com/gradle/gradle-build-action/releases/tag/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](https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#deleting-cache-entries). 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 <project-root>/.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](#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](https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/enabling-features-for-your-repository/managing-github-actions-settings-for-a-repository#controlling-changes-from-forks-to-workflows-in-public-repositories).

CVE-2023-30853 Affected Gradle/gradle build action Versions

1 component(s)
Fixed Versions:
2.4.2
Product / Package Ecosystem Affected Versions Fixed Version
gradle/gradle-build-action
GitHub Actions
< 2.4.2
2.4.2

References

Frequently Asked Questions

What is CVE-2023-30853?
CVE-2023-30853 is a security vulnerability in Gradle/gradle build action involving Data written to GitHub Actions Cache may expose secrets under CWE-312: Cleartext Storage of Sensitive Information.
Which Gradle/gradle build action versions are affected?
Affected versions include releases prior to 2.4.2 across affected packages: gradle/gradle-build-action.
What version fixes CVE-2023-30853?
Upgrading to 2.4.2 (or the latest patched release for your respective branch) resolves the vulnerability.
Is gradle/gradle-build-action affected?
Yes, gradle/gradle-build-action is affected in releases prior to 2.4.2. Upgrade your dependency to 2.4.2 or later.
What is the CVSS score of CVE-2023-30853?
CVE-2023-30853 has a CVSS v3.1 base score of 7.6 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:L/A:N.
What CWE is associated with CVE-2023-30853?
CVE-2023-30853 is classified under CWE-312: Cleartext Storage of Sensitive Information (The product stores sensitive information in cleartext within a resource that might be accessible to another control sphere.).
How can I check GitHub Actions dependencies for CVE-2023-30853?
Run the dependency tree command: 'inspect dependencies for gradle/gradle-build-action'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-h3qr-39j9-4r5v",
  "modified" : "2023-05-01T13:42:44Z",
  "published" : "2023-05-01T13:42:44Z",
  "aliases" : [ "CVE-2023-30853" ],
  "summary" : "Data written to GitHub Actions Cache may expose secrets",
  "details" : "### Impact\n\nThis vulnerability impacts GitHub workflows using the [Gradle Build Action](https://github.com/marketplace/actions/gradle-build-action) that have executed the Gradle Build Tool with the [configuration cache](https://docs.gradle.org/current/userguide/configuration_cache.html) enabled, potentially exposing secrets configured for the repository.\n\nSecrets 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.\n\nThis 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](#Remediation)).\n\n### Patches\n\n[Gradle Build Action v2.4.2](https://github.com/gradle/gradle-build-action/releases/tag/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.\n\n### Remediation\n\nWhile 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.\n\nCurrent 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](https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#deleting-cache-entries).\n\nWhile 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. \nWarning signs to look for in a pull request include:\n- Making changes to GitHub Actions workflow files in a way that may attempt to read/extract data from the Gradle User Home or <project-root>/.gradle directories.\n- 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.\n\n### Workarounds\n\nWe 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](#Remediation)). \n\nIf for some reason this is not possible, users can limit the impact of this vulnerability:\n- If the Gradle project does not opt-in to using the configuration cache, then it is not vulnerable. \n- 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.\n\nIn 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](https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/enabling-features-for-your-repository/managing-github-actions-settings-for-a-repository#controlling-changes-from-forks-to-workflows-in-public-repositories).",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:L/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "GitHub Actions",
      "name" : "gradle/gradle-build-action"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.4.2"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/gradle/gradle-build-action/security/advisories/GHSA-h3qr-39j9-4r5v"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2023-30853"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/gradle/gradle-build-action"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/gradle/gradle-build-action/releases/tag/v2.4.2"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-200", "CWE-312" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2023-05-01T13:42:44Z",
    "nvd_published_at" : "2023-04-28T16:15:10Z"
  }
}