mod_rewrite Rules To Stop Worms & Web Attacks | eWeek

mod_rewrite Rules To Stop Worms & Web Attacks

Écrit par
Larry Seltzer
Larry Seltzer
May 28, 2003
1 minute read
eWeek Le contenu et les recommandations de produits sont indépendants de la rédaction. Nous pouvons gagner de l'argent lorsque vous cliquez sur des liens vers nos partenaires. En savoir plus

Thanks to Jonas Eckerman (http://www.truls.org/) for answering my request in a recent column for input rules for the Apache mod_rewrite module to make it work roughly like Microsofts UrlScan. Eckerman isnt familiar with UrlScan, but says these rules “stop a majority of worms and attacks against web servers.”

These rules cause Apache to return an HTTP 403 (“forbidden”) response for URLs which match (for example “http://www.truls.org/testing/cmd.exe?whatever”). Its not perfect or complete, but it does stop a lot.

RewriteEngine OnRewriteOptions inheritRewriteLog logs/rewrite_logRewriteCond %{REQUEST_URI}?%{QUERY_STRING} (.*)/winnt/system32/(.*) [NC,OR] RewriteCond %{REQUEST_URI}?%{QUERY_STRING} (.*)/winnt/system/(.*) [NC,OR] RewriteCond %{REQUEST_URI}?%{QUERY_STRING} (.*)/windows/system32/(.*) [NC,OR] RewriteCond %{REQUEST_URI}?%{QUERY_STRING} (.*)/windows/system/(.*) [NC,OR] RewriteCond %{REQUEST_URI}?%{QUERY_STRING} (.*)/cmd.exe[$|?(.*)] [NC,OR] RewriteCond %{REQUEST_URI}?%{QUERY_STRING} (.*)/scripts/root.exe[$|?(.*)] [NC,OR] RewriteCond %{REQUEST_URI}?%{QUERY_STRING} (.*)/msadc/root.exe[$|?(.*)] [NC,OR] RewriteCond %{REQUEST_URI}?%{QUERY_STRING} (.*)..(.*) [NC,OR] RewriteCond %{REQUEST_URI}?%{QUERY_STRING} (.*)/admin.dll[$|?(.*)] [NC,OR] RewriteCond %{REQUEST_URI}?%{QUERY_STRING} (.*)/msadcs.dll[$|?(.*)] [NC,OR] RewriteCond %{REQUEST_URI}?%{QUERY_STRING} (.*)/ext.dll[$|?(.*)] [NC,OR] RewriteCond %{REQUEST_URI} (.*)/.(.*) [NC,OR] RewriteCond %{REQUEST_URI}?%{QUERY_STRING} (.*)/php.exe[$|?(.*)] [NC,OR] RewriteCond %{REQUEST_URI}?%{QUERY_STRING} (.*)

<

(.*) [OR] RewriteCond %{REQUEST_URI}?%{QUERY_STRING} (.*)

>

(.*) [OR] RewriteCond %{REQUEST_URI}?%{QUERY_STRING} (.*)|(.*) [OR] RewriteCond %{REQUEST_URI} (.{255,}) [OR] RewriteCond %{QUERY_STRING} (.{127,}) [OR] RewriteCond %{REQUEST_URI}?%{QUERY_STRING} [x00-x1f]+ [OR] RewriteCond %{REQUEST_URI}?%{QUERY_STRING} [x7f|xff]+ RewriteRule (.*) http://monty.frukt.org/error/filtered.html [NC,F]

eWeek Logo

eWeek has the latest technology news and analysis, buying guides, and product reviews for IT professionals and technology buyers. The site's focus is on innovative solutions and covering in-depth technical content. eWeek stays on the cutting edge of technology news and IT trends through interviews and expert analysis. Gain insight from top innovators and thought leaders in the fields of IT, business, enterprise software, startups, and more.

Propriété de TechnologyAdvice. © 2026 TechnologyAdvice. Tous droits réservés

Divulgation publicitaire : Certains des produits qui apparaissent sur ce site proviennent d'entreprises dont TechnologyAdvice reçoit une compensation. Cette compensation peut influencer la façon dont les produits apparaissent sur ce site, notamment l'ordre dans lequel ils apparaissent. TechnologyAdvice n'inclut pas toutes les entreprises ou tous les types de produits disponibles sur le marché.