ReDos

ReDos

The Regular expression Denial of Service (ReDoS) is a Denial of Service attack, that exploits the fact that most Regular Expression implementations may reach extreme situations that cause them to work very slowly (exponentially related to input size). An attacker can then cause a program using a Regular Expression (Regex) to enter these extreme situations and then hang for a very long time. (More Info)

Blind Regex Injection

Take the following code as an example:

const regExp = require('time-limited-regular-expressions')({ limit: 2 });

app.get("/",(req,res)=>{
	return res.render("index.html");
});
app.get("/license",(req,res)=>{
	return res.render("license.html");
});
const checkLicense = async (license) => {
    try {
        const match = await regExp.match(license, process.env.FLAG)
        return !!match;
    } catch (error) {
        return false;
    }
}

Exploit Code

Last updated