Skip to content

How to catch XML Parse Error with REQBODY_PROCESSOR_ERROR #3315

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
touchweb-vincent opened this issue Dec 13, 2024 · 0 comments
Closed

How to catch XML Parse Error with REQBODY_PROCESSOR_ERROR #3315

touchweb-vincent opened this issue Dec 13, 2024 · 0 comments
Labels
2.x Related to ModSecurity version 2.x

Comments

@touchweb-vincent
Copy link

Hello,

It's not a bug report, just an information share we hope some folks would find usefull.

If you want catch REQBODY_PROCESSOR_ERROR against requestBodyProcessor=XML, your rules on phase 2 will be bypass.

You must catch it on phase 3+.

This will work on both requestBodyProcessor=JSON and requestBodyProcessor=XML :

SecRule REQBODY_PROCESSOR_ERROR "!@eq 0" "id:'200003',phase:3,t:none,deny,status:403,msg:'Multipart request body failed strict validation: PE %{REQBODY_PROCESSOR_ERROR}''

curl -v 'https://preprod.X' -H 'content-type: application/xml' -d 'test'
curl -v 'https://preprod.X' -H 'content-type: application/json' -d 'test'

Have a good day

Vincent

@touchweb-vincent touchweb-vincent added the 2.x Related to ModSecurity version 2.x label Dec 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.x Related to ModSecurity version 2.x
Projects
None yet
Development

No branches or pull requests

1 participant