Skip to content

fix: Sanitise environment basename in shell prompt - #595

Merged
alecthomas merged 1 commit into
masterfrom
aat/vuln-78225-env-basename-injection
Aug 2, 2026
Merged

fix: Sanitise environment basename in shell prompt#595
alecthomas merged 1 commit into
masterfrom
aat/vuln-78225-env-basename-injection

Conversation

@alecthomas

Copy link
Copy Markdown
Collaborator

The environment root's basename was interpolated raw into the generated
PS1 assignment, so a directory named $(...) or containing backticks
executed as the user on activation (bash) or at the first prompt (zsh).
This is reachable by default: prompt = "env" resolves as the default for
both absent and empty user config files.

Replace runes outside a conservative allowlist rather than quoting the
name into a shell variable, because zsh expands "%" after substitution
and renders the reference literally unless PROMPT_SUBST is set.

VULN-78225

Co-Authored-By: Claude Fable 5 noreply@anthropic.com

The environment root's basename was interpolated raw into the generated
PS1 assignment, so a directory named $(...) or containing backticks
executed as the user on activation (bash) or at the first prompt (zsh).
This is reachable by default: prompt = "env" resolves as the default for
both absent and empty user config files.

Replace runes outside a conservative allowlist rather than quoting the
name into a shell variable, because zsh expands "%" after substitution
and renders the reference literally unless PROMPT_SUBST is set.

VULN-78225

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@alecthomas
alecthomas enabled auto-merge (squash) August 2, 2026 22:23
@alecthomas
alecthomas disabled auto-merge August 2, 2026 22:23
@alecthomas
alecthomas merged commit 6bccbca into master Aug 2, 2026
8 checks passed
@alecthomas
alecthomas deleted the aat/vuln-78225-env-basename-injection branch August 2, 2026 22:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant