codebase-memory-mcp: .gitignore glob backtracking stalls the indexer
codebase-memory-mcp - catastrophic backtracking in .gitignore glob matching lets a repository stall the indexer (GHSA-cjhf-76h2-4hwg)
Fixed in 0.10.0 (2026-08-10) by 886a885, which gives the .gitignore matcher a 20,000-step budget. 0.12.1 (2026-10-16) keeps the same budget and is the recommended upgrade. Track the fix at DeusData/codebase-memory-mcp#1464.
- Product
- codebase-memory-mcp (npm and PyPI package codebase-memory-mcp, plus release binaries) in DeusData/codebase-memory-mcp
- Affected versions
- codebase-memory-mcp before 0.10.0 (npm, PyPI and release binaries). Fixed in 0.10.0 (2026-08-10). The maintainer recommends 0.12.1 (2026-10-16).
- Severity
- MEDIUM
- Status
- Patched
- Weaknesses
- CWE-400Uncontrolled Resource Consumption
- CWE-1333Inefficient Regular Expression Complexity
- GitHub advisory
- GHSA-cjhf-76h2-4hwg
Published by the maintainer on 2026-11-17 - CVE
- CVE-2026-114499
- Published
- Credit
- Finder: Aaron Elijah Mars of Aeon. Tool: Aeon (https://www.aeon.fun).
What users should do now
- Upgrade codebase-memory-mcp to 0.12.1, the release the maintainer verified and recommends. 0.10.0 is the first fixed release.
- This applies however you installed it: the npm package, the PyPI package or a release binary. Restart any running server after the upgrade so the new matcher is in use.
- Until you upgrade, only index repositories you trust. If an index job never finishes, stop it and check the repository's
.gitignorefiles for lines packed with*or**.
Summary
codebase-memory-mcp indexes a code repository into a graph that AI coding agents can query over MCP. While it walks the repository it reads the .gitignore files there and skips matching paths, using its own glob matcher in src/discover/gitignore.c. That matcher handled * and ** by trying the rest of the pattern at every possible position, recursively, with no limit on the total work. Each extra wildcard group multiplies the number of tries, so the cost grows exponentially with the number of groups. A repository that ships one crafted ignore rule, plus a path long enough to match against, makes discovery run for an unbounded time.
Affected versions
codebase-memory-mcp before 0.10.0, as published on npm and PyPI and as release binaries. The attacker only needs the victim to index a repository they control, for example a cloned project or a dependency checked out into the workspace. No network access to the victim's machine is needed.
Impact
- Indexing hangs. The index job for the malicious repository never finishes, so the agent gets no code graph for it.
- Server stall on older builds. Before the daemon moved indexing into separate workers, the stuck matcher also blocked the server itself, so other projects and tools served by the same process stopped answering too.
- Availability only. No data is read, changed or sent anywhere. The work is local CPU time.
Scored 5.5 (CVSS 3.1 AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H) on the advisory.
Affected code
Permalinks at 4bbe098, the commit just before the fix.
**followed by/retries the rest of the pattern at every/boundary, with no limit: src/discover/gitignore.c#L45-L57**followed by any other character retries at every position: src/discover/gitignore.c#L59-L70*retries at every position up to the next/: src/discover/gitignore.c#L72-L82- The recursive matcher those helpers call back into, with no step count or depth limit: src/discover/gitignore.c#L121-L172
- Unrooted patterns are tried against the basename and again at every path suffix, which multiplies the work: src/discover/gitignore.c#L321-L342
- Every pattern from the repository's ignore files is run against every discovered path: src/discover/gitignore.c#L344-L371
Fix
- 886a885 ("bound response buffers, parse depth and glob matching"), part of #1464, passes a step budget through the matcher. Past 20,000 steps it gives up and reports no match, so a pathological pattern fails to ignore anything rather than ignoring the wrong files. The commit adds a test that the matcher ends on such input. Released in 0.10.0.
- In 0.12.1 the matcher lives in
src/discover/gitignore_core.cand keeps the shared 20,000-step budget (GI_MATCH_MAX_STEPS). The older matcher still returns no match when the budget runs out; the newer checked matcher reports an explicit limit result instead of a partial answer. The maintainer notes this bounds the work but does not claim every expensive input is gone. - The fix is still in place on
maintoday (checked at649eb5e).
Detection (for defenders)
Signs are an index job that never completes and a codebase-memory-mcp process pinned near 100% of one CPU core while discovery is running. In the repository being indexed, look for .gitignore lines with many * or ** groups in a row, especially next to very long or deeply nested paths. A working exploit is withheld.
Timeline
- Fix commit 886a885 adds a step budget to the
.gitignorematcher. - Maintainer merges #1464, which carries the fix.
- codebase-memory-mcp 0.10.0 released with the fix.
- codebase-memory-mcp 0.12.1 released; the maintainer later verifies it contains the fix and recommends it.
- Maintainer publishes GHSA-cjhf-76h2-4hwg with CVE-2026-114499; public write-up.
Credit
Finder: Aaron Elijah Mars of Aeon. Tool: Aeon.
References
- Fix PR (merged 2026-08-06): DeusData/codebase-memory-mcp#1464; fix commit 886a885
- Fixed release: codebase-memory-mcp 0.10.0
- Recommended release: codebase-memory-mcp 0.12.1
- GitHub advisory: GHSA-cjhf-76h2-4hwg
- CVE: CVE-2026-114499
- Affected repository: DeusData/codebase-memory-mcp