CVE-2025-25285 is a medium-severity (CVSS 5.3) vulnerability in @octokit/endpoint. A fix is available for @octokit/endpoint — see the affected versions and patch details below.
@octokit/endpoint has a Regular Expression in parse that Leads to ReDoS Vulnerability Due to Catastrophic Backtracking
Exploitation Status
Proof-of-concept exploit code exists
- CISA’s SSVC triage found public proof-of-concept exploit code for this CVE, though no confirmed active exploitation.
- CISA assesses this as automatable — exploitation doesn’t require manual, per-target effort, which raises the odds of mass scanning and opportunistic attacks.
Exploitation and automatability from CISA’s SSVC triage for CVE-2025-25285.
EPSS Exploitation Probability
EPSS (Exploit Prediction Scoring System) is a daily probability model maintained by FIRST.org. It estimates the likelihood a CVE will be exploited in production environments within the next 30 days, derived from real-world threat intelligence signals.
How urgent is this, really
CVE-2025-25285 plotted by exploitation likelihood (EPSS) against impact (CVSS). The shaded corner — EPSS 50%+ and CVSS 7.0+ — is where this CVE doesn't sit, though severity or exploitability alone can still warrant action.
Where this sits among everything scored
Of 377,636 CVEs with a current EPSS score, this one falls in the < 10% band (highlighted). Real counts from FIRST.org, not a sample — log-scaled since the landscape is heavily right-skewed.
Real-World Exposure
How broadly this vulnerability is actually deployed: weekly install volume shows current usage, and reverse-dependency count shows how many other packages break if it stays unpatched.
@octokit/endpointnpmDescription
Summary
By crafting specific options parameters, the endpoint.parse(options) call can be triggered, leading to a regular expression denial-of-service (ReDoS) attack. This causes the program to hang and results in high CPU utilization.
Details
The issue occurs in the parse function within the parse.ts file of the npm package @octokit/endpoint. The specific code is located at the following link: https://github.com/octokit/endpoint.js/blob/main/src/parse.ts, at line 62:
headers.accept.match(/[\w-]+(?=-preview)/g) || ([] as string[]);
The regular expression /[\w-]+(?=-preview)/g encounters a backtracking issue when it processes a large number of characters followed by the - symbol.
e.g., the attack string:
"" + "A".repeat(100000) + "-"
PoC
The gist Here is the reproduction process for the vulnerability:
- run
npm i @octokit/endpoint - Move
poc.jsto the root directory of the same level asREADME.md - run
node poc.jsresult: - then the program will be stuck forever with high CPU usage
import { endpoint } from "@octokit/endpoint";
// import { parse } from "./node_modules/@octokit/endpoint/dist-src/parse.js";
const options = {
method: "POST",
url: "/graphql", // Ensure that the URL ends with "/graphql"
headers: {
accept: "" + "A".repeat(100000) + "-", // Pass in the attack string
"content-type": "text/plain",
},
mediaType: {
previews: ["test-preview"], // Ensure that mediaType.previews exists and has values
format: "raw", // Optional media format
},
baseUrl: "https://api.github.com",
};
const startTime = performance.now();
endpoint.parse(options);
const endTime = performance.now();
const duration = endTime - startTime;
console.log(`Endpoint execution time: ${duration} ms`);
-
Import the
endpointmodule: First, import theendpointmodule from the npm package@octokit/endpoint, which is used for handling GitHub API requests. -
Construct the
optionsobject that triggers a ReDoS attack: The following member variables are critical in constructing theoptionsobject:
url: Set to"/graphql", ensuring the URL ends with/graphqlto match the format for GitHub's GraphQL API.headers:
accept: A long attack string is crafted with"A".repeat(100000) + "-", which will be passed to the regular expression and cause a backtracking attack (ReDoS).
mediaType:
previews: Set to["test-preview"], ensuringmediaType.previewsexists and has values.
format: Set to"raw", indicating raw data format.
-
Call the
endpoint.parse(options)function and record the time: Call theendpoint.parse(options)function and useperformance.now()to record the start and end times, measuring the execution duration. -
Calculate the time difference and output it: Compute the difference between the start and end times and output it using
<img width="800" alt="2" src="https://github.com/user-attachments/assets/9fc865a4-e150-42d5-bcd5-93ab6b0c29ef" />console.log. When the attack string length reaches 100000, the response time typically exceeds 10000 milliseconds, satisfying the characteristic condition for a ReDoS attack, where response times dramatically increase.
Impact
What kind of vulnerability is it?
This is a Regular Expression Denial of Service (ReDoS) vulnerability. It arises from inefficient regular expressions that can cause excessive backtracking when processing certain inputs. Specifically, the regular expression /[\w-]+(?=-preview)/g is vulnerable because it attempts to match long strings of characters followed by a hyphen (-), which leads to inefficient backtracking when provided with specially crafted attack strings. This backtracking results in high CPU utilization, causing the application to become unresponsive and denying service to legitimate users.
Who is impacted?
This vulnerability impacts any application that uses the affected regular expression in conjunction with user-controlled inputs, particularly where large or maliciously crafted strings can trigger excessive backtracking.
In addition to directly affecting applications using the @octokit/endpoint package, the impact is more widespread because @octokit/endpoint is a library used to wrap REST APIs, including GitHub's API. This means that any system or service built on top of this library that interacts with GitHub or other REST APIs could be vulnerable. Given the extensive use of this package in API communication, the potential for exploitation is broad and serious. The vulnerability could affect a wide range of applications, from small integrations to large enterprise-level systems, especially those relying on the package to handle API requests.
Attackers can exploit this vulnerability to cause performance degradation, downtime, and service disruption, making it a critical issue for anyone using the affected version of @octokit/endpoint.
Solution
To resolve the ReDoS vulnerability, the regular expression should be updated to avoid excessive backtracking. By modifying the regular expression to (?<![\w-])[\w-]+(?=-preview), we prevent the issue.
Here is how this change solves the problem:
- Old Regular Expression:
/[\w-]+(?=-preview)/g
- This regular expression matches any sequence of word characters (
\w) and hyphens (-) followed by-preview. - The issue arises when the regex engine encounters a long string of characters followed by a
-, causing excessive backtracking and high CPU usage.
- New Regular Expression:
(?<![\w-])[\w-]+(?=-preview)
- This updated regular expression uses a negative lookbehind
(?<![\w-]), ensuring that the matched string is not preceded by any word characters or hyphens (\wor-). - The new expression still matches sequences of word characters and hyphens, but the negative lookbehind ensures it doesn't cause backtracking issues when processing long attack strings.
- By adding this lookbehind, we effectively prevent the vulnerability, ensuring the regex operates efficiently without excessive backtracking.
Full Solution Example:
The specific code is located at the following link: https://github.com/octokit/endpoint.js/blob/main/src/parse.ts, at line 62:
- Update the Regular Expression: In the
parse.tsfile (or wherever the original regex is defined), replace the existing regular expression:
const previewsFromAcceptHeader =
headers.accept.match(/[\w-]+(?=-preview)/g) || ([] as string[]);
With the updated one:
const previewsFromAcceptHeader =
headers.accept.match(/(?<![\w-])[\w-]+(?=-preview)/g) || ([] as string[]);
- Test the Change: After updating the regular expression, thoroughly test the application with both regular and malicious inputs to ensure that:
- The functionality remains correct and the expected matches still occur.
- The performance improves and the ReDoS vulnerability no longer occurs when handling large attack strings.
- Deploy the Fix: Once the solution is verified, deploy the fix to your production environment to protect against potential attacks.
Affected Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| 📦npm | @octokit/endpoint | ≥ 9.0.5&&< 9.0.6 | 9.0.6npm install @octokit/endpoint@9.0.6 |
| 📦npm | @octokit/endpoint | ≥ 10.0.0&&< 10.1.3 | 10.1.3npm install @octokit/endpoint@10.1.3 |
Detection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for @octokit/endpoint, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.
Fix
Update @octokit/endpoint to 9.0.6 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms CVE-2025-25285 is resolved across your whole dependency graph.
Workarounds
If you can't upgrade right away: gate or disable the affected feature, validate untrusted input at the boundary, and avoid passing attacker-controlled data into the vulnerable path. O3's runtime protection blocks exploitation in production as an interim safeguard until the upgrade lands.
How O3 protects you
O3 Security's impact-aware SCA analyses which vulnerable code paths your application actually calls, so a match like CVE-2025-25285 can be triaged on real exposure rather than presence alone.
Tailored to CVE-2025-25285. Runtime protection reduces exposure until a permanent patch is applied and verified — it complements patching, it doesn't replace it.
Frequently Asked Questions
Is CVE-2025-25285 in your dependencies?
O3 Security finds CVE-2025-25285 across npm dependencies, including transitive ones, and its impact-aware SCA ranks findings by whether your code actually calls the vulnerable path.