Forum Moderators: phranque
# Block image inclusion outside our domain except Google, AltaVista, Gigablast, and Comet Systems translators and caches
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{HTTP_REFERER}!^$
RewriteCond %{HTTP_REFERER}!^http://(www\.)?mydomain\.org [NC]
RewriteCond %{HTTP_REFERER}!^http://216\.239\.(3[2-9]¦[45][0-9]¦6[0-3]).*(www\.)?mydomaine\.org [NC]
RewriteCond %{HTTP_REFERER}!^http://babel.altavista.com/.*(www\.)?myotherdomain\.com [NC]
RewriteCond %{HTTP_REFERER}!^http://216\.243\.113\.1/cgi/
RewriteCond %{HTTP_REFERER}!^http://search.*\.cometsystems\.com/search.*(www\.)?mydomain\.org [NC]
RewriteRule \.(gif¦jpg¦jpeg?)$ - [NC,F]
# Forbid if blank *and* UA
RewriteCond %{HTTP_referer} ^$
RewriteCond %{HTTP_user_agent} ^$
RewriteRule .* - [F]
# Forbid if *faked* blank referer *or* UA
RewriteCond %{HTTP_referer} ^-$ [OR]
RewriteCond %{HTTP_user_agent} ^-$
RewriteRule .* - [F]
# Send em internally to the trap
RewriteCond %{HTTP_referer} badgossip\.improperly-moderated\.com/ [NC]
RewriteRule!^cgi\/trap\.cgi$ /cgi/trap.cgi [L]
# Internally re-direct html trap-bait-directory and contents to trap
# Also the templates directory and content
RewriteCond %{request_uri} directory\-name
RewriteRule ^directory\-name\/.* /cgi/trap.cgi [L]
RewriteCond %{request_uri} templates
RewriteRule ^templates\/.* /cgi/trap.cgi [L]
# worm and exploit #*$!:
RewriteCond %{request_uri} \_vti\_ [NC,OR]
RewriteCond %{request_uri} (/c\+dir¦CAPREQ¦owssvr¦cltreq¦script\>¦\[drive\-letter\]¦\[server\-name\]¦NULL) [NC,OR]
RewriteCond %{request_uri} (nobody¦form¦mail¦cmd¦root¦autoexec¦shell)(2¦to)?\.(bat¦asp¦cgi¦exe¦php¦pl¦pm) [NC,OR]
RewriteCond %{request_uri} (\.\.¦\*¦'¦\(.*\)¦\+) [OR]
RewriteCond %{request_uri} \.ida [NC] [OR}
# web-ripping tools:
RewriteCond %{HTTP_USER_AGENT} (curl¦Dart.?Communications¦Enfish¦htdig¦Java¦larbin) [NC,OR]
RewriteCond %{HTTP_USER_AGENT} (FrontPage¦Indy.?Library¦RPT\-HTTPClient) [NC,OR]
RewriteCond %{HTTP_USER_AGENT} (libwww¦lwp¦PHP¦Python¦www\.thatrobotsite\.com¦webbandit¦Wget¦Zeus) [NC,OR]
RewriteCond %{HTTP_USER_AGENT} (Microsoft¦MFC).(Data¦Internet¦URL¦WebDAV¦Foundation).(Access¦Explorer¦Control¦MiniRedir¦Class) [NC,OR]
# Image-grabbers
RewriteCond %{HTTP_USER_AGENT} (AcoiRobot¦FlickBot¦webcollage) [NC,OR]
RewriteCond %{HTTP_USER_AGENT} (Express¦Mister¦Web).?(Web¦Pix¦Image).?(Pictures¦Collector)? [NC,OR]
RewriteCond %{HTTP_USER_AGENT} Image.?(fetch¦Stripper¦Sucker) [NC,OR]
# higher bandwidth users
RewriteCond %{HTTP_REFERER} iaea\.org [NC,OR]
RewriteCond %{HTTP_USER_AGENT} (LinkWalker¦ia_archiver¦NPBot) [NC]
RewriteRule .* /worms.txt [L]
<Files .htaccess>
order deny,allow
deny from all
</Files>
<Limit PUT DELETE>
order deny,allow
deny from all
</Limit>
I'd suggest a modification to the blank-UA blocking code, in order to avoid blocking AOL users:
# Forbid if blank *and* UA, except for HEAD requests
RewriteCond %{REQUEST_METHOD} !^HEAD$
RewriteCond %{HTTP_REFERER} ^$
RewriteCond %{HTTP_USER_AGENT} ^$
RewriteRule .* - [F]
Jim