1
DCrussader
XOOPS Security (without Xoritfy and Protector) [BETA]

1. Always use latest stable XOOPS core.
2. Keep your modules updated to the latest stable release.
3. The .htaccess file

Remote File Inclusion Protection
RewriteEngine On
RewriteBase 
/
RewriteCond %{QUERY_STRING} ^.*=(ht)|(f)+(tp)+(://|s://)+.*(??)+ 
RewriteRule .* http://your-trap.com/php-trap-script.php [R,L]


Various protections
# Block out any script trying to base64_encode crap to send via URL
RewriteCond %{QUERY_STRINGbase64_encode.*(.*) [OR]
# Block out any script that includes a <script> tag in URL
RewriteCond %{QUERY_STRING} (<|%3C).*script.*(>|%3E) [NC,OR]
# Block out any script trying to set a PHP GLOBALS variable via URL
RewriteCond %{QUERY_STRINGGLOBALS(=|[|%[0-9A-Z]{0,2}) [OR]
# Block out any script trying to modify a _REQUEST variable via URL
RewriteCond %{QUERY_STRING_REQUEST(=|[|%[0-9A-Z]{0,2})
# Send all blocked request to homepage with 403 Forbidden error!
RewriteRule ^(.*)$ index.php [F,L]


Disallow displaying content of folders which don't have index.html within
Options +FollowSymLinks -Indexes


Next 2 must be added directly after RewriteEngine On
Blocking Download Managers and Proxies
RewriteCond %{HTTP:VIA}                 !^$ [OR]
RewriteCond %{HTTP:FORWARDED}           !^$ [OR]
RewriteCond %{HTTP:USERAGENT_VIA}       !^$ [OR]
RewriteCond %{HTTP:X_FORWARDED_FOR}     !^$ [OR]
RewriteCond %{HTTP:PROXY_CONNECTION}    !^$ [OR]
RewriteCond %{HTTP:XPROXY_CONNECTION}   !^$ [OR]
RewriteCond %{HTTP:HTTP_PC_REMOTE_ADDR} !^$ [OR]
RewriteCond %{HTTP:XROXY_CONNECTION}    !^$ [OR]
RewriteCond %{HTTP:X-FORWARDED-FOR}     !^$ [OR]
RewriteCond %{HTTP:FORWARDED-FOR}       !^$ [OR]
RewriteCond %{HTTP:X-FORWARDED}         !^$ [OR]
RewriteCond %{HTTP:HTTP_CLIENT_IP}      !^$
RewriteRule ^(.*)$ - [F]


Blocking Bad Robots
RewriteCond %{HTTP_USER_AGENT} ^BlackWidow [OR]
RewriteCond %{HTTP_USER_AGENT} ^Bot mailto:craftbot@yahoo.com [OR]
RewriteCond %{HTTP_USER_AGENT} ^ChinaClaw [OR]
RewriteCond %{HTTP_USER_AGENT} ^Custo [OR]
RewriteCond %{HTTP_USER_AGENT} ^DISCo [OR]
RewriteCond %{HTTP_USER_AGENT} ^Download Demon [OR]
RewriteCond %{HTTP_USER_AGENT} ^eCatch [OR]
RewriteCond %{HTTP_USER_AGENT} ^EirGrabber [OR]
RewriteCond %{HTTP_USER_AGENT} ^EmailSiphon [OR]
RewriteCond %{HTTP_USER_AGENT} ^EmailWolf [OR]
RewriteCond %{HTTP_USER_AGENT} ^Express WebPictures [OR]
RewriteCond %{HTTP_USER_AGENT} ^ExtractorPro [OR]
RewriteCond %{HTTP_USER_AGENT} ^EyeNetIE [OR]
RewriteCond %{HTTP_USER_AGENT} ^FlashGet [OR]
RewriteCond %{HTTP_USER_AGENT} ^GetRight [OR]
RewriteCond %{HTTP_USER_AGENT} ^GetWeb! [OR]
RewriteCond %{HTTP_USER_AGENT} ^Go!Zilla [OR]
RewriteCond %{HTTP_USER_AGENT} ^Go-Ahead-Got-It [OR]
RewriteCond %{HTTP_USER_AGENT} ^GrabNet [OR]
RewriteCond %{HTTP_USER_AGENT} ^Grafula [OR]
RewriteCond %{HTTP_USER_AGENT} ^HMView [OR]
RewriteCond %{HTTP_USER_AGENTHTTrack [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^Image Stripper [OR]
RewriteCond %{HTTP_USER_AGENT} ^Image Sucker [OR]
RewriteCond %{HTTP_USER_AGENTIndy Library [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^InterGET [OR]
RewriteCond %{HTTP_USER_AGENT} ^Internet Ninja [OR]
RewriteCond %{HTTP_USER_AGENT} ^JetCar [OR]
RewriteCond %{HTTP_USER_AGENT} ^JOC Web Spider [OR]
RewriteCond %{HTTP_USER_AGENT} ^larbin [OR]
RewriteCond %{HTTP_USER_AGENT} ^LeechFTP [OR]
RewriteCond %{HTTP_USER_AGENT} ^Mass Downloader [OR]
RewriteCond %{HTTP_USER_AGENT} ^MIDown tool [OR]
RewriteCond %{HTTP_USER_AGENT} ^Mister PiX [OR]
RewriteCond %{HTTP_USER_AGENT} ^Navroad [OR]
RewriteCond %{HTTP_USER_AGENT} ^NearSite [OR]
RewriteCond %{HTTP_USER_AGENT} ^NetAnts [OR]
RewriteCond %{HTTP_USER_AGENT} ^NetSpider [OR]
RewriteCond %{HTTP_USER_AGENT} ^Net Vampire [OR]
RewriteCond %{HTTP_USER_AGENT} ^NetZIP [OR]
RewriteCond %{HTTP_USER_AGENT} ^Octopus [OR]
RewriteCond %{HTTP_USER_AGENT} ^Offline Explorer [OR]
RewriteCond %{HTTP_USER_AGENT} ^Offline Navigator [OR]
RewriteCond %{HTTP_USER_AGENT} ^PageGrabber [OR]
RewriteCond %{HTTP_USER_AGENT} ^Papa Foto [OR]
RewriteCond %{HTTP_USER_AGENT} ^pavuk [OR]
RewriteCond %{HTTP_USER_AGENT} ^pcBrowser [OR]
RewriteCond %{HTTP_USER_AGENT} ^RealDownload [OR]
RewriteCond %{HTTP_USER_AGENT} ^ReGet [OR]
RewriteCond %{HTTP_USER_AGENT} ^SiteSnagger [OR]
RewriteCond %{HTTP_USER_AGENT} ^SmartDownload [OR]
RewriteCond %{HTTP_USER_AGENT} ^SuperBot [OR]
RewriteCond %{HTTP_USER_AGENT} ^SuperHTTP [OR]
RewriteCond %{HTTP_USER_AGENT} ^Surfbot [OR]
RewriteCond %{HTTP_USER_AGENT} ^tAkeOut [OR]
RewriteCond %{HTTP_USER_AGENT} ^Teleport Pro [OR]
RewriteCond %{HTTP_USER_AGENT} ^VoidEYE [OR]
RewriteCond %{HTTP_USER_AGENT} ^Web Image Collector [OR]
RewriteCond %{HTTP_USER_AGENT} ^Web Sucker [OR]
RewriteCond %{HTTP_USER_AGENT} ^WebAuto [OR]
RewriteCond %{HTTP_USER_AGENT} ^WebCopier [OR]
RewriteCond %{HTTP_USER_AGENT} ^WebFetch [OR]
RewriteCond %{HTTP_USER_AGENT} ^WebGo IS [OR]
RewriteCond %{HTTP_USER_AGENT} ^WebLeacher [OR]
RewriteCond %{HTTP_USER_AGENT} ^WebReaper [OR]
RewriteCond %{HTTP_USER_AGENT} ^WebSauger [OR]
RewriteCond %{HTTP_USER_AGENT} ^Website eXtractor [OR]
RewriteCond %{HTTP_USER_AGENT} ^Website Quester [OR]
RewriteCond %{HTTP_USER_AGENT} ^WebStripper [OR]
RewriteCond %{HTTP_USER_AGENT} ^WebWhacker [OR]
RewriteCond %{HTTP_USER_AGENT} ^WebZIP [OR]
RewriteCond %{HTTP_USER_AGENT} ^Wget [OR]
RewriteCond %{HTTP_USER_AGENT} ^Widow [OR]
RewriteCond %{HTTP_USER_AGENT} ^WWWOFFLE [OR]
RewriteCond %{HTTP_USER_AGENT} ^Xaldon WebSpider [OR]
RewriteCond %{HTTP_USER_AGENT} ^Zeus
RewriteRule 
.* - [F]


The following 4 lines
RewriteCond %{HTTP:VIA}                 !^$ [OR]
RewriteCond %{HTTP:FORWARDED}           !^$ [OR]
RewriteCond %{HTTP:USERAGENT_VIA}       !^$ [OR]
RewriteCond %{HTTP:X_FORWARDED_FOR}     !^$ [OR]

blocks the access to services such as Facebook and Google Translate, if u don't comment them out.

Check that all files are with permissions 644 and folders with permissions 755.
The following lines must be added in php.ini and placed in your XOOPS root folder
register_globals=Off
safe_mode
=Off
allow_url_fopen
=Off
allow_url_include
=Off
disable_functions
=show_sourcesystemshell_execpassthruexecphpinfopopenproc_open
open_basedir
=/home/some_path/public_html


safe_mode - must be Off.
safe_mode is a security risk; it was supposed to add a new layer of security to PHP, but it ended up creating more bugs.

allow_url_fopen - must be Off
allow_url_fopen might allow an attacker to include his own PHP scripts in your XOOPS website, ultimately taking control of the webserver.

allow_url_include - must be Off
allow_url_include might allow an attacker to include his own PHP scripts in your XOOPS website, ultimately taking control of the webserver.

disable_functions - recommended to be used
disable_functions disables dangerous PHP functions. It is recommended to disable: show_source, system, shell_exec, passthru, exec, phpinfo, popen, proc_open

open_basedir - recommended to be used. open_basedir restricts access to specified directories only.

Do not use administrator user name such as: admin, administrator, root. Make password with random chars.

Do not install modules which are from:
Dead authors
Abandoned
Not Trusted Sites
Not Trusted Authors

IP Blocking:
Use
deny from 111.222.333.444

For blocking specific IP Address Range
or
deny from 111.222.333.0-111.222.333.255


[EDIT by Mamba]
Using IP2Country IP Address List you can ban those countries from which you're receiving most spam in your Website, or which are historically known for spam activities, and your Website is not interested in traffic from them
[/EDIT]

(Some more stuff will be added later.... XOOPS should be changed a bit too)

Edit: Proposed PHP.INI may conflict with some XOOPS installs.
May The Source Be With You!

2
Anonymous
Re: XOOPS Security (without Xoritfy and Protector) [BETA]
  • 2012/4/4 17:40

  • Anonymous

  • Posts: 0

  • Since:


Nice and docile tutorial DCrussader.

3
Dante7237
Re: XOOPS Security (without Xoritfy and Protector) [BETA]

Excellent tutorial.
Every webmaster should implement these techniques.

Of course, allow who you want, block who you want....

The more I know, the more I know that I really didn't wanna know.

4
Mamba
Re: XOOPS Security (without Xoritfy and Protector) [BETA]
  • 2012/4/5 6:48

  • Mamba

  • Moderator

  • Posts: 11366

  • Since: 2004/4/23


I had to put my moderator hat today and make some edits.

We don't need to pinpoint particular countries for banning - it's up to the individual Webmaster to decide based on his records of who is spamming his Website.

So let's focus on the technical aspects of the issue, i.e. once you see that most of the spam is coming form country ABC, how can you ban them and protect your Website.

With that - Happy Xoopsing!


Support XOOPS => DONATE
Use 2.5.10 | Docs | Modules | Bugs

5
DCrussader
Re: XOOPS Security (without Xoritfy and Protector) [BETA]

Heh... ok
--------------------
Next step is activating reCaptcha in comments and registration.

You have to edit /class/captcha/config.php
on Line 29 to add 'recaptcha'

next file for edit is /class/config.recaptcha.php
Lines 24-27
Private and Public keys (obtain yours fromhttp://www.google.com/recaptcha
Theme of reCaptcha (clean, mostly used)
Line 27 'lang' -> change _LANGCODE to 'en'

demo (till next deletion)
Registration (http://xoops.cmsbg.info/modules/profile/register.php)
Comment (http://xoops.cmsbg.info/modules/TDMDownloads/comment_new.php?com_itemid=1&com_order=0&com_mode=flat&cid=2)
May The Source Be With You!

6
Peekay
Re: XOOPS Security (without Xoritfy and Protector) [BETA]
  • 2012/4/5 13:28

  • Peekay

  • XOOPS is my life!

  • Posts: 2335

  • Since: 2004/11/20


Some good advice.

I found the single biggest prevention against script attacks is to keep PERL off your server. I posted how to do this in htaccess here.

The Perishable Press 4G blacklist mentioned in that thread also covers a lot of exploits, although you may need to disable some prohibited characters or expressions to use Xoops.
A thread is for life. Not just for Christmas.

7
wishcraft
Re: XOOPS Security (without Xoritfy and Protector) [BETA]

These are two very good articles, however Xortify is for more Captcha Sweat Shops, Captcha beating bots, signup fraud, harvesting and other things as well, I would recommend running it, most people i have spoken to who are getting attacked with signup captcha sweat shops seem to have them beat with xortify.
Resized Image
www.ohloh.net/accounts/226400

Follow, Like & Read:-

twitter.com/RegaltyFamily
github.com/Chronolabs-Cooperative
facebook.com/DrAntonyRoberts

Login

Who's Online

232 user(s) are online (160 user(s) are browsing Support Forums)


Members: 0


Guests: 232


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Apr 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits