Skip to content
Leaked secrets Write-up Beginner

️ From Public Sheet to API Takeover: Google Sheets Misconfig +

A Google service account private key was hardcoded in frontend JavaScript assets, allowing anyone to authenticate to the Google Sheets API and read or write the exposed spreadsheet. The attacker could modify cell values in bulk and add or remove sheets, and potentially access other GCP resources if the key had broader permissions.

Салах Follow

Published on medium.com

During a recent bug bounty engagement, I encountered a critical misconfiguration involving a public Google Sheets document integrated into a production system. But this wasn’t just a case of “anyone can view.” It escalated quickly from read-access to unauthenticated full write access – and even worse, I discovered a…

Салах, on medium.com

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

Impact

The leaked key allowed full read and write access to the spreadsheet, enabling data integrity compromise, and could potentially grant access to other cloud services or full project compromise if the key had broader permissions.

What the attacker needed

Publicly accessible Google Sheet; hardcoded service account key in frontend; no authentication required

The fix

The leaked service account keys should be revoked and rotated, credentials should be stored in environment variables or secret managers instead of hardcoded, IAM permissions should be audited, sheet sharing should be restricted, and alerting for unusual API usage should be added.

How it was found

  1. Perform reconnaissance using search engine dorks, endpoint enumeration, and JavaScript analysis to find a publicly accessible Google Sheet used as a backend.
  2. Notice a script referencing the Google Sheets API and hardcoded credentials in the frontend assets.
  3. Extract the service account JSON key file containing client_email, private_key_id, and private_key.
  4. Authenticate to the Google Sheets API using the leaked service account key.
  5. Confirm full access: read data, write to any range, modify cell values in bulk, add or remove sheets.
  6. Write a Python script using gspread and oauth2client to overwrite an entire column in the sheet with a message, demonstrating impact.

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.

A service account is a special Google account used by programs, and its private key is like a password. The developers left this key inside the website's code, so anyone could find it and use it to control the connected Google Sheet and possibly other cloud services.

What is Leaked secrets?

Keys, tokens or passwords left in public code, apps, logs or responses, that grant real access.

More by Салах

View all

1 more disclosed report, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Leaked secrets and credentials

The lesson behind this report.

Keys, tokens or passwords left in public code, apps, logs or responses, that grant real access.