2 ms·
Of all the workarounds, this is probably the best option because it will still allow ranges to function. Option 1: (Apache 2.0 and 2.2) # Drop the
by ck2 15y ago
Of all the workarounds, this is probably the best option because it will still allow ranges to function.
Option 1: (Apache 2.0 and 2.2)
# Drop the Range header when more than 5 ranges.
# CVE-2011-3192
SetEnvIf Range (,.*?){5,} bad-range=1
RequestHeader unset Range env=bad-range
# optional logging.
CustomLog logs/range-CVE-2011-3192.log common env=bad-range
Option 2: (Also for Apache 1.3)
# Reject request when more than 5 ranges in the Range: header.
# CVE-2011-3192
#
RewriteEngine on
RewriteCond %{HTTP:range} !(^bytes=[^,]+(,[^,]+){0,4}$|^$)
RewriteRule .* - [F]
- jarin 15y agoMaking sure ranges work is especially important if you're serving up streaming video.
- ck2 15y agoAlso for download resuming if I remember correctly.
- ZoFreX 15y agoYes, but very few people are using browsers / download clients that will actually resume downloads, and in many cases sites don't support it for files anyway. However with video it's absolutely expected behaviour.
- shoota 15y agoBoth firefox and chrome will resume downloads if they're paused.
- nickthedart 15y agoAdditional info : Changing this slightly to drop range header when more than 10 ranges (i:e the 5 on the third line becomes a 10 instead ), can avoid problems where serving of large pdfs get broken by this fix.
- whyleyc 15y agoI've been testing this fix today on Apache 2.0.53 and observed that when running the attack script against a server patched with option 1 (minus the optional logging) there was still a significant hike in CPU usage, perhaps because there is a cost in processing the header analysis. Option 2 produced no such hike, and protected the server from attack.