Sha256: 3bdce1fcf41ce57303948604101842809925ecff7ffce511d4f62c1dee0810b8

Contents?: true

Size: 886 Bytes

Versions: 48

Compression:

Stored size: 886 Bytes

Contents

require 'brakeman/checks/base_check'

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

  @description = "Checks for versions with CSRF token forgery vulnerability (CVE-2020-8166)"

  def run_check
    fix_version = case
      when version_between?('0.0.0', '5.2.4.2')
        '5.2.4.3'
      when version_between?('6.0.0', '6.0.3')
        '6.0.3.1'
      else
        nil
      end

    if fix_version
      warn :warning_type => "Cross-Site Request Forgery",
        :warning_code => :CVE_2020_8166,
        :message => msg(msg_version(rails_version), " has a vulnerability that may allow CSRF token forgery. Upgrade to ", msg_version(fix_version), " or patch"),
        :confidence => :medium,
        :gem_info => gemfile_or_environment,
        :link => "https://groups.google.com/g/rubyonrails-security/c/NOjKiGeXUgw"
    end
  end
end

Version data entries

48 entries across 48 versions & 3 rubygems

Version Path
brakeman-5.2.3 lib/brakeman/checks/check_csrf_token_forgery_cve.rb
brakeman-lib-5.2.3 lib/brakeman/checks/check_csrf_token_forgery_cve.rb
brakeman-min-5.2.3 lib/brakeman/checks/check_csrf_token_forgery_cve.rb
brakeman-5.2.2 lib/brakeman/checks/check_csrf_token_forgery_cve.rb
brakeman-lib-5.2.2 lib/brakeman/checks/check_csrf_token_forgery_cve.rb
brakeman-min-5.2.2 lib/brakeman/checks/check_csrf_token_forgery_cve.rb
brakeman-5.2.1 lib/brakeman/checks/check_csrf_token_forgery_cve.rb
brakeman-lib-5.2.1 lib/brakeman/checks/check_csrf_token_forgery_cve.rb
brakeman-min-5.2.1 lib/brakeman/checks/check_csrf_token_forgery_cve.rb
brakeman-5.2.0 lib/brakeman/checks/check_csrf_token_forgery_cve.rb
brakeman-lib-5.2.0 lib/brakeman/checks/check_csrf_token_forgery_cve.rb
brakeman-min-5.2.0 lib/brakeman/checks/check_csrf_token_forgery_cve.rb
brakeman-5.1.2 lib/brakeman/checks/check_csrf_token_forgery_cve.rb
brakeman-lib-5.1.2 lib/brakeman/checks/check_csrf_token_forgery_cve.rb
brakeman-min-5.1.2 lib/brakeman/checks/check_csrf_token_forgery_cve.rb
brakeman-5.1.1 lib/brakeman/checks/check_csrf_token_forgery_cve.rb
brakeman-lib-5.1.1 lib/brakeman/checks/check_csrf_token_forgery_cve.rb
brakeman-min-5.1.1 lib/brakeman/checks/check_csrf_token_forgery_cve.rb
brakeman-5.1.0 lib/brakeman/checks/check_csrf_token_forgery_cve.rb
brakeman-lib-5.1.0 lib/brakeman/checks/check_csrf_token_forgery_cve.rb