Can't load some base_rules - Apache hangs
Steffan Vigano <svigano <at> boothcreek.com>
2010-09-02 22:05:04 GMT
Hello,
Having trouble getting mod_security to load the base set of rules. If
I start Apache commenting out the base_rules conf files, it starts just
fine.
> <IfModule security2_module>
> Include
> /usr/local/apache2/conf/Includes/mod_security2/modsecurity_crs_10_config.conf
> # Include
> /usr/local/apache2/conf/Includes/mod_security2/base_rules/*.conf
> </IfModule>
From the Apache log:
> [Thu Sep 02 13:16:47 2010] [notice] ModSecurity for Apache/2.5.12
> (http://www.modsecurity.org/) configured.
> [Thu Sep 02 13:16:48 2010] [notice] Apache/2.2.16 (Unix)
> mod_ssl/2.2.16 OpenSSL/0.9.8n PHP/5.2.14 configured -- resuming normal
> operations
But if I uncomment that line and try to read in the default ruleset, it
just hangs and I have to cntl-c to quit.
> <IfModule security2_module>
> Include
> /usr/local/apache2/conf/Includes/mod_security2/modsecurity_crs_10_config.conf
> Include
> /usr/local/apache2/conf/Includes/mod_security2/base_rules/*.conf
> </IfModule>
>
> village [/usr/local/apache2/]# apachectl -e debug
> [Thu Sep 02 14:17:08 2010] [debug] mod_so.c(328): loaded file
> /usr/local/lib/libxml2.so
> [Thu Sep 02 14:17:08 2010] [debug] mod_so.c(246): loaded module
> php5_module
> [Thu Sep 02 14:17:08 2010] [debug] mod_so.c(246): loaded module
> security2_module
> ^C
>
> village [/usr/local/apache2/]#
>
No output in the Apache Error log or the modsec_debug.log, even with
debugging turned all the way up. The only way I can get something to
output is to build mod_sec with debugging enabled. With that, I can
see that it starts to parse the rules before the hang:
> village [/usr/local/apache2/]# apachectl -e debug
>
> [Thu Sep 02 14:02:27 2010] [debug] mod_so.c(328): loaded file
> /usr/local/lib/libxml2.so
> [Thu Sep 02 14:02:27 2010] [debug] mod_so.c(246): loaded module
> php5_module
> [Thu Sep 02 14:02:27 2010] [debug] mod_so.c(246): loaded module
> security2_module
> Created directory config 2855bba0 path (null)
> Rule: type=1 p1='REMOTE_ADDR' p2=' <at> unconditionalMatch'
> p3='phase:1,t:none,pass,nolog,initcol:global=global,initcol:ip=%{remote_addr}'
> Adding rule 2909e3d0 phase=1 id="(none)".
> Rule: type=1 p1='REMOTE_ADDR' p2=' <at> unconditionalMatch'
> p3='phase:1,t:none,nolog,pass,setvar:tx.paranoid_mode=0'
> Adding rule 2909ed70 phase=1 id="(none)".
> Rule: type=1 p1='REMOTE_ADDR' p2=' <at> unconditionalMatch'
> p3='phase:1,t:none,nolog,pass,setvar:tx.inbound_anomaly_score_level=20'
> Adding rule 2909f418 phase=1 id="(none)".
> Rule: type=1 p1='REMOTE_ADDR' p2=' <at> unconditionalMatch'
> p3='phase:1,t:none,nolog,pass,setvar:tx.outbound_anomaly_score_level=15'
> Adding rule 2909fb70 phase=1 id="(none)".
> Rule: type=1 p1='REMOTE_ADDR' p2=' <at> unconditionalMatch'
> p3='phase:1,t:none,nolog,pass, setvar:tx.critical_anomaly_score=20,
> setvar:tx.error_anomaly_score=15, setvar:tx.warning_anomaly_score=10,
> setvar:tx.notice_anomaly_score=5'
> Adding rule 290a2350 phase=1 id="(none)".
> Rule: type=1 p1='REMOTE_ADDR' p2=' <at> unconditionalMatch'
> p3='phase:1,t:none,nolog,pass,setvar:tx.max_num_args=255'
> Adding rule 290a3180 phase=1 id="(none)".
> Rule: type=1 p1='REMOTE_ADDR' p2=' <at> unconditionalMatch'
> p3='phase:1,t:none,nolog,pass, setvar:'tx.allowed_methods=GET HEAD
> POST OPTIONS',
> setvar:'tx.allowed_request_content_type=application/x-www-form-urlencoded
> multipart/form-data text/xml application/xml',
> setvar:'tx.allowed_http_versions=HTTP/0.9 HTTP/1.0 HTTP/1.1',
> setvar:'tx.restricted_extensions=.asa .asax .ascx .axd .backup .bak
> .bat .cdx .cer .cfg .cmd .com .config .conf .cs .csproj .csr .dat .db
> .dbf .dll .dos .htr .htw .ida .idc .idq .inc .ini .key .licx .lnk .log
> .mdb .old .pass .pdb .pol .printer .pwd .resources .resx .sql .sys .vb
> .vbs .vbproj .vsdisco .webinfo .xsd .xsx',
> setvar:'tx.restricted_headers=Proxy-Connection Lock-Token
> Content-Range Translate via if''
> Adding rule 290a3a98 phase=1 id="(none)".
> Rule: type=0 p1='REQUEST_LINE'
>
p2='!^(?:(?:[a-z]{3,10}\\s+(?:\\w{3,7}?://[\\w\\-\\./]*(?::\\d+)?)?/[^?#]*(?:\\?[^#\\s]*)?(?:#[\\S]*)?|connect
> (?:\\d{1,3}\\.){3}\\d{1,3}\\.?(?::\\d+)?|options
> \\*)\\s+[\\w\\./]+|get /[^?#]*(?:\\?[^#\\s]*)?(?:#[\\S]*)?)$'
> p3='t:none,t:lowercase,phase:2,deny,log,auditlog,status:400,msg:'Invalid
> HTTP Request Line',id:'960911',severity:'2''
>
> ^C
If I hand pick a few conf files, it does load. Those that load are:
* modsecurity_crs_35_bad_robots.conf
* modsecurity_35_scanners.data
* modsecurity_35_bad_robots.data
* modsecurity_crs_47_common_exceptions.conf
* modsecurity_crs_42_tight_security.conf
* modsecurity_42_comment_spam.data
* modsecurity_crs_48_local_exceptions.conf
* modsecurity_crs_49_inbound_blocking.conf
* modsecurity_crs_49_enforcement.conf
* modsecurity_crs_59_outbound_blocking.conf
* modsecurity_crs_60_correlation.conf
Those that won't load are:
* modsecurity_crs_20_protocol_violations.conf
* modsecurity_crs_21_protocol_anomalies.conf
* modsecurity_crs_23_request_limits.conf
* modsecurity_crs_30_http_policy.conf
* modsecurity_crs_45_trojans.conf
* modsecurity_crs_41_xss_attacks.conf
* modsecurity_crs_41_phpids_converter.conf
* modsecurity_crs_41_phpids_filters.conf
* modsecurity_crs_41_sql_injection_attacks.conf
I'm at a loss. I'm working on FreeBSD 8.1 and compiling everything
from source using the latest versions of httpd (2.2.16) & modsecurity
(2.5.12). Configure and make never complain, and I checked that all
the mod_sec dependencies are also up to date. I'm not using liblua or
libcurl. Could that be the problem? What else could I check?
Thanks
-Steffan
------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:
Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
_______________________________________________
mod-security-users mailing list
mod-security-users <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mod-security-users
Commercial ModSecurity Appliances, Rule Sets and Support:
http://www.modsecurity.org/breach/index.html