CVE-2023-27581: Rlespinasse/github slug action Github-slug-action Vulnerable To Arbitrary Code Vulnerability

HIGH
Advisory Identifier: GHSA-6q4m-7476-932w
CVSS 8.8
CWE-77
Published
Advisory Summary

CVE-2023-27581 is a HIGH (CVSS 8.8) github-slug-action vulnerable to arbitrary code vulnerability (CWE-77: Improper Neutralization of Special Elements used in a Command ('Command Injection')) affecting Rlespinasse/github slug action libraries in the GitHub Actions ecosystem. The issue involves github-slug-action vulnerable to arbitrary code execution. Remediation is available by upgrading affected packages to version 4.4.1.

CVE-2023-27581 at a Glance

CVE Identifier CVE-2023-27581
GHSA Identifier GHSA-6q4m-7476-932w
Severity HIGH
CVSS v3.1 Base Score 8.8
CWE Classification CWE-77: Improper Neutralization of Special Elements used in a Command ('Command Injection')
Affected Product Rlespinasse/github slug action
Package Ecosystem GitHub Actions
Published Date
Last Updated

Security Impact

CVSS: 8.8

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:N/S:U/C:H/I:H/A:H).

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

How to Fix CVE-2023-27581

To remediate this vulnerability, upgrade all affected Rlespinasse/github slug 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.

rlespinasse/github-slug-action fixed: 4.4.1
Upgrade rlespinasse/github-slug-action to 4.4.1
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 rlespinasse/github-slug-action

How to Check if You Are Affected

To determine whether your application is affected by CVE-2023-27581, inspect your project dependencies for Rlespinasse/github slug action:

inspect dependencies for rlespinasse/github-slug-action

Analyze the terminal output to locate any version of Rlespinasse/github slug action in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 4.4.1), 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-77: Improper Neutralization of Special Elements used in a Command ('Command Injection'), where the product constructs all or part of a command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended command when it is sent to a downstream component. In Rlespinasse/github slug 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 action uses the `github.head_ref` parameter in an insecure way. This vulnerability can be triggered by any user on GitHub on any workflow using the action on pull requests. They just need to create a pull request with a branch name, which can contain the attack payload. (Note that first-time PR requests will not be run - but the attacker can submit a valid PR before submitting an invalid PR). This can be used to execute code on the GitHub runners (potentially use it for crypto-mining, and waste your resources) and to exfiltrate any secrets you use in the CI pipeline. ### Patches > Pass the variable as an environment variable and then use the environment variable instead of substituting it directly. Patched action is available on tag **v4**, tag **v4.4.1**, and any tag beyond. ### Workarounds No workaround is available if impacted, please upgrade the version > ℹ️ **v3** and **v4** are compatibles. ### References [Here](https://securitylab.github.com/research/github-actions-untrusted-input/) is a set of blog posts by Github's security team explaining this issue. ### Thanks Thanks to the team of researchers from Purdue University, who are working on finding vulnerabilities in CI/CD configurations of open-source software. Their tool detected this security vulnerability.

CVE-2023-27581 Affected Rlespinasse/github slug action Versions

1 component(s)
Fixed Versions:
4.4.1
Product / Package Ecosystem Affected Versions Fixed Version
rlespinasse/github-slug-action
GitHub Actions
≥ 4.0.0
< 4.4.1
4.4.1

References

Frequently Asked Questions

What is CVE-2023-27581?
CVE-2023-27581 is a security vulnerability in Rlespinasse/github slug action involving github-slug-action vulnerable to arbitrary code execution under CWE-77: Improper Neutralization of Special Elements used in a Command ('Command Injection').
Which Rlespinasse/github slug action versions are affected?
Affected versions include releases prior to 4.4.1 across affected packages: rlespinasse/github-slug-action.
What version fixes CVE-2023-27581?
Upgrading to 4.4.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is rlespinasse/github-slug-action affected?
Yes, rlespinasse/github-slug-action is affected in releases prior to 4.4.1. Upgrade your dependency to 4.4.1 or later.
What is the CVSS score of CVE-2023-27581?
CVE-2023-27581 has a CVSS v3.1 base score of 8.8 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2023-27581?
CVE-2023-27581 is classified under CWE-77: Improper Neutralization of Special Elements used in a Command ('Command Injection') (The product constructs all or part of a command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended command when it is sent to a downstream component.).
How can I check GitHub Actions dependencies for CVE-2023-27581?
Run the dependency tree command: 'inspect dependencies for rlespinasse/github-slug-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-6q4m-7476-932w",
  "modified" : "2025-02-18T22:42:28Z",
  "published" : "2023-03-13T20:43:33Z",
  "aliases" : [ "CVE-2023-27581" ],
  "summary" : "github-slug-action vulnerable to arbitrary code execution",
  "details" : "### Impact\n\nThis action uses the `github.head_ref` parameter in an insecure way. \n\nThis vulnerability can be triggered by any user on GitHub on any workflow using the action on pull requests. They just need to create a pull request with a branch name, which can contain the attack payload. (Note that first-time PR requests will not be run - but the attacker can submit a valid PR before submitting an invalid PR).  This can be used to execute code on the GitHub runners (potentially use it for crypto-mining, and waste your resources) and to exfiltrate any secrets you use in the CI pipeline.\n\n### Patches\n\n> Pass the variable as an environment variable and then use the environment variable instead of substituting it directly.\n\nPatched action is available on tag **v4**, tag **v4.4.1**, and any tag beyond.\n\n### Workarounds\n\nNo workaround is available if impacted, please upgrade the version\n\n> ℹ️ **v3** and **v4** are compatibles.\n\n### References\n\n[Here](https://securitylab.github.com/research/github-actions-untrusted-input/) is a set of blog posts by Github's security team explaining this issue.\n\n### Thanks\n\nThanks to the team of researchers from Purdue University, who are working on finding vulnerabilities in CI/CD configurations of open-source software. Their tool detected this security vulnerability.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "GitHub Actions",
      "name" : "rlespinasse/github-slug-action"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "4.0.0"
      }, {
        "fixed" : "4.4.1"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/rlespinasse/github-slug-action/security/advisories/GHSA-6q4m-7476-932w"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2023-27581"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/rlespinasse/github-slug-action/commit/102b1a064a9b145e56556e22b18b19c624538d94"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/rlespinasse/github-slug-action"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/rlespinasse/github-slug-action/releases/tag/v4.4.1"
  }, {
    "type" : "WEB",
    "url" : "https://securitylab.github.com/research/github-actions-untrusted-input"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-77" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2023-03-13T20:43:33Z",
    "nvd_published_at" : "2023-03-13T21:15:00Z"
  }
}