跨域资源共享(CORS)
1.CORS 漏洞与基本源反射
登陆网站,burp查看历史记录,寻找到返回apikey的accountdetails
此时受害者已经登陆正常网站,浏览器留下可复用的cookie


在请求头添加origin,允许下面网站代表受害者跨域访问正常网站
Origin: https://example.com

返回
Access-Control-Allow-Origin:https://example.com
Access-Control-Allow-Credentials: true
说明正常网站接受携带cookie跨域
利用脚本,攻击网站https://example.com跨域访问正常网站获得受害者apikey

2.CORS漏洞与可信空源
burp历史记录,在accountdetails找到apikey和Access-Control-Allow-Credentials: true
表示可能存在cors
首先请求头添加Origin: https://example.com
返回缺少Access-Control-Allow-Origin: https://example.com ,服务器不信任网站源跨域
换成:Origin: null
返回
Access-Control-Allow-Origin: null
Access-Control-Allow-Credentials: true
apikey
说明目标网站信任null源
所以设计脚本,使用sandbox,使iframe内部代码变成null源,绕过同源策略

浙公网安备 33010602011771号