Miggo Logo

CVE-2024-41815:
Starship vulnerable to shell injection via undocumented, unpredictable shell expansion in custom commands

7.4

CVSS Score
3.1

Basic Information

EPSS Score
0.2808%
Published
7/26/2024
Updated
9/19/2024
KEV Status
No
Technology
TechnologyRust

Technical Details

CVSS Vector
CVSS:3.1/AV:L/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H
Package NameEcosystemVulnerable VersionsFirst Patched Version
starshiprust>= 1.0.0, <= 1.19.01.20.0

Vulnerability Intelligence
Miggo AIMiggo AI

Miggo AIRoot Cause Analysis

The vulnerability stems from how custom command output was handled in the StringFormatter. The pre-patch code in src/modules/custom.rs used map_no_escaping for the 'output' variable, which disabled escaping of special characters. This is shown in the commit diff where output handling was moved to a variables_closure and made conditional on the new unsafe_no_escape flag. The addition of escaping by default (using .map() instead of .map_no_escaping()) in the patched version directly addresses the command injection vulnerability. The test cases added in the commit (output_is_escaped and unsafe_no_escape) further confirm this was the vulnerable code path.

Vulnerable functions

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

WAF Protection Rules

WAF Rule

## **s*ription St*rs*ip is * *ross-s**ll prompt. St*rtin* in v*rsion *.*.* *n* prior to v*rsion *.**.*, un*o*um*nt** *n* unpr**i*t**l* s**ll *xp*nsion *n*/or quotin* rul*s m*k* it **sily to ***i**nt*lly **us* s**ll inj**tion w**n usin* *ustom *omm*n

Reasoning

T** vuln*r**ility st*ms *rom *ow *ustom *omm*n* output w*s **n*l** in t** Strin**orm*tt*r. T** pr*-p*t** *o** in sr*/mo*ul*s/*ustom.rs us** m*p_no_*s**pin* *or t** 'output' v*ri**l*, w*i** *is**l** *s**pin* o* sp**i*l ***r**t*rs. T*is is s*own in t**