Loading...

A Closer Look at Azure WAF’s Data Masking Capabilities for Azure Front Door

A Closer Look at Azure WAF’s Data Masking Capabilities for Azure Front Door

The Azure Web Application Firewall (WAF) on Azure Front Door offers centralized protection for your web applications against vulnerabilities and threats. The effectiveness of your Azure WAF in managing traffic can be assessed through WAF logs stored in specified locations such as a Log Analytics Workspace or Storage Accounts. These logs document requests that have been either matched or blocked by WAF rules. This data is crucial for monitoring, auditing, and resolving issues. By default, WAF logs are maintained in a plain text format for user convenience and analysis. However, these client requests might include sensitive personal data, like personally identifiable information (PII), which can include names, addresses, contact details, and financial information. Without proper sanitization, logs containing such PII could be exposed to unauthorized access. To address this, Azure Front Door WAF now offers sensitive data protection through log scrubbing. WAF log scrubbing employs a customizable rules engine to pinpoint and redact sensitive portions within the requests, replacing them with a series of asterisks (******) to prevent data exposure. This blog will explains the log scrubbing process and provides practical examples for a more comprehensive understanding.

Log Scrubbing

The Azure Front Door WAF’s sensitive data protection feature using log scrubbing is compatible with all WAF policy rule sets including Default Rule Set (DRS), Bot Manager Ruleset, and any Custom rules. It utilizes a range of match variables, such as client IP, headers, cookies, and request arguments, to identify data for scrubbing. Rule creation involves selecting a match variable, an operator, and defining a selector, which determines the specific key to be cleansed from the logs. Take a simple login process, which generally involves username and password fields; these are two distinct keys that can be targeted as selectors. Should a dubious login attempt activate the WAF, it records the username and password if they contain the suspect string or code injection. The log scrubber then anonymizes these details, obscuring the malicious content while preserving the attack's characteristics and significantly reducing the risk of personal data exposure.

 

See below for the full list of Match Variables:

 

Match Variable

Operator

Selector

Request IP Address

Equals any

<None>

Request URI

Equals any

<None>

Request Header Names

Equals/Equals any

<Custom>

Request Cookie Names

Equals/Equals any

<Custom>

Request Body Post Arg Names

Equals/Equals any

<Custom>

Request Body Json Arg Names

Equals/Equals any

<Custom>

Query String Arg Names

Equals/Equals any

<Custom>

 

Request IP, Request URI & Request Header

In our initial scenario, we examine the log scrubbing engine's capability to conceal the requester's IP address, the request URI, and the User-Agent that activated the WAF rule. In this example, the User-Agent is a carrier for a SQL injection string within the User-Agent key's value. The log scrubbing rules are configured so that the selector targets User-Agent within the Request Header Names, ensuring every User-Agent occurrence, including the embedded SQL injection string, is cleansed from the WAF logs. This scenario serves as an example on how to write log scrubbing rules to cleanse potentially sensitive values. It is best practice to specify only those values that contain potential personally identifiable information (PII) or other sensitive data, rather than generic request headers like User-Agent.

Rules.png

With the rules defined and the feature enabled, we’ll send a request using Postman that will trigger a block by the WAF and then check on the logs. Our screenshot below shows a 403 Forbidden status code returned from the Azure WAF policy.

User-Agent.png


Upon examining the logs, the fields labeled clientIP_s, requestUri_s, and matchVariableValue within details_matches_s are now populated with ***** as the full value. While the specific User-Agent involved in this incident is not visible in the logs, the presence of an attack can still be inferred through the analysis of the request headers. This method allows for the identification of unauthorized attempts to access the site, despite certain data being obscured.

 

AzureDiagnostics

| where ResourceProvider == "MICROSOFT.CDN" and Category == "FrontDoorWebApplicationFirewallLog"

| project TimeGenerated, Resource, policy_s, clientIP_s, clientPort_d, requestUri_s, details_matches_s, details_msg_s, action_s, trackingReference_s 

RequestHeader-Log.png

Request Body JSON

