Summary
OpenProject's repository changes endpoint allows attacker-controlled Git arguments to be passed directly to the underlying SCM command, enabling arbitrary file writes on the server.
Any user with the :browse_repository permission can abuse the rev parameter to inject Git options, write crafted content as files, and ultimately achieve remote code execution under the OpenProject process user.
Affected context
This vulnerability occurs within OpenProject's web-based project repository browsing feature, specifically the /projects/:project_id/repository/changes endpoint when rendering the "latest changes" view via git log.
It manifests when user-supplied repository revision identifiers (rev) are passed to the Git command without strict validation or safe argument handling.
The issue is relevant where:
- Git is configured as the SCM backend
- The OpenProject application executes Git commands on behalf of users
- Users possess
:browse_repositorypermission on at least one project
Exploit preconditions
- Attack surface: HTTP(S) interface for project repository browsing (
/projects/:project_id/repository/changes) - Required access: Valid OpenProject account with the
:browse_repositorypermission on the targeted project - Trigger point: Supplying a specially crafted
revvalue that Git interprets as command-line options (e.g., options that control output file paths) - Why exploitation is possible: The server constructs and executes an SCM command where the
revparameter is incorporated in a way that allows Git to treat it as arguments, enabling arbitrary file writes and potential script deployment
Why this happens
The core issue is improper handling of user-controlled input in a context where it is later interpreted as part of a system command.
Instead of being treated as a strictly validated revision identifier or hash, the rev parameter is forwarded directly to git log, allowing option injection such as custom output paths.
This maps to CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection'), where untrusted input is concatenated or passed to command-line utilities without robust quoting, whitelisting, or argument separation.
Potential impact
- Creation or overwriting of arbitrary files writable by the OpenProject process user
- Upload and persistence of executable shell scripts or other malicious files
- Remote code execution with the privileges of the OpenProject application user
- Establishment of reverse shells from the server to attacker-controlled hosts
- Unauthorized access to sensitive files on the host (e.g., configuration files,
/etc/passwd) - Further lateral movement or pivoting within the hosting environment
General mitigation guidance
Effective mitigation focuses on treating all SCM-related parameters as untrusted and strictly constraining how they reach the underlying commands.
Recommended patterns include:
- Using high-level Git libraries or APIs instead of shelling out to raw Git commands whenever possible
- Enforcing strict allowlists for revision identifiers (e.g., commit hashes, tags) and rejecting any value that does not match expected formats
- Avoiding direct string concatenation into command lines; instead, pass arguments as discrete, pre-validated parameters to process execution APIs
- Disabling or stripping any input that begins with
-or otherwise resembles a command-line option when a revision or path is expected - Running the application under a minimally privileged account with tightly constrained filesystem permissions to reduce the blast radius of any file write
- Segmenting repositories and application data on the filesystem so that writable locations do not include directories from which code is executed
How teams detect issues like this
Organizations can detect similar vulnerabilities and their potential abuse using a combination of code and runtime analysis:
- Static analysis: Create rules to flag code paths where HTTP parameters are passed into command execution functions or SCM adapters without strong validation or normalization.
- Code review signals: Examine repository browsing and SCM integration code for:
- Direct invocation of
git(or other SCM commands) using user-controllable parameters - Lack of pattern-based validation for
rev, branch names, and commit identifiers - Use of shell command wrappers instead of structured argument APIs
- Runtime monitoring: Inspect application logs for suspicious Git invocations that contain unexpected flags (e.g.,
--output,--exec, or other advanced options) originating from user requests. - Policy enforcement: Incorporate security gates in CI pipelines requiring explicit review of any code that constructs or executes external commands, possibly assisted by automated security review tools.

