ReDoS-example

there is 6 vulnerabilities

  1. ReDoS in index.vuln.js line 30
const regex1 = RegExp('(x+x+)+y','g');
const str1 = req.body.msg;

let matchedStrings = regex1.exec(str1);
res.end(matchedStrings)
  1. ReDoS in index.vuln.js line 39
const regex1 = RegExp(req.body.word,'g');
const str1 = 'table football, foosball';

let matchedStrings = regex1.exec(str1);
res.end(matchedStrings)
  1. ReDoS in index.vuln.js line 48
const regex1 = RegExp('(x+x+)+y','g');
const str1 = 'table football, foosball';

let matchedStrings = regex1.exec(str1);
res.end(matchedStrings)
  1. ReDoS in index.vuln.ts line 29
const regex1 = RegExp('(x+x+)+y','g');
const str1 = req.body.msg;

let matchedStrings = regex1.exec(str1);
res.end(matchedStrings)
  1. ReDoS in index.vuln.ts line 38
const regex1 = RegExp(req.body.word,'g');
const str1 = 'table football, foosball';

let matchedStrings = regex1.exec(str1);
res.end(matchedStrings)
  1. ReDoS in index.vuln.ts line 47
const regex1 = RegExp('(x+x+)+y','g');
const str1 = 'table football, foosball';

let matchedStrings = regex1.exec(str1);
res.end(matchedStrings)