Community Forums
Connect with us on LinkedIn
Community Notice
+ Reply to Thread
Results 1 to 5 of 5
  1. #1
    Member
    Join Date
    Sep 2003
    Posts
    217

    Default mod_security - advice

    All major php software seems to be hindered by the mod security rule Generic Path Recursion. How do some of you deal with this? Do you remove this rule? Or simply whitelist the domain?

  2. #2
    Member
    Join Date
    May 2007
    Posts
    19

    Default

    I'll suggest you to just whitelist the domain rather then removing it completely. That help to prevent from attack by some malicous activity on your domain. You can whitelist it by using following command in .htaccess file.

    SecFilterEngine Off
    SecFilterScanPOST Off
    ------------------------------------------------------------------------------------------
    Dedicated server System administration - Technical support issues
    Cheap Dedicated server
    ------------------------------------------------------------------------------------------

  3. #3
    Member
    Join Date
    Mar 2002
    Posts
    248

    Default

    How do we whitelist domain for mod security?
    Gundamz (Gundam Zeta) : Japanese version of transformers.

  4. #4
    Member
    Join Date
    Sep 2003
    Posts
    217

    Default

    Quote Originally Posted by Billa View Post
    I'll suggest you to just whitelist the domain rather then removing it completely. That help to prevent from attack by some malicous activity on your domain. You can whitelist it by using following command in .htaccess file.

    SecFilterEngine Off
    SecFilterScanPOST Off
    So if I whitelist every domain that uses wordpress, Joomla, phpBB, etc. What exactly am I protecting? These are the sites that will most likely be hacked.

  5. #5
    Member
    Join Date
    Jan 2006
    Posts
    9

    Default Work around for the -specific- mod_sec rules

    This is the recent advisory I sent to my co-admins due to our tightened mod_sec2 rules: (edited)


    First, determine which rule it is catching...

    Step 1: Goto the WHM ( https://xxxxxx.xxx:2087/ )

    Step 2: Bottom left menu, choose "Configserver Security & Firewall"

    Step 3: Mid bottom of page, choose "Mod Security Log" (Pick 20-50 entries if you cannot see it)

    (Note: You will need to tail the /etc/httpd/logs/modsec_audit.log or try the built in cpanel mod_sec addon if you don't have cfs/lfd installed)

    Step 4: Find the page and error you need, copy the [id xxxxxx] code.

    Step 5: Left WHM menu again, "Apache Setup" (you can type apache in top search box to go faster)

    Step 6: Select "Include Editor"

    Step 7: Select "Pre Virtual Host Include" and "All Versions"

    Step 8: Copy/Paste the similar configs and replace the mod sec rule ID number

    (Note: Config samples at bottom of this post. BE SPECIFIC for the file locations you are exempting!)


    Step 9: Update, then Restart Apache.

    Step 10: Recheck problem... it might hit more rules after that one, they can be slightly similar.

    If this doesn't work, just ask.

    Please also create 400/401 etc pages from your cpanel (http://xxxxxxx.xxx/cpanel/ ) interface, near the bottom there is a simple editor to add all the pages. At least have something in there to reduce the error-log clutter.


    Below is reference info from the incident we diagnosed:


    http://blogsecurity.net/wordpress/mo...ense-in-depth/

    http://weblogtoolscollection.com/arc...t-implemented/



    root@xxxxxx [~]# tail -f /etc/httpd/logs/modsec_audit.log

    --37d2f309-H--
    Message: Access denied with code 501 (phase 2). Pattern match "(?:\\b(?:(?:n(?:et(?:\\b\\W+?\\blocalgroup|\\.exe)|(?:map|c)\\.exe)|t(?:racer(?:oute|t)|elnet\\.exe|clsh8?|ftp)|(?:w(?:guest|sh)|rcmd|ftp)\\.exe|echo\\b\\W*?\\by+)\\b|c(?:md(?:(?:32)?\\.exe\\b|\\b\\W*?\\/c)|d(?:\\b\\W*?[\\\\/]|\\W*?\\.\\.)|hmod.{0,40}? ..." at ARGS:newcontent. [id "950xxxx"] [msg "System Command Injection. Matched signature <; ?>\" id>"] [severity "CRITICAL"]
    Action: Intercepted (phase 2)
    Stopwatch: 1205643356130899 28484 (22443* 28143 -)
    Producer: ModSecurity v2.1.x (Apache 2.x)
    Server: Apache/2.2.xx (Unix) mod_ssl/2.xxxx OpenSSL/0.xxxx DAV/2 mod_mono/1.2.xxx mod_auth_passthrough/2.xxx mod_bwlimited/1.xxx FrontPage/5.0.x.xxxx mod_perl/2.xxxx Perl/v5.8.xxxx



    Directives added to http.conf:

    <LocationMatch "/wp-admin/post.php">
    SecRuleRemoveById xxxxxx
    </LocationMatch>

    <LocationMatch "/wp-admin/theme-editor.php">
    SecRuleRemoveById xxxxxxx
    </LocationMatch>

Similar Threads & Tags
Similar threads

  1. Need an Advice!
    By Voltar in forum cPanel and WHM Discussions
    Replies: 4
    Last Post: 02-11-2009, 11:01 PM
  2. Advice
    By steve-sydney in forum cPGS Discussions
    Replies: 1
    Last Post: 06-26-2008, 10:44 AM
  3. need advice
    By sicute in forum New User Questions
    Replies: 2
    Last Post: 12-13-2006, 12:14 PM
  4. Advice:
    By hostmedic in forum cPanel and WHM Discussions
    Replies: 5
    Last Post: 04-20-2006, 05:53 AM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube