Executing Edits Under Document Owner Context in Google Docs —
An editor of a Google Doc can create a container-bound Apps Script that runs under the document owner's context, allowing the editor to re-add themselves after removal and make edits that appear under the owner's name. The script can also cache the document and serve it via a GET endpoint, bypassing download restrictions.
Published on medium.com
A lot of people, professionals, corporations, and students are using Google Docs to collaborate, automate, and have seamless collaborations around the world that have the Internet.
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.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the Apps Script container-bound script executes with the document owner's authority without requiring explicit authorisation from the owner when triggered by the owner opening the document.
Impact
An editor could persist access after removal, impersonate the owner in edit history, and bypass download restrictions, though Google classified this as intended behaviour.
What the attacker needed
Attacker is an editor of the document; owner opens or refreshes the document; for download bypass, owner must visit document first
The fix
The author suggests that the getActive function should be behind an authorization or permission wall, though Google considers the behaviour intended.
How it was found
- As an editor, create a container-bound Apps Script in the document.
- Add an onOpen trigger that calls addEditor to re-add the attacker.
- When the owner opens or refreshes the document, the script runs and re-adds the attacker.
- For download bypass, use CacheService to store the document as base64 and a doGet endpoint to return it.
- The owner must refresh or visit the document first to populate the cache.
- Then visit the deployed GET endpoint to download the PDF.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
Google Docs lets you attach small programs called Apps Script to a document. The author found that a person invited as an editor can add such a program, and when the document owner opens the document, the program runs with the owner's permissions. This lets the editor keep access even after being removed and make changes that look like the owner made them.
What is Access control?
A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.