Sha256: 7d7babed3f247363aa51057d16f8a1789f8da762d363af58db6eb1c61c677a94

Contents?: true

Size: 1.14 KB

Versions: 51

Compression:

Stored size: 1.14 KB

Contents

require 'brakeman/checks/base_check'

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

  @description = "Check for page caching vulnerability (CVE-2020-8159)"

  def run_check
    gem_name = 'actionpack-page_caching'
    gem_version = tracker.config.gem_version(gem_name.to_sym)
    upgrade_version = '1.2.2'
    cve = 'CVE-2020-8159'

    return unless gem_version and version_between?('0.0.0', '1.2.1', gem_version)

    message = msg("Directory traversal vulnerability in ", msg_version(gem_version, gem_name), " ", msg_cve(cve), ". Upgrade to ", msg_version(upgrade_version, gem_name))

    if uses_caches_page?
      confidence = :high
    else
      confidence = :weak
    end

    warn :warning_type => 'Directory Traversal',
      :warning_code => :CVE_2020_8159,
      :message => message,
      :confidence => confidence,
      :link_path => 'https://groups.google.com/d/msg/rubyonrails-security/CFRVkEytdP8/c5gmICECAgAJ',
      :gem_info => gemfile_or_environment(gem_name)
  end

  def uses_caches_page?
    tracker.controllers.any? do |name, controller|
      controller.options.has_key? :caches_page
    end
  end
end

Version data entries

51 entries across 51 versions & 3 rubygems

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