Setting up an Azure Target
Introduction
An Azure machine, just like any other server on the Internet, requires some due diligence to be permformed in terms of network rules, application setup and system security configuration. A system hosting an application can be attacked if a vulnerability allows an attacker to reach the OS from the application.
What are we going to cover?
This chapter will setup an Azure VM instance, install XAMPP on it and deploy our application target on it.
Setting up the machine
Create a new Windows Virtual Machine
Create a new Windows Virtual Machine using the Azure Portal
Click on
Virtual Machinesunder FavoritesVirtual machine name -
Windows-Web-AppSelect Image -
Windows 10 Pro 1803Change the Size to
B2sAuthentication Type password. Username -
winadmin. Set a strong password and note itSet Inbound port rule none. We will set this through the Network Security Group settings later
Click on
Next: DisksSelect
Standard HDDand click NextSet Inbound ports to None
Keep defaults for the next sections till you reach the final review screen
Click create to launch your VM
Setting up access via RDP
We need to open TCP port 3389 in the Azure's firewall so that we can login and perform some post login configuration.
Select the VM in Azure portal and select
NetworkingClick on
Add Inbound port rule buttonAdd port 3389 as destination and source IP as your student VM's public IP (Visit
https://x41.cofor your public IP)If RDP is already added to the rules then ensure that the source is pointed to your student VMs external IP
This firewall rule will ensure you can connect to the Azure machine from your Windows host OS (using
mstsc) or using a client likexfreerdp
Setting up the Web server and the App
Login into the VM using remote desktop.
If you are on Windows you can use
Start > Run > mstsc. If you are on Mac or Linux, you can use the student VM to launchxfreerdp -u:winadmin -v:IP-AZURE-VMvia terminal. Replace theIP-AZURE-VMwith the public IP address of the just deployed Azure VM.Launch powershell as administrator (right click > Runas Administrator)
Allow powershell to run scripts downloaded from the Internet by running
Set-ExecutionPolicy Unrestricted -Forcerun
wget -UseBasicParsing https://s3.amazonaws.com/bapawsazure-artifacts/app-setup.ps1 -OutFile app-setup.ps1This script,
app-setup.ps1, is also provided in thesetup-filesdirectory of this repo, in case you want a local copy of the script and web app.After the script is downloaded, execute it by running it
.\app-setup.ps1Wait for the setup to finish
Add another firewall rule to the VM for TCP port 80, add port 80 as destination and source IP as your cloud attacker IP
Once the setup is done, the app should be deployed at
http://IP-AZURE-VM/but accessible only from the attacker IP. Replace theIP-AZURE-VMwith the public IP address of the just deployed Azure VM.You can access the application by firefox using the SOCKS proxy running on port 9090. If not, then use the same setup (Firefox > Burp > SOCKS Proxy > Attacker machine > Target) that we created in the AWS Attacking web apps on EC2 chapter.
References
Last updated