x10Hosting Forums

Corporate Free Hosting for the Masses.



Register

Reply
 
LinkBack Thread Tools Display Modes
I love the internet

vigge_sWe's Avatar

Join Date: Oct 2007
Posts: 2,704
Credits: 8,753
vigge_sWe has a reputation beyond reputevigge_sWe has a reputation beyond repute
Location: Göteborg, Sweden

Quote  
05-03-2008, 12:05 PM
.htaccess firewall

This is a small .htaccess firewall to protect your site from hackers:

Code:
RewriteEngine On

Options +FollowSymLinks



ServerSignature Off



RewriteCond %{REQUEST_METHOD}  ^(HEAD|TRACE|DELETE|TRACK) [NC,OR]

RewriteCond %{HTTP_REFERER}    ^(.*)(<|>|'|%0A|%0D|%27|%3C|%3E|%00).* [NC,OR]

RewriteCond %{REQUEST_URI}     ^/(,|;|<|>|/{2,999}).* [NC,OR]



RewriteCond %{HTTP_USER_AGENT} ^$ [OR]

RewriteCond %{HTTP_USER_AGENT} ^(java|curl|wget).* [NC,OR]

RewriteCond %{HTTP_USER_AGENT} ^.*(winhttp|HTTrack|clshttp|archiver|loader|email|harvest|extract|grab|miner).* [NC,OR]

RewriteCond %{HTTP_USER_AGENT} ^.*(libwww|curl|wget|python|nikto|scan).* [NC,OR]

RewriteCond %{HTTP_USER_AGENT} ^.*(<|>|'|%0A|%0D|%27|%3C|%3E|%00).* [NC,OR]



RewriteCond %{HTTP_COOKIE}     ^.*(<|>|'|%0A|%0D|%27|%3C|%3E|%00).* [NC,OR]

RewriteCond %{QUERY_STRING}    ^.*(;|'|").*(union|select|insert|declare|drop|update|md5|benchmark).* [NC,OR]

RewriteCond %{QUERY_STRING}    ^.*(localhost|loopback|127\.0\.0\.1).* [NC,OR]



RewriteCond %{QUERY_STRING}    ^.*\.[A-Za-z0-9].* [NC,OR] # prevents shell injection

RewriteCond %{QUERY_STRING}    ^.*(<|>|'|%0A|%0D|%27|%3C|%3E|%00).* [NC]



RewriteRule ^(.*)$ index.php # better yet: send them to a fail-safe page, like error.php
Source:
http://www.0x000000.com/?i=558

http://jagf.net/blog/programming/website-firewall/
__________________
Reply With Quote
vigge_sWe is online nowReport Post
VIP User

Join Date: Jan 2008
Posts: 907
Credits: 478
bigjoe4 has a reputation beyond reputebigjoe4 has a reputation beyond repute
Quote  
05-26-2008, 10:12 AM
Re: .htaccess firewall

I am interrested in this, can I just replace my existing htaccess with this or will that mess stuff up? have you tried it yourself?
__________________
Please visit my site: Circuit designer
Reply With Quote
bigjoe4 is offlineReport Post
I love the internet

vigge_sWe's Avatar

Join Date: Oct 2007
Posts: 2,704
Credits: 8,753
vigge_sWe has a reputation beyond reputevigge_sWe has a reputation beyond repute
Location: Göteborg, Sweden

Quote  
05-26-2008, 10:21 AM
Re: .htaccess firewall

Quote:
Originally Posted by bigjoe4 View Post
I am interrested in this, can I just replace my existing htaccess with this or will that mess stuff up? have you tried it yourself?
Put it in the end of your .htaccess. No I haven't had time to try it
__________________
Reply With Quote
vigge_sWe is online nowReport Post
Lord Of The Keys

LHVWB's Avatar

Join Date: Jan 2008
Posts: 1,280
Credits: 9,231
LHVWB is a jewel in the rough
Location: Australia

Send a message via MSN to LHVWB
Quote  
05-28-2008, 12:44 AM
Re: .htaccess firewall

Maybe you should put this into the tutorials section? It would probably make a good tutorial.
Reply With Quote
LHVWB is offlineReport Post
Senior Account Manager

TechAsh's Avatar

Join Date: Oct 2007
Posts: 5,237
Credits: 22,315
TechAsh has a reputation beyond repute
Location: UK

Quote  
05-28-2008, 03:27 AM
Re: .htaccess firewall

I have tested it on my site. The only problem I've noticed is that it blocks "." in the query string, and this can cause problems with some scripts that use this. I just commented that bit out of the .htaccess file any it still works.

I haven't tried to hack my site with this firewall in place to see how effective it is, and I'm not going to, but I think it will stop some attempts.
__________________
My Website - Earthtime Games is worth
Reply With Quote
TechAsh is offlineReport Post
Account Manager

sohailamir52's Avatar

Join Date: Sep 2007
Posts: 2,796
Credits: 1,301
sohailamir52 has a reputation beyond repute
Location: Dubai, UAE

Quote  
05-28-2008, 03:49 AM
Re: .htaccess firewall

Yeah i'll move this to the tuorials section now... This is a great script, but don't you have to place this in the .htaccess file of everyday directory as I think that if you were to put it in you main directory it would only work for that directory and not any subs?
__________________

SohailTech MANAGER/X10 MODERATOR
•NEED DESIGNING SERVICES/ADVERTISING? CLICK HERE
•PLEASE DO NOT PM ME OR ANY OF THE STAFF FOR HELP
•CLICK THE TO GIVE ME REP

NEED HELP?
SERVER STATUS - INSERTING ADS - PHP PROBLEMS? - HOW DO CREDITS WORK? - x10 COMMANDMENTS - TERMS OF SERVICE - MARKETPLACE RULES
Reply With Quote
sohailamir52 is offlineReport Post
Senior Account Manager

TechAsh's Avatar

Join Date: Oct 2007
Posts: 5,237
Credits: 22,315
TechAsh has a reputation beyond repute
Location: UK

Quote  
05-28-2008, 03:52 AM
Re: .htaccess firewall

Quote:
This is a great script, but don't you have to place this in the .htaccess file of everyday directory as I think that if you were to put it in you main directory it would only work for that directory and not any subs?
No. If you place it in the main directory, it will work for all sub-directories as well.
__________________
My Website - Earthtime Games is worth
Reply With Quote
TechAsh is offlineReport Post
Lord Of The Keys

LHVWB's Avatar

Join Date: Jan 2008
Posts: 1,280
Credits: 9,231
LHVWB is a jewel in the rough
Location: Australia

Send a message via MSN to LHVWB
Quote  
05-28-2008, 08:18 AM
Re: .htaccess firewall

Just a question, I haven't done much working with securing websites, so how safe is this method when compared to other methods?

Last edited by LHVWB; 05-28-2008 at 08:21 AM.
Reply With Quote
LHVWB is offlineReport Post
Account Manager

sunils's Avatar

Join Date: Jan 2008
Posts: 2,033
Credits: 30,567
sunils has a reputation beyond repute
Location: Chennai ,India

Send a message via AIM to sunils Send a message via Yahoo to sunils
Quote  
05-28-2008, 10:39 AM
Re: .htaccess firewall

But i tried this. It just showed my pages cannot be displayed. I tried in my local server.
__________________
Sunil Sankar
-------------------------------------------------------------------------
Account Manager

Reply With Quote
sunils is offlineReport Post
I love the internet

vigge_sWe's Avatar

Join Date: Oct 2007
Posts: 2,704
Credits: 8,753
vigge_sWe has a reputation beyond reputevigge_sWe has a reputation beyond repute
Location: Göteborg, Sweden

Quote  
05-28-2008, 10:49 AM
Re: .htaccess firewall

Quote:
Originally Posted by verbsite View Post
Just a question, I haven't done much working with securing websites, so how safe is this method when compared to other methods?
I don't belive it stops everything but I think it stops the n00b hackers that just learnt how to hack
__________________
Reply With Quote
vigge_sWe is online nowReport Post
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
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Best Firewall? Twinkie Crossfire 13 04-13-2008 01:34 PM
Server firewall blocking countries? clanuis Free Hosting 14 11-23-2007 11:13 AM
default .htaccess fedlerner Computers & Technology 9 09-05-2007 10:10 PM
What's your Antivirus & Firewall stealth_thunder Scripts & 3rd Party Apps 30 04-28-2005 03:56 PM


All times are GMT -5. The time now is 03:06 PM. Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.2.0 RC7
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios

Credit Cards | Anime Forum | Bad Credit Mortgages | Internet Advertising | Diamond Rings