title: Possible XSS vulnerability in Rack
There is a possible vulnerability in Rack. This vulnerability has been
assigned the CVE identifier CVE-2018-16471.
Versions Affected: All.
Not affected: None.
Fixed Versions: 2.0.6, 1.6.11
There is a possible XSS vulnerability in Rack. Carefully crafted requests can
impact the data returned by the `scheme` method on `Rack::Request`.
Applications that expect the scheme to be limited to "http" or "https" and do
not escape the return value could be vulnerable to an XSS attack.
Vulnerable code looks something like this:
<%= request.scheme.html_safe %>
Note that applications using the normal escaping mechanisms provided by Rails
may not impacted, but applications that bypass the escaping mechanisms, or do
not use them may be vulnerable.
All users running an affected release should either upgrade or use one of the
The 2.0.6 and 1.6.11 releases are available at the normal locations.
The following monkey patch can be applied to work around this issue:
SCHEME_WHITELIST = %w(https http).freeze
if get_header(Rack::HTTPS) == 'on'
elsif get_header(HTTP_X_FORWARDED_SSL) == 'on'
scheme_headers = [
scheme_headers.each do |header|
return header if SCHEME_WHITELIST.include?(header)
- "~> 1.6.11"
- ">= 2.0.6"