I have configured a Azure Application Gateway + WAF
in front of an ASP.Net Core application running on an Azure WebApp.
I have the the default OWASP 3.0
Rules set on and in Prevention mode.
The problem I have is that every request via the WAF fails in one way or another with some of the default set of rules returning a 403 - Forbidden status
.
Looking through WAF logs I had found few rules failing.
SQL Hex Encoding Identified
{ "message": "Warning. Pattern match \"(?i:(?:\\\\A|[^\\\\d])0x[a-f\\\\d]{3,}[a-f\\\\d]*)+\" at REQUEST_COOKIES:ASP.Net_Auth.", "data": "Matched Data: H0XAa4 found within REQUEST_COOKIES:AspNetCore.Auth: CfDJ8El_2vmJILFHjQYUCDWwttioV16BAlL12KiQnTLGZztGtA8P0xbo1MosAgmrkUk4IQ7pF5O4ZMJbmRHsHxYHq842rq_hr8FUyMhAMo_5mQ-C_5jBrkRWqUGrYHMa6fVIj4xtGOfku...", }
SQL Comment Sequence Detected
"message": "SQL Comment Sequence Detected.", "details": { "message": "Warning. Pattern match \"(/\\\\*!?|\\\\*/|[';]--|--[\\\\s\\\\r\\\\n\\\\v\\\\f]|(?:--[^-]*?-)|([^\\\\-&])#.*?[\\\\s\\\\r\\\\n\\\\v\\\\f]|;?\\\\x00)\" at REQUEST_COOKIES:.AspNetCore.Identity.Application.", "data": "Matched Data: --Z35d...- found within REQUEST_COOKIES:.AspNetCore.Identity.Application: CfDJ8El_2vmJILFHjQYUCDWwttihjUTpJneEVE1l-3UeTx...", "file": "rules/REQUEST-942-APPLICATION-ATTACK-SQLI.conf", "line": "1053" }
PCRE limits exceeded
{ "requestUri": "/api/ping?_=240477821", "message": "Execution error - PCRE limits exceeded (-8): (null)." }
That url /api/ping has no return except 200 OK.
I can't find any good documentation on these rules and when and which rule should be enabled/disabled. I'm sure I can disable them but it feels to me that the WAF is very aggressive and picks up too many false positives.
Is there a default set of rules that are good and safe and compatible by default with an ASP.Net Core app?