|
| 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 | +``` |
0 commit comments