Repository navigation
WAF hunting query added #15285
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Ravi Nandan Ray (Rajaravi99)
wants to merge
5
commits into
Azure:master
from
Rajaravi99:waf_hunting_query
Closed
WAF hunting query added #15285
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
6732c99
WAF hunting query added
Rajaravi99 69e8c06
updated readme with version 3.1.0
Rajaravi99 1e6ba9b
minor version updated to 3.1.0 and updated releasenote
Rajaravi99 2a32e39
resolved merge conflicts
Rajaravi99 64a5e80
regenerated solution package 3.1.0
Rajaravi99 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
...Firewall (WAF)/Hunting Queries/Azure WAF - Bypass Via Double URL Encoded Admin Paths.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| id: 16a81a04-3d26-4118-8f6d-6dd3389583cc | ||
| name: Bypass Attempt via Double URL Encoding | ||
| description: | | ||
| Identifies potential malicious bypass attempts of the Azure Web Application Firewall using Double URL Encoding techniques. Adversaries often use multi-layer encoding to obfuscate payloads targeting administrative or sensitive application directories. | ||
| description-detailed: | | ||
| This hunting query screens both modern and legacy Azure Application Gateway WAF logs for instances where a request URI, when stripped of query parameters and decoded a second time, reveals a mismatch against its initial decode layer. It filters these anomalies against critical administrative keywords (e.g., admin, setup, config) to isolate targeted evasion. Verify that the flagged clients are not authorized web scanners or legacy custom applications utilizing eccentric routing configurations. | ||
| status: Available | ||
| requiredDataConnectors: | ||
| - connectorId: WAF | ||
| dataTypes: | ||
| - AGWFirewallLogs | ||
| - AzureDiagnostics | ||
| tactics: | ||
| - DefenseEvasion | ||
| relevantTechniques: | ||
| - T1027 | ||
| query: | | ||
| let StartTime = ago(1d); | ||
| let EndTime = now(); | ||
| let TargetAdminPathRegex = @"^/?(admin|psemhub|bin|config|setup|install|login)"; | ||
| let ModernWAF = (AGWFirewallLogs | ||
| | where TimeGenerated between (StartTime .. EndTime) | ||
| | where Action in~ ("Allowed", "Matched") | ||
| | extend RequestPath = tostring(split(RequestUri, "?")[0]) | ||
| | extend PrimaryDecode = url_decode(RequestPath), SecondaryDecode = url_decode(url_decode(RequestPath)) | ||
| | where RequestPath != PrimaryDecode and PrimaryDecode != SecondaryDecode | ||
| | extend NormalizedPath = tolower(SecondaryDecode) | ||
| | where NormalizedPath matches regex TargetAdminPathRegex | ||
| | project TimeGenerated, clientIp = ClientIp, hostname = Hostname, requestUri = RequestUri, action = Action); | ||
| let LegacyWAF = (AzureDiagnostics | ||
| | where TimeGenerated between (StartTime .. EndTime) | ||
| | where Category == "ApplicationGatewayFirewallLog" | ||
| | where action_s in~ ("Allowed", "Matched") | ||
| | extend RequestPath = tostring(split(requestUri_s, "?")[0]) | ||
| | extend PrimaryDecode = url_decode(RequestPath), SecondaryDecode = url_decode(url_decode(RequestPath)) | ||
| | where RequestPath != PrimaryDecode and PrimaryDecode != SecondaryDecode | ||
| | extend NormalizedPath = tolower(SecondaryDecode) | ||
| | where NormalizedPath matches regex TargetAdminPathRegex | ||
| | project TimeGenerated, clientIp = clientIp_s, hostname = hostname_s, requestUri = requestUri_s, action = action_s); | ||
| union isfuzzy=true ModernWAF, LegacyWAF | ||
| | summarize | ||
| FirstSeen = min(TimeGenerated), | ||
| LastSeen = max(TimeGenerated), | ||
| AttackCount = count(), | ||
| SamplePayloads = make_set(requestUri, 5) | ||
| by clientIp, hostname, action | ||
| entityMappings: | ||
| - entityType: IP | ||
| fieldMappings: | ||
| - identifier: Address | ||
| columnName: clientIp | ||
| - entityType: Host | ||
| fieldMappings: | ||
| - identifier: HostName | ||
| columnName: hostname | ||
| customDetails: | ||
| WAFAction: action | ||
| TotalAttempts: AttackCount | ||
| version: 1.0.0 |
Binary file modified
BIN
+1.1 KB
(110%)
Solutions/Azure Web Application Firewall (WAF)/Package/3.0.0.zip
Binary file not shown.
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.