Daniel Finn | 3 Jan 2011 22:21
Favicon

Recently upgraded from 1.6.1 to 2.0.5 and I've got some questions/confusion.

As the subject says, I recently upgraded from 1.6.1 to 2.0.5 on one of our servers and I’m a little confused about the results.  I’m running RHEL 5.5 and I got the mod_security package from the EPEL repo.  According to RPM I am running version 2.5.12-1.el5 of mod_security and /etc/httpd/modsecurity.d/modsecurity_crs_10_config.conf says I’m running Core Rule Set ver. 2.0.5.

While looking over some things I noticed that this updated rule set came with SecDefaultAction set to "phase:2,pass".   Previous to upgrading, I had SecDefaultAction set to "phase:2,log,deny,status:403,t:lowercase,t:replaceNulls,t:compressWhitespace".  What I’m confused about is it seems like having it currently set to “phase:2,pass” should be allowing everything through but that is not the case.

Some of the tests I found online to determine whether or not mod_security is functioning properly work and some don’t.  For example, www.example.com/?wget logs an error but passes the page through however www.domain.com/phpids?test=1+OR+1%3D1 logs an error and blocks the page.  Why would that be?


Here’s my /etc/httpd/modsecurity.d/modsecurity_crs_10_config.conf:

# ---------------------------------------------------------------
# Core ModSecurity Rule Set ver.2.0.5
# Copyright (C) 2006-2010 Breach Security Inc. All rights reserved.
#
# The ModSecurity Core Rule Set is distributed under GPL version 2
# Please see the enclosed LICENCE file for full details.
# ---------------------------------------------------------------


## -- Configuration ----------------------------------------------------------
#
# Specify CRS version in the audit logs.
#
SecComponentSignature "core ruleset/2.0.5"

#
# Create both Global and IP collections for rules to use
# There are some CRS rules that assume that these two collections
# have already been initiated.
#
SecAction "phase:1,t:none,pass,nolog,initcol:global=global,initcol:ip=%{remote_addr}"

# You most likely already have a base ModSecurity configuration.  The data
# presented in this file should work in conjunction with your configs.
# There are also some references to some directive settings that you will
# want to double check.

#
# -=[ Paranoid Mode ]=-
#
# There are many different transactional variables that can be inspected for
# attacks.  Some variables, such as ARGS, has the best false negative/false
# positive ratio where it will catch the vast majority of attack payloads and
# not have a high false positive rate.  This is also true for some security
# checks such as <at> validateByteRange checks where we are initially only inspecting
# for Nul Bytes.
#
# There are, however, some possibilities for false negative issues with inspecting
# parsed data and this could lead to missed attacks.  If you
# want to lessen the chances for false negatives, then you should enable
# "Paranoid Mode" processing by setting the following line to 1.  This will process
# additional rules that are inspecting variables with a higher false positive rate.
#
SecAction "phase:1,t:none,nolog,pass,setvar:tx.paranoid_mode=0"


#
# -=[ Anomaly Scoring Threshold Levels ]=-
#
# These variables are used in macro expansion in the 49 inbound blocking and 59
# outbound blocking files.
#
# **MUST HAVE** ModSecurity v2.5.12 or higher to use macro expansion in numeric
# operators.  If you have an earlier version, edit the 49/59 files directly to
# set the appropriate anomaly score levels.
#
# You should set the score to the proper threshold you would prefer. If set to "5"
# it will work similarly to previous Mod CRS rules and will create an event in the error_log
# file if there are any rules that match.  If you would like to lessen the number of events
# generated in the error_log file, you should increase the anomaly score threshold to
# something like "20".  This would only generate an event in the error_log file if
# there are multiple lower severity rule matches or if any 1 higher severity item matches.
#
SecAction "phase:1,t:none,nolog,pass,setvar:tx.inbound_anomaly_score_level=20"
SecAction "phase:1,t:none,nolog,pass,setvar:tx.outbound_anomaly_score_level=15"


#
# -=[ Anomaly Scoring Severity Levels ]=-
#
# These are the default scoring points for each severity level.  You may
# adjust these to you liking.  These settings will be used in macro expansion
# in the rules to increment the anomaly scores when rules match.
#
# These are the default Severity ratings (with anomaly scores) of the individual rules -
#
#    - 2: Critical - Anomaly Score of 20.
#         Is the highest severity level possible without correlation.  It is
#         normally generated by the web attack rules (40 level files).
#    - 3: Error - Anomaly Score of 15.
#         Is generated mostly from outbound leakage rules (50 level files).
#    - 4: Warning - Anomaly Score of 10.
#         Is generated by malicious client rules (35 level files).
#    - 5: Notice - Anomaly Score of 5.
#         Is generated by the Protocol policy and anomaly files.
#
SecAction "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"


#
# -=[ HTTP Policy Settings ]=-
# Set the following policy settings here and they will be propagated to the 23 rules
# file (modsecurity_common_23_request_limits.conf) by using macro expansion.  
# If you run into false positives, you can adjust the settings here.
#
# Only the max number of args is uncommented by default as there are a high rate
# of false positives.  Uncomment the items you wish to set.
#
## Maximum number of arguments in request limited
SecAction "phase:1,t:none,nolog,pass,setvar:tx.max_num_args=255"

## Limit argument name length
#SecAction "phase:1,t:none,nolog,pass,setvar:tx.arg_name_length=100"

## Limit value name length
#SecAction "phase:1,t:none,nolog,pass,setvar:tx.arg_length=400"

## Limit arguments total length
#SecAction "phase:1,t:none,nolog,pass,setvar:tx.total_arg_length=64000"

## Individual file size is limited
#SecAction "phase:1,t:none,nolog,pass,setvar:tx.max_file_size=1048576"

## Combined file size is limited
#SecAction "phase:1,t:none,nolog,pass,setvar:tx.combined_file_sizes=1048576"


# Set the following policy settings here and they will be propagated to the 30 rules
# file (modsecurity_crs_30_http_policy.conf) by using macro expansion.  
# If you run into false positves, you can adjust the settings here.
#
SecAction "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'"

#
#
# -=[ Blocking Action ]=-
# What to do when the anomaly score threshold is exceeded.
#
# The default is to log the error and let the request go through.
# This is a reasonable setting to start with because you do not
# want to reject legitimate requests with an untuned rule set.
#
# The following line's settings will be inherited by rules that
# do blocking in the 49 inbound and 59 outbound blocking files.
#
# Change to a disruptive action such as deny, drop or redirect if you
# want to block the transaction.
#
SecDefaultAction "phase:2,pass"


#
# Review your SecRuleEngine settings.  If you want to
# allow blocking, then set it to On however check your SecDefaultAction setting
# to ensure that it is set appropriately.
#
SecRuleEngine On

SecDataDir /tmp/

SecAuditLogRelevantStatus "^(?:5|4(?!04))"
# You can select to log all events to a single log file (set SecAuditLogType to
# TODO Set the SecAuditLog (for "Serial" logging) or SecAuditLogStorageDir (for
#      SecAuditLogStorageDir directive and make sure the direcory specified
SecAuditLogType Serial
SecAuditLog logs/modsec_audit.log
# SecAuditLogStorageDir logs/modsec_audit
SecAuditLogParts "ABIFHKZ"
SecAuditEngine RelevantOnly
#SecDefaultAction "phase:2,log,deny,status:403,t:lowercase,t:replaceNulls,t:compressWhitespace"


And here’s the modules that it’s using:

modsecurity_35_bad_robots.data
modsecurity_35_scanners.data
modsecurity_40_generic_attacks.data
modsecurity_41_sql_injection_attacks.data
modsecurity_42_comment_spam.data
modsecurity_46_et_sql_injection.data
modsecurity_46_et_web_rules.data
modsecurity_50_outbound.data
modsecurity_50_outbound_malware.data
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_35_bad_robots.conf
modsecurity_crs_40_generic_attacks.conf
modsecurity_crs_41_phpids_converter.conf
modsecurity_crs_41_phpids_filters.conf
modsecurity_crs_41_sql_injection_attacks.conf
modsecurity_crs_41_xss_attacks.conf
modsecurity_crs_42_tight_security.conf
modsecurity_crs_45_trojans.conf
modsecurity_crs_47_common_exceptions.conf
modsecurity_crs_48_local_exceptions.conf
modsecurity_crs_49_enforcement.conf
modsecurity_crs_49_inbound_blocking.conf
modsecurity_crs_50_outbound.conf
modsecurity_crs_59_outbound_blocking.conf
modsecurity_crs_60_correlation.conf

Any help or pointers would be really appreciated.

Thanks,
Dan

Email Policy - Unauthorized review, use, disclosure, or distribution of this e-mail is strictly prohibited. This e-mail transmission, and any documents, files or previous e-mail messages attached to it, is intended solely for the individual or individuals to whom it is specifically addressed. If the recipient of this email is not the intended recipient, do not read, copy or distribute it or any of the information it contains. Please delete it immediately and notify us by return email or by telephone 801.572.4200.
------------------------------------------------------------------------------
Learn how Oracle Real Application Clusters (RAC) One Node allows customers
to consolidate database storage, standardize their database environment, and, 
should the need arise, upgrade to a full multi-node Oracle RAC database 
without downtime or disruption
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
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
Ryan Barnett | 3 Jan 2011 22:46

Re: Recently upgraded from 1.6.1 to 2.0.5 and I've got some questions/confusion.

Dan,
A few things -

