Sha256: 4fce6aab9258e141a28fb741b7d028513943b444e8c93a19a5f7d45c774619dc

Contents?: true

Size: 1.09 KB

Versions: 12

Compression:

Stored size: 1.09 KB

Contents

require 'brakeman/checks/base_check'

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

  @description = "Checks for versions with file existence disclosure vulnerability"

  def run_check
    fix_version = case
      when version_between?('2.0.0', '2.3.18')
        '3.2.21'
      when version_between?('3.0.0', '3.2.20')
        '3.2.21'
      when version_between?('4.0.0', '4.0.11')
        '4.0.12'
      when version_between?('4.1.0', '4.1.7')
        '4.1.8'
      else
        nil
      end

    if fix_version and serves_static_assets?
      warn :warning_type => "File Access",
        :warning_code => :CVE_2014_7829,
        :message => "Rails #{tracker.config[:rails_version]} has a file existence disclosure. Upgrade to #{fix_version} or disable serving static assets",
        :confidence => CONFIDENCE[:high],
        :gem_info => gemfile_or_environment,
        :link_path => "https://groups.google.com/d/msg/rubyonrails-security/23fiuwb1NBA/MQVM1-5GkPMJ"
    end
  end

  def serves_static_assets?
    true? tracker.config[:rails][:serve_static_assets]
  end
end

Version data entries

12 entries across 12 versions & 2 rubygems

Version Path
brakeman-3.0.5 lib/brakeman/checks/check_file_disclosure.rb
brakeman-min-3.0.5 lib/brakeman/checks/check_file_disclosure.rb
brakeman-3.0.4 lib/brakeman/checks/check_file_disclosure.rb
brakeman-min-3.0.4 lib/brakeman/checks/check_file_disclosure.rb
brakeman-min-3.0.3 lib/brakeman/checks/check_file_disclosure.rb
brakeman-3.0.3 lib/brakeman/checks/check_file_disclosure.rb
brakeman-min-3.0.2 lib/brakeman/checks/check_file_disclosure.rb
brakeman-3.0.2 lib/brakeman/checks/check_file_disclosure.rb
brakeman-min-3.0.1 lib/brakeman/checks/check_file_disclosure.rb
brakeman-3.0.1 lib/brakeman/checks/check_file_disclosure.rb
brakeman-3.0.0 lib/brakeman/checks/check_file_disclosure.rb
brakeman-min-3.0.0 lib/brakeman/checks/check_file_disclosure.rb