Sha256: f26fcb2d8d40ad02e295019020734bc0c341b64a8a27328510144c1d275f970b

Contents?: true

Size: 1.06 KB

Versions: 25

Compression:

Stored size: 1.06 KB

Contents

require 'brakeman/checks/base_check'

class Brakeman::CheckBasicAuthTimingAttack < Brakeman::BaseCheck
  Brakeman::Checks.add self

  @description = "Check for timing attack in basic auth (CVE-2015-7576)"

  def run_check
    @upgrade = case
               when version_between?("0.0.0", "3.2.22")
                 "3.2.22.1"
               when version_between?("4.0.0", "4.1.14")
                 "4.1.14.1"
               when version_between?("4.2.0", "4.2.5")
                 "4.2.5.1"
               else
                 return
               end

    check_basic_auth_call
  end

  def check_basic_auth_call
    tracker.find_call(target: nil, method: :http_basic_authenticate_with).each do |result|
      warn :result => result,
        :warning_type => "Timing Attack",
        :warning_code => :CVE_2015_7576,
        :message => "Basic authentication in Rails #{rails_version} is vulnerable to timing attacks. Upgrade to #@upgrade",
        :confidence => :high,
        :link => "https://groups.google.com/d/msg/rubyonrails-security/ANv0HDHEC3k/mt7wNGxbFQAJ"
    end
  end
end

Version data entries

25 entries across 25 versions & 3 rubygems

Version Path
brakeman-4.3.1 lib/brakeman/checks/check_basic_auth_timing_attack.rb
brakeman-lib-4.3.1 lib/brakeman/checks/check_basic_auth_timing_attack.rb
brakeman-min-4.3.1 lib/brakeman/checks/check_basic_auth_timing_attack.rb
brakeman-4.3.0 lib/brakeman/checks/check_basic_auth_timing_attack.rb
brakeman-min-4.3.0 lib/brakeman/checks/check_basic_auth_timing_attack.rb
brakeman-lib-4.3.0 lib/brakeman/checks/check_basic_auth_timing_attack.rb
brakeman-4.2.1 lib/brakeman/checks/check_basic_auth_timing_attack.rb
brakeman-min-4.2.1 lib/brakeman/checks/check_basic_auth_timing_attack.rb
brakeman-lib-4.2.1 lib/brakeman/checks/check_basic_auth_timing_attack.rb
brakeman-4.2.0 lib/brakeman/checks/check_basic_auth_timing_attack.rb
brakeman-lib-4.2.0 lib/brakeman/checks/check_basic_auth_timing_attack.rb
brakeman-min-4.2.0 lib/brakeman/checks/check_basic_auth_timing_attack.rb
brakeman-4.1.1 lib/brakeman/checks/check_basic_auth_timing_attack.rb
brakeman-lib-4.1.1 lib/brakeman/checks/check_basic_auth_timing_attack.rb
brakeman-min-4.1.1 lib/brakeman/checks/check_basic_auth_timing_attack.rb
brakeman-4.1.0 lib/brakeman/checks/check_basic_auth_timing_attack.rb
brakeman-lib-4.1.0 lib/brakeman/checks/check_basic_auth_timing_attack.rb
brakeman-min-4.1.0 lib/brakeman/checks/check_basic_auth_timing_attack.rb
brakeman-4.0.1 lib/brakeman/checks/check_basic_auth_timing_attack.rb
brakeman-min-4.0.1 lib/brakeman/checks/check_basic_auth_timing_attack.rb