1) Check out this recent blog post -
<http://blog.spiderlabs.com/2010/11/advanced-topic-of-the-week-traditional-vs-anomaly-scoring-detection-modes.html> http://blog.spiderlabs.com/2010/11/advanced-topic-of-the-week-traditional-vs-anomaly-scoring-detection-modes.html


2) I would install the latest CRS v2.1.1 -
<https://sourceforge.net/projects/mod-security/files/modsecurity-crs/0-CURRENT/> https://sourceforge.net/projects/mod-security/files/modsecurity-crs/0-CURRENT/


3) I would also sign up for the CRS mail list -
<https://lists.owasp.org/mailman/listinfo/owasp-modsecurity-core-rule-set> https://lists.owasp.org/mailman/listinfo/owasp-modsecurity-core-rule-set


--
Ryan Barnett


On Jan 3, 2011, at 4:40 PM, "Daniel Finn" <Dan.Finn <at> ultradent.com<mailto:Dan.Finn <at> ultradent.com>> wrote:

As the subject says, I recently upgraded from 1.6.1 to 2.0.5 on one of our servers and I’m a little confused
about the results.  I’m running RHEL 5.5 and I got the mod_security package from the EPEL repo.  According
to RPM I am running version 2.5.12-1.el5 of mod_security and
/etc/httpd/modsecurity.d/modsecurity_crs_10_config.conf says I’m running Core Rule Set ver. 2.0.5.

While looking over some things I noticed that this updated rule set came with SecDefaultAction set to
"phase:2,pass".   Previous to upgrading, I had SecDefaultAction set to
"phase:2,log,deny,status:403,t:lowercase,t:replaceNulls,t:compressWhitespace".  What I’m
confused about is it seems like having it currently set to “phase:2,pass” should be allowing
everything through but that is not the case.

Some of the tests I found online to determine whether or not mod_security is functioning properly work and
some don’t.  For example, www.example.com/?wget<http://www.example.com/?wget> logs an error but
passes the page through however
www.domain.com/phpids?test=1+OR+1%3D1<http://www.domain.com/phpids?test=1+OR+1%3D1> logs an
error and blocks the page.  Why would that be?


Here’s my /etc/httpd/modsecurity.d/modsecurity_crs_10_config.conf:

# ---------------------------------------------------------------
# Core ModSecurity Rule Set ver.2.0.5
# Copyright (C) 2006-2010 Breach Security Inc. All rights reserved.
#
# The ModSecurity Core Rule Set is distributed under GPL version 2
# Please see the enclosed LICENCE file for full details.
# ---------------------------------------------------------------


## -- Configuration ----------------------------------------------------------
#
# Specify CRS version in the audit logs.
#
SecComponentSignature "core ruleset/2.0.5"

#
# Create both Global and IP collections for rules to use
# There are some CRS rules that assume that these two collections
# have already been initiated.
#
SecAction "phase:1,t:none,pass,nolog,initcol:global=global,initcol:ip=%{remote_addr}"

# You most likely already have a base ModSecurity configuration.  The data
# presented in this file should work in conjunction with your configs.
# There are also some references to some directive settings that you will
# want to double check.

#
# -=[ Paranoid Mode ]=-
#
# There are many different transactional variables that can be inspected for
# attacks.  Some variables, such as ARGS, has the best false negative/false
# positive ratio where it will catch the vast majority of attack payloads and
# not have a high false positive rate.  This is also true for some security
# checks such as  <at> validateByteRange checks where we are initially only inspecting
# for Nul Bytes.
#
# There are, however, some possibilities for false negative issues with inspecting
# parsed data and this could lead to missed attacks.  If you
# want to lessen the chances for false negatives, then you should enable
# "Paranoid Mode" processing by setting the following line to 1.  This will process
# additional rules that are inspecting variables with a higher false positive rate.
#
SecAction "phase:1,t:none,nolog,pass,setvar:tx.paranoid_mode=0"


#
# -=[ Anomaly Scoring Threshold Levels ]=-
#
# These variables are used in macro expansion in the 49 inbound blocking and 59
# outbound blocking files.
#
# **MUST HAVE** ModSecurity v2.5.12 or higher to use macro expansion in numeric
# operators.  If you have an earlier version, edit the 49/59 files directly to
# set the appropriate anomaly score levels.
#
# You should set the score to the proper threshold you would prefer. If set to "5"
# it will work similarly to previous Mod CRS rules and will create an event in the error_log
# file if there are any rules that match.  If you would like to lessen the number of events
# generated in the error_log file, you should increase the anomaly score threshold to
# something like "20".  This would only generate an event in the error_log file if
# there are multiple lower severity rule matches or if any 1 higher severity item matches.
#
SecAction "phase:1,t:none,nolog,pass,setvar:tx.inbound_anomaly_score_level=20"
SecAction "phase:1,t:none,nolog,pass,setvar:tx.outbound_anomaly_score_level=15"


#
# -=[ Anomaly Scoring Severity Levels ]=-
#
# These are the default scoring points for each severity level.  You may
# adjust these to you liking.  These settings will be used in macro expansion
# in the rules to increment the anomaly scores when rules match.
#
# These are the default Severity ratings (with anomaly scores) of the individual rules -
#
#    - 2: Critical - Anomaly Score of 20.
#         Is the highest severity level possible without correlation.  It is
#         normally generated by the web attack rules (40 level files).
#    - 3: Error - Anomaly Score of 15.
#         Is generated mostly from outbound leakage rules (50 level files).
#    - 4: Warning - Anomaly Score of 10.
#         Is generated by malicious client rules (35 level files).
#    - 5: Notice - Anomaly Score of 5.
#         Is generated by the Protocol policy and anomaly files.
#
SecAction "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"


#
# -=[ HTTP Policy Settings ]=-
# Set the following policy settings here and they will be propagated to the 23 rules
# file (modsecurity_common_23_request_limits.conf) by using macro expansion.
# If you run into false positives, you can adjust the settings here.
#
# Only the max number of args is uncommented by default as there are a high rate
# of false positives.  Uncomment the items you wish to set.
#
## Maximum number of arguments in request limited
SecAction "phase:1,t:none,nolog,pass,setvar:tx.max_num_args=255"

## Limit argument name length
#SecAction "phase:1,t:none,nolog,pass,setvar:tx.arg_name_length=100"

## Limit value name length
#SecAction "phase:1,t:none,nolog,pass,setvar:tx.arg_length=400"

## Limit arguments total length
#SecAction "phase:1,t:none,nolog,pass,setvar:tx.total_arg_length=64000"

## Individual file size is limited
#SecAction "phase:1,t:none,nolog,pass,setvar:tx.max_file_size=1048576"

## Combined file size is limited
#SecAction "phase:1,t:none,nolog,pass,setvar:tx.combined_file_sizes=1048576"


# Set the following policy settings here and they will be propagated to the 30 rules
# file (modsecurity_crs_30_http_policy.conf) by using macro expansion.
# If you run into false positves, you can adjust the settings here.
#
SecAction "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'"

#
#
# -=[ Blocking Action ]=-
# What to do when the anomaly score threshold is exceeded.
#
# The default is to log the error and let the request go through.
# This is a reasonable setting to start with because you do not
# want to reject legitimate requests with an untuned rule set.
#
# The following line's settings will be inherited by rules that
# do blocking in the 49 inbound and 59 outbound blocking files.
#
# Change to a disruptive action such as deny, drop or redirect if you
# want to block the transaction.
#
SecDefaultAction "phase:2,pass"


#
# Review your SecRuleEngine settings.  If you want to
# allow blocking, then set it to On however check your SecDefaultAction setting
# to ensure that it is set appropriately.
#
SecRuleEngine On

SecDataDir /tmp/

SecAuditLogRelevantStatus "^(?:5|4(?!04))"
# You can select to log all events to a single log file (set SecAuditLogType to
# TODO Set the SecAuditLog (for "Serial" logging) or SecAuditLogStorageDir (for
#      SecAuditLogStorageDir directive and make sure the direcory specified
SecAuditLogType Serial
SecAuditLog logs/modsec_audit.log
# SecAuditLogStorageDir logs/modsec_audit
SecAuditLogParts "ABIFHKZ"
SecAuditEngine RelevantOnly
#SecDefaultAction "phase:2,log,deny,status:403,t:lowercase,t:replaceNulls,t:compressWhitespace"


And here’s the modules that it’s using:

modsecurity_35_bad_robots.data
modsecurity_35_scanners.data
modsecurity_40_generic_attacks.data
modsecurity_41_sql_injection_attacks.data
modsecurity_42_comment_spam.data
modsecurity_46_et_sql_injection.data
modsecurity_46_et_web_rules.data
modsecurity_50_outbound.data
modsecurity_50_outbound_malware.data
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_35_bad_robots.conf
modsecurity_crs_40_generic_attacks.conf
modsecurity_crs_41_phpids_converter.conf
modsecurity_crs_41_phpids_filters.conf
modsecurity_crs_41_sql_injection_attacks.conf
modsecurity_crs_41_xss_attacks.conf
modsecurity_crs_42_tight_security.conf
modsecurity_crs_45_trojans.conf
modsecurity_crs_47_common_exceptions.conf
modsecurity_crs_48_local_exceptions.conf
modsecurity_crs_49_enforcement.conf
modsecurity_crs_49_inbound_blocking.conf
modsecurity_crs_50_outbound.conf
modsecurity_crs_59_outbound_blocking.conf
modsecurity_crs_60_correlation.conf

