Skip to content

Commit 6234266

Browse files
committed
auto acc
1 parent 9c3a698 commit 6234266

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

src/pentesting-cloud/azure-security/az-privilege-escalation/az-automation-accounts-privesc.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Fore more information check:
1010
../az-services/az-automation-accounts.md
1111
{{#endref}}
1212

13-
### Hybrid Workers
13+
### Hybrid Workers Group
1414

1515
Remember that if somehow an attacker can execute an arbitrary runbook (arbitrary code) in a hybrid worker, he will **pivot to the location of the VM**. This could be an on-premise machine, a VPC of a different cloud or even an Azure VM.
1616

@@ -66,7 +66,7 @@ az rest --method GET \
6666
--url "https://management.azure.com/subscriptions/<subscription-id>/resourceGroups/<res-group>/providers/Microsoft.Automation/automationAccounts/<automation-account-name>/jobs/<job-name>/output?api-version=2023-11-01"
6767
```
6868

69-
If there aren't Runbooks created, or ou want to create a new one, you will need the **permissions `Microsoft.Resources/subscriptions/resourcegroups/read` and `Microsoft.Automation/automationAccounts/runbooks/write`** to do it using:
69+
If there aren't Runbooks created, or you want to create a new one, you will need the **permissions `Microsoft.Resources/subscriptions/resourcegroups/read` and `Microsoft.Automation/automationAccounts/runbooks/write`** to do it using:
7070

7171
```bash
7272
az automation runbook create --automation-account-name <account-name> --resource-group <res-group> --name <runbook-name> --type PowerShell

src/pentesting-cloud/azure-security/az-services/az-automation-accounts.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,12 @@ Azure Automation Accounts are cloud-based services in Microsoft Azure that help
1414
- **Connections**: Used to store **connection information** to external services. This could contain **sensitive information**.
1515
- **Network Access**: It can be set to **public** or **private**.
1616

17-
## Runbooks & Jobs
17+
### Runbooks & Jobs
1818

1919
A Runbook in Azure Automation is a **script that performs tasks automatically** within your cloud environment. Runbooks can be written in PowerShell, Python, or Graphical editors. They help automate administrative tasks like VM management, patching, or compliance checks.
2020

2121
In the **code** located inside **Runbooks** could contains **sensitive info** (such as creds).
2222

23-
Go to `Automation Accounts` --> `<Select Automation Account>` --> `Runbooks/Jobs/Hybrid worker groups/Watcher tasks/credentials/variables/certificates/connections`
24-
2523
A **Job is an instance of a Runbook execution**. When you run a Runbook, a Job is created to track that execution. Each job includes:
2624

2725
- **Status**: Queued, Running, Completed, Failed, Suspended.
@@ -42,15 +40,15 @@ There are 3 main ways to execute a Runbook:
4240

4341
It allows to import Runbooks from **Github, Azure Devops (Git) and Azure Devops (TFVC)**. It's possible to indicate it to publish the Runbooks of the repo to Azure Automation account and it's also possible to indicate to **sync the changes from the repo** to the Azure Automation account.
4442

45-
When the sync is enabled, in the **Github repository a webhook is created** to trigger the sync everytime a push event ocurs. Example of a webhook URL: `https://f931b47b-18c8-45a2-9d6d-0211545d8c02.webhook.eus.azure-automation.net/webhooks?token=DRjQyFiOrUtz%2fw7o23XbDpOlTe1%2bUqPQm4pQH2WBfJg%3d`
43+
When the sync is enabled, in the **Github repository a webhook is created** to trigger the sync every time a push event occurs. Example of a webhook URL: `https://f931b47b-18c8-45a2-9d6d-0211545d8c02.webhook.eus.azure-automation.net/webhooks?token=DRjQyFiOrUtz%2fw7o23XbDpOlTe1%2bUqPQm4pQH2WBfJg%3d`
4644

4745
Note that these webhooks **won't be visible** when listing webhooks in the associated runbooks to the Github repo. Also note that it's **not possible to change the repo URL** of a source control once it's created.
4846

49-
In order for the configured source control to work, the **Azure Automation Account** needs to have a managed identity (system or user) with the **`Contributor`** role. Moreover, to assing a user managed identity to the Automation Account, it's needed to indicate the client ID of the user MI in the variable **`AUTOMATION_SC_USER_ASSIGNED_IDENTITY_ID`**.
47+
In order for the configured source control to work, the **Azure Automation Account** needs to have a managed identity (system or user) with the **`Contributor`** role. Moreover, to assign a user managed identity to the Automation Account, it's needed to indicate the client ID of the user MI in the variable **`AUTOMATION_SC_USER_ASSIGNED_IDENTITY_ID`**.
5048

5149
### Runtime Environments
5250

53-
When creating a Runbook it'spossible to select the runtime environment. By default, the following runtime environments are available:
51+
When creating a Runbook it's possible to select the runtime environment. By default, the following runtime environments are available:
5452

5553
- **Powershell 5.1**
5654
- **Powershell 7.1**
@@ -71,7 +69,7 @@ When a hybrid worker group is created it's needed to indicate the **credentials*
7169
- **Default credentials**: You don't need to provide the credentials and the runbooks will be executed inside the VMs as **System**.
7270
- **Specific credentials**: You need to provide the name of the credentials object inside the automation account, which will be used to execute the **runbooks inside the VMs**. Therefore, in this case, it could be possible to **steal valid credentials** for the VMs.
7371

74-
Therefore, if you can choose to run a **Runbook** in a **Windows Hybrid Worker**, you will execute **arbitrary commands** inside an external machine as **System** (nice pivot technique).
72+
Therefore, if you can choose to run a **Runbook** in a **Hybrid Worker**, you will execute **arbitrary commands** inside an external machine as **System** (nice pivot technique).
7573

7674
Moreover, if the hybrid worker is running in Azure with other Managed Identities attached, the runbook will be able to access the **managed identity of the runbook and all the managed identities of the VM from the metadata service**.
7775

@@ -173,7 +171,7 @@ az rest --method GET \
173171

174172
# Get the source control setting of an automation account (if any)
175173
## inside the output it's possible to see if the autoSync is enabled, if the publishRunbook is enabled and the repo URL
176-
aaz automation source-control list --automation-account-name <AUTOMATION-ACCOUNT> --resource-group <RG-NAME>
174+
az automation source-control list --automation-account-name <AUTOMATION-ACCOUNT> --resource-group <RG-NAME>
177175

178176
# Get custom runtime environments
179177
## Check in defaultPackages for custom ones, by default Python envs won't have anything here and PS1 envs will have "az" and "azure cli"

0 commit comments

Comments
 (0)