Bug 1301933 (CVE-2015-7576) - CVE-2015-7576 rubygem-actionpack: Timing attack vulnerability in basic authentication in Action Controller
Summary: CVE-2015-7576 rubygem-actionpack: Timing attack vulnerability in basic authen...
Keywords:
Status: CLOSED ERRATA
Alias: CVE-2015-7576
Product: Security Response
Classification: Other
Component: vulnerability
Version: unspecified
Hardware: All
OS: Linux
low
low
Target Milestone: ---
Assignee: Red Hat Product Security
QA Contact:
URL:
Whiteboard:
Depends On: 1301934 1301935 1301995 1301996 1301997 1301998 1301999 1306275 1306276 1306277 1306278 1306279 1306281
Blocks: 1302006
TreeView+ depends on / blocked
 
Reported: 2016-01-26 12:09 UTC by Adam Mariš
Modified: 2021-06-02 06:13 UTC (History)
40 users (show)

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.
Clone Of:
Environment:
Last Closed: 2016-03-15 21:21:58 UTC


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2016:0296 0 normal SHIPPED_LIVE Important: rh-ror41 security update 2016-02-24 15:36:00 UTC
Red Hat Product Errata RHSA-2016:0454 0 normal SHIPPED_LIVE Important: ror40 security update 2016-03-16 00:56:17 UTC
Red Hat Product Errata RHSA-2016:0455 0 normal SHIPPED_LIVE Important: ruby193 security update 2016-03-16 00:55:59 UTC

Description Adam Mariš 2016-01-26 12:09:30 UTC
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 13:55:36 UTC
Created rubygem-activesupport tracking bugs for this issue:

Affects: fedora-all [bug 1301999]

Comment 6 Adam Mariš 2016-01-26 13:55:52 UTC
Created rubygem-actionpack tracking bugs for this issue:

Affects: fedora-all [bug 1301996]

Comment 9 Ján Rusnačko 2016-02-09 13:23:59 UTC
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 10:36:40 UTC
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 08:25:42 UTC
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 08:28:48 UTC
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 12:24:58 UTC
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 12:25:41 UTC
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 20:59:48 UTC
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 21:02:40 UTC
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.