ModSecurity icon indicating copy to clipboard operation
ModSecurity copied to clipboard

REQBODY_ERROR = null - ModSecurity/v3,nginx/1.12.0

Open JarRoDk opened this issue 9 years ago • 6 comments

Hi i wan to block not validated xml, my problem is that any xml request show REQBODY_ERROR = null

I am using recommended rules. https://github.com/SpiderLabs/ModSecurity/blob/v3/master/modsecurity.conf-recommended with SecRuleEngine On

this is my debug:

https://gist.github.com/JarRoDk/7eb32f0252f9993b7cb24846d6c5a953

my request is

POST https://<removed>:443/ HTTP/1.1
User-Agent: Fiddler
Content-Length: 6
Host: <removed>:443
Content-Type: text/xml; charset=utf-8

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" xmlns:int="http://<removed>/">
<s:Body>
<int:HealthCheck>
<int:healthCheckParameter>0</int:healthCheckParameter>
</int:HealthCheck>
</s:Body>
</s:Envelope>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" xmlns:int="http://<removed>/">
<s:Body>
<int:HealthCheck>
<int:healthCheckParameter>0</int:healthCheckParameter>
</int:HealthCheck>
</s:Body>
</s:Envelope>

In Modsecurity Apache/2.9.1 this request correct detect error in xml, i belive that right answers for REQBODY_ERROR should be 0/1 not NULL. Please tell me what i can do ?

JarRoDk avatar Jun 01 '17 15:06 JarRoDk

Hi @JarRoDk,

I was trying to reproduce your issue in a number of ways but it didn't worked. When firing your POST request against the latest codebase of libModSecurity and the nginx-connector with the recommended modsecurity.conf loaded this I get the results below.

My debug log shows this on line 28: [4] XML: Parsing complete (well_formed 0).

And on line 32 my debug log shows that the XML parser works as expected: [6] Resolving: reqbody_error_msg to: XML parsing error: XML: Failed parsing document.

Strangely enough line 44 of your logs suggest that the XML parser returned that the XML is valid: [4] XML: Parsing complete (well_formed 1). On a wild guess, because your XML is actually invalid it looks like the the code for the reqbody_error variable is not getting into any of the expected cases on your setup and it could explain why you're getting the value as NULL.

Could you make sure that are running the latest codebase and provide some additional information about your setup so we can try to reproduce the issue?

victorhora avatar Jun 01 '17 22:06 victorhora

@victorhora thx for answer my versions:

ModSecurity-nginx origin/master commit 3de175bdcbfa704a308d0e26fa8e34c0bb6b21ac Mon Apr 3 16:00:01 2017 +0300
ModSecurity v3/master commit 6143eb99e3ec8905acb6d309e201150dfd9f518d Wed May 10 12:50:38 2017 -0300

my build: https://gist.github.com/JarRoDk/bcfe26bd6e24424b1f0eb43a9249058f

in previews post i should say: In Modsecurity Apache/2.9.1 this request correct detect errorwhen i brake it, i belive that right answers for REQBODY_ERROR should be 0/1 not NULL. Please tell me what i can do ?

i will rebuild codebase and try to prepare infromation if i had still problem.

JarRoDk avatar Jun 02 '17 08:06 JarRoDk

Today i build ModSecurity v3/master commit 9d70345d3d3b938392f060cf67074322d20c29ee and i still had problem.

when i send checked and validated (for example on Apache/ModSecurity/2.9.1) request to my server with Nginx/ModSecurite v3 i always receive NULL

JarRoDk avatar Jun 02 '17 15:06 JarRoDk

@JarRoDk Can you share your modsecurity.conf and all the requests (valid/invalid) you are firing so I try to reproduce here?

victorhora avatar Jun 02 '17 16:06 victorhora

Values are no longer NULL. Only two valid states: zero or one.

zimmerle avatar Jul 31 '17 17:07 zimmerle

Hi @JarRoDk , what gcc version of the compiler (v3mod)? when i use gcc4.4.7 , i get error. must be use gcc4.8+ ???

365moods avatar Sep 11 '17 07:09 365moods