aboutsummaryrefslogtreecommitdiff
path: root/samples/ApacheConf/filenames/.htaccess
diff options
context:
space:
mode:
authorJoshua Peek <josh@joshpeek.com>2012-12-10 09:37:42 -0600
committerJoshua Peek <josh@joshpeek.com>2012-12-10 09:37:42 -0600
commitd00dfd82c1170bd84c8616c34dd8a869058e49af (patch)
tree00cbd88419ff1cc43a7554cfd04683cf948b25b2 /samples/ApacheConf/filenames/.htaccess
parent9003139119e21da4c35ec99f21ab7571c5626928 (diff)
Add samples for apache and nginx confs
Diffstat (limited to 'samples/ApacheConf/filenames/.htaccess')
-rw-r--r--samples/ApacheConf/filenames/.htaccess26
1 files changed, 26 insertions, 0 deletions
diff --git a/samples/ApacheConf/filenames/.htaccess b/samples/ApacheConf/filenames/.htaccess
new file mode 100644
index 0000000..29bd614
--- /dev/null
+++ b/samples/ApacheConf/filenames/.htaccess
@@ -0,0 +1,26 @@
+ServerSignature Off
+RewriteCond %{REQUEST_METHOD} ^(HEAD|TRACE|DELETE|TRACK) [NC,OR]
+RewriteCond %{THE_REQUEST} (\\r|\\n|%0A|%0D) [NC,OR]
+
+RewriteCond %{HTTP_REFERER} (<|>|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]
+RewriteCond %{HTTP_COOKIE} (<|>|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]
+RewriteCond %{REQUEST_URI} ^/(,|;|:|<|>|”>|”<|/|\\\.\.\\).{0,9999} [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-perl|curl|wget|python|nikto|scan) [NC,OR]
+RewriteCond %{HTTP_USER_AGENT} (<|>|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]
+
+#Block mySQL injects
+RewriteCond %{QUERY_STRING} (;|<|>|’|”|\)|%0A|%0D|%22|%27|%3C|%3E|%00).*(/\*|union|select|insert|cast|set|declare|drop|update|md5|benchmark) [NC,OR]
+
+RewriteCond %{QUERY_STRING} \.\./\.\. [OR]
+
+RewriteCond %{QUERY_STRING} (localhost|loopback|127\.0\.0\.1) [NC,OR]
+RewriteCond %{QUERY_STRING} \.[a-z0-9] [NC,OR]
+RewriteCond %{QUERY_STRING} (<|>|’|%0A|%0D|%27|%3C|%3E|%00) [NC]
+# Note: The final RewriteCond must NOT use the [OR] flag.
+
+# Return 403 Forbidden error.
+RewriteRule .* index.php [F]