Skip to content

Instantly share code, notes, and snippets.

@johnl
Created January 9, 2013 01:12
Show Gist options
  • Save johnl/4489723 to your computer and use it in GitHub Desktop.
Save johnl/4489723 to your computer and use it in GitHub Desktop.
Apache rewrite config to block xml request bodies. Simple way to block attacks targetting the recent Rails XML/yaml security bug (CVE-2013-0156). Updating or patching your rails app is preferred though: https://groups.google.com/forum/?fromgroups=#!topic/rubyonrails-security/t1WFuuQyavI
RewriteEngine On
RewriteCond %{REQUEST_METHOD} !GET|HEAD
RewriteCond %{SCRIPT_FILENAME} \.xml$ [OR]
RewriteCond %{HTTP:Content-Type} xml
RewriteRule . - [forbidden,last]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment