Описание
@octokit/plugin-paginate-rest has a Regular Expression in iterator Leads to ReDoS Vulnerability Due to Catastrophic Backtracking
Summary
For the npm package @octokit/plugin-paginate-rest
, when calling octokit.paginate.iterator()
, a specially crafted octokit
instance—particularly with a malicious link
parameter in the headers
section of the request
—can trigger a ReDoS attack.
Details
The issue occurs at line 39 of iterator.ts in the @octokit/plugin-paginate-rest repository. The relevant code is as follows:
The regular expression /<([^>]+)>;\s*rel="next"/
may lead to a potential backtracking vulnerability, resulting in a ReDoS (Regular Expression Denial of Service) attack. This could cause high CPU utilization and even service slowdowns or freezes when processing specially crafted Link
headers.
PoC
- run npm i @octokit/plugin-paginate-rest
- run 'node poc.js' result:
- then the program will stuck forever with high CPU usage
Impact
What kind of vulnerability is it?
This is a Regular Expression Denial of Service (ReDoS) vulnerability, which occurs due to excessive backtracking in the regex pattern:
When processing a specially crafted Link
header, this regex can cause significant performance degradation, leading to high CPU utilization and potential service unresponsiveness.
Who is impacted?
- Users of
@octokit/plugin-paginate-rest
who calloctokit.paginate.iterator()
and process untrusted or manipulatedLink
headers. - Applications relying on Octokit's pagination mechanism, particularly those handling large volumes of API requests.
- GitHub API consumers who integrate this package into their projects for paginated data retrieval.
Ссылки
- https://github.com/octokit/plugin-paginate-rest.js/security/advisories/GHSA-h5c3-5r3r-rr8q
- https://nvd.nist.gov/vuln/detail/CVE-2025-25288
- https://github.com/octokit/plugin-paginate-rest.js/commit/bb6c4f945d8023902cf387391d2b2209261044ab
- https://github.com/octokit/plugin-paginate-rest.js/blob/main/src/iterator.ts
- https://github.com/octokit/plugin-paginate-rest.js/releases/tag/v9.2.2
Пакеты
@octokit/plugin-paginate-rest
>= 9.3.0-beta.1, < 11.4.1
11.4.1
@octokit/plugin-paginate-rest
>= 1.0.0, < 9.2.2
9.2.2
Связанные уязвимости
@octokit/plugin-paginate-rest is the Octokit plugin to paginate REST API endpoint responses. For versions starting in 1.0.0 and prior to 11.4.1 of the npm package `@octokit/plugin-paginate-rest`, when calling `octokit.paginate.iterator()`, a specially crafted `octokit` instance—particularly with a malicious `link` parameter in the `headers` section of the `request`—can trigger a ReDoS attack. Version 11.4.1 contains a fix for the issue.
@octokit/plugin-paginate-rest is the Octokit plugin to paginate REST API endpoint responses. For versions starting in 1.0.0 and prior to 11.4.1 of the npm package `@octokit/plugin-paginate-rest`, when calling `octokit.paginate.iterator()`, a specially crafted `octokit` instance—particularly with a malicious `link` parameter in the `headers` section of the `request`—can trigger a ReDoS attack. Version 11.4.1 contains a fix for the issue.