Google Workspace Gmail Routing or Forwarding Rule Created or Modified
Detects when a Gmail routing, mail-forwarding, or custom mail-host setting is created or modified in Google Workspace. Adversaries with administrative access can add Routing rules (also deliver to / change envelope recipient), recipient address map forwarding, or mail hosts and outbound gateways to copy or redirect sensitive email for collection.
Elastic rule (View on GitHub)
1[metadata]
2creation_date = "2022/09/13"
3integration = ["google_workspace"]
4maturity = "production"
5updated_date = "2026/09/18"
6
7[rule]
8author = ["Elastic"]
9description = """
10Detects when a Gmail routing, mail-forwarding, or custom mail-host setting is created or modified in Google Workspace.
11Adversaries with administrative access can add Routing rules (also deliver to / change envelope recipient), recipient
12address map forwarding, or mail hosts and outbound gateways to copy or redirect sensitive email for collection.
13"""
14false_positives = [
15 """
16 Administrators may create or change Gmail routing, dual-delivery, address maps, or mail hosts for migrations,
17 journaling, spam handling, or partner integrations.
18 """,
19]
20from = "now-20m"
21index = ["logs-google_workspace.admin-*"]
22interval = "10m"
23language = "kuery"
24license = "Elastic License v2"
25name = "Google Workspace Gmail Routing or Forwarding Rule Created or Modified"
26note = """## Triage and analysis
27
28### Investigating Google Workspace Gmail Routing or Forwarding Rule Created or Modified
29
30Gmail administrators can change where mail is delivered using several Admin console areas under Apps > Google Workspace > Gmail:
31
32- Routing — specialized rules (modify message, change route, also deliver to, change envelope recipient). Audit: `UNIFIED_MAIL_ROUTING` or `MESSAGE_SECURITY_RULE` (legacy); `google_workspace.admin.setting.metadata.rule.type` may repeat the legacy type on `RuleState` rows.
33- Email forwarding using recipient address map — rewrite or forward by address mapping. Audit: `ALIAS_TABLE`.
34- Hosts / Outbound gateway — custom SMTP routes. Audit: `EMAIL_ROUTE`.
35
36Google may emit multiple admin audit events per single save (legacy `CREATE_GMAIL_SETTING`, new `CREATE_APPLICATION_SETTING`, rule body, and rule enabled state). Expect duplicate documents at the same `@timestamp`; correlate on `user.name`, `google_workspace.admin.USER_DEFINED_SETTING_NAME` (rule id), and `event.id`.
37
38### Possible investigation steps
39
40- Identify the administrator (`user.name`, `user.email`) and confirm the change was authorized.
41- In Admin console, review the rule matching `google_workspace.admin.USER_DEFINED_SETTING_NAME`:
42 - Routing (`UNIFIED_MAIL_ROUTING`, `MESSAGE_SECURITY_RULE`): Apps > Gmail > Routing
43 - Recipient address map (`ALIAS_TABLE`): Apps > Gmail > Default routing > Email forwarding using recipient address map
44 - Mail hosts / outbound gateway (`EMAIL_ROUTE`): Apps > Gmail > Hosts
45- Map the alert to the admin area using `google_workspace.admin.setting.name` and `google_workspace.admin.setting.metadata.rule.type`
46- Review whether the rule adds also deliver to, change envelope recipient, or routes to an external mail host or domain.
47- Review related `event.action` values for the same administrator in the last 48 hours.
48- If licensed for Gmail log events (BigQuery / Enterprise Plus), use Reporting > Audit and investigation > Gmail log events to confirm messages were delivered per the rule (`message_info.flattened_destinations`, `triggered_rule_info`).
49- Submit suspicious URLs or attachments from affected mail to reputational services as needed.
50
51### False positive analysis
52
53- Legitimate mail migrations, journaling, compliance archiving, and internal dual-delivery are common.
54- Tune with exceptions for known administrator accounts, rule ids (`USER_DEFINED_SETTING_NAME`), or approved external domains.
55
56### Response and remediation
57
58- Initiate the incident response process based on the outcome of the triage.
59- Disable or limit the account during the investigation and response.
60- Identify the possible impact of the incident and prioritize accordingly; the following actions can help you gain context:
61 - Identify the account role in the cloud environment.
62 - Assess the criticality of affected services and servers.
63 - Work with your IT team to identify and minimize the impact on users.
64 - Identify if the attacker is moving laterally and compromising other accounts, servers, or services.
65 - Identify any regulatory or legal ramifications related to this activity.
66- Investigate credential exposure on systems compromised or used by the attacker to ensure all compromised accounts are identified. Reset passwords or delete API keys as needed to revoke the attacker's access to the environment. Work with your IT teams to minimize the impact on business operations during these actions.
67- Review the permissions assigned to the implicated user to ensure that the least privilege principle is being followed.
68- Implement security best practices [outlined](https://support.google.com/a/answer/7587183) by Google.
69- Determine the initial vector abused by the attacker and take action to prevent reinfection via the same vector.
70- Using the incident response data, update logging and audit policies to improve the mean time to detect (MTTD) and the mean time to respond (MTTR).
71
72## Setup
73
74The Google Workspace Fleet integration with the Admin data stream (`logs-google_workspace.admin-*`) is required for this rule.
75
76### Important Information Regarding Google Workspace Event Lag Times
77- 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.
78- This rule uses `timestamp_override = event.ingested` and is configured to run every 10 minutes with a lookback of 20 minutes, aligned with the integration's default Admin poll interval (`interval`: 15m) and lag time (`lag_time`: 3m).
79- See the following references for further information:
80 - https://support.google.com/a/answer/7061566
81 - https://www.elastic.co/docs/reference/integrations/google_workspace"""
82references = [
83 "https://support.google.com/a/answer/2685650?hl=en",
84 "https://www.elastic.co/security-labs/google-workspace-attack-surface-part-one",
85 "https://www.elastic.co/security-labs/google-workspace-attack-surface-part-two"
86 ]
87risk_score = 73
88rule_id = "9510add4-3392-11ed-bd01-f661ea17fbce"
89severity = "high"
90tags = [
91 "Domain: Cloud",
92 "Data Source: Google Workspace",
93 "Data Source: Google Workspace Audit Logs",
94 "Tactic: Collection",
95 "Resources: Investigation Guide",
96 "Noise: Low",
97 "Performance: Fast",
98 "Profile: Recommended",
99 "Rule Type: Custom Query (KQL)",
100 "Platform: Google Workspace",
101 "Domain: SaaS",
102]
103timestamp_override = "event.ingested"
104type = "query"
105
106query = '''
107data_stream.dataset:"google_workspace.admin" and event.action:(
108 "CREATE_GMAIL_SETTING" or "CHANGE_GMAIL_SETTING"
109 or "CREATE_APPLICATION_SETTING" or "CHANGE_APPLICATION_SETTING"
110)
111and (
112 google_workspace.admin.setting.name:(
113 "UNIFIED_MAIL_ROUTING"
114 or "ALIAS_TABLE"
115 or "EMAIL_ROUTE"
116 or "MESSAGE_SECURITY_RULE"
117 )
118 or google_workspace.admin.setting.metadata.rule.type:(
119 "UNIFIED_MAIL_ROUTING"
120 or "ALIAS_TABLE"
121 or "EMAIL_ROUTE"
122 )
123)
124'''
125[rule.investigation_fields]
126field_names = [
127 "source.ip",
128 "user.name",
129 "user.email",
130 "event.action",
131 "google_workspace.admin.org_unit.name",
132 "google_workspace.admin.setting.name",
133 "google_workspace.admin.setting.metadata.rule.type",
134 "google_workspace.admin.USER_DEFINED_SETTING_NAME",
135]
136
137
138[[rule.threat]]
139framework = "MITRE ATT&CK"
140[[rule.threat.technique]]
141id = "T1114"
142name = "Email Collection"
143reference = "https://attack.mitre.org/techniques/T1114/"
144[[rule.threat.technique.subtechnique]]
145id = "T1114.003"
146name = "Email Forwarding Rule"
147reference = "https://attack.mitre.org/techniques/T1114/003/"
148
149
150
151[rule.threat.tactic]
152id = "TA0009"
153name = "Collection"
154reference = "https://attack.mitre.org/tactics/TA0009/"
Triage and analysis
Investigating Google Workspace Gmail Routing or Forwarding Rule Created or Modified
Gmail administrators can change where mail is delivered using several Admin console areas under Apps > Google Workspace > Gmail:
- Routing — specialized rules (modify message, change route, also deliver to, change envelope recipient). Audit:
UNIFIED_MAIL_ROUTINGorMESSAGE_SECURITY_RULE(legacy);google_workspace.admin.setting.metadata.rule.typemay repeat the legacy type onRuleStaterows. - Email forwarding using recipient address map — rewrite or forward by address mapping. Audit:
ALIAS_TABLE. - Hosts / Outbound gateway — custom SMTP routes. Audit:
EMAIL_ROUTE.
Google may emit multiple admin audit events per single save (legacy CREATE_GMAIL_SETTING, new CREATE_APPLICATION_SETTING, rule body, and rule enabled state). Expect duplicate documents at the same @timestamp; correlate on user.name, google_workspace.admin.USER_DEFINED_SETTING_NAME (rule id), and event.id.
Possible investigation steps
- Identify the administrator (
user.name,user.email) and confirm the change was authorized. - In Admin console, review the rule matching
google_workspace.admin.USER_DEFINED_SETTING_NAME:- Routing (
UNIFIED_MAIL_ROUTING,MESSAGE_SECURITY_RULE): Apps > Gmail > Routing - Recipient address map (
ALIAS_TABLE): Apps > Gmail > Default routing > Email forwarding using recipient address map - Mail hosts / outbound gateway (
EMAIL_ROUTE): Apps > Gmail > Hosts
- Routing (
- Map the alert to the admin area using
google_workspace.admin.setting.nameandgoogle_workspace.admin.setting.metadata.rule.type - Review whether the rule adds also deliver to, change envelope recipient, or routes to an external mail host or domain.
- Review related
event.actionvalues for the same administrator in the last 48 hours. - If licensed for Gmail log events (BigQuery / Enterprise Plus), use Reporting > Audit and investigation > Gmail log events to confirm messages were delivered per the rule (
message_info.flattened_destinations,triggered_rule_info). - Submit suspicious URLs or attachments from affected mail to reputational services as needed.
False positive analysis
- Legitimate mail migrations, journaling, compliance archiving, and internal dual-delivery are common.
- Tune with exceptions for known administrator accounts, rule ids (
USER_DEFINED_SETTING_NAME), or approved external domains.
Response and remediation
- Initiate the incident response process based on the outcome of the triage.
- Disable or limit the account during the investigation and response.
- Identify the possible impact of the incident and prioritize accordingly; the following actions can help you gain context:
- Identify the account role in the cloud environment.
- Assess the criticality of affected services and servers.
- Work with your IT team to identify and minimize the impact on users.
- Identify if the attacker is moving laterally and compromising other accounts, servers, or services.
- Identify any regulatory or legal ramifications related to this activity.
- Investigate credential exposure on systems compromised or used by the attacker to ensure all compromised accounts are identified. Reset passwords or delete API keys as needed to revoke the attacker's access to the environment. Work with your IT teams to minimize the impact on business operations during these actions.
- Review the permissions assigned to the implicated user to ensure that the least privilege principle is being followed.
- Implement security best practices outlined by Google.
- Determine the initial vector abused by the attacker and take action to prevent reinfection via the same vector.
- Using the incident response data, update logging and audit policies to improve the mean time to detect (MTTD) and the mean time to respond (MTTR).
Setup
The Google Workspace Fleet integration with the Admin data stream (logs-google_workspace.admin-*) is required for 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 uses
timestamp_override = event.ingestedand is configured to run every 10 minutes with a lookback of 20 minutes, aligned with the integration's default Admin poll interval (interval: 15m) and lag time (lag_time: 3m). - See the following references for further information:
References
Related rules
- Application Added to Google Workspace Domain
- Google Workspace MFA Enforcement Disabled For Organization
- Google Workspace Role Modified
- Application Removed from Blocklist in Google Workspace
- Google Workspace 2SV Policy Disabled By User