Any help or pointers would be really appreciated.

Thanks,
Dan

Email Policy - Unauthorized review, use, disclosure, or distribution of this e-mail is strictly
prohibited. This e-mail transmission, and any documents, files or previous e-mail messages attached to
it, is intended solely for the individual or individuals to whom it is specifically addressed. If the
recipient of this email is not the intended recipient, do not read, copy or distribute it or any of the
information it contains. Please delete it immediately and notify us by return email or by telephone 801.572.4200.
------------------------------------------------------------------------------
Learn how Oracle Real Application Clusters (RAC) One Node allows customers
to consolidate database storage, standardize their database environment, and,
should the need arise, upgrade to a full multi-node Oracle RAC database
without downtime or disruption
http://p.sf.net/sfu/oracle-sfdevnl

_______________________________________________
mod-security-users mailing list
mod-security-users <at> lists.sourceforge.net<mailto: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

------------------------------------------------------------------------------
Learn how Oracle Real Application Clusters (RAC) One Node allows customers
to consolidate database storage, standardize their database environment, and, 
should the need arise, upgrade to a full multi-node Oracle RAC database 
without downtime or disruption
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
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
Daniel Finn | 3 Jan 2011 23:09
Favicon

Re: Recently upgraded from 1.6.1 to 2.0.5 and I've got some questions/confusion.

Thanks Ryan, that definitely provides some explanation as well as even
deeper confusion ;)

So, to clarify, I do currently have mod_security enabled and blocking but
it's now using Anomaly scoring versus the static scoring that I was
previously used to?  This explains why some things are being blocked and
others are not?

Does the white listing of rules still work in the same way?

I notice that in the blog post the values are different for the thresholds.
For example, it looks like the current CRS has critical set at 5 and mine is
currently set at 20.  Is this just because the values have changed in more
recent versions of the CRS or are mine set way too high?

Thanks,
Dan

On 1/3/11 2:46 PM, "Ryan Barnett" <RBarnett <at> trustwave.com> wrote:

