# CVE-2017-20165: debug-js debug node.js useColors redos

> An attacker can cause a denial of service in the debug-js library by triggering inefficient regular expression complexity in the useColors function.

- **Severity:** Low 3.5 (`CVSS:3.1/AV:A/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:L`)
- **Exploited in the wild:** Not known
- **Login needed:** Any signed-in user
- **Attackable:** Local or same network only
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 9 Jan 2023
- **Updated:** 5 Aug 2024
- **Also known as:** CLSA-2026-1772928826, CLSA-2026-1773101692, CLSA-2026-1777077475, CLSA-2026-1777077476, CLSA-2026-1777077478, CLSA-2026-1777077479, CLSA-2026-1781484845, CLSA-2026-1784596327, CLSA-2026-1784682965, CLSA-2026-1784683087, CLSA-2026-1784769528, DEBIAN-CVE-2017-20165, GHSA-9vvw-cc9w-f27h, ROOT-APP-NPM-CVE-2017-20165, UBUNTU-CVE-2017-20165

## What is CVE-2017-20165?

CVE-2017-20165 is a low-severity denial of service vulnerability in debug-js debug, published on 9 Jan 2023. It can only be exploited from the same machine or local network, with no action from the victim.

### Official description

A vulnerability classified as problematic has been found in debug-js debug up to 3.0.x. This affects the function useColors of the file src/node.js. The manipulation of the argument str leads to inefficient regular expression complexity. Upgrading to version 3.1.0 is able to address this issue. The identifier of the patch is c38a0166c266a679c8de012d4eaccec3f944e685. It is recommended to upgrade the affected component. The identifier VDB-217665 was assigned to this vulnerability.

Weakness: CWE-1333 (Inefficient Regular Expression Complexity)

## Which versions are affected by CVE-2017-20165?

4 open source packages ship an affected version, including debug. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `debug` | npm | All versions | 2.6.9 |
| `debug` | npm | All versions | 2.6.9 |
| `debug` | npm | From 3.0.0 | 3.1.0 |
| `debug` | npm | From 3.0.0 | 3.1.0 |

Products: Debug Project Debug.

## How do I fix CVE-2017-20165?

Upgrade debug to a fixed version for your release line: 2.6.9 or 3.1.0.

## Is CVE-2017-20165 being exploited?

There is no known exploitation of CVE-2017-20165 in the wild and no public exploit code.

Public exploit code:

- Fork of the send module to deal with CVE-2017-20165 (github_poc): https://github.com/fastify/send

## Other vulnerabilities in debug-js debug

- [CVE-2017-16137](https://insights.sbomify.com/CVE-2017-16137/): Regular Expression Denial of Service in debug (medium 5.3)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2017-20165 and fix it if it is affected.

What it is: CVE-2017-20165 is a low-severity denial of service vulnerability in debug-js debug, published on 9 Jan 2023. It can only be exploited from the same machine or local network, with no action from the victim.
Exploitation: There is no known exploitation of CVE-2017-20165 in the wild and no public exploit code.

Affected packages and fixed versions:
- debug (npm): affected all versions; fixed in 2.6.9
- debug (npm): affected all versions; fixed in 2.6.9
- debug (npm): affected from 3.0.0; fixed in 3.1.0
- debug (npm): affected from 3.0.0; fixed in 3.1.0

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2017-20165/ (Markdown: https://insights.sbomify.com/CVE-2017-20165/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2017-20165
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2017-20165
- OSV: https://osv.dev/vulnerability/CVE-2017-20165

---
From sbomify Insights: https://insights.sbomify.com/CVE-2017-20165/
Summaries are generated and may contain mistakes; the official description above is the record.
