CVE-2024-41815: Starship Starship Vulnerable To Shell Injection Vulnerability

HIGH
Advisory Identifier: GHSA-vx24-x4mv-vwr5
CVSS 7.4
CWE-78 CWE-77
Published
Advisory Summary

CVE-2024-41815 is a HIGH (CVSS 7.4) starship vulnerable to shell injection vulnerability (CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')) affecting Starship libraries in the crates.io ecosystem. The issue involves starship vulnerable to shell injection via undocumented, unpredictable shell expansion in custom commands. Remediation is available by upgrading affected packages to version 1.20.0.

CVE-2024-41815 at a Glance

CVE Identifier CVE-2024-41815
GHSA Identifier GHSA-vx24-x4mv-vwr5
Severity HIGH
CVSS v3.1 Base Score 7.4
CWE Classification CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
Affected Product Starship
Package Ecosystem crates.io
Published Date
Last Updated

Security Impact

CVSS: 7.4

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:L/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H).

Attack Vector Local (AV:L)
Attack Complexity High (AC:H)
Privileges Required None (PR:N)
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-2024-41815

To remediate this vulnerability, upgrade all affected Starship dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

starship fixed: 1.20.0
Upgrade starship to 1.20.0
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 starship

How to Check if You Are Affected

To determine whether your application is affected by CVE-2024-41815, inspect your project dependencies for Starship:

inspect dependencies for starship

Analyze the terminal output to locate any version of Starship in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.20.0), 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-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection'), where the product constructs all or part of an os command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended os command when it is sent to a downstream component. In Starship, 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

## Description Starship is a cross-shell prompt. Starting in version 1.0.0 and prior to version 1.20.0, undocumented and unpredictable shell expansion and/or quoting rules make it easily to accidentally cause shell injection when using custom commands with starship in bash. Version 1.20.0 fixes the vulnerability. ### PoC Have some custom command which prints out information from a potentially untrusted/unverified source. ``` [custom.git_commit_name] command = 'git show -s --format="%<(25,mtrunc)%s"' style = "italic" when = true ``` ### Impact This issue only affects users with custom commands, so the scope is limited, and without knowledge of others' commands, it could be hard to successfully target someone.

CVE-2024-41815 Affected Starship Versions

1 component(s)
Fixed Versions:
1.20.0
Product / Package Ecosystem Affected Versions Fixed Version
starship
crates.io
≥ 1.0.0
< 1.20.0
1.20.0

References

Frequently Asked Questions

What is CVE-2024-41815?
CVE-2024-41815 is a security vulnerability in Starship involving Starship vulnerable to shell injection via undocumented, unpredictable shell expansion in custom commands under CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection').
Which Starship versions are affected?
Affected versions include releases prior to 1.20.0 across affected packages: starship.
What version fixes CVE-2024-41815?
Upgrading to 1.20.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is starship affected?
Yes, starship is affected in releases prior to 1.20.0. Upgrade your dependency to 1.20.0 or later.
What is the CVSS score of CVE-2024-41815?
CVE-2024-41815 has a CVSS v3.1 base score of 7.4 (HIGH) with vector string CVSS:3.1/AV:L/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2024-41815?
CVE-2024-41815 is classified under CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection') (The product constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.).
How can I check crates.io dependencies for CVE-2024-41815?
Run the dependency tree command: 'inspect dependencies for starship'. 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-vx24-x4mv-vwr5",
  "modified" : "2025-12-22T16:31:41Z",
  "published" : "2024-07-26T21:24:18Z",
  "aliases" : [ "CVE-2024-41815" ],
  "summary" : "Starship vulnerable to shell injection via undocumented, unpredictable shell expansion in custom commands",
  "details" : "## Description \nStarship is a cross-shell prompt. Starting in version 1.0.0 and prior to version 1.20.0, undocumented and unpredictable shell expansion and/or quoting rules make it easily to accidentally cause shell injection when using custom commands with starship in bash. Version 1.20.0 fixes the vulnerability.\n\n### PoC\nHave some custom command which prints out information from a potentially untrusted/unverified source.\n```\n[custom.git_commit_name]\ncommand = 'git show -s --format=\"%<(25,mtrunc)%s\"'\nstyle = \"italic\"\nwhen = true\n```\n\n### Impact\nThis issue only affects users with custom commands, so the scope is limited, and without knowledge of others' commands, it could be hard to successfully target someone.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:L/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "crates.io",
      "name" : "starship"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.0.0"
      }, {
        "fixed" : "1.20.0"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 1.19.0"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/starship/starship/security/advisories/GHSA-vx24-x4mv-vwr5"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-41815"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/starship/starship/commit/cfc58161e0ec595db90af686ad77a73df6d44d74"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/starship/starship"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/starship/starship/releases/tag/v1.20.0"
  }, {
    "type" : "WEB",
    "url" : "https://rustsec.org/advisories/RUSTSEC-2024-0446.html"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-77", "CWE-78" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-07-26T21:24:18Z",
    "nvd_published_at" : "2024-07-26T21:15:14Z"
  }
}