Skip to content

Instantly share code, notes, and snippets.

@Narven
Created October 21, 2013 10:06
Show Gist options
  • Select an option

  • Save Narven/7081496 to your computer and use it in GitHub Desktop.

Select an option

Save Narven/7081496 to your computer and use it in GitHub Desktop.
site protection temporary solutions https://coderwall.com/p/-3oqoa?&p=1&q= this is more for my own reminder and place to come back to for reference Simple rules that have been tested for years to plug most any whole in your site. Not to replace good coding practice, or directly address the root issue, but to act as a simple first line defense as…
# URL Filtering helps stop some hack attempts
#IF the URI contains a "http:"
RewriteCond %{QUERY_STRING} http\: [OR]
#OR if the URI contains a "["
RewriteCond %{QUERY_STRING} \[ [OR]
#OR if the URI contains a "]"
RewriteCond %{QUERY_STRING} \] [OR]
#OR if the URI contains a "<script>"
RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR]
#OR script trying to set a PHP GLOBALS variable via URL
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
#OR any script trying to modify a _REQUEST variable via URL
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
RewriteCond %{QUERY_STRING} .*((%73|%53|s)(%65|%45|e)(%6C|%4C|l)(%65|%45|e)(%63|%43|c)(%74|%54|t)|(%69|%49|i)(%6E|%4E|n)(%73|%53|s)(%65|%45|e)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment