Search code examples
azureazure-waf

How do determine Azure WAF rule that affect to my specific url


My request got 403 when access to url like this format https://example.com/Test.aspx?param=https%3A%2F%2Fwww.test.com%2Fen-us%3F

I have read the document but I not sure which rule prevented my request.

Anyone can show me:

  • How do find exactly rule prevent my request
  • Report prevented requests (I have looked at the log but nothing in there)

Solution

  • If you have enabled WAF monitoring for application gateway or for Azure front door, you should see the ruleId in the Firewall log. Please note that the logs are only saved hourly. You could get more details from this blog.

    {
      "resourceId": "/SUBSCRIPTIONS/{subscriptionId}/RESOURCEGROUPS/{resourceGroupName}/PROVIDERS/MICROSOFT.NETWORK/APPLICATIONGATEWAYS/{applicationGatewayName}",
      "operationName": "ApplicationGatewayFirewall",
      "time": "2017-03-20T15:52:09.1494499Z",
      "category": "ApplicationGatewayFirewallLog",
      "properties": {
        "instanceId": "ApplicationGatewayRole_IN_0",
        "clientIp": "104.210.252.3",
        "clientPort": "4835",
        "requestUri": "/?a=%3Cscript%3Ealert(%22Hello%22);%3C/script%3E",
        "ruleSetType": "OWASP",
        "ruleSetVersion": "3.0",
        "ruleId": "941320",
        "message": "Possible XSS Attack Detected - HTML Tag Handler",
        "action": "Blocked",
        "site": "Global",
        "details": {
          "message": "Warning. Pattern match \"<(a|abbr|acronym|address|applet|area|audioscope|b|base|basefront|bdo|bgsound|big|blackface|blink|blockquote|body|bq|br|button|caption|center|cite|code|col|colgroup|comment|dd|del|dfn|dir|div|dl|dt|em|embed|fieldset|fn|font|form|frame|frameset|h1|head|h ...\" at ARGS:a.",
          "data": "Matched Data: <script> found within ARGS:a: <script>alert(\\x22hello\\x22);</script>",
          "file": "rules/REQUEST-941-APPLICATION-ATTACK-XSS.conf",
          "line": "865"
        }
        "hostname": "40.90.218.100", 
        "transactionId": "AYAcUqAcAcAcAcAcASAcAcAc"
      }
    }