Trustwave Rapid Response: CrowdStrike Falcon Outage Update. Learn More

Trustwave Rapid Response: CrowdStrike Falcon Outage Update. Learn More

Managed Detection & Response

Eliminate active threats with 24/7 threat detection, investigation, and response.

Co-Managed SOC (SIEM)

Maximize your SIEM investment, stop alert fatigue, and enhance your team with hybrid security operations support.

Advisory & Diagnostics

Advance your cybersecurity program and get expert guidance where you need it most.

Penetration Testing

Test your physical locations and IT infrastructure to shore up weaknesses before exploitation.

Database Security

Prevent unauthorized access and exceed compliance requirements.

Email Security

Stop email threats others miss and secure your organization against the #1 ransomware attack vector.

Digital Forensics & Incident Response

Prepare for the inevitable with 24/7 global breach response in-region and available on-site.

Firewall & Technology Management

Mitigate risk of a cyberattack with 24/7 incident and health monitoring and the latest threat intelligence.

Offensive Security
Solutions to maximize your security ROI
Microsoft Exchange Server Attacks
Stay protected against emerging threats
Rapidly Secure New Environments
Security for rapid response situations
Securing the Cloud
Safely navigate and stay protected
Securing the IoT Landscape
Test, monitor and secure network objects
Why Trustwave
About Us
Awards and Accolades
Trustwave SpiderLabs Team
Trustwave Fusion Security Operations Platform
Trustwave Security Colony
Technology Alliance Partners
Key alliances who align and support our ecosystem of security offerings
Trustwave PartnerOne Program
Join forces with Trustwave to protect against the most advance cybersecurity threats
SpiderLabs Blog

Azure Web App Service For Offensive Operations

In this blog, I will be covering how to use Azure App Services for offensive purposes. What is Azure App Services you may ask? Azure App Services as defined by Microsoft:

“Quickly build, deploy, and scale web apps created with popular frameworks .NET, .NET Core, Node.js, Java, PHP, Ruby, or Python, in containers or running on any operating system. Meet rigorous, enterprise-grade performance, security, and compliance requirements by using the fully managed platform for your operational and monitoring tasks.” —

What’s great beyond the ability to run many platforms such as .NET, Python, and Node.js, is that when you deploy an app, you receive a custom subdomain on “”. Pretty nice! Deploying websites and applications is also a breeze with the Azure PowerShell modules.

What can we do with Azure Apps regarding offensive operations?

  • Static HTML Pages
  • PHP Phishing Pages
  • C2 Redirection via Flask

Microsoft Examples:


Azure PowerShell static HTML deployment

First, log into your Azure service with the command:
az login

For help on all commands available use:
az webapp up help

For a static html deployment, start in your web application’s root folder and simply deploy your app with:
az webapp up --location eastus --resource-group htmlphishtest --name htmlphishtest --html

Note that when your deployment is finished, you’ll have a domain “”!

In this simple example where I am using a modified version of the “html-docs-hello-world” page which will serve up an executable to the target.

Here is what it looks like when browsed to:

Figure 1: Static Phishing Page with JavaScript Downloader


PHP Credential Phishing

Using PHP applications from the zphisher platform, we can serve up credential harvesting pages via Azure Apps as well. This takes a little more effort and requires that Git be installed.

For the Microsoft docs regarding this deployment, visit

First, create your deployment user and password. These credentials will be used to clone and push the Git repository you deploy.

az webapp deployment user set --user-name <username> --password <password>

Next, create a resource group:
az group create --name myResourceGroup --location eastus

Create an Azure App Service plan:
az appservice plan create --name myAppServicePlan --resource-group myResourceGroup --sku FREE

Create your empty web application with either Bash or Powershell.
Using Bash:
az webapp create --resource-group myResourceGroup --plan myAppServicePlan --name <app_name> --runtime "PHP|7.4" --deployment-local-git

Using PowerShell:
az --% webapp create --resource-group myResourceGroup --plan myAppServicePlan --name <app_name> --runtime "PHP|7.4" --deployment-local-git

This command will output the details of your app including the git URL to clone. From a clean folder, clone your empty git repository using the username and password you set for the application. For example: git clone

Copy your PHP phishing application into the empty folder. In this instance, I used the “Microsoft” folder from zphisher.

Add your files with git:
git add *

Commit your changes:
git commit -a -m "Initial Commit"

Push your repo to your application:
git push

Your phishing application should now be hosted at your URL

Figure 2: Fake Login Page

Now, to access the logs, open a console via the application’s console page located in your Azure Portal.

Figure 3: Accessing the Console


In this instance, cat the usernames.txt file for any captured credentials.


Figure 4: Viewing Captured Credentials


Flask C2 Redirection

Using a Python Flask app, allows you to also perform redirection to a Command and Control (C2) server. In this example, I am using a “magic header” as described in my previous blog about protecting redirectors. In Cobalt Strike, this magic header may be set under the “client” portion of your profile. Also, be sure to comment out the first HEADER variable and then uncomment second HEADER and HEADER_KEY lines to use magic headers in

Figure 5: settings


From the Python-Flask-Redirector folder execute the following command with your custom variables:
az webapp up --location eastus --resource-group mynewresourcegroup --name mynewsubdomain --SKU FREE

After launching a beacon, the redirector checks that the magic header exists otherwise it will redirect to a site of your choosing. Note the external IP address of this beacon running through Azure Apps. It may be good to whitelist this range.

Figure 6: Deploying the redirector and receiving a Cobalt Strike Beacon


If you would like to manage your app via Secure FTP, you may do so by enabling that in the Deployment Center in the settings of your App in Azure. For more information on this visit

Figure 7: FTPS Settings


That is all for now! Please visit my GitHub for the code used in this post at I hope this blog post sheds some light on how legitimate Azure services may be used for offensive purposes.

Latest SpiderLabs Blogs

Cloudy with a Chance of Hackers: Protecting Critical Cloud Workloads

If you've been following along with David's posts, you'll have noticed a structure to the topics: Part I: The Plan, Part II: The Execution and now we move into Part III: Security Operations. Things...

Read More

Trustwave Rapid Response: CrowdStrike Falcon Outage Update

Trustwave is proactively assessing and monitoring our clients who may have been impacted by CrowdStrike’s recently rolled-out update for its Windows users. The critical issue identified with...

Read More

Using AWS Secrets Manager and Lambda Function to Store, Rotate and Secure Keys

When working with Amazon Web Services (AWS), we often find that various AWS services need to store and manage secrets. AWS Secrets Manager is the go-to solution for this. It's a centralized service...

Read More