Skip to content

SecRuleUpdateTargetById does not work anymore (since version 3.0.4) #2251

@matthijs

Description

@matthijs

Describe the bug

Due to a security bug in libmodsecurity version 3.0.3 we decided to upgrade to version 3.0.4. After we did the upgrade one of our SecRuleUpdateTargetById didn't work anymore.

To be more precise, we have an incoming JSON request which contains a SSL-certificate. This certificate causes libinjection to detect a XSS. Which is obviously not true. So we have the following configuration to exclude that specific parameter:
SecRuleUpdateTargetById 941100 "!ARGS:json.data.certificate.certificates.intermediate"

Logs and dumps

Output of:

  1. DebugLogs (level 9)
    See attachment debug.log.gz

  2. AuditLogs
    See attachment audit.log.gz

  3. Error logs
    2020/01/28 16:55:15 [error] 30675#30675: *1 [client ] ModSecurity: Access denied with code 403 (phase 2). Matched "Operator Ge' with parameter 5' against variable TX:ANOMALY_SCORE' (Value: 5' ) [file "/usr/share/modsecurity-crs/rules/REQUEST-949-BLOCKING-EVALUATION.conf"] [line "79"] [id "949110"] [rev ""] [msg "Inbound Anomaly Score Exceeded (Total Score: 5)"] [data ""] [severity "2"] [ver ""] [maturity "0"] [accuracy "0"] [tag "application-multi"] [tag "language-multi"] [tag "platform-multi"] [tag "attack-generic"] [hostname ""] [uri "/url"] [unique_id "158022691566.663811"] [ref ""], client: , server: ccp.cacholong.nl, request: "POST /url HTTP/2.0", host: "host"

  4. If there is a crash, the core dump file.
    No crash.

To Reproduce

Steps to reproduce the behavior:

1.) Have the core rule set installed (version 3.2.0) with the following configuration in nginx:
Include /etc/modsecurity/modsecurity.conf
Include /etc/modsecurity/crs/crs-setup.conf
Include /etc/modsecurity/crs/REQUEST-900-EXCLUSION-RULES-BEFORE-CRS.conf
Include /usr/share/modsecurity-crs/rules/*.conf
SecRuleUpdateTargetById 941100 "!ARGS:json.data.certificate.certificates.intermediate"
Include /etc/modsecurity/crs/RESPONSE-999-EXCLUSION-RULES-AFTER-CRS.conf

2.) curl command to reproduce: (postdata.json.gz)
curl -D - -o /dev/null -s -H 'Content-Type: application/json' -H 'Signature: sha256=9555eb4df0540088409847235897b5f99c298678157baf90f3670f5ddb3990f7' -X POST -d @postdata.json https://somehost/url

Expected behavior

I expect that modsecurity leaves the request alone and does not return with a 403 error. To be precise the rule 941100 should not be triggered because of the updated target (!ARGS:json.data.certificate.certificates.intermediate).

Server (please complete the following information):

  • ModSecurity v3.0.4 with nginx-connector v1.0.1
  • WebServer: nginx 1.16.1
  • OS (and distro): Linux, Debian GNU/Linux

Rule Set (please complete the following information):

  • Running any public or commercial rule set?
    Modsecurity core rule set (debian package installed on this system)
  • What is the version number?
    3.2.0

Regards, Matthijs

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions