Truffle Security Co. TruffleHog git arbitrary code execution vulnerability
TruffleHog's git scanner reads the repository's .git/config and honours a core.fsmonitor setting, so a crafted repository can run an arbitrary command when scanned. An attacker who delivers such a repository could execute code on the victim's machine.
Originally disclosed on Cisco Talos
An arbitrary code execution vulnerability exists in the git functionality of Truffle Security Co. TruffleHog 3.90.2.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the scanner invokes the git client with default settings, so Git reads the repository's own .git/config and executes the core.fsmonitor command it finds there.
Impact
An attacker could achieve arbitrary command execution on the victim's machine when the malicious repository is scanned, though the attack requires the victim to open or scan the crafted repository.
What the attacker needed
Victim scans a crafted repository; repository delivered as an archive or copy
The fix
The vendor released a patch; more generally, tools should override dangerous Git configuration options such as core.fsmonitor when invoking git.
How it was found
- Create a new git repository directory and initialise it.
- Write a core.fsmonitor setting into the repository's .git/config that runs a command.
- Run TruffleHog's git scan against the local repository path.
- Observe that the command has executed.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
Git repositories have a hidden settings file that can tell Git to run a helper program. TruffleHog, a tool that scans repositories for secrets, trusted that file and ran the helper, so opening a booby-trapped repository with it could run the attacker's command on your computer.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.