Skip to content

Commit e9d8e96

Browse files
siigilchristophetd
andauthored
New Technique: Access Virtual Machine using Bastion shareable link (#583)
* Add Azure Bastion shareable link technique * Add delay note for Bastion technique * Add techniqe documentation * Change category to persistence * Fix tf formatting * Error and string handling + technique rename * Update v2/internal/attacktechniques/azure/persistence/create-bastion-shareable-link/main.go Co-authored-by: Christophe Tafani-Dereeper <[email protected]> * Update v2/internal/attacktechniques/azure/persistence/create-bastion-shareable-link/main.go Co-authored-by: Christophe Tafani-Dereeper <[email protected]> * Cosmetic changes * Add shareable link + credentials to output * Fix error handling * autogen docs --------- Co-authored-by: Christophe Tafani-Dereeper <[email protected]> Co-authored-by: Christophe Tafani-Dereeper <[email protected]>
1 parent 62d42a6 commit e9d8e96

File tree

10 files changed

+581
-3
lines changed

10 files changed

+581
-3
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
---
2+
title: Access Virtual Machine using Bastion shareable link
3+
---
4+
5+
# Access Virtual Machine using Bastion shareable link
6+
7+
<span class="smallcaps w3-badge w3-orange w3-round w3-text-sand" title="This attack technique is slow to warm up and cleanup">slow</span>
8+
9+
10+
Platform: Azure
11+
12+
## MITRE ATT&CK Tactics
13+
14+
15+
- Persistence
16+
17+
## Description
18+
19+
20+
By utilizing the 'shareable link' feature on Bastions where it is enabled, an attacker can create a link to allow access to a virtual machine (VM) from untrusted networks. Public links generated for an Azure Bastion can allow VM network access to anyone with the generated URL.
21+
NOTE: This technique will take 10-15 minutes to warmup, and 10-15 minutes to cleanup. This is due to the time to deploy an Azure Bastion.
22+
23+
References:
24+
25+
- https://blog.karims.cloud/2022/11/26/yet-another-azure-vm-persistence.html
26+
- https://learn.microsoft.com/en-us/azure/bastion/shareable-link
27+
- https://microsoft.github.io/Azure-Threat-Research-Matrix/Persistence/AZT509/AZT509/
28+
29+
<span style="font-variant: small-caps;">Warm-up</span>:
30+
31+
- Create a VM and VNet
32+
- Create an Azure Bastion host with access to the VM, and shareable links enabled
33+
NOTE: Warm-up and cleanup can each take 10-15 minutes to create and destroy the Azure Bastion instance
34+
35+
<span style="font-variant: small-caps;">Detonation</span>:
36+
37+
- Create an Azure Bastion shareable link with access to the VM
38+
39+
## Instructions
40+
41+
```bash title="Detonate with Stratus Red Team"
42+
stratus detonate azure.persistence.bastion-shareable-link
43+
```
44+
## Detection
45+
46+
Identify Azure events of type <code>Microsoft.Network/bastionHosts/createshareablelinks/action</code> and <code>Microsoft.Network/bastionHosts/getShareablelinks/action</code>. A sample of <code>createshareablelinks</code> is shown below (redacted for clarity).
47+
48+
```json hl_lines="7"
49+
{
50+
"category": {
51+
"value": "Administrative",
52+
"localizedValue": "Administrative"
53+
},
54+
"level": "Informational",
55+
"operationName": {
56+
"value": "Microsoft.Network/bastionHosts/createshareablelinks/action",
57+
"localizedValue": "Creates shareable urls for the VMs under a bastion and returns the urls"
58+
},
59+
"resourceGroupName": "stratus-red-team-shareable-link-rg-tz6o",
60+
"resourceProviderName": {
61+
"value": "Microsoft.Network",
62+
"localizedValue": "Microsoft.Network"
63+
},
64+
"resourceType": {
65+
"value": "Microsoft.Network/bastionHosts",
66+
"localizedValue": "Microsoft.Network/bastionHosts"
67+
},
68+
"resourceId": "[removed]/resourceGroups/stratus-red-team-shareable-link-rg-tz6o/providers/Microsoft.Network/bastionHosts/stratus-red-team-shareable-link-bastion-tz6o",
69+
"status": {
70+
"value": "Succeeded",
71+
"localizedValue": "Succeeded"
72+
},
73+
"subStatus": {
74+
"value": "",
75+
"localizedValue": ""
76+
},
77+
"properties": {
78+
"eventCategory": "Administrative",
79+
"entity": "[removed]/resourceGroups/stratus-red-team-shareable-link-rg-tz6o/providers/Microsoft.Network/bastionHosts/stratus-red-team-shareable-link-bastion-tz6o",
80+
"message": "Microsoft.Network/bastionHosts/createshareablelinks/action",
81+
"hierarchy": "[removed]"
82+
},
83+
}
84+
```
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
---
2+
title: Create Azure VM Bastion shareable link
3+
---
4+
5+
# Create Azure VM Bastion shareable link
6+
7+
<span class="smallcaps w3-badge w3-orange w3-round w3-text-sand" title="This attack technique might be slow to warm up or detonate">slow</span>
8+
9+
10+
Platform: Azure
11+
12+
## MITRE ATT&CK Tactics
13+
14+
15+
- Persistence
16+
17+
## Description
18+
19+
20+
By utilizing the 'shareable link' feature on Bastions where it is enabled, an attacker can create a link to allow access to a virtual machine (VM) from untrusted networks. Public links generated for an Azure Bastion can allow VM network access to anyone with the generated URL.
21+
22+
References:
23+
24+
- https://blog.karims.cloud/2022/11/26/yet-another-azure-vm-persistence.html
25+
- https://learn.microsoft.com/en-us/azure/bastion/shareable-link
26+
- https://microsoft.github.io/Azure-Threat-Research-Matrix/Persistence/AZT509/AZT509/
27+
28+
<span style="font-variant: small-caps;">Warm-up</span>:
29+
30+
- Create a VM and VNet
31+
- Create an Azure Bastion host with access to the VM, and shareable links enabled
32+
33+
NOTE: Warm-up and cleanup can each take 10-15 minutes to create and destroy the Azure Bastion instance
34+
35+
<span style="font-variant: small-caps;">Detonation</span>:
36+
37+
- Create an Azure Bastion shareable link with access to the VM
38+
39+
40+
## Instructions
41+
42+
```bash title="Detonate with Stratus Red Team"
43+
stratus detonate azure.persistence.create-bastion-shareable-link
44+
```
45+
## Detection
46+
47+
48+
Identify Azure events of type <code>Microsoft.Network/bastionHosts/createshareablelinks/action</code> and <code>Microsoft.Network/bastionHosts/getShareablelinks/action</code>. A sample of <code>createshareablelinks</code> is shown below (redacted for clarity).
49+
50+
```json hl_lines="7"
51+
{
52+
{
53+
"category": {
54+
"value": "Administrative",
55+
"localizedValue": "Administrative"
56+
},
57+
"level": "Informational",
58+
"operationName": {
59+
"value": "Microsoft.Network/bastionHosts/createshareablelinks/action",
60+
"localizedValue": "Creates shareable urls for the VMs under a bastion and returns the urls"
61+
},
62+
"resourceGroupName": "stratus-red-team-shareable-link-rg-tz6o",
63+
"resourceProviderName": {
64+
"value": "Microsoft.Network",
65+
"localizedValue": "Microsoft.Network"
66+
},
67+
"resourceType": {
68+
"value": "Microsoft.Network/bastionHosts",
69+
"localizedValue": "Microsoft.Network/bastionHosts"
70+
},
71+
"resourceId": "[removed]/resourceGroups/stratus-red-team-shareable-link-rg-tz6o/providers/Microsoft.Network/bastionHosts/stratus-red-team-shareable-link-bastion-tz6o",
72+
"status": {
73+
"value": "Succeeded",
74+
"localizedValue": "Succeeded"
75+
},
76+
"subStatus": {
77+
"value": "",
78+
"localizedValue": ""
79+
},
80+
"properties": {
81+
"eventCategory": "Administrative",
82+
"entity": "[removed]/resourceGroups/stratus-red-team-shareable-link-rg-tz6o/providers/Microsoft.Network/bastionHosts/stratus-red-team-shareable-link-bastion-tz6o",
83+
"message": "Microsoft.Network/bastionHosts/createshareablelinks/action",
84+
"hierarchy": "[removed]"
85+
},
86+
}
87+
```
88+
89+

docs/attack-techniques/azure/index.md

+5
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,8 @@ Note that some Stratus attack techniques may correspond to more than a single AT
1515

1616
- [Export Disk Through SAS URL](./azure.exfiltration.disk-export.md)
1717

18+
19+
## Persistence
20+
21+
- [Create Azure VM Bastion shareable link](./azure.persistence.create-bastion-shareable-link.md)
22+

docs/attack-techniques/list.md

+1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ This page contains the list of all Stratus Attack Techniques.
5252
| [Execute Command on Virtual Machine using Custom Script Extension](./azure/azure.execution.vm-custom-script-extension.md) | [Azure](./azure/index.md) | Execution |
5353
| [Execute Commands on Virtual Machine using Run Command](./azure/azure.execution.vm-run-command.md) | [Azure](./azure/index.md) | Execution |
5454
| [Export Disk Through SAS URL](./azure/azure.exfiltration.disk-export.md) | [Azure](./azure/index.md) | Exfiltration |
55+
| [Create Azure VM Bastion shareable link](./azure/azure.persistence.create-bastion-shareable-link.md) | [Azure](./azure/index.md) | Persistence |
5556
| [Create Admin EKS Access Entry](./EKS/eks.lateral-movement.create-access-entry.md) | [EKS](./EKS/index.md) | Lateral Movement |
5657
| [Backdoor aws-auth EKS ConfigMap](./EKS/eks.persistence.backdoor-aws-auth-configmap.md) | [EKS](./EKS/index.md) | Persistence, Privilege Escalation |
5758
| [Backdoor Entra ID application through service principal](./entra-id/entra-id.persistence.backdoor-application-sp.md) | [Entra ID](./entra-id/index.md) | Persistence, Privilege Escalation |

docs/index.yaml

+8
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,14 @@ Azure:
472472
- Exfiltration
473473
platform: Azure
474474
isIdempotent: true
475+
Persistence:
476+
- id: azure.persistence.create-bastion-shareable-link
477+
name: Create Azure VM Bastion shareable link
478+
isSlow: true
479+
mitreAttackTactics:
480+
- Persistence
481+
platform: Azure
482+
isIdempotent: false
475483
Entra ID:
476484
Persistence:
477485
- id: entra-id.persistence.backdoor-application-sp

v2/go.mod

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ require (
99
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.14.0
1010
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0
1111
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute v1.0.0
12-
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.0.0
12+
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6 v6.1.0
13+
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.2.0
1314
github.com/aws/aws-sdk-go-v2 v1.31.0
1415
github.com/aws/aws-sdk-go-v2/config v1.25.11
1516
github.com/aws/aws-sdk-go-v2/credentials v1.16.9

v2/go.sum

+10-2
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,18 @@ github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute v1.0.0
1313
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute v1.0.0/go.mod h1:gM3K25LQlsET3QR+4V74zxCsFAy0r6xMNN9n80SZn+4=
1414
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal v1.0.0 h1:lMW1lD/17LUA5z1XTURo7LcVG2ICBPlyMHjIUrcFZNQ=
1515
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal v1.0.0/go.mod h1:ceIuwmxDWptoW3eCqSXlnPsZFKh4X+R38dWPv7GS9Vs=
16+
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v2 v2.0.0 h1:PTFGRSlMKCQelWwxUyYVEUqseBJVemLyqWJjvMyt0do=
17+
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v2 v2.0.0/go.mod h1:LRr2FzBTQlONPPa5HREE5+RjSCTXl7BwOvYOaWTqCaI=
18+
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v3 v3.1.0 h1:2qsIIvxVT+uE6yrNldntJKlLRgxGbZ85kgtz5SNBhMw=
19+
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v3 v3.1.0/go.mod h1:AW8VEadnhw9xox+VaVd9sP7NjzOAnaZBLRH6Tq3cJ38=
20+
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/managementgroups/armmanagementgroups v1.0.0 h1:pPvTJ1dY0sA35JOeFq6TsY2xj6Z85Yo23Pj4wCCvu4o=
21+
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/managementgroups/armmanagementgroups v1.0.0/go.mod h1:mLfWfj8v3jfWKsL9G4eoBoXVcsqcIUTapmdKy7uGOp0=
1622
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork v1.0.0 h1:nBy98uKOIfun5z6wx6jwWLrULcM0+cjBalBFZlEZ7CA=
1723
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork v1.0.0/go.mod h1:243D9iHbcQXoFUtgHJwL7gl2zx1aDuDMjvBZVGr2uW0=
18-
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.0.0 h1:ECsQtyERDVz3NP3kvDOTLvbQhqWp/x9EsGKtb4ogUr8=
19-
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.0.0/go.mod h1:s1tW/At+xHqjNFvWU4G0c0Qv33KOhvbGNj0RCTQDV8s=
24+
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6 v6.1.0 h1:Fd+iaEa+JBwzYo6OTWYSNqyvlPSLciMGsmsnYCKcXM0=
25+
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6 v6.1.0/go.mod h1:ulHyBFJOI0ONiRL4vcJTmS7rx18jQQlEPmAgo80cRdM=
26+
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.2.0 h1:Dd+RhdJn0OTtVGaeDLZpcumkIVCtA/3/Fo42+eoYvVM=
27+
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.2.0/go.mod h1:5kakwfW5CjC9KK+Q4wjXAg+ShuIm2mBMua0ZFj2C8PE=
2028
github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 h1:XHOnouVk1mxXfQidrMEnLlPk9UMeRtyBTnEFtxkV0kU=
2129
github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI=
2230
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=

0 commit comments

Comments
 (0)