• Welcome to Simple Machines Community Forum. Please login or sign up.

Having problems with mod_security?

Started by [Unknown], April 26, 2005, 12:07:59 AM

Previous topic - Next topic


April 26, 2005, 12:07:59 AM Last Edit: September 22, 2005, 11:24:51 PM by [Unknown]
Some hosts have begun installing something called mod_security.  This filters posts and URLs for certain key words, and if they are found, spits out an error.  Many people are experiencing problems because of this.  Problems include weird "403" or access denied errors, login problems, and similar.

For example, if I were to post this:

QuoteHave you ever used cURL?  You can find information about it at http://curl.haxx.se/.  More specifically, libcurl is useful for accessing URLs in a program - it could be helpful if you're a programmer.

On a server with mod_security enabled, I'd get an error.  This error wouldn't be preventable by SMF, because it's created by the server and Apache, before SMF even gets a say in anything.

However, depending on your host... it may be possible to disable this unnecessary and unwanted behavior.  Since SMF is able to (properly) filter requests without resorting to just blindly grasping at keywords, doing so should be completely safe.  If you don't trust me, live with the false positives or talk to your host to have the mod_security filtering rules changed.

To try to disable it, create a file with the name "htaccess.txt" and put the following in it:

<IfModule mod_security.c>
# Turn off mod_security filtering.  SMF is a big boy, it doesn't need its hands held.
SecFilterEngine Off

# The below probably isn't needed, but better safe than sorry.
SecFilterScanPOST Off

Upload it to your server, and then rename it to ".htaccess" (that's right, it starts with a dot.)  If you already have a file with that name, you'll want to open it with Notepad, and add the above to it (top or bottom.)  Create a backup, though, before overwriting anything.

How do I modify files?

If your host doesn't allow you to disable mod_security, the forum will no longer load.  Don't fret if this happens, just delete the .htaccess file or replace it with the backup you made.  However, if this does happen you will not be able to disable mod_security's filtering.


Joshua Dickerson

I was interested in this so I found this url http://www.modsecurity.org/projects/modsecurity/apache/index.html and it seems like a stupid module if you are a decent coder. Fortunately, security is one of SMF's strong-suit.
Come work with me at Promenade Group

Need help? See the wiki. Want to help SMF? See the wiki!

Did you know you can help develop SMF? See us on Github.

How have you bettered the world today?


Not even in /Dev/Null/ no one can hear u scream.Join Net-force For all your Security Needs, click here to enter



hxxp:www.krypticx.com [nonactive]



i opened two new topics under help threads named;
1- Internal server error when registering a new user
2- Themes not showing.

in both topics, moderators directed me to this thread.
but, my host cannot be using mod_security, because their board is also smf.
and they dont have the problems i do.
additionaly, host doesnt allow dot files to be upload (like .htaccess)
Home of Elmacik


Create a phpinfo.php file.  What is phpinfo.php?  If it contains "mod_security" anywhere in it, you have it.

Contact your host, then, and tell them of your problems.  Point them to this topic.  Perhaps they can create the file for you.




Quote from: [Unknown] on April 26, 2005, 12:07:59 AM

Upload it to your server, and then rename it to ".htaccess" (that's right, it starts with a dot.)

What folder should this be uploaded to? Main SMF folder that contains the index? or our main root directory that is 1 folder before the SMF folder?


Quote from: DrateX on August 27, 2005, 01:15:19 AM
Quote from: [Unknown] on April 26, 2005, 12:07:59 AM

Upload it to your server, and then rename it to ".htaccess" (that's right, it starts with a dot.)

What folder should this be uploaded to? Main SMF folder that contains the index? or our main root directory that is 1 folder before the SMF folder?

Either folder works fine.  I suggest the directory SMF is in, which contains index.php and Settings.php.



Dear Unknown et al,
I just wanted to add my thanks for this (and appropriate search targets). I've been getting http 500 (internal server) error (since moving to - otherwise excellent - host) when trying to amend themes from admin and also none of our avatars were showing up on site (if changed by user). But this .htaccess amendment has solved both my problems.  :D
PS still on v1.0.5


I did these changes and i really want to see if it fixes my problems.

BTW: [Unknown], how come you're SMF Friend now?


He has IRL projects that takes up his time, and other internet projects also.
You'll get the idea

I'm all ok.


It was killing meeeeeee!  >:(

But  :P Thanks to You , I sleep again, like a baby..  ;D

You rule! Let the source be with You!  ;D


i did what you said unknown but in IE i still can't see my forum :'(
|| Leonardo Dicaprio is the Hottest Man Alive Believe Me ||


December 25, 2005, 08:31:09 AM #15 Last Edit: December 25, 2005, 12:16:35 PM by DucTX
i have the problem that my packages site in the admin center is not shown because of error 500. i already asked somewhere else and now i am here. i dont know how to solve my problem. is there anything left i can do? hxxp:www.bl-53.de/phpinfo.php [nonactive] and i cant find anything inside there about mod_security and the thing with the ".htaccess" doesnt work too.


I really think that simply passing the buck off to the server is a bad call by the coders.

For people who are still having this problem as I was on my server, check out Oldiesmann's solution which solved my problem.


i thought the new release candidate would maybe solve my problem but the error 500 when opening the packages site is still there.  please help.


DucTX, your server may not support gz. If you don't have any packages in your Packages directory can you access it then? If so try un-tarring the package on your home PC, then uploading the extracted files to a sub-directory of the Packages directory.
I'm only a half geek really...


January 01, 2006, 08:58:31 AM #19 Last Edit: January 01, 2006, 09:02:53 AM by DucTX
i worked fine at the beginning and i installed some packages. could be that the problem is the gz. i will check it.

EDIT: Yes the gz files caused the problem. thanks. great now my smf works fine again.  :)