First Time Seen Google Workspace OAuth Login from Third-Party Application
Detects the first time a third-party application logs in and authenticated with OAuth. OAuth is used to grant permissions to specific resources and services in Google Workspace. Compromised credentials or service accounts could allow an adversary to authenticate to Google Workspace as a valid user and inherit their privileges.
Elastic rule (View on GitHub)
1[metadata]
2creation_date = "2023/03/30"
3integration = ["google_workspace"]
4maturity = "production"
5updated_date = "2024/09/23"
6
7[rule]
8author = ["Elastic"]
9description = """
10Detects the first time a third-party application logs in and authenticated with OAuth. OAuth is used to grant
11permissions to specific resources and services in Google Workspace. Compromised credentials or service accounts could
12allow an adversary to authenticate to Google Workspace as a valid user and inherit their privileges.
13"""
14false_positives = [
15 """
16 Developers may leverage third-party applications for legitimate purposes in Google Workspace such as for
17 administrative tasks.
18 """,
19]
20from = "now-130m"
21index = ["filebeat-*", "logs-google_workspace*"]
22interval = "10m"
23language = "kuery"
24license = "Elastic License v2"
25name = "First Time Seen Google Workspace OAuth Login from Third-Party Application"
26note = """## Setup
27The Google Workspace Fleet integration, Filebeat module, or similarly structured data is required to be compatible with this rule.
28### Important Information Regarding Google Workspace Event Lag Times
29- As per Google's documentation, Google Workspace administrators may observe lag times ranging from minutes up to 3 days between the time of an event's occurrence and the event being visible in the Google Workspace admin/audit logs.
30- This rule is configured to run every 10 minutes with a lookback time of 130 minutes.
31- To reduce the risk of false negatives, consider reducing the interval that the Google Workspace (formerly G Suite) Filebeat module polls Google's reporting API for new events.
32- By default, `var.interval` is set to 2 hours (2h). Consider changing this interval to a lower value, such as 10 minutes (10m).
33- See the following references for further information:
34 - https://support.google.com/a/answer/7061566
35 - https://www.elastic.co/guide/en/beats/filebeat/current/filebeat-module-google_workspace.html"""
36references = [
37 "https://www.elastic.co/security-labs/google-workspace-attack-surface-part-one",
38 "https://www.elastic.co/security-labs/google-workspace-attack-surface-part-two",
39 "https://developers.google.com/apps-script/guides/bound",
40 "https://developers.google.com/identity/protocols/oauth2",
41]
42risk_score = 47
43rule_id = "21bafdf0-cf17-11ed-bd57-f661ea17fbcc"
44severity = "medium"
45tags = ["Domain: Cloud", "Data Source: Google Workspace", "Tactic: Defense Evasion", "Tactic: Initial Access"]
46timestamp_override = "event.ingested"
47type = "new_terms"
48
49query = '''
50event.dataset: "google_workspace.token" and event.action: "authorize" and
51google_workspace.token.scope.data: *Login and google_workspace.token.client.id: *apps.googleusercontent.com
52'''
53
54
55[[rule.threat]]
56framework = "MITRE ATT&CK"
57[[rule.threat.technique]]
58id = "T1550"
59name = "Use Alternate Authentication Material"
60reference = "https://attack.mitre.org/techniques/T1550/"
61[[rule.threat.technique.subtechnique]]
62id = "T1550.001"
63name = "Application Access Token"
64reference = "https://attack.mitre.org/techniques/T1550/001/"
65
66
67
68[rule.threat.tactic]
69id = "TA0005"
70name = "Defense Evasion"
71reference = "https://attack.mitre.org/tactics/TA0005/"
72[[rule.threat]]
73framework = "MITRE ATT&CK"
74[[rule.threat.technique]]
75id = "T1078"
76name = "Valid Accounts"
77reference = "https://attack.mitre.org/techniques/T1078/"
78[[rule.threat.technique.subtechnique]]
79id = "T1078.004"
80name = "Cloud Accounts"
81reference = "https://attack.mitre.org/techniques/T1078/004/"
82
83
84
85[rule.threat.tactic]
86id = "TA0001"
87name = "Initial Access"
88reference = "https://attack.mitre.org/tactics/TA0001/"
89
90[rule.new_terms]
91field = "new_terms_fields"
92value = ["google_workspace.token.client.id"]
93[[rule.new_terms.history_window_start]]
94field = "history_window_start"
95value = "now-15d"
Setup
The Google Workspace Fleet integration, Filebeat module, or similarly structured data is required to be compatible with this rule.
Important Information Regarding Google Workspace Event Lag Times
- As per Google's documentation, Google Workspace administrators may observe lag times ranging from minutes up to 3 days between the time of an event's occurrence and the event being visible in the Google Workspace admin/audit logs.
- This rule is configured to run every 10 minutes with a lookback time of 130 minutes.
- To reduce the risk of false negatives, consider reducing the interval that the Google Workspace (formerly G Suite) Filebeat module polls Google's reporting API for new events.
- By default,
var.interval
is set to 2 hours (2h). Consider changing this interval to a lower value, such as 10 minutes (10m). - See the following references for further information:
References
Related rules
- Application Removed from Blocklist in Google Workspace
- Domain Added to Google Workspace Trusted Domains
- External User Added to Google Workspace Group
- Google Workspace Bitlocker Setting Disabled
- Google Workspace Object Copied to External Drive with App Consent