Ryan Barnett | 2 Jul 14:22

Re: the @pm operator inmodsecurity_crs_40_generic_attacks.conf

It is important to understand the value/purpose that the set-based matching operator brings - speed.  It is
much faster that the regex operator (especially when the data it is inspecting is very large).  With this
being said, you also need to realiaze its shortcoming - decreased logic.  It is simply a text string matcher
and does not have the advaced logic of a regex.

What we chose to do with the core rule set was to use the set-based matching operator as a "pre-qualifier"
before running the more expensive regex checks.  The @pm check casts a wide net to see if the data even has a
chance of matching (as your example shows) and then the regex check would do further analysis (such as
apply word boudary checks) to both rule out this false positive and confirm attack payloads with
increased logic.

Hope this helps.

Thanks,
Ryan C. Barnett 

----- Original Message -----
From: mod-security-users-bounces <at> lists.sourceforge.net <mod-security-users-bounces <at> lists.sourceforge.net>
To: mod-security-users <at> lists.sourceforge.net <mod-security-users <at> lists.sourceforge.net>
Sent: Tue Jul 01 23:24:59 2008
Subject: [mod-security-users] the @pm operator inmodsecurity_crs_40_generic_attacks.conf

Hi,

Is there any way to get the @pm operator to match only whole words?

I am using the Command Injection rule in
modsecurity_crs_40_generic_attacks.conf and it seems there should be a
better way.
SecRule ARGS "@pm ping id rm ..." ""t:htmlEntityDecode,t:lowercase..." matches:
(Continue reading)

Re: the @pm operator inmodsecurity_crs_40_generic_attacks.conf

Yes, that helps a lot - to use it as a speedy filter.

After RTFM, it appears to have the same functionality as @contain and
that I can use @streq if I want a whole word match.

Thanks,
Stephen

On Wed, Jul 2, 2008 at 8:24 PM, Ryan Barnett <Ryan.Barnett <at> breach.com> wrote:
> It is important to understand the value/purpose that the set-based matching operator brings - speed.  It
is much faster that the regex operator (especially when the data it is inspecting is very large).  With this
being said, you also need to realiaze its shortcoming - decreased logic.  It is simply a text string matcher
and does not have the advaced logic of a regex.
>
> What we chose to do with the core rule set was to use the set-based matching operator as a "pre-qualifier"
before running the more expensive regex checks.  The @pm check casts a wide net to see if the data even has a
chance of matching (as your example shows) and then the regex check would do further analysis (such as
apply word boudary checks) to both rule out this false positive and confirm attack payloads with
increased logic.
>
> Hope this helps.
>
> Thanks,
> Ryan C. Barnett
>
> ----- Original Message -----
> From: mod-security-users-bounces <at> lists.sourceforge.net <mod-security-users-bounces <at> lists.sourceforge.net>
> To: mod-security-users <at> lists.sourceforge.net <mod-security-users <at> lists.sourceforge.net>
> Sent: Tue Jul 01 23:24:59 2008
> Subject: [mod-security-users] the @pm operator inmodsecurity_crs_40_generic_attacks.conf
(Continue reading)

Ryan Barnett | 2 Jul 17:02

Re: the @pm operator inmodsecurity_crs_40_generic_attacks.conf

> -----Original Message-----
> From: Stephen Craig Evans [mailto:stephencraig.evans <at> gmail.com]
> Sent: Wednesday, July 02, 2008 9:38 AM
> To: Ryan Barnett
> Cc: mod-security-users <at> lists.sourceforge.net
> Subject: Re: [mod-security-users] the @pm operator
> inmodsecurity_crs_40_generic_attacks.conf
> 
> Yes, that helps a lot - to use it as a speedy filter.
> 
> After RTFM, it appears to have the same functionality as @contain
[Ryan Barnett] @contains does allow for a string match however it
differs in that it is not as fast but does allow for macro expansion.

> and that I can use @streq if I want a whole word match.
> 
[Ryan Barnett] This is true, however you need to keep in mind that many
times the attacks are injection type of issues and the @streq operator
is looking to match the ENTIRE payload.  So, if you wanted to use it to
filter if someone was trying to access the /etc/password file -

SecRule ARGS "@streq /etc/passwd"

It would catch this -

http://www.example.com/cgi-bin/foo.php?param=/etc/passwd

but not this -

http://www.example.com/cgi-bin/foo.php?param=12345;cat%20/etc/passwd
(Continue reading)


Gmane