920160 - Content-Length HTTP header is not numeric triggered on WAF
Hello everyone,
I'm encountering an issue with my Azure-hosted application. It's hosted on Azure app service, and I have the OSWAP_3.2 WAF policy enabled on my application gateway.
Recently, I've started receiving a 403 Forbidden error when making an API POST request. I'm using Postman for this request, and I believe the "Content-Length" header is automatically added by Postman.
Here are the details of the error from the firewall logs:
{
"timeStamp": "2023-08-15T05:25:12+00:00",
"resourceId": "/SUBSCRIPTIONS/XXXXX-XXXX-XX-AA76-391CEB2CFDBA/RESOURCEGROUPS/OSS-XXX-USE2-XXXXXSVC-DEV-RG01/PROVIDERS/MICROSOFT.NETWORK/APPLICATIONGATEWAYS/AZUSWAXXXXX",
"operationName": "ApplicationGatewayFirewall",
"category": "ApplicationGatewayFirewallLog",
"properties": {
"instanceId": "appgw_0",
"clientIp": "20.187.22.22",
"requestUri": "\/connect\/token",
"ruleSetType": "OWASP CRS",
"ruleSetVersion": "3.2",
"ruleId": "920160",
"ruleGroup": "REQUEST-920-PROTOCOL-ENFORCEMENT",
"message": "Content-Length HTTP header is not numeric.",
"action": "Matched",
"details": {
"message": "Pattern match ^\\d+$ at REQUEST_HEADERS:content-length.",
"data": "{ found within [REQUEST_HEADERS:]}",
"file": "REQUEST-920-PROTOCOL-ENFORCEMENT.conf",
"line": "130"
},
"hostname": "dev.xyz.com",
"transactionId": "23e63bed8a6e218e2d286ca237216051",
"policyId": "154#_subscriptions_xxxxx-xxx-xxx-aa76-391ceb2cfdba_resourceGroups_OSS-XXX-USE2-XXXX-DEV-RG01_providers_Microsoft.Network_ApplicationGatewayWebApplicationFirewallPolicies_WAF-azuswa1xxxxxx",
"policyScope": "Global",
"policyScopeName": "Global",
"engine": "Azwaf"
}
}
I tried adding an exclusion to stop checking the "Content-Length" header, but that didn't work. Could this be a false positive?
Any advice or suggestions on how to troubleshoot and resolve this issue would be greatly appreciated.
Thank you in advance for your assistance!