Open-Source Security Intelligence

Know every vulnerability
before it knows you.

DevGuard continuously monitors your dependencies and alerts you when CVEs like this one affect your stack — with real-time threat intelligence built for developers.

Search

RUSTSEC-2024-0446

HighCVSS 7.4 / 10
Published Jul 26, 2024·Last modified Dec 22, 2025
Affected Components(0)

No affected components available

Description

Summary

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.

Details

I wanted to show the git commit name in my prompt (I use bash), so I added a command:

[custom.git_commit_name]
command = 'git show -s --format="%<(25,mtrunc)%s"'
style = "italic"
when = true

To my surprise, when I had a commit with backticks in it, the backticks were expanded. e.g.:

touch foo
git add foo
git commit -m '`ls`'

Thankfully I noticed it on my own commit before checking out someone's code whose commit message was

rm -rf /important/stuff

The documentation says:

Command output is printed unescaped to the prompt

    Whatever output the command generates is printed unmodified in the prompt.
    This means if the output contains special sequences that are interpreted
    by your shell they will be expanded when displayed. These special
    sequences are shell specific, e.g. you can write a command module that
    writes bash sequences, e.g. \h, but this module will not work in a fish
    or zsh shell.

    Format strings can also contain shell specific prompt sequences, e.g. Bash, Zsh.

However, it doesn't specifically mention shell injection with $() and backticks; it just mentions the prompt escape sequences, and the link doesn't suggest any shell injection possibilities either.

Furthermore, I can't even figure out how to properly escape things, because simply changing the command to

command = 'printf %q "$(git show -s --format="%<(25,mtrunc)%s")"'

doesn't work, as it's also adding a backslash before spaces. I also tried use_stdin=false

I'm not 100% sure this qualifies as a vulnerability, but I feel it is not documented well enough to warn unsuspecting users, and it certainly is not documented how to properly quote things, because after 15-30 minutes of trying, I can't figure it out.

I see some past commits about fixing shell injection with $, and it does seem like the problem doesn't exist in build-in modules like git branch.

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

People with custom commands, so the scope is limited, and without knowledge of people's commands, it could be hard to target people. The only one I saw in the example custom commands that may be vulnerable is the playerctl one.

Risk Scores
Base Score
7.4

The vulnerability requires local access to the device to be exploited. It is difficult for an attacker to exploit this vulnerability and may require special conditions. An attacker does not need any special privileges or access rights. No user interaction is needed for the attacker to exploit this vulnerability. The impact is confined to the system where the vulnerability exists. There is a high impact on the confidentiality of the information. There is a high impact on the integrity of the data. There is a high impact on the availability of the system.

Threat Intelligence
6.8

Exploitation attempts have been detected. Elevated vigilance and prompt remediation are advised.

EPSS
0.46%

The exploit probability is very low. The vulnerability is unlikely to be exploited in the next 30 days.

Exploit
Not available

We did not find any exploit available. Neither in GitHub repositories nor in the Exploit-Database.

Browse More

Scan your project

Continuously monitor your dependencies and get alerted when vulnerabilities like this one affect your stack.

Checkout DevGuard