Vulnerabilities in pkg:npm/@octokit/request-error

PACKAGE
Advisory Identifier: GHSA-xx4v-prfh-6cgc
Advisory Summary

CVE-2025-25289 is a MODERATE (CVSS 5.3) denial of service vulnerability (CWE-1333: Inefficient Regular Expression Complexity) affecting @octokit/request error libraries in the npm ecosystem. The issue involves @octokit/request-error has a regular expression in index that leads to redos vulnerability due to catastrophic backtracking. Remediation is available by upgrading affected packages to version 5.1.1, 6.1.7.

1 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:npm/@octokit/request-error

1 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:npm/@octokit/request-error. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-xx4v-prfh-6cgc CVE-2025-25289 MODERATE @octokit/request-error has a Regular Expression in index that Leads to ReDoS Vulnerability Due to Catastrophic Backtracking

CVE-2025-25289 at a Glance

CVE Identifier CVE-2025-25289
GHSA Identifier GHSA-xx4v-prfh-6cgc
Severity MODERATE
CVSS v3.1 Base Score 5.3
CWE Classification CWE-1333: Inefficient Regular Expression Complexity
Affected Product @octokit/request error
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 5.3

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity None (I:N)
Availability Low (A:L)

How to Fix CVE-2025-25289

To remediate this vulnerability, upgrade all affected @octokit/request error dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

@octokit/request-error fixed: 5.1.1
npm install @octokit/request-error@5.1.1
@octokit/request-error fixed: 6.1.7
npm install @octokit/request-error@6.1.7
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls @octokit/request-error

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2025-25289, inspect your project dependencies using npm:

npm ls @octokit/request-error

Analyze the terminal output to locate any version of @octokit/request error in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 5.1.1), your application is affected.

Note: The npm ls @octokit/request-error command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-1333: Inefficient Regular Expression Complexity, where the product uses a regular expression with a worst-case computational complexity that is inefficient and possibly exponential. In @octokit/request error, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Summary A Regular Expression Denial of Service (ReDoS) vulnerability exists in the processing of HTTP request headers. By sending an authorization header containing an excessively long sequence of spaces followed by a newline and "@", an attacker can exploit inefficient regular expression processing, leading to excessive resource consumption. This can significantly degrade server performance or cause a denial-of-service (DoS) condition, impacting availability. ### Details The issue occurs at [line 52](https://github.com/octokit/request-error.js/blob/main/src/index.ts) of iterator.ts in the @octokit/request-error repository. The vulnerability is caused by the use of an inefficient regular expression in the handling of the `authorization` header within the request processing logic: ```js authorization: options.request.headers.authorization.replace( / .*$/, " [REDACTED]" ) ``` The regular expression `/ .*$/` matches a space followed by any number of characters until the end of the line. This pattern is vulnerable to Regular Expression Denial of Service (ReDoS) when processing specially crafted input. Specifically, an attacker can send an `authorization` header containing a long sequence of spaces followed by a newline and "@", such as: ```js headers: { authorization: "" + " ".repeat(100000) + "\n@", } ``` Due to the way JavaScript's regular expression engine backtracks while attempting to match the space followed by arbitrary characters, this input can cause excessive CPU usage, significantly slowing down or even freezing the server. This leads to a denial-of-service condition, impacting availability. ### PoC [The gist of PoC.js](https://gist.github.com/ShiyuBanzhou/e1203ad22701fd043b8501eb37676a0d) 1. run npm i @octokit/request-error 2. run 'node poc.js' result: 3. then the program will stuck forever with high CPU usage ```js import { RequestError } from "@octokit/request-error"; const error = new RequestError("Oops", 500, { request: { method: "POST", url: "https://api.github.com/foo", body: { bar: "baz", }, headers: { authorization: ""+" ".repeat(100000)+"\n@", }, }, response: { status: 500, url: "https://api.github.com/foo", headers: { "x-github-request-id": "1:2:3:4", }, data: { foo: "bar", }, }, }); ``` ### Impact #### Vulnerability Type & Impact: This is a `Regular Expression Denial of Service (ReDoS) vulnerability`, which occurs due to an inefficient regular expression (`/ .*$/`) used to sanitize the `authorization` header. An attacker can craft a malicious input that triggers excessive backtracking in the regex engine, leading to high CPU consumption and potential denial-of-service (DoS). #### Who is Impacted? * Projects or services using this code to process HTTP headers are vulnerable. * Applications that rely on user-supplied `authorization` headers are at risk, especially those processing a large volume of authentication requests. * Multi-tenant or API-driven platforms could experience degraded performance or service outages if exploited at scale.

CVE-2025-25289 Affected @octokit/request error Versions

2 component(s)
Fixed Versions:
5.1.16.1.7
Product / Package Ecosystem Affected Versions Fixed Version
@octokit/request-error
npm
≥ 1.0.0
< 5.1.1
5.1.1
@octokit/request-error
npm
≥ 6.0.0
< 6.1.7
6.1.7

References

Frequently Asked Questions

What is CVE-2025-25289?
CVE-2025-25289 is a security vulnerability in @octokit/request error involving @octokit/request-error has a Regular Expression in index that Leads to ReDoS Vulnerability Due to Catastrophic Backtracking under CWE-1333: Inefficient Regular Expression Complexity.
Which @octokit/request error versions are affected?
Affected versions include releases prior to 5.1.1, 6.1.7 across affected packages: @octokit/request-error.
What version fixes CVE-2025-25289?
Upgrading to 5.1.1, 6.1.7 (or the latest patched release for your respective branch) resolves the vulnerability.
Is @octokit/request-error affected?
Yes, @octokit/request-error is affected in releases prior to 5.1.1, 6.1.7. Upgrade your dependency to 5.1.1, 6.1.7 or later.
What is the CVSS score of CVE-2025-25289?
CVE-2025-25289 has a CVSS v3.1 base score of 5.3 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L.
What CWE is associated with CVE-2025-25289?
CVE-2025-25289 is classified under CWE-1333: Inefficient Regular Expression Complexity (The product uses a regular expression with a worst-case computational complexity that is inefficient and possibly exponential.).
How can I check npm dependencies for CVE-2025-25289?
Run the dependency tree command: 'npm ls @octokit/request-error'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-xx4v-prfh-6cgc",
  "modified" : "2025-02-14T23:07:29Z",
  "published" : "2025-02-14T17:58:54Z",
  "aliases" : [ "CVE-2025-25289" ],
  "summary" : "@octokit/request-error has a Regular Expression in index that Leads to ReDoS Vulnerability Due to Catastrophic Backtracking",
  "details" : "### Summary\nA Regular Expression Denial of Service (ReDoS) vulnerability exists in the processing of HTTP request headers. By sending an authorization header containing an excessively long sequence of spaces followed by a newline and \"@\", an attacker can exploit inefficient regular expression processing, leading to excessive resource consumption. This can significantly degrade server performance or cause a denial-of-service (DoS) condition, impacting availability.\n### Details\nThe issue occurs at [line 52](https://github.com/octokit/request-error.js/blob/main/src/index.ts) of iterator.ts in the @octokit/request-error repository.\nThe vulnerability is caused by the use of an inefficient regular expression in the handling of the `authorization` header within the request processing logic:\n```js\nauthorization: options.request.headers.authorization.replace(\n  / .*$/, \n  \" [REDACTED]\"\n)\n```\nThe regular expression `/ .*$/` matches a space followed by any number of characters until the end of the line. This pattern is vulnerable to Regular Expression Denial of Service (ReDoS) when processing specially crafted input. Specifically, an attacker can send an `authorization` header containing a long sequence of spaces followed by a newline and \"@\", such as:\n```js\nheaders: {\n  authorization: \"\" + \" \".repeat(100000) + \"\\n@\",\n}\n```\nDue to the way JavaScript's regular expression engine backtracks while attempting to match the space followed by arbitrary characters, this input can cause excessive CPU usage, significantly slowing down or even freezing the server. This leads to a denial-of-service condition, impacting availability.\n### PoC\n[The gist of PoC.js](https://gist.github.com/ShiyuBanzhou/e1203ad22701fd043b8501eb37676a0d)\n1. run npm i @octokit/request-error\n2. run 'node poc.js'\nresult:\n3. then the program will stuck forever with high CPU usage\n```js\nimport { RequestError } from \"@octokit/request-error\";\n\nconst error = new RequestError(\"Oops\", 500, {\n  request: {\n    method: \"POST\",\n    url: \"https://api.github.com/foo\",\n    body: {\n      bar: \"baz\",\n    },\n    headers: {\n      authorization: \"\"+\" \".repeat(100000)+\"\\n@\",\n    },\n  },\n  response: {\n    status: 500,\n    url: \"https://api.github.com/foo\",\n    headers: {\n      \"x-github-request-id\": \"1:2:3:4\",\n    },\n    data: {\n      foo: \"bar\",\n    },\n  },\n});\n```\n\n### Impact\n#### Vulnerability Type & Impact:\nThis is a `Regular Expression Denial of Service (ReDoS) vulnerability`, which occurs due to an inefficient regular expression (`/ .*$/`) used to sanitize the `authorization` header. An attacker can craft a malicious input that triggers excessive backtracking in the regex engine, leading to high CPU consumption and potential denial-of-service (DoS).\n#### Who is Impacted?\n* Projects or services using this code to process HTTP headers are vulnerable.\n* Applications that rely on user-supplied `authorization` headers are at risk, especially those processing a large volume of authentication requests.\n* Multi-tenant or API-driven platforms could experience degraded performance or service outages if exploited at scale.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "@octokit/request-error"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.0.0"
      }, {
        "fixed" : "5.1.1"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "@octokit/request-error"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "6.0.0"
      }, {
        "fixed" : "6.1.7"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/octokit/request-error.js/security/advisories/GHSA-xx4v-prfh-6cgc"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2025-25289"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/octokit/request-error.js/commit/d558320874a4bc8d356babf1079e6f0056a59b9e"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/octokit/request-error.js"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/octokit/request-error.js/blob/main/src/index.ts"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-1333" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2025-02-14T17:58:54Z",
    "nvd_published_at" : "2025-02-14T20:15:35Z"
  }
}