Bug 1301933 - (CVE-2015-7576) CVE-2015-7576 rubygem-actionpack: Timing attack vulnerability in basic authentication in Action Controller
CVE-2015-7576 rubygem-actionpack: Timing attack vulnerability in basic authen...
Status: CLOSED ERRATA
Product: Security Response
Classification: Other
Component: vulnerability (Show other bugs)
unspecified
All Linux
low Severity low
: ---
: ---
Assigned To: Red Hat Product Security
impact=low,public=20160125,reported=2...
: Security
Depends On: 1301934 1301935 1301995 1301996 1301997 1301998 1301999 1306275 1306276 1306277 1306278 1306279 1306281
Blocks: 1302006
  Show dependency treegraph
 
Reported: 2016-01-26 07:09 EST by Adam Mariš
Modified: 2017-09-21 11:15 EDT (History)
39 users (show)

See Also:
Fixed In Version: rubygem-rails 5.0.0.beta1.1, rubygem-rails 4.2.5.1, rubygem-rails 4.1.14.1, rubygem-rails 3.2.22.1
Doc Type: Bug Fix
Doc Text:
A flaw was found in the way the Action Controller component compared user names and passwords when performing HTTP basic authentication. Time taken to compare strings could differ depending on input, possibly allowing a remote attacker to determine valid user names and passwords using a timing attack.
Story Points: ---
Clone Of:
Environment:
Last Closed: 2016-03-15 17:21:58 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Adam Mariš 2016-01-26 07:09:30 EST
It was found that due to the way that Action Controller compares user names and passwords in basic authentication authorization code, it is possible for an attacker to analyze the time taken by a response and intuit the password.

External References:

https://groups.google.com/forum/#!msg/rubyonrails-security/ANv0HDHEC3k/mt7wNGxbFQAJ
http://weblog.rubyonrails.org/2016/1/25/Rails-5-0-0-beta1-1-4-2-5-1-4-1-14-1-3-2-22-1-and-rails-html-sanitizer-1-0-3-have-been-released/
Comment 5 Adam Mariš 2016-01-26 08:55:36 EST
Created rubygem-activesupport tracking bugs for this issue:

Affects: fedora-all [bug 1301999]
Comment 6 Adam Mariš 2016-01-26 08:55:52 EST
Created rubygem-actionpack tracking bugs for this issue:

Affects: fedora-all [bug 1301996]
Comment 7 Adam Mariš 2016-01-26 10:22:27 EST
Acknowledgments:

Red Hat would like to thank Ruby on Rails project for reporting this issue.
Upstream acknowledges Daniel Waterworth as the original reporter.
Comment 9 Ján Rusnačko 2016-02-09 08:23:59 EST
Mitigation:

Use following code to monkey-patch http_basic_authenticate_with method in ActionController:

~~~
module ActiveSupport
  module SecurityUtils
    def secure_compare(a, b)
      return false unless a.bytesize == b.bytesize

      l = a.unpack "C#{a.bytesize}"

      res = 0
      b.each_byte { |byte| res |= byte ^ l.shift }
      res == 0
    end
    module_function :secure_compare

    def variable_size_secure_compare(a, b)
      secure_compare(::Digest::SHA256.hexdigest(a), ::Digest::SHA256.hexdigest(b))
    end
    module_function :variable_size_secure_compare
  end
end

module ActionController
  class Base
    def self.http_basic_authenticate_with(options = {})
      before_action(options.except(:name, :password, :realm)) do
        authenticate_or_request_with_http_basic(options[:realm] || "Application") do |name, password|
          # This comparison uses & so that it doesn't short circuit and
          # uses `variable_size_secure_compare` so that length information
          # isn't leaked.
          ActiveSupport::SecurityUtils.variable_size_secure_compare(name, options[:name]) &
            ActiveSupport::SecurityUtils.variable_size_secure_compare(password, options[:password])
        end
      end
    end
  end
end
~~~
Comment 13 errata-xmlrpc 2016-02-24 05:36:40 EST
This issue has been addressed in the following products:

  Red Hat Software Collections for Red Hat Enterprise Linux 7.1 EUS
  Red Hat Software Collections for Red Hat Enterprise Linux 7
  Red Hat Software Collections for Red Hat Enterprise Linux 7.2 EUS
  Red Hat Software Collections for Red Hat Enterprise Linux 6.6 EUS
  Red Hat Software Collections for Red Hat Enterprise Linux 6.7 EUS
  Red Hat Software Collections for Red Hat Enterprise Linux 6

Via RHSA-2016:0296 https://rhn.redhat.com/errata/RHSA-2016-0296.html
Comment 14 Fedora Update System 2016-02-28 03:25:42 EST
rubygem-actionpack-4.2.0-3.fc22, rubygem-activemodel-4.2.0-2.fc22 has been pushed to the Fedora 22 stable repository. If problems still persist, please make note of it in this bug report.
Comment 15 Fedora Update System 2016-02-28 03:28:48 EST
rubygem-activesupport-4.2.0-4.fc22 has been pushed to the Fedora 22 stable repository. If problems still persist, please make note of it in this bug report.
Comment 16 Fedora Update System 2016-02-28 07:24:58 EST
rubygem-activesupport-4.2.3-3.fc23 has been pushed to the Fedora 23 stable repository. If problems still persist, please make note of it in this bug report.
Comment 17 Fedora Update System 2016-02-28 07:25:41 EST
rubygem-actionpack-4.2.3-4.fc23 has been pushed to the Fedora 23 stable repository. If problems still persist, please make note of it in this bug report.
Comment 18 errata-xmlrpc 2016-03-15 16:59:48 EDT
This issue has been addressed in the following products:

  Red Hat Software Collections for Red Hat Enterprise Linux 7.2 EUS
  Red Hat Software Collections for Red Hat Enterprise Linux 7
  Red Hat Software Collections for Red Hat Enterprise Linux 7.1 EUS
  Red Hat Software Collections for Red Hat Enterprise Linux 6
  Red Hat Software Collections for Red Hat Enterprise Linux 6.7 EUS
  Red Hat Software Collections for Red Hat Enterprise Linux 6.6 EUS

Via RHSA-2016:0455 https://rhn.redhat.com/errata/RHSA-2016-0455.html
Comment 19 errata-xmlrpc 2016-03-15 17:02:40 EDT
This issue has been addressed in the following products:

  Red Hat Software Collections for Red Hat Enterprise Linux 7.2 EUS
  Red Hat Software Collections for Red Hat Enterprise Linux 7
  Red Hat Software Collections for Red Hat Enterprise Linux 7.1 EUS
  Red Hat Software Collections for Red Hat Enterprise Linux 6
  Red Hat Software Collections for Red Hat Enterprise Linux 6.7 EUS
  Red Hat Software Collections for Red Hat Enterprise Linux 6.6 EUS

Via RHSA-2016:0454 https://rhn.redhat.com/errata/RHSA-2016-0454.html

Note You need to log in before you can comment on or make changes to this bug.