Summary
Goose CLI can execute commands configured through a repository's Git settings when a user runs goose review on a crafted repository. Those commands run with the user's privileges, potentially exposing credentials and provider API keys.
Affected context
The vulnerability affects Goose CLI's Git review workflow when it runs git diff without disabling external diff behavior. A repository's .git/config can define an external diff command, so the issue becomes risky when a user reviews an untrusted repository and Git honors that setting.
Exploit preconditions
- Attack surface: Local execution through the Goose CLI Git review workflow
- Required access: The attacker must be able to provide or influence a repository that the victim reviews
- Trigger point: The victim runs
goose reviewon that repository - Why exploitation is possible: Git may honor the repository's
diff.externalsetting when Goose invokesgit diffwithout disabling external diff behavior
Why this happens
The underlying issue is that Goose invokes Git in a way that can honor repository-controlled external diff configuration. This allows untrusted repository metadata to influence command execution rather than being treated only as data. It maps to CWE-78: Improper Neutralization of Special Elements used in an OS Command, because attacker-influenced input reaches an operating-system command execution path without adequately restricting its behavior.
Potential impact
- Commands may execute with the privileges of the user running Goose
- Local files or credentials accessible to that user could be exposed
- Provider API keys or other secrets available in the environment could be accessed
- The compromised environment could be used for further unauthorized activity
General mitigation guidance
Defensive patterns focus on preventing repository-controlled Git settings from triggering external commands.
- Disable external diff behavior when invoking Git on untrusted repositories
- Use controlled Git configuration and avoid inheriting settings from untrusted repository metadata
- Treat repositories and their configuration as untrusted input during review workflows
- Limit the credentials and privileges available to review processes
- Consider isolated environments for inspecting untrusted repositories
How teams detect issues like this
- Use static analysis and code review to identify Git command invocations that may honor repository-local configuration
- Check whether review workflows explicitly disable external diff behavior for untrusted repositories
- Review policies governing which Git configuration sources command-line tools may trust
- Add automated checks that flag subprocess calls whose behavior can be controlled by repository metadata