> Dan,
> A few things -
> 
> 1) Check out this recent blog post -
> <http://blog.spiderlabs.com/2010/11/advanced-topic-of-the-week-traditional-vs-
> anomaly-scoring-detection-modes.html>
> http://blog.spiderlabs.com/2010/11/advanced-topic-of-the-week-traditional-vs-a
> nomaly-scoring-detection-modes.html
> 
> 2) I would install the latest CRS v2.1.1 -
> <https://sourceforge.net/projects/mod-security/files/modsecurity-crs/0-CURRENT
> /> 
> https://sourceforge.net/projects/mod-security/files/modsecurity-crs/0-CURRENT/
> 
> 3) I would also sign up for the CRS mail list -
> <https://lists.owasp.org/mailman/listinfo/owasp-modsecurity-core-rule-set>
> https://lists.owasp.org/mailman/listinfo/owasp-modsecurity-core-rule-set
> 
> --
> Ryan Barnett
> 
> 
> On Jan 3, 2011, at 4:40 PM, "Daniel Finn"
> <Dan.Finn <at> ultradent.com<mailto:Dan.Finn <at> ultradent.com>> wrote:
> 
> As the subject says, I recently upgraded from 1.6.1 to 2.0.5 on one of our
> servers and I¹m a little confused about the results.  I¹m running RHEL 5.5 and
> I got the mod_security package from the EPEL repo.  According to RPM I am
> running version 2.5.12-1.el5 of mod_security and
> /etc/httpd/modsecurity.d/modsecurity_crs_10_config.conf says I¹m running Core
> Rule Set ver. 2.0.5.
> 
> While looking over some things I noticed that this updated rule set came with
> SecDefaultAction set to "phase:2,pass".   Previous to upgrading, I had
> SecDefaultAction set to
> "phase:2,log,deny,status:403,t:lowercase,t:replaceNulls,t:compressWhitespace".
> What I¹m confused about is it seems like having it currently set to
> ³phase:2,pass² should be allowing everything through but that is not the case.
> 
> Some of the tests I found online to determine whether or not mod_security is
> functioning properly work and some don¹t.  For example,
> www.example.com/?wget<http://www.example.com/?wget> logs an error but passes
> the page through however
> www.domain.com/phpids?test=1+OR+1%3D1<http://www.domain.com/phpids?test=1+OR+1
> %3D1> logs an error and blocks the page.  Why would that be?
> 
> 
> Here¹s my /etc/httpd/modsecurity.d/modsecurity_crs_10_config.conf:
> 
> # ---------------------------------------------------------------
> # Core ModSecurity Rule Set ver.2.0.5
> # Copyright (C) 2006-2010 Breach Security Inc. All rights reserved.
> #
> # The ModSecurity Core Rule Set is distributed under GPL version 2
> # Please see the enclosed LICENCE file for full details.
> # ---------------------------------------------------------------
> 
> 
> ## -- Configuration ----------------------------------------------------------
> #
> # Specify CRS version in the audit logs.
> #
> SecComponentSignature "core ruleset/2.0.5"
> 
> #
> # Create both Global and IP collections for rules to use
> # There are some CRS rules that assume that these two collections
> # have already been initiated.
> #
> SecAction 
> "phase:1,t:none,pass,nolog,initcol:global=global,initcol:ip=%{remote_addr}"
> 
> # You most likely already have a base ModSecurity configuration.  The data
> # presented in this file should work in conjunction with your configs.
> # There are also some references to some directive settings that you will
> # want to double check.
> 
> #
> # -=[ Paranoid Mode ]=-
> #
> # There are many different transactional variables that can be inspected for
> # attacks.  Some variables, such as ARGS, has the best false negative/false
> # positive ratio where it will catch the vast majority of attack payloads and
> # not have a high false positive rate.  This is also true for some security
> # checks such as  <at> validateByteRange checks where we are initially only
> inspecting
> # for Nul Bytes.
> #
> # There are, however, some possibilities for false negative issues with
> inspecting
> # parsed data and this could lead to missed attacks.  If you
> # want to lessen the chances for false negatives, then you should enable
> # "Paranoid Mode" processing by setting the following line to 1.  This will
> process
> # additional rules that are inspecting variables with a higher false positive
> rate.
> #
> SecAction "phase:1,t:none,nolog,pass,setvar:tx.paranoid_mode=0"
> 
> 
> #
> # -=[ Anomaly Scoring Threshold Levels ]=-
> #
> # These variables are used in macro expansion in the 49 inbound blocking and
> 59
> # outbound blocking files.
> #
> # **MUST HAVE** ModSecurity v2.5.12 or higher to use macro expansion in
> numeric
> # operators.  If you have an earlier version, edit the 49/59 files directly to
> # set the appropriate anomaly score levels.
> #
> # You should set the score to the proper threshold you would prefer. If set to
> "5"
> # it will work similarly to previous Mod CRS rules and will create an event in
> the error_log
> # file if there are any rules that match.  If you would like to lessen the
> number of events
> # generated in the error_log file, you should increase the anomaly score
> threshold to
> # something like "20".  This would only generate an event in the error_log
> file if
> # there are multiple lower severity rule matches or if any 1 higher severity
> item matches.
> #
> SecAction "phase:1,t:none,nolog,pass,setvar:tx.inbound_anomaly_score_level=20"
> SecAction 
> "phase:1,t:none,nolog,pass,setvar:tx.outbound_anomaly_score_level=15"
> 
> 
> #
> # -=[ Anomaly Scoring Severity Levels ]=-
> #
> # These are the default scoring points for each severity level.  You may
> # adjust these to you liking.  These settings will be used in macro expansion
> # in the rules to increment the anomaly scores when rules match.
> #
> # These are the default Severity ratings (with anomaly scores) of the
> individual rules -
> #
> #    - 2: Critical - Anomaly Score of 20.
> #         Is the highest severity level possible without correlation.  It is
> #         normally generated by the web attack rules (40 level files).
> #    - 3: Error - Anomaly Score of 15.
> #         Is generated mostly from outbound leakage rules (50 level files).
> #    - 4: Warning - Anomaly Score of 10.
> #         Is generated by malicious client rules (35 level files).
> #    - 5: Notice - Anomaly Score of 5.
> #         Is generated by the Protocol policy and anomaly files.
> #
> SecAction "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"
> 
> 
> #
> # -=[ HTTP Policy Settings ]=-
> # Set the following policy settings here and they will be propagated to the 23
> rules
> # file (modsecurity_common_23_request_limits.conf) by using macro expansion.
> # If you run into false positives, you can adjust the settings here.
> #
> # Only the max number of args is uncommented by default as there are a high
> rate
> # of false positives.  Uncomment the items you wish to set.
> #
> ## Maximum number of arguments in request limited
> SecAction "phase:1,t:none,nolog,pass,setvar:tx.max_num_args=255"
> 
> ## Limit argument name length
> #SecAction "phase:1,t:none,nolog,pass,setvar:tx.arg_name_length=100"
> 
> ## Limit value name length
> #SecAction "phase:1,t:none,nolog,pass,setvar:tx.arg_length=400"
> 
> ## Limit arguments total length
> #SecAction "phase:1,t:none,nolog,pass,setvar:tx.total_arg_length=64000"
> 
> ## Individual file size is limited
> #SecAction "phase:1,t:none,nolog,pass,setvar:tx.max_file_size=1048576"
> 
> ## Combined file size is limited
> #SecAction "phase:1,t:none,nolog,pass,setvar:tx.combined_file_sizes=1048576"
> 
> 
> # Set the following policy settings here and they will be propagated to the 30
> rules
> # file (modsecurity_crs_30_http_policy.conf) by using macro expansion.
> # If you run into false positves, you can adjust the settings here.
> #
> SecAction "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'"
> 
> #
> #
> # -=[ Blocking Action ]=-
> # What to do when the anomaly score threshold is exceeded.
> #
> # The default is to log the error and let the request go through.
> # This is a reasonable setting to start with because you do not
> # want to reject legitimate requests with an untuned rule set.
> #
> # The following line's settings will be inherited by rules that
> # do blocking in the 49 inbound and 59 outbound blocking files.
> #
> # Change to a disruptive action such as deny, drop or redirect if you
> # want to block the transaction.
> #
> SecDefaultAction "phase:2,pass"
> 
> 
> #
> # Review your SecRuleEngine settings.  If you want to
> # allow blocking, then set it to On however check your SecDefaultAction
> setting
> # to ensure that it is set appropriately.
> #
> SecRuleEngine On
> 
> SecDataDir /tmp/
> 
> SecAuditLogRelevantStatus "^(?:5|4(?!04))"
> # You can select to log all events to a single log file (set SecAuditLogType
> to
> # TODO Set the SecAuditLog (for "Serial" logging) or SecAuditLogStorageDir
> (for
> #      SecAuditLogStorageDir directive and make sure the direcory specified
> SecAuditLogType Serial
> SecAuditLog logs/modsec_audit.log
> # SecAuditLogStorageDir logs/modsec_audit
> SecAuditLogParts "ABIFHKZ"
> SecAuditEngine RelevantOnly
> #SecDefaultAction
> "phase:2,log,deny,status:403,t:lowercase,t:replaceNulls,t:compressWhitespace"
> 
> 
> And here¹s the modules that it¹s using:
> 
> modsecurity_35_bad_robots.data
> modsecurity_35_scanners.data
> modsecurity_40_generic_attacks.data
> modsecurity_41_sql_injection_attacks.data
> modsecurity_42_comment_spam.data
> modsecurity_46_et_sql_injection.data
> modsecurity_46_et_web_rules.data
> modsecurity_50_outbound.data
> modsecurity_50_outbound_malware.data
> 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_35_bad_robots.conf
> modsecurity_crs_40_generic_attacks.conf
> modsecurity_crs_41_phpids_converter.conf
> modsecurity_crs_41_phpids_filters.conf
> modsecurity_crs_41_sql_injection_attacks.conf
> modsecurity_crs_41_xss_attacks.conf
> modsecurity_crs_42_tight_security.conf
> modsecurity_crs_45_trojans.conf
> modsecurity_crs_47_common_exceptions.conf
> modsecurity_crs_48_local_exceptions.conf
> modsecurity_crs_49_enforcement.conf
> modsecurity_crs_49_inbound_blocking.conf
> modsecurity_crs_50_outbound.conf
> modsecurity_crs_59_outbound_blocking.conf
> modsecurity_crs_60_correlation.conf
> 
> Any help or pointers would be really appreciated.
> 
> Thanks,
> Dan
> 
> Email Policy - Unauthorized review, use, disclosure, or distribution of this
> e-mail is strictly prohibited. This e-mail transmission, and any documents,
> files or previous e-mail messages attached to it, is intended solely for the
> individual or individuals to whom it is specifically addressed. If the
> recipient of this email is not the intended recipient, do not read, copy or
> distribute it or any of the information it contains. Please delete it
> immediately and notify us by return email or by telephone 801.572.4200.
> ------------------------------------------------------------------------------
> Learn how Oracle Real Application Clusters (RAC) One Node allows customers
> to consolidate database storage, standardize their database environment, and,
> should the need arise, upgrade to a full multi-node Oracle RAC database
> without downtime or disruption
> http://p.sf.net/sfu/oracle-sfdevnl
> _______________________________________________
> mod-security-users mailing list
> mod-security-users <at> lists.sourceforge.net<mailto:mod-security-users <at> lists.sourc
> eforge.net>
> https://lists.sourceforge.net/lists/listinfo/mod-security-users
> Commercial ModSecurity Appliances, Rule Sets and Support:
> http://www.modsecurity.org/breach/index.html

Thanks,
Dan

Daniel Finn
Linux/Storage Administrator
P: 801.553.4587
M: 801.683.9147

³Improving Oral Health Globally²

Email Policy - Unauthorized review, use, disclosure, or distribution of this e-mail is strictly
prohibited.  This e-mail transmission, and any documents, files or previous e-mail messages attached to
it, is intended solely for the individual or individuals to whom it is specifically addressed. If the
recipient of this email is not the intended recipient, do not read, copy or distribute it or any of the
information it contains. Please delete it immediately and notify us by return email or by telephone 801.572.4200.

------------------------------------------------------------------------------
Learn how Oracle Real Application Clusters (RAC) One Node allows customers
to consolidate database storage, standardize their database environment, and, 
should the need arise, upgrade to a full multi-node Oracle RAC database 
without downtime or disruption
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
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

Daniel Finn | 4 Jan 2011 22:12
Favicon

Re: Recently upgraded from 1.6.1 to 2.0.5 and I've got some questions/confusion.

I'm still trying to get a handle on the anomaly scoring.  It seems to me
like this simple domain.com/?wget request should get blocked, and it appears
to say it's blocking it with a 403 however it actually allows it through.
Here's the entry from the logs:

--c0d67e6f-A--
[04/Jan/2011:14:03:58 --0700] m2v-VQoKC40AACZc11oAAAAK 10.1.122.115 50325
10.10.11.143 443
--c0d67e6f-B--
GET /?wget HTTP/1.1
Host: store.domain.com
User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_5; en-us)
AppleWebKit/533.19.4 (KHTML, like Gecko) Version/5.0.3 Safari/533.19.4
Accept:
application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image
/png,*/*;q=0.5
Accept-Language: en-us
Accept-Encoding: gzip, deflate
Cookie: __utma=203516370.1341964573.1292635243.1294085376.1294093464.3;
__utmz=203516370.1292635243.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none
); __utmb=161092729.2.10.1294174589; __utmc=161092729;
__utma=161092729.1948753204.1256676423.1292635216.1294174589.8;
s_sq=%5B%5BB%5D%5D; s_cc=true;
__utmz=161092729.1279214681.6.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none
)
Connection: keep-alive

--c0d67e6f-F--
HTTP/1.1 200 OK
Accept-Ranges: bytes
Content-Length: 5043
Content-Type: text/html; charset=UTF-8
Via: 1.1 store.domain.com
Connection: close

--c0d67e6f-H--
Message: Pattern match
"(?:(?:[\;\|\`]\W*?\bcc|\b(wget|curl))\b|\/cc(?:[\'"\|\;\`\-\s]|$))" at
ARGS_NAMES:wget. [file
"/etc/httpd/modsecurity.d/base_rules/modsecurity_crs_40_generic_attacks.conf
"] [line "24"] [id "950907"] [rev "2.0.5"] [msg "System Command Injection"]
[data "wget"] [severity "CRITICAL"] [tag "WEB_ATTACK/COMMAND_INJECTION"]
[tag "WASCTC/WASC-31"] [tag "OWASP_TOP_10/A1"] [tag "PCI/6.5.2"]
Message: Access denied with code 403 (phase 2). [file
"/etc/httpd/modsecurity.d/base_rules/modsecurity_crs_49_enforcement.conf"]
[line "25"] [msg "Anomaly Score Exceeded (score 20): System Command
Injection"]
Action: Intercepted (phase 2)
Apache-Handler: proxy-server
Stopwatch: 1294175038078805 9115 (391 2202 -)
Producer: ModSecurity for Apache/2.5.12 (http://www.modsecurity.org/); core
ruleset/2.0.5.
Server: Apache/2.2.3 (CentOS)

--c0d67e6f-K--
SecAction
"phase:1,auditlog,t:none,pass,nolog,initcol:global=global,initcol:ip=%{remot
e_addr}"
SecAction "phase:1,auditlog,t:none,nolog,pass,setvar:tx.paranoid_mode=0"
SecAction
"phase:1,auditlog,t:none,nolog,pass,setvar:tx.inbound_anomaly_score_level=20
"
SecAction
"phase:1,auditlog,t:none,nolog,pass,setvar:tx.outbound_anomaly_score_level=1
5"
SecAction
"phase:1,auditlog,t:none,nolog,pass,setvar:tx.critical_anomaly_score=20,setv
ar:tx.error_anomaly_score=15,setvar:tx.warning_anomaly_score=10,setvar:tx.no
tice_anomaly_score=5"
SecAction "phase:1,auditlog,t:none,nolog,pass,setvar:tx.max_num_args=255"
SecAction "phase:1,auditlog,t:none,nolog,pass,setvar:'tx.allowed_methods=GET
HEAD POST
OPTIONS',setvar:'tx.allowed_request_content_type=application/x-www-form-urle
ncoded 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'"
SecRule "REQUEST_METHOD" " <at> rx ^(?:GET|HEAD)$"
"phase:2,chain,rev:2.0.5,t:none,pass,nolog,auditlog,msg:'GET or HEAD
requests with
bodies',severity:2,id:960011,tag:PROTOCOL_VIOLATION/EVASION,tag:WASCTC/WASC-
21,tag:OWASP_TOP_10/A7,tag:PCI/6.5.10,tag:http://www.w3.org/Protocols/rfc261
6/rfc2616-sec4.html#sec4.3"
SecRule "&REQUEST_HEADERS:Content-Type" " <at> eq 0"
"phase:2,pass,chain,rev:2.0.5,t:none,nolog,auditlog,msg:'Request Containing
Content, but Missing Content-Type header',id:960904,severity:5"
SecRule "&TX:MAX_NUM_ARGS" " <at> eq 1"
"phase:2,chain,t:none,pass,nolog,auditlog,msg:'Too many arguments in
request',id:960335,severity:4,rev:2.0.5"
SecRule "REQUEST_FILENAME|ARGS_NAMES|ARGS|XML:/*" " <at> rx
(?:(?:[\\;\\|\\`]\\W*?\\bcc|\\b(wget|curl))\\b|\\/cc(?:[\\'\"\\|\\;\\`\\-\\s
]|$))"
"phase:2,rev:2.0.5,capture,t:none,t:normalisePath,t:lowercase,ctl:auditLogPa
rts=+E,nolog,auditlog,msg:'System Command
Injection',id:950907,tag:WEB_ATTACK/COMMAND_INJECTION,tag:WASCTC/WASC-31,tag
:OWASP_TOP_10/A1,tag:PCI/6.5.2,logdata:%{TX.0},severity:2,setvar:tx.msg=%{ru
le.msg},setvar:tx.anomaly_score=+%{tx.critical_anomaly_score},setvar:tx.comm
and_injection_score=+%{tx.critical_anomaly_score},setvar:tx.%{rule.id}-WEB_A
TTACK/COMMAND_INJECTION-%{matched_var_name}=%{tx.0},skipAfter:END_COMMAND_IN
JECTION1"
SecRule "TX:PARANOID_MODE" "! <at> eq 1"
"phase:2,t:none,nolog,skipAfter:END_SESSION_FIXATION"
SecRule "TX:PARANOID_MODE" "! <at> eq 1"
"phase:2,t:none,nolog,skipAfter:END_FILE_INJECTION"
SecRule "TX:PARANOID_MODE" "! <at> eq 1"
"phase:2,t:none,nolog,skipAfter:END_COMMAND_ACCESS"
SecRule "TX:PARANOID_MODE" "! <at> eq 1"
"phase:2,t:none,nolog,skipAfter:END_COMMAND_INJECTION"
SecRule "&TX:/SQL_INJECTION/" " <at> eq 0"
"phase:2,rev:2.0.5,t:none,nolog,skipAfter:END_SQL_INJECTION_WEAK"
SecRule "TX:PARANOID_MODE" "! <at> eq 1"
"phase:2,t:none,nolog,skipAfter:END_XSS_CHECK"
SecRule "TX:ANOMALY_SCORE" " <at> ge 20"
"phase:2,t:none,nolog,auditlog,deny,msg:'Anomaly Score Exceeded (score
%{TX.ANOMALY_SCORE}): %{tx.msg}',setvar:tx.inbound_tx_msg=%{tx.msg}"

--c0d67e6f-Z--

So I don't see where it's telling me the total score for this request but it
does tell me that it's gone over the critical score of 20: "Anomaly Score
Exceeded (score 20): System Command Injection".  Am I missing something here
(most likely)?

Thanks,
Dan

On 1/3/11 2:46 PM, "Ryan Barnett" <RBarnett <at> trustwave.com> wrote:

> Dan,
> A few things -
>
> 1) Check out this recent blog post -
> <http://blog.spiderlabs.com/2010/11/advanced-topic-of-the-week-traditional-vs-
> anomaly-scoring-detection-modes.html>
> http://blog.spiderlabs.com/2010/11/advanced-topic-of-the-week-traditional-vs-a
> nomaly-scoring-detection-modes.html
>
> 2) I would install the latest CRS v2.1.1 -
> <https://sourceforge.net/projects/mod-security/files/modsecurity-crs/0-CURRENT
> />
> https://sourceforge.net/projects/mod-security/files/modsecurity-crs/0-CURRENT/
>
> 3) I would also sign up for the CRS mail list -
> <https://lists.owasp.org/mailman/listinfo/owasp-modsecurity-core-rule-set>
> https://lists.owasp.org/mailman/listinfo/owasp-modsecurity-core-rule-set
>
> --
> Ryan Barnett
>
>
> On Jan 3, 2011, at 4:40 PM, "Daniel Finn"
> <Dan.Finn <at> ultradent.com<mailto:Dan.Finn <at> ultradent.com>> wrote:
>
> As the subject says, I recently upgraded from 1.6.1 to 2.0.5 on one of our
> servers and I¹m a little confused about the results.  I¹m running RHEL 5.5 and
> I got the mod_security package from the EPEL repo.  According to RPM I am
> running version 2.5.12-1.el5 of mod_security and
> /etc/httpd/modsecurity.d/modsecurity_crs_10_config.conf says I¹m running Core
> Rule Set ver. 2.0.5.
>
> While looking over some things I noticed that this updated rule set came with
> SecDefaultAction set to "phase:2,pass".   Previous to upgrading, I had
> SecDefaultAction set to
> "phase:2,log,deny,status:403,t:lowercase,t:replaceNulls,t:compressWhitespace".
> What I¹m confused about is it seems like having it currently set to
> ³phase:2,pass² should be allowing everything through but that is not the case.
>
> Some of the tests I found online to determine whether or not mod_security is
> functioning properly work and some don¹t.  For example,
> www.example.com/?wget<http://www.example.com/?wget> logs an error but passes
> the page through however
> www.domain.com/phpids?test=1+OR+1%3D1<http://www.domain.com/phpids?test=1+OR+1
> %3D1> logs an error and blocks the page.  Why would that be?
>
>
> Here¹s my /etc/httpd/modsecurity.d/modsecurity_crs_10_config.conf:
>
> # ---------------------------------------------------------------
> # Core ModSecurity Rule Set ver.2.0.5
> # Copyright (C) 2006-2010 Breach Security Inc. All rights reserved.
> #
> # The ModSecurity Core Rule Set is distributed under GPL version 2
> # Please see the enclosed LICENCE file for full details.
> # ---------------------------------------------------------------
>
>
> ## -- Configuration ----------------------------------------------------------
> #
> # Specify CRS version in the audit logs.
> #
> SecComponentSignature "core ruleset/2.0.5"
>
> #
> # Create both Global and IP collections for rules to use
> # There are some CRS rules that assume that these two collections
> # have already been initiated.
> #
> SecAction
> "phase:1,t:none,pass,nolog,initcol:global=global,initcol:ip=%{remote_addr}"
>
> # You most likely already have a base ModSecurity configuration.  The data
> # presented in this file should work in conjunction with your configs.
> # There are also some references to some directive settings that you will
> # want to double check.
>
> #
> # -=[ Paranoid Mode ]=-
> #
> # There are many different transactional variables that can be inspected for
> # attacks.  Some variables, such as ARGS, has the best false negative/false
> # positive ratio where it will catch the vast majority of attack payloads and
> # not have a high false positive rate.  This is also true for some security
> # checks such as  <at> validateByteRange checks where we are initially only
> inspecting
> # for Nul Bytes.
> #
> # There are, however, some possibilities for false negative issues with
> inspecting
> # parsed data and this could lead to missed attacks.  If you
> # want to lessen the chances for false negatives, then you should enable
> # "Paranoid Mode" processing by setting the following line to 1.  This will
> process
> # additional rules that are inspecting variables with a higher false positive
> rate.
> #
> SecAction "phase:1,t:none,nolog,pass,setvar:tx.paranoid_mode=0"
>
>
> #
> # -=[ Anomaly Scoring Threshold Levels ]=-
> #
> # These variables are used in macro expansion in the 49 inbound blocking and
> 59
> # outbound blocking files.
> #
> # **MUST HAVE** ModSecurity v2.5.12 or higher to use macro expansion in
> numeric
> # operators.  If you have an earlier version, edit the 49/59 files directly to
> # set the appropriate anomaly score levels.
> #
> # You should set the score to the proper threshold you would prefer. If set to
> "5"
> # it will work similarly to previous Mod CRS rules and will create an event in
> the error_log
> # file if there are any rules that match.  If you would like to lessen the
> number of events
> # generated in the error_log file, you should increase the anomaly score
> threshold to
> # something like "20".  This would only generate an event in the error_log
> file if
> # there are multiple lower severity rule matches or if any 1 higher severity
> item matches.
> #
> SecAction "phase:1,t:none,nolog,pass,setvar:tx.inbound_anomaly_score_level=20"
> SecAction
> "phase:1,t:none,nolog,pass,setvar:tx.outbound_anomaly_score_level=15"
>
>
> #
> # -=[ Anomaly Scoring Severity Levels ]=-
> #
> # These are the default scoring points for each severity level.  You may
> # adjust these to you liking.  These settings will be used in macro expansion
> # in the rules to increment the anomaly scores when rules match.
> #
> # These are the default Severity ratings (with anomaly scores) of the
> individual rules -
> #
> #    - 2: Critical - Anomaly Score of 20.
> #         Is the highest severity level possible without correlation.  It is
> #         normally generated by the web attack rules (40 level files).
> #    - 3: Error - Anomaly Score of 15.
> #         Is generated mostly from outbound leakage rules (50 level files).
> #    - 4: Warning - Anomaly Score of 10.
> #         Is generated by malicious client rules (35 level files).
> #    - 5: Notice - Anomaly Score of 5.
> #         Is generated by the Protocol policy and anomaly files.
> #
> SecAction "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"
>
>
> #
> # -=[ HTTP Policy Settings ]=-
> # Set the following policy settings here and they will be propagated to the 23
> rules
> # file (modsecurity_common_23_request_limits.conf) by using macro expansion.
> # If you run into false positives, you can adjust the settings here.
> #
> # Only the max number of args is uncommented by default as there are a high
> rate
> # of false positives.  Uncomment the items you wish to set.
> #
> ## Maximum number of arguments in request limited
> SecAction "phase:1,t:none,nolog,pass,setvar:tx.max_num_args=255"
>
> ## Limit argument name length
> #SecAction "phase:1,t:none,nolog,pass,setvar:tx.arg_name_length=100"
>
> ## Limit value name length
> #SecAction "phase:1,t:none,nolog,pass,setvar:tx.arg_length=400"
>
> ## Limit arguments total length
> #SecAction "phase:1,t:none,nolog,pass,setvar:tx.total_arg_length=64000"
>
> ## Individual file size is limited
> #SecAction "phase:1,t:none,nolog,pass,setvar:tx.max_file_size=1048576"
>
> ## Combined file size is limited
> #SecAction "phase:1,t:none,nolog,pass,setvar:tx.combined_file_sizes=1048576"
>
>
> # Set the following policy settings here and they will be propagated to the 30
> rules
> # file (modsecurity_crs_30_http_policy.conf) by using macro expansion.
> # If you run into false positves, you can adjust the settings here.
> #
> SecAction "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'"
>
> #
> #
> # -=[ Blocking Action ]=-
> # What to do when the anomaly score threshold is exceeded.
> #
> # The default is to log the error and let the request go through.
> # This is a reasonable setting to start with because you do not
> # want to reject legitimate requests with an untuned rule set.
> #
> # The following line's settings will be inherited by rules that
> # do blocking in the 49 inbound and 59 outbound blocking files.
> #
> # Change to a disruptive action such as deny, drop or redirect if you
> # want to block the transaction.
> #
> SecDefaultAction "phase:2,pass"
>
>
> #
> # Review your SecRuleEngine settings.  If you want to
> # allow blocking, then set it to On however check your SecDefaultAction
> setting
> # to ensure that it is set appropriately.
> #
> SecRuleEngine On
>
> SecDataDir /tmp/
>
> SecAuditLogRelevantStatus "^(?:5|4(?!04))"
> # You can select to log all events to a single log file (set SecAuditLogType
> to
> # TODO Set the SecAuditLog (for "Serial" logging) or SecAuditLogStorageDir
> (for
> #      SecAuditLogStorageDir directive and make sure the direcory specified
> SecAuditLogType Serial
> SecAuditLog logs/modsec_audit.log
> # SecAuditLogStorageDir logs/modsec_audit
> SecAuditLogParts "ABIFHKZ"
> SecAuditEngine RelevantOnly
> #SecDefaultAction
> "phase:2,log,deny,status:403,t:lowercase,t:replaceNulls,t:compressWhitespace"
>
>
> And here¹s the modules that it¹s using:
>
> modsecurity_35_bad_robots.data
> modsecurity_35_scanners.data
> modsecurity_40_generic_attacks.data
> modsecurity_41_sql_injection_attacks.data
> modsecurity_42_comment_spam.data
> modsecurity_46_et_sql_injection.data
> modsecurity_46_et_web_rules.data
> modsecurity_50_outbound.data
> modsecurity_50_outbound_malware.data
> 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_35_bad_robots.conf
> modsecurity_crs_40_generic_attacks.conf
> modsecurity_crs_41_phpids_converter.conf
> modsecurity_crs_41_phpids_filters.conf
> modsecurity_crs_41_sql_injection_attacks.conf
> modsecurity_crs_41_xss_attacks.conf
> modsecurity_crs_42_tight_security.conf
> modsecurity_crs_45_trojans.conf
> modsecurity_crs_47_common_exceptions.conf
> modsecurity_crs_48_local_exceptions.conf
> modsecurity_crs_49_enforcement.conf
> modsecurity_crs_49_inbound_blocking.conf
> modsecurity_crs_50_outbound.conf
> modsecurity_crs_59_outbound_blocking.conf
> modsecurity_crs_60_correlation.conf
>
> Any help or pointers would be really appreciated.
>
> Thanks,
> Dan
>
> Email Policy - Unauthorized review, use, disclosure, or distribution of this
> e-mail is strictly prohibited. This e-mail transmission, and any documents,
> files or previous e-mail messages attached to it, is intended solely for the
> individual or individuals to whom it is specifically addressed. If the
> recipient of this email is not the intended recipient, do not read, copy or
> distribute it or any of the information it contains. Please delete it
> immediately and notify us by return email or by telephone 801.572.4200.
> ------------------------------------------------------------------------------
> Learn how Oracle Real Application Clusters (RAC) One Node allows customers
> to consolidate database storage, standardize their database environment, and,
> should the need arise, upgrade to a full multi-node Oracle RAC database
> without downtime or disruption
> http://p.sf.net/sfu/oracle-sfdevnl
> _______________________________________________
> mod-security-users mailing list
> mod-security-users <at> lists.sourceforge.net<mailto:mod-security-users <at> lists.sourc
> eforge.net>
> https://lists.sourceforge.net/lists/listinfo/mod-security-users
> Commercial ModSecurity Appliances, Rule Sets and Support:
> http://www.modsecurity.org/breach/index.html

Thanks,
Dan

Daniel Finn
Linux/Storage Administrator
P: 801.553.4587
M: 801.683.9147

³Improving Oral Health Globally²

Email Policy - Unauthorized review, use, disclosure, or distribution of this e-mail is strictly
prohibited.  This e-mail transmission, and any documents, files or previous e-mail messages attached to
it, is intended solely for the individual or individuals to whom it is specifically addressed. If the
recipient of this email is not the intended recipient, do not read, copy or distribute it or any of the
information it contains. Please delete it immediately and notify us by return email or by telephone 801.572.4200.

------------------------------------------------------------------------------
Learn how Oracle Real Application Clusters (RAC) One Node allows customers
to consolidate database storage, standardize their database environment, and, 
should the need arise, upgrade to a full multi-node Oracle RAC database 
without downtime or disruption
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
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

Ryan Barnett | 4 Jan 2011 22:34

Re: Recently upgraded from 1.6.1 to 2.0.5 and I've got some questions/confusion.

Please upgrade to the latest CRS v2.1.1 as there have been many improvements and bug fixes since the 2.0.5 version.

--
Ryan Barnett


On Jan 4, 2011, at 4:12 PM, Daniel Finn <Dan.Finn <at> ultradent.com> wrote:

> I'm still trying to get a handle on the anomaly scoring.  It seems to me
> like this simple domain.com/?wget request should get blocked, and it appears
> to say it's blocking it with a 403 however it actually allows it through.
> Here's the entry from the logs:
>
> --c0d67e6f-A--
> [04/Jan/2011:14:03:58 --0700] m2v-VQoKC40AACZc11oAAAAK 10.1.122.115 50325
> 10.10.11.143 443
> --c0d67e6f-B--
> GET /?wget HTTP/1.1
> Host: store.domain.com
> User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_5; en-us)
> AppleWebKit/533.19.4 (KHTML, like Gecko) Version/5.0.3 Safari/533.19.4
> Accept:
> application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image
> /png,*/*;q=0.5
> Accept-Language: en-us
> Accept-Encoding: gzip, deflate
> Cookie: __utma=203516370.1341964573.1292635243.1294085376.1294093464.3;
> __utmz=203516370.1292635243.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none
> ); __utmb=161092729.2.10.1294174589; __utmc=161092729;
> __utma=161092729.1948753204.1256676423.1292635216.1294174589.8;
> s_sq=%5B%5BB%5D%5D; s_cc=true;
> __utmz=161092729.1279214681.6.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none
> )
> Connection: keep-alive
>
> --c0d67e6f-F--
> HTTP/1.1 200 OK
> Accept-Ranges: bytes
> Content-Length: 5043
> Content-Type: text/html; charset=UTF-8
> Via: 1.1 store.domain.com
> Connection: close
>
> --c0d67e6f-H--
> Message: Pattern match
> "(?:(?:[\;\|\`]\W*?\bcc|\b(wget|curl))\b|\/cc(?:[\'"\|\;\`\-\s]|$))" at
> ARGS_NAMES:wget. [file
> "/etc/httpd/modsecurity.d/base_rules/modsecurity_crs_40_generic_attacks.conf
> "] [line "24"] [id "950907"] [rev "2.0.5"] [msg "System Command Injection"]
> [data "wget"] [severity "CRITICAL"] [tag "WEB_ATTACK/COMMAND_INJECTION"]
> [tag "WASCTC/WASC-31"] [tag "OWASP_TOP_10/A1"] [tag "PCI/6.5.2"]
> Message: Access denied with code 403 (phase 2). [file
> "/etc/httpd/modsecurity.d/base_rules/modsecurity_crs_49_enforcement.conf"]
> [line "25"] [msg "Anomaly Score Exceeded (score 20): System Command
> Injection"]
> Action: Intercepted (phase 2)
> Apache-Handler: proxy-server
> Stopwatch: 1294175038078805 9115 (391 2202 -)
> Producer: ModSecurity for Apache/2.5.12 (http://www.modsecurity.org/); core
> ruleset/2.0.5.
> Server: Apache/2.2.3 (CentOS)
>
> --c0d67e6f-K--
> SecAction
> "phase:1,auditlog,t:none,pass,nolog,initcol:global=global,initcol:ip=%{remot
> e_addr}"
> SecAction "phase:1,auditlog,t:none,nolog,pass,setvar:tx.paranoid_mode=0"
> SecAction
> "phase:1,auditlog,t:none,nolog,pass,setvar:tx.inbound_anomaly_score_level=20
> "
> SecAction
> "phase:1,auditlog,t:none,nolog,pass,setvar:tx.outbound_anomaly_score_level=1
> 5"
> SecAction
> "phase:1,auditlog,t:none,nolog,pass,setvar:tx.critical_anomaly_score=20,setv
> ar:tx.error_anomaly_score=15,setvar:tx.warning_anomaly_score=10,setvar:tx.no
> tice_anomaly_score=5"
> SecAction "phase:1,auditlog,t:none,nolog,pass,setvar:tx.max_num_args=255"
> SecAction "phase:1,auditlog,t:none,nolog,pass,setvar:'tx.allowed_methods=GET
> HEAD POST
> OPTIONS',setvar:'tx.allowed_request_content_type=application/x-www-form-urle
> ncoded 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'"
> SecRule "REQUEST_METHOD" " <at> rx ^(?:GET|HEAD)$"
> "phase:2,chain,rev:2.0.5,t:none,pass,nolog,auditlog,msg:'GET or HEAD
> requests with
> bodies',severity:2,id:960011,tag:PROTOCOL_VIOLATION/EVASION,tag:WASCTC/WASC-
> 21,tag:OWASP_TOP_10/A7,tag:PCI/6.5.10,tag:http://www.w3.org/Protocols/rfc261

> 6/rfc2616-sec4.html#sec4.3"
> SecRule "&REQUEST_HEADERS:Content-Type" " <at> eq 0"
> "phase:2,pass,chain,rev:2.0.5,t:none,nolog,auditlog,msg:'Request Containing
> Content, but Missing Content-Type header',id:960904,severity:5"
> SecRule "&TX:MAX_NUM_ARGS" " <at> eq 1"
> "phase:2,chain,t:none,pass,nolog,auditlog,msg:'Too many arguments in
> request',id:960335,severity:4,rev:2.0.5"
> SecRule "REQUEST_FILENAME|ARGS_NAMES|ARGS|XML:/*" " <at> rx
> (?:(?:[\\;\\|\\`]\\W*?\\bcc|\\b(wget|curl))\\b|\\/cc(?:[\\'\"\\|\\;\\`\\-\\s
> ]|$))"
> "phase:2,rev:2.0.5,capture,t:none,t:normalisePath,t:lowercase,ctl:auditLogPa
> rts=+E,nolog,auditlog,msg:'System Command
> Injection',id:950907,tag:WEB_ATTACK/COMMAND_INJECTION,tag:WASCTC/WASC-31,tag
> :OWASP_TOP_10/A1,tag:PCI/6.5.2,logdata:%{TX.0},severity:2,setvar:tx.msg=%{ru
> le.msg},setvar:tx.anomaly_score=+%{tx.critical_anomaly_score},setvar:tx.comm
> and_injection_score=+%{tx.critical_anomaly_score},setvar:tx.%{rule.id}-WEB_A
> TTACK/COMMAND_INJECTION-%{matched_var_name}=%{tx.0},skipAfter:END_COMMAND_IN
> JECTION1"
> SecRule "TX:PARANOID_MODE" "! <at> eq 1"
> "phase:2,t:none,nolog,skipAfter:END_SESSION_FIXATION"
> SecRule "TX:PARANOID_MODE" "! <at> eq 1"
> "phase:2,t:none,nolog,skipAfter:END_FILE_INJECTION"
> SecRule "TX:PARANOID_MODE" "! <at> eq 1"
> "phase:2,t:none,nolog,skipAfter:END_COMMAND_ACCESS"
> SecRule "TX:PARANOID_MODE" "! <at> eq 1"
> "phase:2,t:none,nolog,skipAfter:END_COMMAND_INJECTION"
> SecRule "&TX:/SQL_INJECTION/" " <at> eq 0"
> "phase:2,rev:2.0.5,t:none,nolog,skipAfter:END_SQL_INJECTION_WEAK"
> SecRule "TX:PARANOID_MODE" "! <at> eq 1"
> "phase:2,t:none,nolog,skipAfter:END_XSS_CHECK"
> SecRule "TX:ANOMALY_SCORE" " <at> ge 20"
> "phase:2,t:none,nolog,auditlog,deny,msg:'Anomaly Score Exceeded (score
> %{TX.ANOMALY_SCORE}): %{tx.msg}',setvar:tx.inbound_tx_msg=%{tx.msg}"
>
> --c0d67e6f-Z--
>
> So I don't see where it's telling me the total score for this request but it
> does tell me that it's gone over the critical score of 20: "Anomaly Score
> Exceeded (score 20): System Command Injection".  Am I missing something here
> (most likely)?
>
> Thanks,
> Dan
>
>
> On 1/3/11 2:46 PM, "Ryan Barnett" <RBarnett <at> trustwave.com> wrote:
>
>> Dan,
>> A few things -
>>
>> 1) Check out this recent blog post -
>> <http://blog.spiderlabs.com/2010/11/advanced-topic-of-the-week-traditional-vs-

