A small startup recently launched its first web application on the Azure cloud. However, they failed to implement proper security measures for the application. As a result:
The company has now decided to enhance its web application security by configuring a Web Application Firewall (WAF) to protect against common web-based attacks, ensuring compliance with industry best practices and safeguarding customer trust.
For all the resources in this lab, we are using the East US region.
In this lab, you will complete the following exercises:
Note: Ensure you have an Azure account with an active subscription or use the Azure Student Package (https://aka.ms/student-account).
In this exercise, you will deploy a simple Azure Web App.
Click + Add and fill in the following details:
Setting | Value |
---|---|
Subscription | Your Subscription |
Resource Group | CyberP-Project |
Name | demowebapp |
Runtime Stack | .NET 8 |
Region | (US) East US |
Pricing Plan | Standard S1 |
Result: You have deployed a simple Azure Web App.
You can continue as is, but optionally if you want to learn how to set up a web application, for more in-depth understanding, follow the WebApp Deployment
In this exercise, you will set up and configure a WAF.
Click + Add and configure the following:
|Setting|Value| |—|—| |Resource Group|CyberP-Project| |Name|demoAppGateway| |Region|(US) East US| |Tier|WAF V2| |WAF Policy|(new)newPolicy| |Virtual network|(new)WebVNET|
The (new) on each option shows that you need to create new item on that list with the name at the front.
Under Frontend IP Configuration, select Public.
Create new Public IPv4 Address using name webappIP.
Under Backend Pool, click add, select a name backend and change Target type to App Services, add your demowebapp from Exercise 1.
Under Configuration, click Add a routing rule, input the following routing rule:
Setting | Value |
---|---|
Rule name | route |
Priority | 200 |
Listener | . |
Listener name | newlistener |
Backend targets | . |
Backend target | backend |
Backend settings | (new)settings |
Backend protocol | HTTPS |
Backend server certificate is issued by a well-known CA | Yes |
Click +Add to continue
Click + Add.
In this exercise, you will test your WAF configuration to ensure it protects against SQL injection and XSS.
Notice the webapp displays.
Add a SQL Query to the web url e.g (https://172.210.107.17/)
Notice the error displayed
Now replace the payload with an XSS payload “<img src=x onerror=alert(‘XSS’)>”
The reason for the error screen is because we didn’t specify how the 503 block page would look like.
In this exercise, you will review WAF logs to analyze the detected attacks.
Result: You have successfully monitored and analyzed WAF logs.
Outcome: By completing this project, you have deployed a secure web application with a Web Application Firewall (WAF) configured to protect against SQL injection and XSS attacks. This project demonstrates the importance of advanced web app security practices.
Side Task: Once done, take a screenshot of the completed task and upload on LinkedIn including the Hashtag #cloudprojectwithcyberpreacher #CPwCP while sharing your experiences around the project.
Note: Ensure to delete every resources created during this project, to ensure cost management.