Miggo Logo

CVE-2023-49291:
tj-actions/branch-names's Improper Sanitization of Branch Name Leads to Arbitrary Code Injection

9.3

CVSS Score
3.1

Basic Information

EPSS Score
0.77319%
Published
12/5/2023
Updated
12/7/2023
KEV Status
No
Technology
TechnologyGitHub Actions

Technical Details

CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:L/I:H/A:N
Package NameEcosystemVulnerable VersionsFirst Patched Version
tj-actions/branch-namesactions< 7.0.77.0.7

Vulnerability Intelligence
Miggo AIMiggo AI

Miggo AIRoot Cause Analysis

The primary vulnerability stems from direct interpolation of GitHub context variables containing attacker-controlled branch names into bash script commands. The patch moved these variables to environment variables first before use. The 'branch' step's run command is clearly vulnerable due to unsanitized ${{ }} expansion of head_ref/base_ref in command substitution. The 'current_branch' step shows similar patterns with github.ref usage. Confidence is high for the branch step due to explicit code execution examples in advisories, and medium for current_branch as defense-in-depth hardening.

Vulnerable functions

Only Mi**o us*rs **n s** t*is s**tion

WAF Protection Rules

WAF Rule

### Summ*ry T** `tj-**tions/*r*n**-n*m*s` *it*u* **tions r***r*n**s t** `*it*u*.*v*nt.pull_r*qu*st.****.r**` *n* `*it*u*.****_r**` *ont*xt v*ri**l*s wit*in * *it*u* **tions `run` st*p. T** **** r** v*ri**l* is t** *r*n** n*m* *n* **n ** us** to *x**

Reasoning

T** prim*ry vuln*r**ility st*ms *rom *ir**t int*rpol*tion o* *it*u* *ont*xt v*ri**l*s *ont*inin* *tt**k*r-*ontroll** *r*n** n*m*s into **s* s*ript *omm*n*s. T** p*t** mov** t**s* v*ri**l*s to *nvironm*nt v*ri**l*s *irst ***or* us*. T** '*r*n**' st*p'