CVE-2026-49987
### Vulnerability Metadata | Field | Detail | | --- | --- | | **Affected Component** | `src/core/git/gitCommand.ts` (`execGitShallowClone`) | | **Impact** | Arbitrary Command Execution / Security Control Bypass | ### Summary The `--remote-branch` CLI option in `repomix` is vulnerable to argument injection. User-supplied input is passed directly to `git fetch` and `git checkout` subprocesses via `child_process.execFileAsync` without sanitization, `--` delimiters, or validation. An attacker can inject arbitrary git command-line options. By injecting the `--upload-pack` option and specifying an SSH (`git@...`) or local (`file://`) remote URL, an attacker achieves arbitrary command execution with the privileges of the user running `repomix`. This bypasses the existing `dangerousParams` blocklist implemented in `validateGitUrl()`. ### Vulnerable Code Analysis **File:** `src/core/git/gitCommand.ts` The `remoteBranch` parameter is appended directly to the arguments array for git subprocesses without the `--` positional delimiter. **Sink 1 (Lines 118-127):** ```typescript await deps.execFileAsync( 'git', ['-C', directory, 'fetch', '--depth', '1', 'origin', remoteBranch], // Vulnerable gitRemoteOpts, ); ``` **Sink 2 (Lines 148-151):** ```typescript await deps.execFileAsync('git', ['-C', directory, 'checkout', remoteBranch]); // Vulnerable ``` **Bypassed Security Control (Lines 192-197):** The application attempts to prevent this exact vulnerability class by blocking dangerous parameters (`--upload-pack`, `--receive-pack`, `--config`, `--exec`) within the `validateGitUrl` function. However, this validation is exclusively applied to the `url` variable and omitted for `remoteBranch`, creating a direct bypass. ### Attack Flow ```text [Source] repomix --remote-branch <injected_option> ↓ src/cli/actions/remoteAction.ts:226 (cloneRepository) ↓ src/core/git/gitCommand.ts:118 (execGitShallowClone) ↓ [Sink] execFileAsync('git', ['...', 'origin', '--uploa
Properties
- summary
- repomix Vulnerable to Command Injection (RCE) via `--remote-branch` Argument Injection
- severity
- high
- epss_score
- 0.00495
- cvss_score
- 8.8
- ghsa_published
- 2026-07-01T19:00:50Z
- source_url
- https://github.com/advisories/GHSA-9mm9-rqhj-j5mx
- ghsa_updated
- 2026-07-01T19:00:51Z
- ghsa_id
- GHSA-9mm9-rqhj-j5mx
- cve_id
- CVE-2026-49987
- cvss_vector
- CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
- is_ghsa_only
- false
- epss_percentile
- 0.40267
Related Entities (5)
ENRICHED_BY (1)
AFFECTS (1)
HAS_WEAKNESS (1)
REPORTED_BY (1)
VULNERABLE_TO (1)
Explore deeper with Ninja Signal's threat intelligence graph