pentesting, updated
Test web messaging
Check whether postMessage handlers validate the sender's origin and the message content.
Goal
Confirm every message event listener checks event.origin before trusting event.data.
How to test
Search the page’s JS for the listener and check its origin handling:
curl -s https://example.com/app.js | grep -n "addEventListener(\"message\""
If event.origin isn’t checked (or checked loosely, e.g. with .includes() instead of an exact match), build a PoC page that posts a crafted message to the target in an iframe/popup.
What to look for
A message handler that trusts event.data without verifying event.origin, or checks it with a bypassable comparison.
References
- OWASP WSTG-CLNT-10 — Test Web Messaging.