Mitigate Apache strut2 vulnerability, cve-2017-5638
Published Mar 07, 2017
Version 1.0Was this article helpful?
Here is a modified version which takes care of false positive mentioned above, removes the POST request checking and, adds a few more values to the white-list.
 
Inspecting Content-Type from GET requests requires a much larger white-list and increases the chance for blocking legitimate requests. It also reduces the effectiveness of this iRule and therefore this iRule is not to be trusted to provide complete protection. White-listing values may not be good for all applications.
 
The best protection is using a WAF. Check here.
 
WARNING: the iRule below can produce false-positives and block legitimate traffic. Make sure you adjust the list of Content-types for you application before relying on this iRule.
 
when HTTP_REQUEST {
switch -glob -- [string tolower [HTTP::header value "Content-Type"]] {
"" -
"multipart/form-data" -
"text/xml; charset=utf-8" -
"text/???" -
"text/javascript" -
"image/??? -
"image/jpeg" -
"text/html" -
"multipart/form-data; boundary=*" -
"application/x-javascript" -
"application/x-www-form-urlencoded" {
Allow request with empty or white listed "Content-Type" headers
}
default {
Reject request with unknown "Content-Type" headers
reject
log local0. "Rejecting a request with Content-type [HTTP::header Content-Type] to [HTTP::uri] from [IP::client_addr]"
}
}
}