LiteSpeed Technologies
Download Download     Blog Blog     Wiki Wiki     Forum Forum     Store     Contact Contact    

Go Back   LiteSpeed Support Forums > LiteSpeed Web Server > LSWS 4.1 Release > mod_security Request Filters

Reply
 
Thread Tools Display Modes
  #1  
Old 02-10-2009, 05:19 AM
Michael.Terence Michael.Terence is offline
Member
 
Join Date: Jan 2009
Posts: 28
Default mod_security Request Filters

Hey everyone - I'm working to secure my webserver with mod_security but have found very little info in the wiki, or the forums. Anyone interested in sharing their rules with everyone else?

I've been looking at the www.gotroot.com website (they have a great library of mod_security rules) but when I attempt to enable things things tend to break.

For example the following rule to block some spam words:
Code:
Action: log,deny,auditlog,phase:2,status:403,t:lowercase,t:replaceNulls,t:compressWhitespace,msg:'No Spam Please'
Rules Definition: SecFilterSelective "POST_PAYLOAD" "(viagra|porn|poker|texasholdem|cialis|bllogspot|casino|gambling-|health-insurancedeals|homeequityloans|hotel-dealse-site|insurance-quotesdeals-4u|mortgage-4-u|mortgagequotes|online-gambling|shemale)"
The rule works for blocking the rules, but people who have subscribed to receive feedburner emails on new posts get an email with all the spaces removed. The action is set to trim whitespace, but I would think that's just for the inspection of the payload.
Reply With Quote
  #2  
Old 02-10-2009, 04:47 PM
Michael.Terence Michael.Terence is offline
Member
 
Join Date: Jan 2009
Posts: 28
I got to looking at the default entries and modified my spam example to the following - the syntax for lsws is a bit different. I'm still unable to get it to actually deny the post though.

Code:
Action:  log,deny,auditlog,status:403,msg:'No Spam Please'
Rules Definition:  SecFilterSelective POST_PAYLOAD "viagra|porn|poker|texasholdem|cialis|bllogspot|casino|gambling-|health-insurancedeals|homeequityloans|hotel-dealse-site|insurance-quotesdeals-4u|mortgage-4-u|mortgagequotes|online-gambling|shemale"
Reply With Quote
  #3  
Old 02-11-2009, 01:59 PM
[QT]bender [QT]bender is offline
Member
 
Join Date: May 2008
Posts: 16
Agree, I have same problem. I was looking at gotroot by Prometheus too and was unable to get it working at Litespeed, and I found manual insufficient too(you can find manual on PHP CHROOT insufficient as well). It seems that there is a lot to do with this module or with manuals for LS tech. Possibly Litespeed tech enhance this module and we'll be able to use this excellent resource to enhance security. I'd even thought about inclusion of this features(gotroot mod_secuirty rule list) to Litespeed(somewhere in section 'Security'). Well, LSWSes has open-source back-end and we can hardcode this by ourselves if Litespeed include this feature in their future releases(our company developing e-Commerce products based on PHP and luckily Litespeed has back-end at PHP, so it's not a problem for us ).

Unfortunately I have no time for testings at the moment, so if you'll get it working and tell me how to do conversion of the rules, I'll be glad to hardcode and share a bash/perl script to convert new rules downloaded from gotroot and possibly automatic checker for rule list updates.

Last edited by [QT]bender; 02-11-2009 at 02:00 PM.. Reason: some typos %^)
Reply With Quote
  #4  
Old 02-11-2009, 05:14 PM
Michael.Terence Michael.Terence is offline
Member
 
Join Date: Jan 2009
Posts: 28
Thanks for posting bender - glad I'm not the only one having difficulties.

I've played around with some more settings but still no luck getting *any* rules to work. Even something as simple as:
log,deny,status:403,msg:'wget request denied'
Code:
SecFilterSelective THE_REQUEST "wget"
Reply With Quote
  #5  
Old 02-11-2009, 05:22 PM
Michael.Terence Michael.Terence is offline
Member
 
Join Date: Jan 2009
Posts: 28
OK - I'M A MORON!

... seriously. I just never looked at the top of the page. I started testing the default rules and even they didn't work, so - I start looking for an option to turn ON the request filtering for the server... it was at the top of the page I've been working on for DAYS! hah

shoot me.
Reply With Quote
  #6  
Old 02-24-2009, 01:39 PM
[QT]bender [QT]bender is offline
Member
 
Join Date: May 2008
Posts: 16
Quote:
Originally Posted by Michael.Terence View Post
OK - I'M A MORON!

... seriously. I just never looked at the top of the page. I started testing the default rules and even they didn't work, so - I start looking for an option to turn ON the request filtering for the server... it was at the top of the page I've been working on for DAYS! hah

shoot me.
Oh crap. Don't mind, never thought that it's at separate tab "Filter", I thought it should be at "Security"... =)
Reply With Quote
  #7  
Old 02-24-2009, 11:40 PM
brrr brrr is offline
Senior Member
 
Join Date: Aug 2007
Posts: 94
Good to hear it is working now.

Pls share your rules - I only have a minimal set of bot blocking rules like:

Code:
log,deny,status:404,msg:'Badbot blocked'
Code:
SecFilterSelective HEADER_USER_AGENT "MLbot"
SecFilterSelective HEADER_USER_AGENT "MOT-MPx220"
SecFilterSelective HEADER_USER_AGENT ^Morfeus
etc

alongside the standard LSWS SQL injection and XSS attack ones.
Reply With Quote
  #8  
Old 02-28-2009, 05:20 PM
Michael.Terence Michael.Terence is offline
Member
 
Join Date: Jan 2009
Posts: 28
Only have one ATM - it has cut my community members spam posts down by a good 80%.

Code:
log,deny,auditlog,status:403,msg:'No Spam Please'
Code:
SecFilterSelective POST_PAYLOAD "lipitor|nude|valtrex|hardcore|viagra|porn|poker|texasholdem|cialis|bllogspot|casino|gambling-|health-insurancedeals|homeequityloans|hotel-dealse-site|insurance-quotesdeals-4u|mortgage-4-u|mortgagequotes|online-gambling|shemale"
Reply With Quote
  #9  
Old 04-28-2012, 02:54 PM
QuantumNet QuantumNet is offline
Senior Member
 
Join Date: Nov 2007
Posts: 61
Would be nice if litespeed a few years later would support the mod security core rule set...

but no matter how many of the config files a stripped out it doesnt work

Litespeed + mod_security = a joke... 3 years and you still dont have it working

https://www.owasp.org/index.php/Cate...le_Set_Project


It seems to me litespeed doesnt take system security seriously, why is this web server so expensive again?
Reply With Quote
  #10  
Old 05-01-2012, 12:14 PM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,590
Please be more specific with your test case that LiteSpeed does not support basic security rules, so, we can look into it.

The rule you think should work. The test request/URI, related File/script.

In order to reduce the cost of heavy mod_security rule, LiteSpeed takes shortcuts in many places, like skipping checking against static files and file does not exist, etc.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 02:41 PM.



- Archive - Top
© Copyright 2003-2011 LiteSpeed Technologies, Inc. All rights reserved. Privacy Policy.