-
Notifications
You must be signed in to change notification settings - Fork 226
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New GCP attack: Inviting an external user (#372)
- Loading branch information
1 parent
d340248
commit 1b3b265
Showing
9 changed files
with
362 additions
and
102 deletions.
There are no files selected for viewing
103 changes: 103 additions & 0 deletions
103
docs/attack-techniques/GCP/gcp.persistence.invite-external-user.md
This file contains 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,103 @@ | ||
--- | ||
title: Invite an External User to a GCP Project | ||
--- | ||
|
||
# Invite an External User to a GCP Project | ||
|
||
|
||
<span class="smallcaps w3-badge w3-blue w3-round w3-text-white" title="This attack technique can be detonated multiple times">idempotent</span> | ||
|
||
Platform: GCP | ||
|
||
## MITRE ATT&CK Tactics | ||
|
||
|
||
- Persistence | ||
|
||
## Description | ||
|
||
|
||
Persists in the GCP project by inviting an external (fictitious) user to the project. The attacker could then use the external user to access the project. | ||
|
||
<span style="font-variant: small-caps;">Warm-up</span>: None | ||
|
||
<span style="font-variant: small-caps;">Detonation</span>: | ||
|
||
- Updates the project IAM policy to grant the attacker account the role of <code>roles/editor</code> | ||
|
||
!!! note | ||
|
||
Since the target e-mail must exist for this attack simulation to work, Stratus Red Team grants the role to stratusredteam@gmail.com by default. | ||
This is a real Google account, owned by Stratus Red Team maintainers and that is not used for any other purpose than this attack simulation. However, you can override | ||
this behavior by setting the environment variable <code>STRATUS_RED_TEAM_ATTACKER_EMAIL</code>, for instance: | ||
|
||
```bash | ||
export STRATUS_RED_TEAM_ATTACKER_EMAIL="your-own-gmail-account@gmail.com" | ||
stratus detonate gcp.persistence.invite-external-user | ||
``` | ||
|
||
|
||
## Instructions | ||
|
||
```bash title="Detonate with Stratus Red Team" | ||
stratus detonate gcp.persistence.invite-external-user | ||
``` | ||
## Detection | ||
|
||
|
||
The Google Cloud Admin logs event <code>SetIamPolicy</code> is generated when a principal is granted non-owner permissions at the project level. | ||
|
||
```javascript hl_lines="5 11 12 13" | ||
{ | ||
"protoPayload": { | ||
"@type": "type.googleapis.com/google.cloud.audit.AuditLog", | ||
"serviceName": "cloudresourcemanager.googleapis.com", | ||
"methodName": "SetIamPolicy", | ||
"serviceData": { | ||
"@type": "type.googleapis.com/google.iam.v1.logging.AuditData", | ||
"policyDelta": { | ||
"bindingDeltas": [ | ||
{ | ||
"action": "ADD", | ||
"role": "roles/editor", | ||
"member": "user:stratusredteam@gmail.com" | ||
} | ||
] | ||
} | ||
}, | ||
"request": { | ||
"resource": "target-project", | ||
"policy": { | ||
// ... | ||
}, | ||
"@type": "type.googleapis.com/google.iam.v1.SetIamPolicyRequest" | ||
} | ||
} | ||
} | ||
``` | ||
|
||
Although this attack technique does not simulate it, an attacker can also | ||
<a href="https://support.google.com/googleapi/answer/6158846?hl=en">use the GCP console to invite an external user as owner</a> of a GCP project, | ||
which cannot be done through the SetIamPolicy API call. In that case, an <code>InsertProjectOwnershipInvite</code> event is generated: | ||
|
||
```json hl_lines="5 8" | ||
{ | ||
"protoPayload": { | ||
"@type": "type.googleapis.com/google.cloud.audit.AuditLog", | ||
"serviceName": "cloudresourcemanager.googleapis.com", | ||
"methodName": "InsertProjectOwnershipInvite", | ||
"resourceName": "projects/target-project", | ||
"request": { | ||
"member": "user:attacker@gmail.com", | ||
"projectId": "target-project", | ||
"@type": "type.googleapis.com/google.internal.cloud.resourcemanager.InsertProjectOwnershipInviteRequest" | ||
}, | ||
"response": { | ||
"@type": "type.googleapis.com/google.internal.cloud.resourcemanager.InsertProjectOwnershipInviteResponse" | ||
} | ||
} | ||
} | ||
``` | ||
|
||
|
||
|
This file contains 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 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 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 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
Oops, something went wrong.