>> anomaly-scoring-detection-modes.html>
>> http://blog.spiderlabs.com/2010/11/advanced-topic-of-the-week-traditional-vs-a

>> nomaly-scoring-detection-modes.html
>>
>> 2) I would install the latest CRS v2.1.1 -
>> <https://sourceforge.net/projects/mod-security/files/modsecurity-crs/0-CURRENT

>> />
>> https://sourceforge.net/projects/mod-security/files/modsecurity-crs/0-CURRENT/

>>
>> 3) I would also sign up for the CRS mail list -
>> <https://lists.owasp.org/mailman/listinfo/owasp-modsecurity-core-rule-set>
>> https://lists.owasp.org/mailman/listinfo/owasp-modsecurity-core-rule-set

>>
>> --
>> Ryan Barnett
>>
>>
>> On Jan 3, 2011, at 4:40 PM, "Daniel Finn"
>> <Dan.Finn <at> ultradent.com<mailto:Dan.Finn <at> ultradent.com>> wrote:
>>
>> As the subject says, I recently upgraded from 1.6.1 to 2.0.5 on one of our
>> servers and I’m a little confused about the results.  I’m running RHEL 5.5 and
>> I got the mod_security package from the EPEL repo.  According to RPM I am
>> running version 2.5.12-1.el5 of mod_security and
>> /etc/httpd/modsecurity.d/modsecurity_crs_10_config.conf says I’m running Core
>> Rule Set ver. 2.0.5.
>>
>> While looking over some things I noticed that this updated rule set came with
>> SecDefaultAction set to "phase:2,pass".   Previous to upgrading, I had
>> SecDefaultAction set to
>> "phase:2,log,deny,status:403,t:lowercase,t:replaceNulls,t:compressWhitespace".
>> What I’m confused about is it seems like having it currently set to
>> “phase:2,pass” should be allowing everything through but that is not the case.
>>
>> Some of the tests I found online to determine whether or not mod_security is
>> functioning properly work and some don’t.  For example,
>> www.example.com/?wget<http://www.example.com/?wget> logs an error but passes
>> the page through however
>> www.domain.com/phpids?test=1+OR+1%3D1<http://www.domain.com/phpids?test=1+OR+1

