Skip to content

[VULN-2216191] neutralize git core.fsmonitor/hooksPath RCE - #1918

Merged
marcomura merged 1 commit into
mainfrom
mmura/VULN-2216191-fix
Jul 28, 2026
Merged

[VULN-2216191] neutralize git core.fsmonitor/hooksPath RCE#1918
marcomura merged 1 commit into
mainfrom
mmura/VULN-2216191-fix

Conversation

@marcomura

@marcomura marcomura commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator

fix(security): neutralize git core.fsmonitor/hooksPath RCE (VULN-2216191)

Summary

The extension’s Shell class spawned git with no config isolation, allowing a malicious repository’s .git/config to set core.fsmonitor to an attacker-controlled executable. Git runs this program automatically during index refreshes triggered by blame, rev-parse, log, and diff — achieving arbitrary code execution with no authentication required, just opening the repository.

Fix

Shell.exec() now automatically applies the following hardening for every git invocation:

  • Prepends -c core.fsmonitor= -c core.hooksPath= to neutralize repo-local hooks
  • Sets GIT_CONFIG_NOSYSTEM=1 and GIT_CONFIG_GLOBAL= to skip system/global config
    All four call sites (git blame, git rev-parse, git log, git diff) are covered by this single change. Non-git commands are unaffected.

Rovo Dev code review: Rovo Dev has reviewed this pull request
Any suggestions or improvements have been posted as pull request comments.

…191)

The Shell class now prepends '-c core.fsmonitor= -c core.hooksPath=' and
sets GIT_CONFIG_NOSYSTEM=1 / GIT_CONFIG_GLOBAL='' for every git invocation.

This prevents a malicious repository's .git/config from causing git to
execute an attacker-supplied program when the extension runs git blame,
git rev-parse, git log, or git diff operations — all without any
authentication or user interaction beyond opening the repository.

4 new unit tests added to verify the hardening is applied correctly.
@marcomura
marcomura merged commit 153274f into main Jul 28, 2026
13 checks passed
@marcomura
marcomura deleted the mmura/VULN-2216191-fix branch July 28, 2026 19:28
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.

2 participants