CVE-2024-54132: Github.com/cli/cli/v2 Path Traversal Vulnerability
MODERATECVE-2024-54132 is a MODERATE path traversal vulnerability (CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')) affecting Github.com/cli/cli/v2 libraries in the Go ecosystem. The issue involves downloading malicious github actions workflow artifact results in path traversal vulnerability. Remediation is available by upgrading affected packages to version 2.63.1.
CVE-2024-54132 at a Glance
How to Fix CVE-2024-54132
To remediate this vulnerability, upgrade all affected Github.com/cli/cli/v2 dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
Upgrade github.com/cli/cli/v2 to 2.63.1
Upgrade github.com/cli/cli to Latest secure release
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
inspect dependencies for github.com/cli/cli/v2
How to Check if You Are Affected
To determine whether your application is affected by CVE-2024-54132, inspect your project dependencies for Github.com/cli/cli/v2:
inspect dependencies for github.com/cli/cli/v2
Analyze the terminal output to locate any version of Github.com/cli/cli/v2 in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.63.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-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal'), where the product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory. In Github.com/cli/cli/v2, 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
CVE-2024-54132 Affected Github.com/cli/cli/v2 Versions
2 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
github.com/cli/cli/v2
|
Go |
< 2.63.1
|
2.63.1
|
|
github.com/cli/cli
|
Go |
≤ 1.14.0
|
|
References
Frequently Asked Questions
What is CVE-2024-54132?
Which Github.com/cli/cli/v2 versions are affected?
What version fixes CVE-2024-54132?
Is github.com/cli/cli/v2 affected?
Is github.com/cli/cli affected?
What CWE is associated with CVE-2024-54132?
How can I check Go dependencies for CVE-2024-54132?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-2m9h-r57g-45pj",
"modified" : "2024-12-04T22:17:31Z",
"published" : "2024-12-04T15:32:45Z",
"aliases" : [ "CVE-2024-54132" ],
"summary" : "Downloading malicious GitHub Actions workflow artifact results in path traversal vulnerability",
"details" : "### Summary\n\nA security vulnerability has been identified in GitHub CLI that could create or overwrite files in unintended directories when users download a malicious GitHub Actions workflow artifact through `gh run download`. \n\n### Details\n\nThis vulnerability stems from a GitHub Actions workflow artifact named `..` when downloaded using `gh run download`. The artifact name and `--dir` flag are used to determine the artifact’s download path. When the artifact is named `..`, the resulting files within the artifact are extracted exactly 1 directory higher than the specified `--dir` flag value.\n\nIn `2.63.1`, `gh run download` will not download artifacts named `..` and `.` and instead exit with the following error message:\n\n```\nerror downloading ..: would result in path traversal\n```\n\n### Impact\n\nSuccessful exploitation heightens the risk of local path traversal attack vectors exactly 1 directory higher than intended.\n\n### Remediation and Mitigation\n\n1. Upgrade `gh` to `2.63.1`\n2. Implement additional validation to ensure artifact filenames do not contain potentially dangerous patterns, such as `..`, to prevent path traversal risks.",
"severity" : [ {
"type" : "CVSS_V4",
"score" : "CVSS:4.0/AV:N/AC:H/AT:N/PR:N/UI:N/VC:N/VI:L/VA:N/SC:N/SI:N/SA:N/U:Green"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "Go",
"name" : "github.com/cli/cli/v2"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "2.63.1"
} ]
} ]
}, {
"package" : {
"ecosystem" : "Go",
"name" : "github.com/cli/cli"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"last_affected" : "1.14.0"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/cli/cli/security/advisories/GHSA-2m9h-r57g-45pj"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-54132"
}, {
"type" : "WEB",
"url" : "https://github.com/cli/cli/commit/1136764c369aaf0cae4ec2ee09dc35d871076932"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/cli/cli"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-22" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2024-12-04T15:32:45Z",
"nvd_published_at" : "2024-12-04T16:15:26Z"
}
}