Skip to content

fix:GitRefSpec.js Potential ReDoS Vulnerability or Inefficient Regular Expression in Project: Need for Assessment and Mitigation#2192

Open
mmmsssttt404 wants to merge 2 commits into
isomorphic-git:mainfrom
mmmsssttt404:GitRefSpec.js-ReDos
Open

fix:GitRefSpec.js Potential ReDoS Vulnerability or Inefficient Regular Expression in Project: Need for Assessment and Mitigation#2192
mmmsssttt404 wants to merge 2 commits into
isomorphic-git:mainfrom
mmmsssttt404:GitRefSpec.js-ReDos

Conversation

@mmmsssttt404

Copy link
Copy Markdown

I'm fixing a bug or typo

  • if this is your first time contributing, run npm run add-contributor and follow the prompts to add yourself to the README
  • squash merge the PR with commit message "fix: [Description of fix]"
    Steps to reproduce
    Hello,

I am writing to report a potential Regular Expression Denial of Service (ReDoS) vulnerability or Inefficient Regular Expression in the project. When using specially crafted input strings in the context, it may lead to extremely high CPU usage, application freezing, or denial of service attacks.

Location of Issue:

The vulnerability is related to a regular expression used in the following validation file, which may result in significantly prolonged execution times under certain conditions.

] = refspec.match(/^(\+?)(.*?)(\*?):(.*?)(\*?)$/).slice(1)

1.git clone https://github.com/mmmsssttt404/isomorphic-git.git
2.npm install
3.npx jest __tests__/test-GitRefSpec.js 
4.npx jest __tests__/test-GitRefSpecSet.js 

use time:

屏幕截图 2025-08-20 125526

Benchmarks show clear quadratic growth with input size, not linear. Even at ~100k chars, runtime reaches several seconds. ReDoS does not require exponential blowup — Polynomial behavior is already recognized as exploitable
redos_result (14)

Proposed Solution:
Change the regular expression to
{7B1FD7C4-664E-4F81-AEFD-49E54CF3392B}

{8979F5F2-BDB4-4C08-B96C-0E1B74BA7B43} {F29A099D-77D8-4DEA-A20A-84AACE61CA4D}

Thank you for your attention to this matter. Your evaluation and response to this potential security concern would be greatly appreciated.

Best regards,

Search keywords: ReDoS

@jcubic

jcubic commented Nov 23, 2025

Copy link
Copy Markdown
Member

Sorry, I've missed this issue.

The tests are failing, so this can't be merged. There is also conflict.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants