Trustwave SpiderLabs Uncovers Critical Cybersecurity Vulnerabilities Exposing Manufacturers to Costly Attacks. Learn More

Trustwave SpiderLabs Uncovers Critical Cybersecurity Vulnerabilities Exposing Manufacturers to Costly Attacks. Learn More

Managed Detection & Response

Eradicate cyberthreats with world-class intel and expertise

Managed Security Services

Expand your team’s capabilities and strengthen your security posture

Consulting & Professional Services

Tap into our global team of tenured cybersecurity specialists

Penetration Testing

Subscription- or project-based testing, delivered by global experts

Database Security

Get ahead of database risk, protect data and exceed compliance requirements

Email Security & Management

Catch email threats others miss with layered security & maximum control

Co-Managed SOC (SIEM)

Eliminate alert fatigue, focus your SecOps team, stop threats fast, and reduce cyber risk

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
The Trustwave Approach
Awards and Accolades
Trustwave SpiderLabs Team
Trustwave Fusion Platform
SpiderLabs Fusion Center
Security Operations Centers
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

Trustwave SpiderLabs Report: LockBit 3.0 Ransomware Vs. the Manufacturing Sector

As the manufacturing sector continues its digital transformation, Operational Technology (OT), Industrial Control Systems (ICS), and Supervisory Control and Data Acquisition (SCADA) are becoming...

Read More

Overview of the Cyberwarfare used in Israel – Hamas War

On October 7, 2023, the Palestinian organization Hamas launched the biggest attack on Israel in years, resulting in numerous casualties and hostages taken. Israel responded with a large-scale ground...

Read More

The 2023 Retail Services Sector Threat Landscape: A Trustwave Threat Intelligence Briefing

The annual holiday shopping season is poised for a surge in spending, a fact well-known to retailers, consumers, and cybercriminals alike. The latter group, however, is poised to exploit any...

Read More