Google Docs postMessage Bug: Hijacked Feedback Screenshots
The Google Docs Send Feedback widget sent a screenshot of the document to a wildcard target origin, so any page that could swap the feedback frame would receive it. An attacker could embed a document, wait for the victim to open Send Feedback, replace the feedback frame with their own page, and capture the screenshot when the victim clicked Send.
medium.com
Published on medium.com
Bug Bounty
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Context
Google's Send Feedback widget lives on www.google.com and is embedded into products such as Google Docs through iframes. When a user opens it, Docs passes the page's pixels across origins with postMessage, a sandboxed Google domain renders them into an image, and on Send the screenshot and description travel back to the feedback frame.

AI-generated illustration
The case study below covers a 2020 disclosure by Sreeram KL: a cross-origin data leak in that shared widget, in which a wildcard target origin let an outside page receive a screenshot of a private document instead of Google. It was reported to Google's Vulnerability Reward Program and, per press coverage, earned $3,133.70. The bug was fixed in 2020, and reproduction details are intentionally omitted from the write-up.
Setup
The attack required two preconditions:
- The victim visits a hostile page controlled by the attacker.
- The victim opens Send Feedback inside an embedded Google Docs document and clicks Send.
No accounts, tools or versions are described beyond this. The report notes that the vulnerability is a cross-origin data leak through postMessage with a wildcard target origin, combined with a navigable cross-origin iframe. It maps analytically to CWE-345 (Insufficient Verification of Data Authenticity) and CWE-1021 (Improper Restriction of Rendered UI Layers). No CVE was reported, and severity and CVSS were not reported either.
Finding it
Most of the messages exchanged between Docs and the feedback frame named their exact destination origin. That meant redirecting a frame elsewhere got nothing: the browser would refuse to deliver a message whose target origin did not match the receiving window.
The final submit message did not follow that pattern. Its target origin was the wildcard *, meaning "deliver to whoever is in this window now." That single asterisk decided who received a screenshot of the private document.
The second ingredient was a browser rule: a page that embeds a document can change the location of frames nested inside it, provided the embedded page allows framing. Docs allowed framing. Together, the wildcard target and the navigable nested frame were enough to redirect the screenshot.
Exploitation
Step 1: Embed a Google Docs document
The attacker hosts a malicious page that embeds a Google Docs document in an iframe. Because Docs permits framing, the embed succeeds.
Step 2: Wait for the victim to open Send Feedback
The victim interacts with the embedded document and opens the Send Feedback widget, which loads the feedback frame inside the document.
Step 3: Swap the feedback frame
From the embedding page, the attacker changes the location of the nested feedback frame to a page the attacker controls. The browser permits this because the embedded page allows framing.
Step 4: Receive the screenshot on Send
When the victim clicks Send, the submit message is posted with the wildcard target origin. The browser delivers it to whatever document currently occupies that window, which is now the attacker's page. The attacker receives the screenshot and description.
The report does not include the specific URLs, parameters, headers or message payloads used in these steps; it states that reproduction details are intentionally omitted.
Root cause
The submit message used * as its target origin. A wildcard target is a broadcast, not a delivery: the browser hands the message to whichever document is in the target window at that moment, with no check that the recipient is the intended Google origin.
The existing defence, naming exact origins on the other messages, did not cover the submit path. The framing policy also failed to prevent the attack: because Docs allowed framing, an attacker could wrap the document and steer the nested feedback frame to a different location. The report does not state whether the receiving side verified event.origin or event.source at the time.
Impact
Feedback screenshots capture whatever is on screen: contracts, financials, internal plans. An attacker who convinces a victim to visit a hostile page and use Send Feedback on an embedded document can receive that screenshot and the accompanying description.
The attack was not silent in the sense that it required victim interaction, but the user had no visible sign that the data went anywhere other than Google. The report does not state which document types or accounts were affected beyond private documents in Docs.
Fix
It presents the following as the defensive measures for this class of bug:
- Never send sensitive data with a wildcard target. Name the exact origin, every time.
- Verify on receipt. Receivers must check
event.originandevent.sourcebefore trusting a message. - Limit who can frame you. A
frame-ancestorspolicy stops hostile pages from wrapping your app and steering nested frames. - Audit shared widgets centrally. One component embedded across many products multiplies one mistake.
The report includes this illustrative pattern for both ends of the exchange:
const FEEDBACK_ORIGIN = "https://feedback.example.com";function submitFeedback(frame, payload) { frame.contentWindow.postMessage(payload, FEEDBACK_ORIGIN); }window.addEventListener("message", (event) => { if (event.origin !== FEEDBACK_ORIGIN) return; if (event.source !== feedbackFrame.contentWindow) return; handleFeedbackReply(event.data);});
Variants to test
- Wildcard target on any submit or data-bearing message. Search client code for
postMessage(calls whose second argument is"*". A positive result is a message that carries document content, screenshots or tokens and is delivered to whatever window is present. - Navigable nested frames. Embed a product page that allows framing and try to change the location of frames it creates. A positive result is a nested frame you can redirect to your own origin.
- Missing receiver checks. Send messages to a widget from an unexpected origin and observe whether it acts on them. A positive result is a reply or state change without an
event.originandevent.sourcecheck. - Shared widgets across products. Test the same feedback or support component wherever it is embedded. A positive result is the same wildcard or framing weakness appearing in more than one product.
- Framing policy gaps. Check for
frame-ancestorson pages that embed sensitive widgets. A positive result is a page that can be framed by an attacker origin and that hosts a nested frame the attacker can steer.
What happened, in plain words
Google Docs is Google's online word processor: you write a document in a browser tab and Google stores it on its servers. Like most Google products, it has a Send Feedback button. When you click it, a small panel opens where you can describe a problem and, importantly, attach a picture of what you were looking at. That picture is a screenshot: a copy of the pixels currently visible on your screen.
In 2020, a researcher named Sreeram KL found a flaw in that feedback panel. Under the right conditions, the screenshot of your private document could be delivered to a page controlled by an attacker instead of to Google. The report was sent to Google's Vulnerability Reward Program, the scheme through which Google pays people for reporting security bugs, and press coverage put the reward at $3,133.70. The bug was fixed in 2020.
The whole thing hinged on a single asterisk: the wildcard * used as the destination of a message. This article walks through what that means, why it mattered, and what defenders should take from it, assuming you know nothing about web security beyond using a browser.

AI-generated illustration
The pieces you need to know first
Before the story makes sense, here are the building blocks, each explained from zero.
A web page is a program. When your browser loads a page, it downloads text (HTML), styling (CSS) and code (JavaScript) and runs that code on your computer. JavaScript is the language that makes pages interactive: buttons respond, panels open, data is fetched.
An origin is the combination of protocol, hostname and port that a page came from, for example https://www.google.com. The browser treats each origin as a separate security zone. Code from one origin is not normally allowed to read data belonging to another. This rule is called the same-origin policy, and it is the main wall that stops a random website from reading your email.
An iframe (inline frame) is a window inside a window. A page can embed another page inside a rectangular area of itself using an <iframe> tag. The outer page is often called the parent or embedder; the inner page is the embedded page. The two are still separate origins, so the same-origin policy applies between them.
postMessage is the browser feature that lets those separate windows talk to each other despite the same-origin policy. One window calls postMessage(data, targetOrigin): it hands data to another window, and targetOrigin says which origin is allowed to receive it. The receiving window listens for a message event and reads the data from it. Think of it as posting a letter through a slot: you choose the address, and the building decides who opens it.
A wildcard target origin is the value * in place of a real address. It means "deliver this to whoever is in that window right now, no questions asked." It is the difference between addressing an envelope to a named person and leaving it on a park bench for whoever walks past.
A cross-origin data leak is the general name for this kind of bug: information that should stay inside one origin ends up readable by another. Here the information is a screenshot.
CWE stands for Common Weakness Enumeration, a public catalogue that gives numbers to classes of software weakness, so people can talk about them consistently. The write-up maps this bug to CWE-345 (Insufficient Verification of Data Authenticity: the code does not properly check that data really came from where it claims) and CWE-1021 (Improper Restriction of Rendered UI Layers: the page does not properly control how its interface can be embedded or overlaid). That mapping is the author's analysis, not something taken from the original research.
CVE stands for Common Vulnerabilities and Exposures, a numbering system for individually tracked vulnerabilities. No CVE was reported for this bug. Severity and CVSS (a standard 0 to 10 scoring system for how serious a vulnerability is) were not reported either.
The setup the attack needed
The attack required two preconditions:
- The victim visits a hostile page controlled by the attacker.
- The victim opens Send Feedback inside an embedded Google Docs document and clicks Send.
No accounts, tools or versions are described beyond this. The vulnerability is a cross-origin data leak through postMessage with a wildcard target origin, combined with a navigable cross-origin iframe. "Navigable" here means the attacker can change where that inner frame points.
Why does the first condition matter? Because the attacker needs a page of their own that the victim will load in a browser. Why the second? Because the screenshot is only produced when a real person uses the feedback feature on a real document. The attacker cannot trigger it alone; the victim has to do the clicking.
How the feedback widget works
Google's Send Feedback widget lives on www.google.com and is embedded into products such as Google Docs through iframes. When a user opens it, Docs passes the page's pixels across origins with postMessage, a sandboxed Google domain renders them into an image, and on Send the screenshot and description travel back to the feedback frame.
Unpack that sentence by sentence, because it contains the whole architecture:
- The feedback panel is not built into Docs. It is a separate Google page, hosted on
www.google.com, that Docs pulls in as an iframe. One widget, reused across many products. - When you open the panel, Docs has to get the picture of your document to that separate page. It does so with
postMessage, because the two pages are different origins and cannot simply read each other's data. - The receiving page turns those pixels into an image.
- When you press Send, the screenshot and your written description travel back to the feedback frame.
So there are two directions of traffic: pixels going out to the widget, and the finished screenshot plus description coming back.
Finding it
Most of the messages exchanged between Docs and the feedback frame named their exact destination origin. That meant redirecting a frame elsewhere got nothing: the browser would refuse to deliver a message whose target origin did not match the receiving window.
This is the key defensive idea, and it is worth restating in everyday terms. If you address a letter to a specific person, and a different person is standing where that person used to be, the postal service will not hand it over. The browser does the same: postMessage(data, "https://www.google.com") will only be delivered if the window on the other end really is a https://www.google.com page. Redirect that frame to https://attacker.example and the message is dropped.
The final submit message did not follow that pattern. Its target origin was the wildcard *, meaning "deliver to whoever is in this window now." That single asterisk decided who received a screenshot of the private document.
The second ingredient was a browser rule: a page that embeds a document can change the location of frames nested inside it, provided the embedded page allows framing. Docs allowed framing. Together, the wildcard target and the navigable nested frame were enough to redirect the screenshot.
Why does the browser allow the outer page to move an inner frame? Because the outer page created that frame; it is the frame's parent. The parent is allowed to tell its child where to go, provided the child's page allows framing. The restriction is on the other side: a page can refuse to be embedded at all, and if it does, the parent cannot load it in the first place. Docs did not refuse, so the parent kept its power to redirect the nested feedback frame.
Exploitation, step by step
Step 1: Embed a Google Docs document
The attacker hosts a malicious page that embeds a Google Docs document in an iframe. Because Docs permits framing, the embed succeeds.
Why this step?
Step 2: Wait for the victim to open Send Feedback
The victim interacts with the embedded document and opens the Send Feedback widget, which loads the feedback frame inside the document.
Why this step? The feedback frame does not exist until the user opens the panel. This is also why the bug needed victim interaction: it was not something that fired on its own.
Step 3: Swap the feedback frame
From the embedding page, the attacker changes the location of the nested feedback frame to a page the attacker controls. The browser permits this because the embedded page allows framing.
Why this step? This is the substitution trick. The window that was supposed to hold Google's feedback page now holds the attacker's page. Everything else stays the same: the victim still sees a document, still has a Send button, and has no obvious reason to suspect that the panel behind it has changed hands.
Step 4: Receive the screenshot on Send
When the victim clicks Send, the submit message is posted with the wildcard target origin. The browser delivers it to whatever document currently occupies that window, which is now the attacker's page. The attacker receives the screenshot and description.
Why does this work? Because of the asterisk. A named origin would have caused the browser to check the recipient and drop the message, since the recipient is no longer Google. The wildcard skips that check entirely. The message is handed to the impostor, screenshot and description included.
The report does not include the specific URLs, parameters, headers or message payloads used in these steps; it states that reproduction details are intentionally omitted.
Why it worked: the root cause
The submit message used * as its target origin. A wildcard target is a broadcast, not a delivery: the browser hands the message to whichever document is in the target window at that moment, with no check that the recipient is the intended Google origin.
That distinction between broadcast and delivery is the heart of the bug. A broadcast is fine for public information that any listener may see. It is not fine for a screenshot of a contract. The moment the data is sensitive, the destination has to be named.
The existing defence, naming exact origins on the other messages, did not cover the submit path. This is a common pattern in real bugs: the team got most of it right, and one message was missed. Security is only as strong as the least careful line of code on the path that carries the secret.
The framing policy also failed to prevent the attack: because Docs allowed framing, an attacker could wrap the document and steer the nested feedback frame to a different location. The report does not state whether the receiving side verified event.origin or event.source at the time.
Those two properties, event.origin and event.source, are the receiver's side of the same defence. When a message event arrives, the browser tells the listener which origin sent it (event.origin) and which window sent it (event.source). A careful receiver checks both before acting on the contents. Defence in depth means having both ends covered, so one mistake is not enough to leak data.
What was at risk
Feedback screenshots capture whatever is on screen: contracts, financials, internal plans. An attacker who convinces a victim to visit a hostile page and use Send Feedback on an embedded document can receive that screenshot and the accompanying description.
The attack was not silent in the sense that it required victim interaction, but the user had no visible sign that the data went anywhere other than Google. That is the uncomfortable part. The victim did everything they were supposed to do: opened a document, clicked feedback, wrote a description, pressed Send. Nothing on screen said the picture was going somewhere else. The report does not state which document types or accounts were affected beyond private documents in Docs.
How to prevent this class of bug
It presents the following as the defensive measures for this class of bug:
- Never send sensitive data with a wildcard target. Name the exact origin, every time.
- Verify on receipt. Receivers must check
event.originandevent.sourcebefore trusting a message. - Limit who can frame you. A
frame-ancestorspolicy stops hostile pages from wrapping your app and steering nested frames. - Audit shared widgets centrally. One component embedded across many products multiplies one mistake.
A word on point 3: frame-ancestors is a directive in a Content Security Policy, a set of rules a server sends with a page telling the browser what that page is allowed to do. frame-ancestors lists which origins may embed the page in an iframe.
Point 4 is about scale. A feedback widget embedded across many products is one piece of code with one set of mistakes, but the consequences appear everywhere it is embedded. Fixing it once fixes it everywhere, and missing it once exposes every product at the same time.
The report includes this illustrative pattern for both ends of the exchange:
const FEEDBACK_ORIGIN = "https://feedback.example.com";function submitFeedback(frame, payload) { frame.contentWindow.postMessage(payload, FEEDBACK_ORIGIN); }window.addEventListener("message", (event) => { if (event.origin !== FEEDBACK_ORIGIN) return; if (event.source !== feedbackFrame.contentWindow) return; handleFeedbackReply(event.data);});
Line by line, in plain words:
const FEEDBACK_ORIGIN = "https://feedback.example.com";stores the one trusted address in a named constant.function submitFeedback(frame, payload) {starts a function that takes the target frame and the data to send.frame.contentWindow.postMessage(payload, FEEDBACK_ORIGIN);sends the data to that frame, but only if the frame's current page really ishttps://feedback.example.com. If someone has swapped the frame for their own page, the browser drops the message. This is the fix for the sending side.window.addEventListener("message", (event) => {registers a listener that runs whenever a message arrives at this window. This is the receiving side.if (event.origin !== FEEDBACK_ORIGIN) return;checks who sent the message. If it is not the trusted origin, stop immediately and do nothing.if (event.source !== feedbackFrame.contentWindow) return;checks which window sent it. Even a message from the right origin is ignored if it did not come from the expected frame.handleFeedbackReply(event.data);only now, after both checks pass, is the content processed.
The point is the shape of the code, not the hostname.
Variants worth testing
If you are learning to look for this kind of bug, these are the patterns the write-up suggests checking. Each comes with what a positive result looks like.
- Wildcard target on any submit or data-bearing message. Search client code for
postMessage(calls whose second argument is"*". A positive result is a message that carries document content, screenshots or tokens and is delivered to whatever window is present. - Navigable nested frames. Embed a product page that allows framing and try to change the location of frames it creates. A positive result is a nested frame you can redirect to your own origin.
- Missing receiver checks. Send messages to a widget from an unexpected origin and observe whether it acts on them. A positive result is a reply or state change without an
event.originandevent.sourcecheck. - Shared widgets across products. Test the same feedback or support component wherever it is embedded. A positive result is the same wildcard or framing weakness appearing in more than one product.
- Framing policy gaps. Check for
frame-ancestorson pages that embed sensitive widgets. A positive result is a page that can be framed by an attacker origin and that hosts a nested frame the attacker can steer.
The short version
- postMessage with
*is a broadcast, not a delivery. - Frames you embed can be swapped by whoever embeds you.
- Defence takes both ends: exact target origins when sending, origin checks when receiving.
Glossary
- Cross-origin data leak: a bug where data belonging to one origin ends up accessible to another origin.
- CWE: Common Weakness Enumeration, a public catalogue of weakness classes. The write-up maps this bug analytically to CWE-345 and CWE-1021.
- CWE-1021: Improper Restriction of Rendered UI Layers, meaning a page does not properly control how its interface can be overlaid by other layers.
- iframe: an inline frame, an element that embeds another web page inside a page.
- JavaScript: the programming language commonly run in the browser to make pages interactive.
- origin: the combination of protocol, host and port a page came from, such as
https://www.google.com; the browser's unit of security separation. - postMessage: the browser feature that lets windows send each other messages, with a target origin saying who may receive them.
- sandboxed: run with reduced privileges so that the code can do less than a normal page.
- screenshot: a copy of the pixels currently visible in the page.
- same-origin policy: the browser rule that code from one origin cannot normally read or interact with data belonging to another.
- wildcard target origin: the value
*used as a postMessage destination, meaning deliver to whichever document is in the window at that moment, whatever its origin.