Sha256: 42963d0cc107588822a9737d697ebbdfa774d0713590893ae8f4ba2325d5e0e8

Contents?: true

Size: 1007 Bytes

Versions: 27

Compression:

Stored size: 1007 Bytes

Contents

require 'brakeman/checks/base_check'

#Check for filter skipping vulnerability
#http://groups.google.com/group/rubyonrails-security/browse_thread/thread/3420ac71aed312d6
class Brakeman::CheckFilterSkipping < Brakeman::BaseCheck
  Brakeman::Checks.add self

  @description = "Checks for versions 3.0-3.0.9 which had a vulnerability in filters"

  def run_check
    if version_between?('3.0.0', '3.0.9') and uses_arbitrary_actions?

      warn :warning_type => "Default Routes",
        :warning_code => :CVE_2011_2929,
        :message => "Versions before 3.0.10 have a vulnerability which allows filters to be bypassed: CVE-2011-2929",
        :confidence => CONFIDENCE[:high],
        :file => gemfile_or_environment,
        :link_path => "https://groups.google.com/d/topic/rubyonrails-security/NCCsca7TEtY/discussion"
    end
  end

  def uses_arbitrary_actions?
    tracker.routes.each do |name, actions|
      if actions == :allow_all_actions
        return true
      end
    end

    false
  end
end

Version data entries

27 entries across 27 versions & 2 rubygems

Version Path
brakeman-min-2.1.0 lib/brakeman/checks/check_filter_skipping.rb
brakeman-2.1.0 lib/brakeman/checks/check_filter_skipping.rb
brakeman-2.0.0 lib/brakeman/checks/check_filter_skipping.rb
brakeman-2.0.0.pre2 lib/brakeman/checks/check_filter_skipping.rb
brakeman-1.9.5 lib/brakeman/checks/check_filter_skipping.rb
brakeman-1.9.4 lib/brakeman/checks/check_filter_skipping.rb
brakeman-1.9.3 lib/brakeman/checks/check_filter_skipping.rb