Skip to content

Entra ID support + AU techniques #566

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 36 commits into from
Sep 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
975fd5b
Add Entra ID AU techniques.
siigil Aug 16, 2024
56742d7
Add AU technique documentation.
siigil Aug 16, 2024
babad2e
Terraform formatting fix.
siigil Aug 19, 2024
03807e9
Fixed typo in Restricted AU account name.
siigil Aug 23, 2024
4c3bd5c
Fix typo in detonation step details
siigil Sep 5, 2024
849947c
Fix typo in detonatin step details
siigil Sep 5, 2024
005c8bf
Merge branch 'main' into katie.knowles/stratus-administrative-units
siigil Sep 5, 2024
e90576f
Add error handling for Graph client
siigil Sep 5, 2024
d7db32b
Update friendly names + remove unused codeBlock
siigil Sep 5, 2024
863884b
Modify Hidden AU technique to create Backdoor user during Detonation
siigil Sep 5, 2024
0109918
Update TF formatting
siigil Sep 5, 2024
2a04a96
Fixed err handling
siigil Sep 5, 2024
e4921c1
fix staticanalysis finding
christophetd Sep 5, 2024
4c7211f
Add Entra ID provider and regenerate docs
christophetd Sep 5, 2024
cefef36
Fixed missing parenthesis in Hidden AU
siigil Sep 5, 2024
a46108d
Remove extraneous err check
christophetd Sep 5, 2024
9b53ae0
Add Guest Invite techniqe, Entra ID Utils, + fix Hidden AU typo
siigil Sep 6, 2024
fb2ddaf
Fix function typo
siigil Sep 6, 2024
f20cef0
Add case in L46 to fix --platform entra-id option
siigil Sep 6, 2024
dd5d6e1
New attack technique (Entra ID): entra-id.persistence.new-application
christophetd Sep 10, 2024
8c1ab25
Apply suggestions from code review
christophetd Sep 10, 2024
a657fd9
make docs
christophetd Sep 10, 2024
91fdbd1
Fix type in fmt.Sprintf
christophetd Sep 10, 2024
791bcb4
New attack technique (Entra ID): entra-id.persistence.backdoor-applic…
christophetd Sep 10, 2024
b8d3b4f
Update package names and regenerate docs
christophetd Sep 10, 2024
5337e37
Enhancements to entra-id.persistence.guest-user
christophetd Sep 10, 2024
0fc4210
Enhancements to entra-id.persistence.restricted-au
christophetd Sep 10, 2024
a27dc89
Enhancements to entra-id.persistence.hidden-au
christophetd Sep 10, 2024
c318a17
Refactor Entra ID attack techniques to be more consistent
christophetd Sep 11, 2024
951276d
Update docs of entra-id.persistence.hidden-au
christophetd Sep 11, 2024
d439ae2
New attack technique (Entra ID): entra-id.persistence.backdoor-applic…
christophetd Sep 11, 2024
6929501
make docs
christophetd Sep 11, 2024
f131843
remove old azure docs
christophetd Sep 11, 2024
eccb066
avoid importing graphmodels twice
christophetd Sep 11, 2024
d3378f1
bump MS Graph SDK
christophetd Sep 11, 2024
b504018
Merge branch 'main' into katie.knowles/stratus-administrative-units
siigil Sep 12, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Through CloudTrail's <code>DescribeInstanceAttribute</code> event.

See:

* [Associated Sigma rule](https://github.com/SigmaHQ/sigma/blob/master/unsupported/cloud/aws_ec2_download_userdata.yml)
* [Associated Sigma rule](https://github.com/SigmaHQ/sigma/blob/master/rules/cloud/aws/aws_ec2_download_userdata.yml)


## Detonation logs <span class="smallcaps w3-badge w3-light-green w3-round w3-text-sand">new!</span>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
---
title: Backdoor Entra ID application through service principal
---

# Backdoor Entra ID application through service principal




Platform: Entra ID

## MITRE ATT&CK Tactics


- Persistence
- Privilege Escalation

## Description


Backdoors an existing Entra ID application by creating a new credential on the associated service principal.

<span style="font-variant: small-caps;">Warm-up</span>:

- Create an Entra ID application and associated service principal
- Assign it the <code>Directory Readers</code> role at the tenant level (for illustration purposes)

<span style="font-variant: small-caps;">Detonation</span>:

- Backdoor the Entra ID application by creating a new credential on the associated service principal

Notes: The warm-up mimics what happens when you create an App Registration through the Azure portal.
When you use the Azure portal, creating an App Registration automatically creates an associated service principal.
When using the Microsoft Graph API, the service principal needs to be created separately.

References:

- https://www.microsoft.com/en-us/security/blog/2023/12/12/threat-actors-misuse-oauth-applications-to-automate-financially-driven-attacks/
- https://www.inversecos.com/2021/10/how-to-backdoor-azure-applications-and.html
- https://posts.specterops.io/azure-privilege-escalation-via-service-principal-abuse-210ae2be2a5
- https://redfoxsec.com/blog/azure-privilege-escalation-via-service-principal/


## Instructions

```bash title="Detonate with Stratus Red Team"
stratus detonate entra-id.persistence.backdoor-application-sp
```
## Detection


Using [Entra ID audit logs](https://learn.microsoft.com/en-us/entra/identity/monitoring-health/concept-audit-logs) with the activity type <code>Add service principal credentials</code>.


Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
---
title: Backdoor Entra ID application
---

# Backdoor Entra ID application




Platform: Entra ID

## MITRE ATT&CK Tactics


- Persistence
- Privilege Escalation

## Description


Backdoors an existing Entra ID application by creating a new password credential.

<span style="font-variant: small-caps;">Warm-up</span>:

- Create an Entra ID application and associated service principal
- Assign it the <code>Directory Readers</code> role at the tenant level (for illustration purposes)

<span style="font-variant: small-caps;">Detonation</span>:

- Backdoor the Entra ID application by creating a new password credential

Notes: The warm-up mimics what happens when you create an App Registration through the Azure portal.
When you use the Azure portal, creating an App Registration automatically creates an associated service principal.
When using the Microsoft Graph API, the service principal needs to be created separately.

References:

- https://www.microsoft.com/en-us/security/blog/2023/12/12/threat-actors-misuse-oauth-applications-to-automate-financially-driven-attacks/
- https://www.inversecos.com/2021/10/how-to-backdoor-azure-applications-and.html
- https://posts.specterops.io/azure-privilege-escalation-via-service-principal-abuse-210ae2be2a5
- https://redfoxsec.com/blog/azure-privilege-escalation-via-service-principal/


## Instructions

```bash title="Detonate with Stratus Red Team"
stratus detonate entra-id.persistence.backdoor-application
```
## Detection


Using [Entra ID audit logs](https://learn.microsoft.com/en-us/entra/identity/monitoring-health/concept-audit-logs) with the activity type <code>Update application – Certificates and secrets management</code>.


114 changes: 114 additions & 0 deletions docs/attack-techniques/entra-id/entra-id.persistence.guest-user.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
---
title: Create Guest User
---

# Create Guest User




Platform: Entra ID

## MITRE ATT&CK Tactics


- Persistence

## Description


Invites an external guest user in the tenant.

<span style="font-variant: small-caps;">Warm-up</span>: None

<span style="font-variant: small-caps;">Detonation</span>:

- Invite guest user (without generating an invitation email)

References:

- https://securitylabs.datadoghq.com/cloud-security-atlas/attacks/inviting-external-users/
- https://derkvanderwoude.medium.com/azure-subscription-hijacking-and-cryptomining-86c2ac018983
- https://dirkjanm.io/assets/raw/US-22-Mollema-Backdooring-and-hijacking-Azure-AD-accounts_final.pdf

!!! note

By default, Stratus Red Team invites the e-mail <code>[email protected]</code>. 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="[email protected]"
stratus detonate entra-id.persistence.guest-user
```


## Instructions

```bash title="Detonate with Stratus Red Team"
stratus detonate entra-id.persistence.guest-user
```
## Detection


Using [Entra ID audit logs](https://learn.microsoft.com/en-us/entra/identity/monitoring-health/concept-audit-logs) with the specific activity types:

- <code>Add user</code>
- <code>Invite external user</code>
- <code>Add user sponsor</code>

When the invited user accepts the invite, an additional event <code>Redeem external user invite</code> is logged.

Sample events, shortened for clarity:

```json
{
"category": "UserManagement",
"result": "success",
"activityDisplayName": "Invite external user",
"loggedByService": "Invited Users",
"initiatedBy": {
"user": {
"userPrincipalName": "<[email protected]>",
}
},
"userAgent": "",
"targetResources": [
{
"displayName": "<invited user display name>",
"type": "User",
"userPrincipalName": "<invited-user-email>#EXT#@<tenant.tld>",
"groupType": null,
"modifiedProperties": []
}
],
"additionalDetails": [
{
"key": "invitedUserEmailAddress",
"value": "<invited-user-email>"
}
]
}
{
"category": "UserManagement",
"result": "success",
"resultReason": null,
"activityDisplayName": "Redeem external user invite",
"loggedByService": "B2B Auth",
"initiatedBy": {
"user": {
"userPrincipalName": "<invited-user-email>",
"ipAddress": "<invited-user-ip>"
}
},
"targetResources": [
{
"id": "d042c4fe-5dd1-44a2-883a-eede6c10608f",
"displayName": "UPN: <invited-user-email>#EXT#<tenant.tld>, Email: <invited-user-email>, InvitationId: 4c93fc70-169a-411f-8cf7-aff732f8c7b9, Source: One Time Passcode",
"type": "User",
"userPrincipalName": "<invited-user-email>#EXT#<tenant.tld>"
}
]
}
```


62 changes: 62 additions & 0 deletions docs/attack-techniques/entra-id/entra-id.persistence.hidden-au.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
---
title: Create Hidden Scoped Role Assignment Through HiddenMembership AU
---

# Create Hidden Scoped Role Assignment Through HiddenMembership AU




Platform: Entra ID

## MITRE ATT&CK Tactics


- Persistence

## Description


Creates an [Administrative Unit (AU)](https://learn.microsoft.com/en-us/graph/api/resources/administrativeunit?view=graph-rest-1.0) with hidden membership, and a scoped role assignment over this AU.
This simulates an attacker that TODO.

<span style="font-variant: small-caps;">Warm-up</span>:

- Create the target (victim) Entra ID user

<span style="font-variant: small-caps;">Detonation</span>:

- Create an administrative unit with hidden membership
- Create a backdoor Entra ID user
- Add the target (victim) user to the administrative unit
- Assign the backdoor user with Privileged Administration Administrator rights over the administrative unit

This simulates an attacker that indirectly persists their access.
The backdoor user can now perform privileged operations over any user in the administrative unit, which can be used to escalate privileges or maintain access, for instance by resetting the target user's password.

References:

- https://learn.microsoft.com/en-us/entra/identity/role-based-access-control/administrative-units



## Instructions

```bash title="Detonate with Stratus Red Team"
stratus detonate entra-id.persistence.hidden-au
```
## Detection


Using [Entra ID audit logs](https://learn.microsoft.com/en-us/entra/identity/monitoring-health/concept-audit-logs) with the specific activity types:

For <code>Service: Core Directory</code> and <code>Category: AdministrativeUnit</code>:

- <code>Add administrative unit</code>
- <code>Add member to administrative unit</code>

For <code>Service: Core Directory</code> and <code>Category: RoleManagement</code>:

- <code>Add scoped member to role</code>


Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
---
title: Create Application
---

# Create Application




Platform: Entra ID

## MITRE ATT&CK Tactics


- Persistence
- Privilege Escalation

## Description


Creates a new Entra ID application to backdoor the tenant.

<span style="font-variant: small-caps;">Warm-up</span>: None

<span style="font-variant: small-caps;">Detonation</span>:

- Create a new Entra ID application
- Create a password credential for the application
- Create a service principal for the application
- Assign the Global Administrator role to the application
- Print the command to retrieve a Graph API access token

References:

- https://www.microsoft.com/en-us/security/blog/2023/12/12/threat-actors-misuse-oauth-applications-to-automate-financially-driven-attacks/
- https://www.inversecos.com/2021/10/how-to-backdoor-azure-applications-and.html

## Instructions

```bash title="Detonate with Stratus Red Team"
stratus detonate entra-id.persistence.new-application
```
## Detection


Using [Entra ID audit logs](https://learn.microsoft.com/en-us/entra/identity/monitoring-health/concept-audit-logs) with the specific activity types:

- <code>Add application</code>
- <code>Update application – Certificates and secrets management</code>
- <code>Add member to role</code>


Loading
Loading