>> %3D1> logs an error and blocks the page.  Why would that be?
>>
>>
>> Here’s my /etc/httpd/modsecurity.d/modsecurity_crs_10_config.conf:
>>
>> # ---------------------------------------------------------------
>> # Core ModSecurity Rule Set ver.2.0.5
>> # Copyright (C) 2006-2010 Breach Security Inc. All rights reserved.
>> #
>> # The ModSecurity Core Rule Set is distributed under GPL version 2
>> # Please see the enclosed LICENCE file for full details.
>> # ---------------------------------------------------------------
>>
>>
>> ## -- Configuration ----------------------------------------------------------
>> #
>> # Specify CRS version in the audit logs.
>> #
>> SecComponentSignature "core ruleset/2.0.5"
>>
>> #
>> # Create both Global and IP collections for rules to use
>> # There are some CRS rules that assume that these two collections
>> # have already been initiated.
>> #
>> SecAction
>> "phase:1,t:none,pass,nolog,initcol:global=global,initcol:ip=%{remote_addr}"
>>
>> # You most likely already have a base ModSecurity configuration.  The data
>> # presented in this file should work in conjunction with your configs.
>> # There are also some references to some directive settings that you will
>> # want to double check.
>>
>> #
>> # -=[ Paranoid Mode ]=-
>> #
>> # There are many different transactional variables that can be inspected for
>> # attacks.  Some variables, such as ARGS, has the best false negative/false
>> # positive ratio where it will catch the vast majority of attack payloads and
>> # not have a high false positive rate.  This is also true for some security
>> # checks such as  <at> validateByteRange checks where we are initially only
>> inspecting
>> # for Nul Bytes.
>> #
>> # There are, however, some possibilities for false negative issues with
>> inspecting
>> # parsed data and this could lead to missed attacks.  If you
>> # want to lessen the chances for false negatives, then you should enable
>> # "Paranoid Mode" processing by setting the following line to 1.  This will
>> process
>> # additional rules that are inspecting variables with a higher false positive
>> rate.
>> #
>> SecAction "phase:1,t:none,nolog,pass,setvar:tx.paranoid_mode=0"
>>
>>
>> #
>> # -=[ Anomaly Scoring Threshold Levels ]=-
>> #
>> # These variables are used in macro expansion in the 49 inbound blocking and
>> 59
>> # outbound blocking files.
>> #
>> # **MUST HAVE** ModSecurity v2.5.12 or higher to use macro expansion in
>> numeric
>> # operators.  If you have an earlier version, edit the 49/59 files directly to
>> # set the appropriate anomaly score levels.
>> #
>> # You should set the score to the proper threshold you would prefer. If set to
>> "5"
>> # it will work similarly to previous Mod CRS rules and will create an event in
>> the error_log
>> # file if there are any rules that match.  If you would like to lessen the
>> number of events
>> # generated in the error_log file, you should increase the anomaly score
>> threshold to
>> # something like "20".  This would only generate an event in the error_log
>> file if
>> # there are multiple lower severity rule matches or if any 1 higher severity
>> item matches.
>> #
>> SecAction "phase:1,t:none,nolog,pass,setvar:tx.inbound_anomaly_score_level=20"
>> SecAction
>> "phase:1,t:none,nolog,pass,setvar:tx.outbound_anomaly_score_level=15"
>>
>>
>> #
>> # -=[ Anomaly Scoring Severity Levels ]=-
>> #
>> # These are the default scoring points for each severity level.  You may
>> # adjust these to you liking.  These settings will be used in macro expansion
>> # in the rules to increment the anomaly scores when rules match.
>> #
>> # These are the default Severity ratings (with anomaly scores) of the
>> individual rules -
>> #
>> #    - 2: Critical - Anomaly Score of 20.
>> #         Is the highest severity level possible without correlation.  It is
>> #         normally generated by the web attack rules (40 level files).
>> #    - 3: Error - Anomaly Score of 15.
>> #         Is generated mostly from outbound leakage rules (50 level files).
>> #    - 4: Warning - Anomaly Score of 10.
>> #         Is generated by malicious client rules (35 level files).
>> #    - 5: Notice - Anomaly Score of 5.
>> #         Is generated by the Protocol policy and anomaly files.
>> #
>> SecAction "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"
>>
>>
>> #
>> # -=[ HTTP Policy Settings ]=-
>> # Set the following policy settings here and they will be propagated to the 23
>> rules
>> # file (modsecurity_common_23_request_limits.conf) by using macro expansion.
>> # If you run into false positives, you can adjust the settings here.
>> #
>> # Only the max number of args is uncommented by default as there are a high
>> rate
>> # of false positives.  Uncomment the items you wish to set.
>> #
>> ## Maximum number of arguments in request limited
>> SecAction "phase:1,t:none,nolog,pass,setvar:tx.max_num_args=255"
>>
>> ## Limit argument name length
>> #SecAction "phase:1,t:none,nolog,pass,setvar:tx.arg_name_length=100"
>>
>> ## Limit value name length
>> #SecAction "phase:1,t:none,nolog,pass,setvar:tx.arg_length=400"
>>
>> ## Limit arguments total length
>> #SecAction "phase:1,t:none,nolog,pass,setvar:tx.total_arg_length=64000"
>>
>> ## Individual file size is limited
>> #SecAction "phase:1,t:none,nolog,pass,setvar:tx.max_file_size=1048576"
>>
>> ## Combined file size is limited
>> #SecAction "phase:1,t:none,nolog,pass,setvar:tx.combined_file_sizes=1048576"
>>
>>
>> # Set the following policy settings here and they will be propagated to the 30
>> rules
>> # file (modsecurity_crs_30_http_policy.conf) by using macro expansion.
>> # If you run into false positves, you can adjust the settings here.
>> #
>> SecAction "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'"
>>
>> #
>> #
>> # -=[ Blocking Action ]=-
>> # What to do when the anomaly score threshold is exceeded.
>> #
>> # The default is to log the error and let the request go through.
>> # This is a reasonable setting to start with because you do not
>> # want to reject legitimate requests with an untuned rule set.
>> #
>> # The following line's settings will be inherited by rules that
>> # do blocking in the 49 inbound and 59 outbound blocking files.
>> #
>> # Change to a disruptive action such as deny, drop or redirect if you
>> # want to block the transaction.
>> #
>> SecDefaultAction "phase:2,pass"
>>
>>
>> #
>> # Review your SecRuleEngine settings.  If you want to
>> # allow blocking, then set it to On however check your SecDefaultAction
>> setting
>> # to ensure that it is set appropriately.
>> #
>> SecRuleEngine On
>>
>> SecDataDir /tmp/
>>
>> SecAuditLogRelevantStatus "^(?:5|4(?!04))"
>> # You can select to log all events to a single log file (set SecAuditLogType
>> to
>> # TODO Set the SecAuditLog (for "Serial" logging) or SecAuditLogStorageDir
>> (for
>> #      SecAuditLogStorageDir directive and make sure the direcory specified
>> SecAuditLogType Serial
>> SecAuditLog logs/modsec_audit.log
>> # SecAuditLogStorageDir logs/modsec_audit
>> SecAuditLogParts "ABIFHKZ"
>> SecAuditEngine RelevantOnly
>> #SecDefaultAction
>> "phase:2,log,deny,status:403,t:lowercase,t:replaceNulls,t:compressWhitespace"
>>
>>
>> And here’s the modules that it’s using:
>>
>> modsecurity_35_bad_robots.data
>> modsecurity_35_scanners.data
>> modsecurity_40_generic_attacks.data
>> modsecurity_41_sql_injection_attacks.data
>> modsecurity_42_comment_spam.data
>> modsecurity_46_et_sql_injection.data
>> modsecurity_46_et_web_rules.data
>> modsecurity_50_outbound.data
>> modsecurity_50_outbound_malware.data
>> 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_35_bad_robots.conf
>> modsecurity_crs_40_generic_attacks.conf
>> modsecurity_crs_41_phpids_converter.conf
>> modsecurity_crs_41_phpids_filters.conf
>> modsecurity_crs_41_sql_injection_attacks.conf
>> modsecurity_crs_41_xss_attacks.conf
>> modsecurity_crs_42_tight_security.conf
>> modsecurity_crs_45_trojans.conf
>> modsecurity_crs_47_common_exceptions.conf
>> modsecurity_crs_48_local_exceptions.conf
>> modsecurity_crs_49_enforcement.conf
>> modsecurity_crs_49_inbound_blocking.conf
>> modsecurity_crs_50_outbound.conf
>> modsecurity_crs_59_outbound_blocking.conf
>> modsecurity_crs_60_correlation.conf
>>
>> Any help or pointers would be really appreciated.
>>
>> Thanks,
>> Dan
>>
>> Email Policy - Unauthorized review, use, disclosure, or distribution of this
>> e-mail is strictly prohibited. This e-mail transmission, and any documents,
>> files or previous e-mail messages attached to it, is intended solely for the
>> individual or individuals to whom it is specifically addressed. If the
>> recipient of this email is not the intended recipient, do not read, copy or
>> distribute it or any of the information it contains. Please delete it
>> immediately and notify us by return email or by telephone 801.572.4200.
>> ------------------------------------------------------------------------------
>> Learn how Oracle Real Application Clusters (RAC) One Node allows customers
>> to consolidate database storage, standardize their database environment, and,
>> should the need arise, upgrade to a full multi-node Oracle RAC database
>> without downtime or disruption
>> http://p.sf.net/sfu/oracle-sfdevnl

>> _______________________________________________
>> mod-security-users mailing list
>> mod-security-users <at> lists.sourceforge.net<mailto:mod-security-users <at> lists.sourc
>> eforge.net>
>> https://lists.sourceforge.net/lists/listinfo/mod-security-users

>> Commercial ModSecurity Appliances, Rule Sets and Support:
>> http://www.modsecurity.org/breach/index.html

>
>
> Thanks,
> Dan
>
> Daniel Finn
> Linux/Storage Administrator
> P: 801.553.4587
> M: 801.683.9147
>
>
> “Improving Oral Health Globally”
>
>
> Email Policy - Unauthorized review, use, disclosure, or distribution of this e-mail is strictly
prohibited.  This e-mail transmission, and any documents, files or previous e-mail messages attached to
it, is intended solely for the individual or individuals to whom it is specifically addressed. If the
recipient of this email is not the intended recipient, do not read, copy or distribute it or any of the
information it contains. Please delete it immediately and notify us by return email or by telephone 801.572.4200.
>
>
>
> ------------------------------------------------------------------------------
> Learn how Oracle Real Application Clusters (RAC) One Node allows customers
> to consolidate database storage, standardize their database environment, and,
> should the need arise, upgrade to a full multi-node Oracle RAC database
> without downtime or disruption
> http://p.sf.net/sfu/oracle-sfdevnl

> _______________________________________________
> 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

------------------------------------------------------------------------------
Learn how Oracle Real Application Clusters (RAC) One Node allows customers
to consolidate database storage, standardize their database environment, and, 
should the need arise, upgrade to a full multi-node Oracle RAC database 
without downtime or disruption
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
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

Gmane