In-depth lesson · postMessage abuse
Typical fixes
Every point the postMessage abuse reports back under this heading, best-backed first, each with the reports it is seen in.
-
Do not allow a message handler to read a session token.
Seen in 23 reports
-
Check the message origin against an exact whitelist rather than a substring, prefix or regex match.
Seen in 3 reports
-
Do not pass message data to eval.
-
Do not assign message data to innerHTML; encode or sanitise it.
Seen in 2 reports
-
Validate that a URL from a message uses an HTTP or HTTPS scheme before assigning it to location.
-
Resolve a pathname from a message and check it stays under the intended prefix.
Seen in 2 reports
-
Do not allow a message handler to read or write cookies.
-
Do not trust the referrer as the message origin.
Seen in 1 report
-
Do not trust messages from the opener without checking its origin.
Seen in 1 report
-
Validate the origin on every message, not only the first.
Seen in 1 report
-
Escape all properties of a payload object, including inherited and read-only ones.
-
Reject invalid protocols in a path filter.
Seen in 1 report
-
Whitelist the target origin instead of accepting a user-supplied value.
Seen in 1 report
-
Do not pass attacker-controlled ajax parameters to jQuery.ajax.
-
Do not allow a route action to set arbitrary model data rendered as HTML.
Seen in 1 report
-
Do not combine allow-same-origin with a custom protocol that allows path traversal.
Seen in 1 report
-
Do not allow a message handler to execute arbitrary calls on an analytics object.
Seen in 1 report
-
Do not allow a message handler to invoke arbitrary methods by name.
Seen in 1 report
-
Do not allow a message handler to load an arbitrary script file as an extension.
Seen in 1 report
-
Do not allow a message handler to inject CSS into the page.
Seen in 1 report
-
Do not allow a message handler to set a map label with HTML.
Seen in 1 report
-
Do not allow a message handler to set an avatar URL parameter consumed by a widget.
Seen in 1 report
-
Do not allow a forged success message to win a race.
-
Do not allow a modal initialise message with an empty source.
Seen in 1 report
-
Do not allow a pushState message with an invalid protocol.
Seen in 1 report
-
Do not allow a call-popup redirect to an attacker domain.
-
Do not allow a WebSocket reconnect to leak a token.
Seen in 1 report
-
Do not allow a message handler to read files from a private repository.
-
Do not allow a message handler to leak the current user directory path.
Seen in 1 report
-
Do not allow a message handler to read contact form data.
-
Do not allow a message handler to read screenshots.
Seen in 1 report
-
Do not allow a message handler to read an OAuth code.
Seen in 1 report
-
Do not allow a message handler to read an OAuth access token.