{"id":"CVE-2023-49291","state":"PUBLISHED","title":"Improper Sanitization of Branch Name Leads to Arbitrary Code Injection","description":"tj-actions/branch-names is a Github action to retrieve branch or tag names with support for all events. The `tj-actions/branch-names` GitHub Actions improperly references the `github.event.pull_request.head.ref` and `github.head_ref` context variables within a GitHub Actions `run` step. The head ref variable is the branch name and can be used to execute arbitrary code using a specially crafted branch name. As a result an attacker can use this vulnerability to steal secrets from or abuse `GITHUB_TOKEN` permissions. This vulnerability has been addressed in version 7.0.7. Users are advised to upgrade. There are no known workarounds for this vulnerability.","publishedAt":"2023-12-04T23:21:33.367Z","updatedAt":"2024-08-02T21:53:44.957Z","severity":{"score":9.3,"label":"Critical","version":"3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:L/I:H/A:N","source":"GitHub_M"},"assigner":"GitHub_M","products":["tj-actions branch-names"],"affected":[{"vendor":"tj-actions","product":"branch-names","versions":[{"version":"< 7.0.7","status":"affected"}]}],"references":["https://github.com/tj-actions/branch-names/security/advisories/GHSA-8v8w-v8xg-79rf","https://github.com/tj-actions/branch-names/commit/4923d1ca41f928c24f1c1b3af9daaadfb71e6337","https://github.com/tj-actions/branch-names/commit/6c999acf206f5561e19f46301bb310e9e70d8815","https://github.com/tj-actions/branch-names/commit/726fe9ba5e9da4fcc716223b7994ffd0358af060","https://securitylab.github.com/research/github-actions-untrusted-input"],"weaknesses":["CWE-20"],"ingestedAt":"2026-10-29T20:06:24.729Z","source":{"repository":"CVEProject/cvelistV5","path":"cves/2023/49xxx/CVE-2023-49291.json","commit":"556c9d3a8cd17e218bb8e452ba7cd619a384ff47"},"raw":{"dataType":"CVE_RECORD","dataVersion":"5.1","cveMetadata":{"cveId":"CVE-2023-49291","state":"PUBLISHED","datePublished":"2023-12-04T23:21:33.367Z","dateUpdated":"2024-08-02T21:53:44.957Z","assignerShortName":"GitHub_M","assignerOrgId":"a0819718-46f1-4df5-94e2-005712e83aaa","dateReserved":"2023-11-24T16:45:24.313Z"},"containers":{"cna":{"title":"Improper Sanitization of Branch Name Leads to Arbitrary Code Injection","descriptions":[{"lang":"en","value":"tj-actions/branch-names is a Github action to retrieve branch or tag names with support for all events. The `tj-actions/branch-names` GitHub Actions improperly references the `github.event.pull_request.head.ref` and `github.head_ref` context variables within a GitHub Actions `run` step. The head ref variable is the branch name and can be used to execute arbitrary code using a specially crafted branch name. As a result an attacker can use this vulnerability to steal secrets from or abuse `GITHUB_TOKEN` permissions. This vulnerability has been addressed in version 7.0.7. Users are advised to upgrade. There are no known workarounds for this vulnerability."}],"affected":[{"vendor":"tj-actions","product":"branch-names","versions":[{"version":"< 7.0.7","status":"affected"}]}],"references":[{"url":"https://github.com/tj-actions/branch-names/security/advisories/GHSA-8v8w-v8xg-79rf","name":"https://github.com/tj-actions/branch-names/security/advisories/GHSA-8v8w-v8xg-79rf","tags":["x_refsource_CONFIRM"]},{"url":"https://github.com/tj-actions/branch-names/commit/4923d1ca41f928c24f1c1b3af9daaadfb71e6337","name":"https://github.com/tj-actions/branch-names/commit/4923d1ca41f928c24f1c1b3af9daaadfb71e6337","tags":["x_refsource_MISC"]},{"url":"https://github.com/tj-actions/branch-names/commit/6c999acf206f5561e19f46301bb310e9e70d8815","name":"https://github.com/tj-actions/branch-names/commit/6c999acf206f5561e19f46301bb310e9e70d8815","tags":["x_refsource_MISC"]},{"url":"https://github.com/tj-actions/branch-names/commit/726fe9ba5e9da4fcc716223b7994ffd0358af060","name":"https://github.com/tj-actions/branch-names/commit/726fe9ba5e9da4fcc716223b7994ffd0358af060","tags":["x_refsource_MISC"]},{"url":"https://securitylab.github.com/research/github-actions-untrusted-input","name":"https://securitylab.github.com/research/github-actions-untrusted-input","tags":["x_refsource_MISC"]}],"metrics":[{"cvssV3_1":{"attackComplexity":"LOW","attackVector":"NETWORK","availabilityImpact":"NONE","baseScore":9.3,"baseSeverity":"CRITICAL","confidentialityImpact":"LOW","integrityImpact":"HIGH","privilegesRequired":"NONE","scope":"CHANGED","userInteraction":"NONE","vectorString":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:L/I:H/A:N","version":"3.1"}}],"problemTypes":[{"descriptions":[{"cweId":"CWE-20","lang":"en","description":"CWE-20: Improper Input Validation","type":"CWE"}]}],"providerMetadata":{"shortName":"GitHub_M","orgId":"a0819718-46f1-4df5-94e2-005712e83aaa","dateUpdated":"2023-12-04T23:21:33.367Z"},"source":{"advisory":"GHSA-8v8w-v8xg-79rf","discovery":"UNKNOWN"}},"adp":[{"title":"CVE Program Container","references":[{"url":"https://github.com/tj-actions/branch-names/security/advisories/GHSA-8v8w-v8xg-79rf","name":"https://github.com/tj-actions/branch-names/security/advisories/GHSA-8v8w-v8xg-79rf","tags":["x_refsource_CONFIRM","x_transferred"]},{"url":"https://github.com/tj-actions/branch-names/commit/4923d1ca41f928c24f1c1b3af9daaadfb71e6337","name":"https://github.com/tj-actions/branch-names/commit/4923d1ca41f928c24f1c1b3af9daaadfb71e6337","tags":["x_refsource_MISC","x_transferred"]},{"url":"https://github.com/tj-actions/branch-names/commit/6c999acf206f5561e19f46301bb310e9e70d8815","name":"https://github.com/tj-actions/branch-names/commit/6c999acf206f5561e19f46301bb310e9e70d8815","tags":["x_refsource_MISC","x_transferred"]},{"url":"https://github.com/tj-actions/branch-names/commit/726fe9ba5e9da4fcc716223b7994ffd0358af060","name":"https://github.com/tj-actions/branch-names/commit/726fe9ba5e9da4fcc716223b7994ffd0358af060","tags":["x_refsource_MISC","x_transferred"]},{"url":"https://securitylab.github.com/research/github-actions-untrusted-input","name":"https://securitylab.github.com/research/github-actions-untrusted-input","tags":["x_refsource_MISC","x_transferred"]}],"providerMetadata":{"shortName":"CVE","orgId":"af854a3a-2127-422b-91ae-364da2661108","dateUpdated":"2024-08-02T21:53:44.957Z"}}]}}}