You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/pentesting-cloud/azure-security/az-privilege-escalation/az-automation-accounts-privesc.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,7 @@ Fore more information check:
10
10
../az-services/az-automation-accounts.md
11
11
{{#endref}}
12
12
13
-
### Hybrid Workers
13
+
### Hybrid Workers Group
14
14
15
15
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.
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:
Copy file name to clipboardExpand all lines: src/pentesting-cloud/azure-security/az-services/az-automation-accounts.md
+6-8Lines changed: 6 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,14 +14,12 @@ Azure Automation Accounts are cloud-based services in Microsoft Azure that help
14
14
-**Connections**: Used to store **connection information** to external services. This could contain **sensitive information**.
15
15
-**Network Access**: It can be set to **public** or **private**.
16
16
17
-
## Runbooks & Jobs
17
+
###Runbooks & Jobs
18
18
19
19
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.
20
20
21
21
In the **code** located inside **Runbooks** could contains **sensitive info** (such as creds).
22
22
23
-
Go to `Automation Accounts` --> `<Select Automation Account>` --> `Runbooks/Jobs/Hybrid worker groups/Watcher tasks/credentials/variables/certificates/connections`
24
-
25
23
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:
@@ -42,15 +40,15 @@ There are 3 main ways to execute a Runbook:
42
40
43
41
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.
44
42
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`
46
44
47
45
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.
48
46
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`**.
50
48
51
49
### Runtime Environments
52
50
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:
54
52
55
53
-**Powershell 5.1**
56
54
-**Powershell 7.1**
@@ -71,7 +69,7 @@ When a hybrid worker group is created it's needed to indicate the **credentials*
71
69
-**Default credentials**: You don't need to provide the credentials and the runbooks will be executed inside the VMs as **System**.
72
70
-**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.
73
71
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).
75
73
76
74
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**.
77
75
@@ -173,7 +171,7 @@ az rest --method GET \
173
171
174
172
# Get the source control setting of an automation account (if any)
175
173
## 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>
177
175
178
176
# Get custom runtime environments
179
177
## 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