T05 · Unauthorized Access and Privilege Escalation
- Location
SKILL.md:148- Finding
Newly Created Google Sheets Are Publicly Writable
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 148–153
Vulnerability Type: Anonymous write access and excessive permissions
Risk Level: HighVulnerable Code
python try: sheet = client.open(sheet_name).sheet1 except gspread.SpreadsheetNotFound: # Create the sheet if it doesn't exist spreadsheet = client.create(sheet_name) spreadsheet.share(None, perm_type="anyone", role="writer") sheet = spreadsheet.sheet1 # Write headers sheet.append_row(SHEET_COLUMNS) print(f"Created new sheet: {sheet_name}")Technical Analysis
When the requested spreadsheet does not exist, the code creates one and grants the anonymous public the
writerrole:python spreadsheet.share(None, perm_type="anyone", role="writer")This sharing configuration breaks the principle of least privilege. Public write access is not required to score leads or record results. Anyone who obtains or discovers the spreadsheet URL can potentially access and modify the stored lead data without authenticating.
The spreadsheet contains business names, URLs, email addresses, telephone numbers, audit results, scores, and operational notes. Anonymous write access therefore affects both the confidentiality and integrity of potentially sensitive business data.
The Google authorization configuration also requests the broad Drive scope:
python "https://www.googleapis.com/auth/drive"Although this scope may be needed for some sharing operations, it is broader than necessary for ordinary spreadsheet updates and increases the consequences of service-account credential compromise.
Attack Path
- The Skill attempts to open a spreadsheet that does not exist.
- The
SpreadsheetNotFoundhandler creates a new spreadsheet. - The code grants
writeraccess toanyone, without requiring authentication. - An attacker obtains or discovers the spreadsheet URL through a ...[truncated 1106 chars]
- Remediation
View remediation
Remediation Suggestions
-
Remove anonymous sharing entirely:
python spreadsheet = client.create(sheet_name) sheet = spreadsheet.sheet1 sheet.append_row(SHEET_COLUMNS) -
Keep newly created spreadsheets private by default.
-
If collaboration is required, share only with explicitly configured and validated email addresses.
-
Grant the minimum required role, such as
readerfor viewers orwriteronly for authorized editors. -
Require an explicit configuration option before performing any sharing operation.
-
Reject configurations that request public or domain-wide write access.
-
Where compatible with the required workflow, replace the full Drive scope with a narrower scope such as:
python scopes = [ "https://www.googleapis.com/auth/spreadsheets", "https://www.googleapis.com/auth/drive.file", ] -
Review spreadsheets previously created by this Skill and revoke existing
anyonepermissions. -
Enable audit logging and periodically inspect permission changes on generated spreadsheets.
-
