coreruleset: Configuration on crs-setup.conf does not work

Describe the bug

Configuration in the crs-setup.conf in :

SecAction \
    "id:900100,\
    phase:1,\
    pass,\
    t:none,\
    nolog,\
    tag:'OWASP_CRS',\
    ver:'OWASP_CRS/4.3.0',\
    setvar:tx.critical_anomaly_score=7,\
    setvar:tx.error_anomaly_score=4,\
    setvar:tx.warning_anomaly_score=3,\
    setvar:tx.notice_anomaly_score=2"


SecAction \
    "id:900991,\
    phase:1,\
    pass,\
    t:none,\
    nolog,\
    tag:'OWASP_CRS',\
    setvar:'tx.sql_injection_score=0',\
    setvar:'tx.xss_score=0',\
    setvar:'tx.lfi=7',\
    setvar:'tx.rfi_score=7'"

On desperation I also edit in the REQUEST-901-INITIALIZATION.conf

by modify this :

    "id:901140,\
    phase:1,\
    pass,\
    nolog,\
    tag:'OWASP_CRS',\
    ver:'OWASP_CRS/4.3.0',\
    setvar:'tx.critical_anomaly_score=7'"

Tested using this url curl ‘https://example.com/.bash_’

Log : ModSecurity: Warning. Matched "Operator PmFromFile’ with parameter restricted-files.data' against variable REQUEST_FILENAME’ (Value: /.bash_' ) [file "/etc/apache2/modsecurity.d/owasp-crs/rules/REQUEST-930-APPLICATION-ATTACK-LFI.conf"] [line "124"] [id "930130"] [rev ""] [msg "Restricted File Access Attempt"] [data "Matched Data: .bash_ found within REQUEST_FILENAME: /.bash_"] [severity "2"] [ver "OWASP_CRS/4.3.0"] [maturity "0"] [accuracy "0"] [tag "application-multi"] [tag "language-multi"] [tag "platform-multi"] [tag "attack-lfi"] [tag "paranoia-level/1"] [tag "OWASP_CRS"] [tag "capec/1000/255/153/126"] [tag "PCI/6.5.4"] [hostname "example.com"] [uri "/.bash_"] [unique_id "171893186374.358779"] [ref "o1,6v4,7t:utf8toUnicode,t:urlDecodeUni,t:normalizePathWin"]

Steps to reproduce

Tested using this url curl 'https://example.com/.bash_'

Expected behaviour

If the rules triggered a CRITICAL it should be blocked. On that configuration the initial value of threshold is 7, so any CRITICAL rules triggered, it should get blocked. If the rules are based on RFI or LFI it should get blocked. should be blocked based on the setting in the crs-setup.conf

Actual behavior

This configuration is not working : setvar:tx.critical_anomaly_score=7,\ and setvar:'tx.rfi_score=7'"

The crs use no value to accumulative anomaly score to block the request

Your Environment

init.conf file content :

   # Include OWASP ModSecurity CRS rules if installed        
   Include "/etc/apache2/modsecurity.d/modsecurity.conf"
   Include /etc/apache2/modsecurity.d/owasp-crs/crs-setup.conf 
   Include /etc/apache2/modsecurity.d/owasp-crs/plugins/*-config.conf
   Include /etc/apache2/modsecurity.d/owasp-crs/plugins/*-before.conf 
   Include /etc/apache2/modsecurity.d/owasp-crs/rules/*.conf 
   Include /etc/apache2/modsecurity.d/owasp-crs/plugins/*-after.conf 
  • CRS version 4.3.0:
  • Paranoia level setting: df
  • ModSecurity version 3.0.12:
  • Web Server and version : Apache - 2.4.41
  • Operating System and version: Ubuntu 20.04

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 28 (17 by maintainers)

Most upvoted comments

@navotera Thanks for letting us know. Please note that i was telling you from the beginning that your installation is broken somehow and needs to be created from scratch (without custom modifications).

After reinstall ModSecurity and ApacheConnector

Please note that the Apache connector for libmodsecurity3 is still not production ready. I suggest you NOT to use it.

Sorry, i cannot help you.