Skip to content

In-depth lesson · technique

postMessage abuse

What every disclosed postMessage abuse report in the index teaches, put together: how it works, how it changed year by year, where it turns up, and things to try. Every point shows the reports it is seen in.

reports cited in this lesson
53

Learning Client-side in depth, step 2

Overview

What it is and why programs pay for it.

postMessage is the browser mechanism that lets windows, iframes, popups and extensions talk to each other across origins. Because it deliberately crosses origin boundaries, the receiving code has to decide for itself whether it trusts the sender and what it is willing to do with the data. When that decision is wrong, an attacker page can drive privileged functionality inside a victim's session. This lesson covers the reports in our database where that trust decision failed, across 55 reports, 21 of which were paid.

Programs care because the impact is often a full account compromise rather than a cosmetic bug. The evidence shows handlers that let an attacker read session tokens, OAuth codes and access tokens, cookies, private repository files, contact form data, screenshots and even NFTs. In several cases the result was account takeover or theft of assets with a single victim interaction.

It turns up wherever one component embeds another: checkout pages with analytics, maps and wallet dialogs, admin panels with pushState routing, chat widgets and contact forms, browser extensions, code editors and notebook renderers, single sign-on flows and sandboxed documents. The common thread is a page that receives messages and acts on them without a strict origin check or without validating the payload.

How it works

The mechanics, as the reports show them.

The page registers a message listener. Any window that can obtain a reference to it, typically by framing it or opening it, can send it a message. The listener receives the message data and the claimed origin of the sender, and then decides what to do.

The first failure is the origin check. Some handlers do not check at all. Others use a substring or prefix comparison, so a domain that merely contains or starts with the trusted string passes. Others use a regular expression where dots act as wildcards, or compare the origin to the referrer, which the opener controls. Some trust any message from the window that opened the page, or validate only the first message and trust everything after it.

The second failure is what the handler does with the data. Message fields get assigned to innerHTML, passed to eval, used as a URL for navigation without a scheme check, concatenated into an admin path without confirming it stays under the prefix, or used to invoke methods by name. Each of these turns a trusted message into script execution, redirection or access to privileged state.

The third failure is what the handler exposes. Handlers have been shown to return session tokens, cookies, OAuth codes and access tokens, private repository files and user directory paths. Sometimes the leak is a reply message, sometimes a redirect to an attacker domain, sometimes a token posted to a target origin the attacker can influence, including a wildcard.

Timing and edge cases matter. A forged success message sent before the legitimate one can win a race. An empty source in a modal message can bypass a check. A File object's read-only name property can slip past an escaping routine that only handles own properties. A path with an invalid protocol can bypass a path filter. These are the variations that turn a near miss into a working report.

Year by year

7 years

What each year's disclosed reports show, newest first. A year with few reports says less.

Reports per yearPeak 2026: 20
Reports per year
20141
20162
20175
20184
201912
202010
20216
20229
20237
20242
202514
202620
  1. 2024

    2 reports

    New this year3

    • Chained bugs with CSP bypass or DOM clobbering first appear clearly in the disclosed reports this year.
    • Abusing a DOM clobbering gadget via postMessage is first documented in the reports.
    • Reading an OAuth access token from an office productivity app via postMessage is first shown in the reports.

    Kept working5

    • Hunters found that message handlers in chat and collaboration apps could be abused to read session tokens, as shown in the reports.
    • A message handler in a code editor allowed reading a session token, according to the reports.
    and 3 more

    Turned up less3

    • The review widget token leak from 2023 does not appear in the 2024 reports.
    • The WordPress embed token leak from 2023 is not repeated in the 2024 reports.
    and 1 more
  2. 2023

    7 reports · median $3,134

    New this year3

    • Widgets and embedded iframes first feature prominently as targets in the disclosed reports this year.
    • Abusing cloud productivity apps via postMessage first appears clearly in the reports.
    • Injecting CSS through a message handler to capture input is first documented in the reports.

    Kept working4

    • A message handler in a review widget allowed reading a session token, according to the reports.
    • A message handler in a WordPress embed allowed reading a session token, as reported.
    and 2 more

    Turned up less3

    • The payment page token leak from 2022 does not appear in the 2023 reports.
    • The PDF viewer token leak from 2022 is not repeated in the 2023 reports.
    and 1 more
  3. 2022

    9 reports · median $1,600

    New this year3

    • Abusing notebooks and code editors via postMessage first appears clearly in the disclosed reports this year.
    • Sandboxed documents and iframes first feature as targets in the reports.
    • Reading or writing cookies through a message handler on a checkout page is first documented in the reports.

    Kept working4

    • Hunters found that message handlers on payment pages could be abused to read session tokens, as shown in the reports.
    • A message handler in a browser extension allowed reading a session token, according to the reports.
    and 2 more

    Turned up less3

    • The referrer-based origin bypass from 2021 does not appear in the 2022 reports.
    • The single sign-on flow token leak from 2021 is not repeated in the 2022 reports.
    and 1 more
Every point, year by year

Where it is found

44

The features and places the reports found it in, most-reported first.

  1. Marketo contact form iframe, including the HackerOne Marketo form.

    Seen in 4 reports
  2. Shopify admin themes page.

    Seen in 4 reports
  3. Shopify admin panel pushState handler.

    Seen in 3 reports
  4. Browser extensions.

    Seen in 1 report
  5. Chat applications.

    Seen in 1 report
View all 44

Root causes

36

The mistakes in the code or configuration behind the reports.

  1. A message handler allowed reading a session token.

    Seen in 23 reports
  2. The handler did not check the origin of incoming messages at all.

    Seen in 11 reports
  3. The origin check used a substring or prefix match instead of an exact comparison.

    Seen in 2 reports
  4. Message data was assigned to innerHTML without sanitisation.

    Seen in 2 reports
View all 36

Things to try

The most-reported tests in the largest contexts. Tick what you have tried; ticks stay in this browser and carry over to the full checklist. Test only what a program's scope allows.

ticked in this lesson

Session token theft from third-party sites

of 3 ticked
  • Seen in 5 reports
  • Seen in 3 reports
  • Seen in 3 reports
More in Session token theft from third-party sites

HTML and script injection via message data

of 3 ticked
More in HTML and script injection via message data

Browser extensions and sandboxed documents

of 3 ticked
More in Browser extensions and sandboxed documents

Origin validation bypass

of 3 ticked
More in Origin validation bypass
View more things to try

Bypasses and variations

32

How reports got past filters, encoders and other defences.

  1. A message handler allowed reading a session token.

    Seen in 23 reports
  2. A path with parent directory segments escaped the admin prefix.

    Seen in 2 reports
  3. A message handler allowed reading or writing cookies.

    Seen in 2 reports
  4. A domain whose name begins with the trusted origin string passed a prefix check.

    Seen in 1 report
  5. A domain containing the trusted origin string anywhere passed a substring check.

    Seen in 1 report
View all 32

Payouts

28 paid

Public bounties in US dollars, from the data. 28 of 121 reports show an amount.

a quarter paid up to
$500
median
$1,500
three quarters paid up to
$3,600
highest
$63k

One in ten paid reports was paid $10k or more.

SeverityReportsPaidMedianHighest
Critical 1 0 None paid None
High 10 4 $1,750 $5,000
Medium 14 3 $500 $1,600
Low 11 6 $500 $500
Unrated 85 15 $3,000 $63k

Typical fixes

33

How programs fixed it, as the reports describe.

  1. Do not allow a message handler to read a session token.

    Seen in 23 reports
  2. Check the message origin against an exact whitelist rather than a substring, prefix or regex match.

    Seen in 3 reports
  3. Do not assign message data to innerHTML; encode or sanitise it.

    Seen in 2 reports
  4. Validate that a URL from a message uses an HTTP or HTTPS scheme before assigning it to location.

    Seen in 2 reports
View all 33

Tips for beginners

12

Advice for a first hunt, drawn from the reports.

  1. Write the report around the root cause and the fix: exact origin whitelist, no eval, encode before innerHTML, scheme validation, path prefix checks, no cookie access, validate every message. This helps triage and shows you understand the bug.

    Seen in 7 reports
  2. Check what the handler will hand back. Session tokens, cookies, OAuth codes, access tokens, private files and directory paths have all been leaked through message replies or redirects. That is usually the strongest impact you can show.

    Seen in 6 reports
  3. Read the listener code and ask two questions: does it check the origin exactly, and what does it do with the data. A missing check, a substring or prefix match, a regex with dots, or a referrer comparison are all findings worth pursuing.

    Seen in 5 reports
  4. Follow the data. If a field reaches innerHTML, eval, a location assignment, a path concatenation or a method lookup, work out whether you can turn that into script execution, redirection or access to privileged state.

    Seen in 5 reports
  5. Start where components are embedded: checkout pages, admin panels, chat widgets, contact forms, browser extensions and code editors. Look for iframes and popups and note which origins they talk to.

    Seen in 4 reports
View all 12

Guides and techniques

The best explainers, cheat sheets and technique posts on postMessage abuse, from around the web.

Keep learning

Where this lesson fits, and what to read next.

How this is made: our model read every listed postMessage abuse report in the index (our own summary where we have one, otherwise the title and the platform's label), listed the patterns, and merged them. Each point was kept only if the reports it cites exist, are listed and belong here; payouts are computed from the data, not written by the model. Read the originals before relying on a point. Generated 26 Nov 2026 from 55 reports. All postMessage abuse reports.