The below example shows screenshots of Request Body JSON argument identified for scrubbing. This example shows how to scrub a JSON argument within the WAF logs and uses Postman to generate the request traffic. A log scrubbing rule uses 'password' as the identifier within Request Body JSON Argument Name. This ensures only the 'password' value in the JSON payload is scrubbed rather than every value transmitted to the website. In our scenario the JSON payload triggers SQL injection WAF rules because of the embedded command string, prompting the Azure WAF to record the event in the logs.

 

{

  “email”: “[email protected]”,

  “password”: “’ or 1=1—”

}


BodyJson-Arg.png

The WAF logs indicate that the JSON value, along with the requester's IP and the request URI, are effectively sanitized.

JSON-Log.png

The below screenshots provide additional examples of how Azure WAF’s log scrubbing rules will remove sensitive data from WAF logs.

 

Request Cookie:
Cookie.png
Cookie-Log.png


Request Body Post:

BodyPost-Arg.pngBodyPost-Log.png

Query String:
Query-Params.png
QueryParam-Log.png

Conclusion

The Azure Front Door WAF’s log scrubbing tool for sensitive data protection provides the same functionality as the current log scrubbing feature available for Application Gateway. This tool provides organizations with a robust solution for safeguarding sensitive data and personally identifiable information within their logs. Sensitive data protection is critical in reducing the likelihood of incurring legal or regulatory repercussions due to the inadvertent disclosure of private or confidential information. Implementing log scrubbing rules is a recommended best practice for all system administrators managing log data. For additional insights into Azure WAF, please refer to the accompanying resources.

Resources

  1. Azure WAF Overview - Introduction to Azure Web Application Firewall | Microsoft Learn
  2. What is Azure Web Application Firewall on Azure Front Door? - What is Azure Web Application Firewall on Azure Front Door? | Microsoft Learn
  3. What is Azure Web Application Firewall Sensitive Data Protection (Preview)? - Azure Web Application Firewall on Azure Front Door Sensitive Data Protection (preview) | Microsoft Learn
  4. How to mask sensitive data on Azure Web Application Firewall - How to mask sensitive data on Azure Web Application Firewall on Azure Front Door (preview) | Microsoft Learn

 

Published on:

Learn more
Azure Network Security Blog articles
Azure Network Security Blog articles

Azure Network Security Blog articles

Share post:

Related posts

Azure SDK Release (September 2024)

The Azure SDKs release every month. This post includes the month's highlights and release notes. The post Azure SDK Release (September 2024) a...

5 hours ago

Azure Boards, September Update

September was a productive month for Azure Boards, and we’re excited to share some of the new features coming your way. Area and Iteration Lev...

8 hours ago

Build a chatbot on your own data in 1 hour with Azure SQL, Langchain and Chainlit

Chatbots are the hot topic lately, and now you can create them easily by downloading solutions like OpenWebUI, connect it to Ollama or any Ope...

1 day ago

Announcing the public preview of the new Azure FXv2-series Virtual Machines

Today, Microsoft is announcing the public preview of the new Azure FXv2-series Virtual Machines (VMs), based on the 5th Generation Intel® Xeon...

1 day ago

Specifying client ID and secret when creating an Azure ACS principal via AppRegNew.aspx will be removed

Starting from early October 2024, Azure ACS (Access Control Service) will remove the option to specify client ID and secret when creating prin...

1 day ago

Announcing Public Preview of Windows Server Hotpatch enabled by Azure Arc

We’re excited to announce the Public Preview of Hotpatch enabled by Azure Arc for Windows Sever 2025 Datacenter and Standard editions!   ...

2 days ago

OneDrive support for RemoteApp in Azure Virtual Desktop

We are excited to announce that Microsoft OneDrive support is now available for RemoteApp in Azure Virtual Desktop! Previously, OneDrive could...

2 days ago

Announcing Cost and Performance Improvements with Azure Cosmos DB’s Binary Encoding

We are excited to announce a significant enhancement to Azure Cosmos DB, bringing substantial cost savings and performance improvements to our...

2 days ago

Customizing the combo of Azure Developer CLI and .NET Aspire

  When in the developer flow the Azure Developer CLI (azd) can provide a good experience when you want to move the code from your machin...

2 days ago
Stay up to date with latest Microsoft Dynamics 365 and Power Platform news!
* Yes, I agree to the privacy policy