Prevent hacks

Started on the old forum in July 2011 · view the original in the archive · old links redirect here

#advance-web-site-hacking #hacking #prevent-hacking

5 replies · 772 views · started 15 years ago · 1 min read

5 participants
razzbee Developer · 130 posts #1

If you want to increase the security level of your website, you can chuck these few lines of codes to prevent some common hacking techniques by detecting malicious URL patterns.

RewriteEngine On

proc/self/environ? no way!

RewriteCond %{QUERY_STRING} proc/self/environ [OR]

Block out any script trying to set a mosConfig value through the URL

RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|%3D) [OR]

Block out any script trying to base64_encode crap to send via URL

RewriteCond %{QUERY_STRING} base64_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_STRING} GLOBALS(=|[|%[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]

metulj Super moderator Principal · 1,726 posts #3

akogwapo14 wrote: where to put that code?

into .htaccess

It's better to keep your mouth shut and give the impression that you're stupid, than to open it and remove all doubt. ⓣⓗⓔ ⓠⓤⓘⓔⓣⓔⓡ ⓨⓞⓤ ⓑⓔ©ⓞⓜⓔ, ⓣⓗⓔ ⓜⓞⓡⓔ ⓨⓞⓤ ⓐⓡⓔ ⓐⓑⓛⓔ ⓣⓞ ⓗⓔⓐⓡ ! ιη тнєσяу, тнє ρяα¢тι¢є ιѕ α яєѕυℓт σƒ тнє тнєσяу, вυт ιη ρяα¢тι¢є ιѕ тнє σρρσѕιтє.

キノgんイノ刀g 4 ア乇ムc乇 ノ丂 レノズ乇 キucズノ刀g 4 √ノ尺gノ刀ノイリ!

akogwapo14 Newbie · 2 posts #4

hi thanks sir i finish put the code please add more security code if you have time thanks

bigboss Developer · 110 posts #5

Direct edit .htaccess file? and put into .htaccess? or delete .htaccess file then upload again in cpanel?

Wintch Developer · 68 posts #6

Tanx men, i l0ve thiz

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close