ha.ckers.org web application security lab - Archive ≫ Lessons Learned From Adobe PDF XSS Patching
Adobe Readerでクロスサイトスクリプティングする脆弱性で加害者にならないために、PDFを公開しているサーバー側でできる対策として
Mod_rewiteで対応しようとする方法についてふれられています。一部のセキュリティソフトではreferrerが正しくなくて正常に動作しないこともあるそうです。
Next was the “you can detect badguys using mod_rewrite” people. Here are two sample rules:
SetEnvIf Request_URI “\.pdf$” requested_pdf=pdf
Header add Content-Disposition “Attachment” env=requested_pdfand
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://([-a-z0-9]+\.)?example\.com[NC]
RewriteRule .*\.(pdf)$ http://www.example.com/images/noexternal.gif [R,NC,L]