Client-Side JavaScript Validation Bypass
Investigation
// validation.js
function validate() {
let username = document.getElementById("username").value;
let password = document.getElementById("password").value;
// Change the username input if it contains "admin" to confuse attackers.
username = username.replace(/admin/g, "noob");
// If the input value of the username/password are both "admin", we can bypass this validation.
if (username === "admin" && password === "admin") {
return true;
}
return false;
}Exploitation
Last updated