brakeman-min 3.7.2 → 4.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES +15 -1
- data/FEATURES +1 -1
- data/lib/brakeman.rb +55 -17
- data/lib/brakeman/call_index.rb +2 -2
- data/lib/brakeman/checks/base_check.rb +4 -2
- data/lib/brakeman/checks/check_basic_auth.rb +3 -3
- data/lib/brakeman/checks/check_basic_auth_timing_attack.rb +1 -1
- data/lib/brakeman/checks/check_content_tag.rb +12 -12
- data/lib/brakeman/checks/check_create_with.rb +5 -5
- data/lib/brakeman/checks/check_cross_site_scripting.rb +8 -8
- data/lib/brakeman/checks/check_default_routes.rb +4 -4
- data/lib/brakeman/checks/check_deserialize.rb +2 -2
- data/lib/brakeman/checks/check_detailed_exceptions.rb +4 -4
- data/lib/brakeman/checks/check_digest_dos.rb +2 -2
- data/lib/brakeman/checks/check_dynamic_finders.rb +1 -1
- data/lib/brakeman/checks/check_escape_function.rb +2 -2
- data/lib/brakeman/checks/check_evaluation.rb +1 -1
- data/lib/brakeman/checks/check_execute.rb +5 -5
- data/lib/brakeman/checks/check_file_access.rb +4 -4
- data/lib/brakeman/checks/check_file_disclosure.rb +2 -2
- data/lib/brakeman/checks/check_filter_skipping.rb +2 -2
- data/lib/brakeman/checks/check_forgery_setting.rb +2 -2
- data/lib/brakeman/checks/check_header_dos.rb +1 -1
- data/lib/brakeman/checks/check_i18n_xss.rb +2 -2
- data/lib/brakeman/checks/check_jruby_xml.rb +2 -4
- data/lib/brakeman/checks/check_json_encoding.rb +4 -4
- data/lib/brakeman/checks/check_json_parsing.rb +6 -6
- data/lib/brakeman/checks/check_link_to.rb +5 -5
- data/lib/brakeman/checks/check_link_to_href.rb +37 -31
- data/lib/brakeman/checks/check_mail_to.rb +2 -2
- data/lib/brakeman/checks/check_mass_assignment.rb +6 -6
- data/lib/brakeman/checks/check_mime_type_dos.rb +1 -1
- data/lib/brakeman/checks/check_model_attr_accessible.rb +5 -5
- data/lib/brakeman/checks/check_model_attributes.rb +4 -4
- data/lib/brakeman/checks/check_model_serialize.rb +3 -3
- data/lib/brakeman/checks/check_nested_attributes.rb +2 -2
- data/lib/brakeman/checks/check_nested_attributes_bypass.rb +1 -1
- data/lib/brakeman/checks/check_number_to_currency.rb +5 -5
- data/lib/brakeman/checks/check_quote_table_name.rb +2 -2
- data/lib/brakeman/checks/check_redirect.rb +2 -2
- data/lib/brakeman/checks/check_regex_dos.rb +3 -3
- data/lib/brakeman/checks/check_render.rb +4 -4
- data/lib/brakeman/checks/check_render_dos.rb +1 -1
- data/lib/brakeman/checks/check_render_inline.rb +5 -5
- data/lib/brakeman/checks/check_response_splitting.rb +1 -1
- data/lib/brakeman/checks/check_route_dos.rb +1 -1
- data/lib/brakeman/checks/check_safe_buffer_manipulation.rb +2 -2
- data/lib/brakeman/checks/check_sanitize_methods.rb +7 -7
- data/lib/brakeman/checks/check_secrets.rb +1 -1
- data/lib/brakeman/checks/check_select_tag.rb +2 -2
- data/lib/brakeman/checks/check_select_vulnerability.rb +3 -3
- data/lib/brakeman/checks/check_send.rb +1 -1
- data/lib/brakeman/checks/check_session_manipulation.rb +2 -2
- data/lib/brakeman/checks/check_session_settings.rb +3 -3
- data/lib/brakeman/checks/check_simple_format.rb +4 -4
- data/lib/brakeman/checks/check_single_quotes.rb +3 -3
- data/lib/brakeman/checks/check_skip_before_filter.rb +3 -3
- data/lib/brakeman/checks/check_sql.rb +9 -9
- data/lib/brakeman/checks/check_sql_cves.rb +2 -2
- data/lib/brakeman/checks/check_ssl_verify.rb +1 -1
- data/lib/brakeman/checks/check_strip_tags.rb +7 -7
- data/lib/brakeman/checks/check_symbol_dos.rb +2 -2
- data/lib/brakeman/checks/check_symbol_dos_cve.rb +1 -1
- data/lib/brakeman/checks/check_translate_bug.rb +3 -3
- data/lib/brakeman/checks/check_unsafe_reflection.rb +2 -2
- data/lib/brakeman/checks/check_unscoped_find.rb +1 -1
- data/lib/brakeman/checks/check_validation_regex.rb +1 -1
- data/lib/brakeman/checks/check_weak_hash.rb +6 -6
- data/lib/brakeman/checks/check_without_protection.rb +2 -2
- data/lib/brakeman/checks/check_xml_dos.rb +1 -1
- data/lib/brakeman/checks/check_yaml_parsing.rb +2 -2
- data/lib/brakeman/commandline.rb +2 -2
- data/lib/brakeman/options.rb +9 -5
- data/lib/brakeman/processors/alias_processor.rb +3 -1
- data/lib/brakeman/processors/lib/rails2_route_processor.rb +8 -8
- data/lib/brakeman/processors/lib/render_helper.rb +3 -3
- data/lib/brakeman/report.rb +9 -6
- data/lib/brakeman/report/report_base.rb +2 -1
- data/lib/brakeman/report/report_text.rb +4 -6
- data/lib/brakeman/rescanner.rb +8 -8
- data/lib/brakeman/tracker.rb +3 -3
- data/lib/brakeman/tracker/collection.rb +1 -1
- data/lib/brakeman/util.rb +5 -1
- data/lib/brakeman/version.rb +1 -1
- data/lib/brakeman/warning.rb +49 -21
- metadata +2 -2
@@ -36,9 +36,9 @@ class Brakeman::CheckDeserialize < Brakeman::BaseCheck
|
|
36
36
|
method = result[:call].method
|
37
37
|
|
38
38
|
if input = has_immediate_user_input?(arg)
|
39
|
-
confidence =
|
39
|
+
confidence = :high
|
40
40
|
elsif input = include_user_input?(arg)
|
41
|
-
confidence =
|
41
|
+
confidence = :medium
|
42
42
|
end
|
43
43
|
|
44
44
|
if confidence
|
@@ -18,13 +18,13 @@ class Brakeman::CheckDetailedExceptions < Brakeman::BaseCheck
|
|
18
18
|
warn :warning_type => "Information Disclosure",
|
19
19
|
:warning_code => :local_request_config,
|
20
20
|
:message => "Detailed exceptions are enabled in production",
|
21
|
-
:confidence =>
|
21
|
+
:confidence => :high,
|
22
22
|
:file => "config/environments/production.rb"
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
26
|
def check_detailed_exceptions
|
27
|
-
tracker.controllers.each do |
|
27
|
+
tracker.controllers.each do |_name, controller|
|
28
28
|
controller.methods_public.each do |method_name, definition|
|
29
29
|
src = definition[:src]
|
30
30
|
body = src.body.last
|
@@ -32,9 +32,9 @@ class Brakeman::CheckDetailedExceptions < Brakeman::BaseCheck
|
|
32
32
|
|
33
33
|
if method_name == :show_detailed_exceptions? and not safe? body
|
34
34
|
if true? body
|
35
|
-
confidence =
|
35
|
+
confidence = :high
|
36
36
|
else
|
37
|
-
confidence =
|
37
|
+
confidence = :medium
|
38
38
|
end
|
39
39
|
|
40
40
|
warn :warning_type => "Information Disclosure",
|
@@ -19,9 +19,9 @@ class Brakeman::CheckDigestDoS < Brakeman::BaseCheck
|
|
19
19
|
end
|
20
20
|
|
21
21
|
if with_http_digest?
|
22
|
-
confidence =
|
22
|
+
confidence = :high
|
23
23
|
else
|
24
|
-
confidence =
|
24
|
+
confidence = :weak
|
25
25
|
end
|
26
26
|
|
27
27
|
warn :warning_type => "Denial of Service",
|
@@ -26,7 +26,7 @@ class Brakeman::CheckDynamicFinders < Brakeman::BaseCheck
|
|
26
26
|
:warning_type => "SQL Injection",
|
27
27
|
:warning_code => :sql_injection_dynamic_finder,
|
28
28
|
:message => "MySQL integer conversion may cause 0 to match any string",
|
29
|
-
:confidence =>
|
29
|
+
:confidence => :medium,
|
30
30
|
:user_input => arg
|
31
31
|
|
32
32
|
break
|
@@ -10,10 +10,10 @@ class Brakeman::CheckEscapeFunction < Brakeman::BaseCheck
|
|
10
10
|
def run_check
|
11
11
|
if version_between?('2.0.0', '2.3.13') and RUBY_VERSION < '1.9.0'
|
12
12
|
|
13
|
-
warn :warning_type => 'Cross
|
13
|
+
warn :warning_type => 'Cross-Site Scripting',
|
14
14
|
:warning_code => :CVE_2011_2932,
|
15
15
|
:message => 'Versions before 2.3.14 have a vulnerability in escape method when used with Ruby 1.8: CVE-2011-2932',
|
16
|
-
:confidence =>
|
16
|
+
:confidence => :high,
|
17
17
|
:gem_info => gemfile_or_environment,
|
18
18
|
:link_path => "https://groups.google.com/d/topic/rubyonrails-security/Vr_7WSOrEZU/discussion"
|
19
19
|
end
|
@@ -56,9 +56,9 @@ class Brakeman::CheckExecute < Brakeman::BaseCheck
|
|
56
56
|
if failure and original? result
|
57
57
|
|
58
58
|
if failure.type == :interp #Not from user input
|
59
|
-
confidence =
|
59
|
+
confidence = :medium
|
60
60
|
else
|
61
|
-
confidence =
|
61
|
+
confidence = :high
|
62
62
|
end
|
63
63
|
|
64
64
|
warn :result => result,
|
@@ -79,7 +79,7 @@ class Brakeman::CheckExecute < Brakeman::BaseCheck
|
|
79
79
|
:warning_code => :command_injection,
|
80
80
|
:message => "Possible command injection in open()",
|
81
81
|
:user_input => match,
|
82
|
-
:confidence =>
|
82
|
+
:confidence => :high
|
83
83
|
end
|
84
84
|
end
|
85
85
|
end
|
@@ -111,9 +111,9 @@ class Brakeman::CheckExecute < Brakeman::BaseCheck
|
|
111
111
|
exp = result[:call]
|
112
112
|
|
113
113
|
if input = include_user_input?(exp)
|
114
|
-
confidence =
|
114
|
+
confidence = :high
|
115
115
|
elsif input = dangerous?(exp)
|
116
|
-
confidence =
|
116
|
+
confidence = :medium
|
117
117
|
else
|
118
118
|
return
|
119
119
|
end
|
@@ -32,18 +32,18 @@ class Brakeman::CheckFileAccess < Brakeman::BaseCheck
|
|
32
32
|
file_name = call.first_arg
|
33
33
|
|
34
34
|
if match = has_immediate_user_input?(file_name)
|
35
|
-
confidence =
|
35
|
+
confidence = :high
|
36
36
|
elsif match = has_immediate_model?(file_name)
|
37
37
|
match = Match.new(:model, match)
|
38
|
-
confidence =
|
38
|
+
confidence = :medium
|
39
39
|
elsif tracker.options[:check_arguments] and
|
40
40
|
match = include_user_input?(file_name)
|
41
41
|
|
42
42
|
#Check for string building in file name
|
43
43
|
if call?(file_name) and (file_name.method == :+ or file_name.method == :<<)
|
44
|
-
confidence =
|
44
|
+
confidence = :high
|
45
45
|
else
|
46
|
-
confidence =
|
46
|
+
confidence = :weak
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
@@ -3,7 +3,7 @@ require 'brakeman/checks/base_check'
|
|
3
3
|
class Brakeman::CheckFileDisclosure < Brakeman::BaseCheck
|
4
4
|
Brakeman::Checks.add self
|
5
5
|
|
6
|
-
@description =
|
6
|
+
@description = 'Checks for versions with file existence disclosure vulnerability'
|
7
7
|
|
8
8
|
def run_check
|
9
9
|
fix_version = case
|
@@ -23,7 +23,7 @@ class Brakeman::CheckFileDisclosure < Brakeman::BaseCheck
|
|
23
23
|
warn :warning_type => "File Access",
|
24
24
|
:warning_code => :CVE_2014_7829,
|
25
25
|
:message => "Rails #{rails_version} has a file existence disclosure. Upgrade to #{fix_version} or disable serving static assets",
|
26
|
-
:confidence =>
|
26
|
+
:confidence => :high,
|
27
27
|
:gem_info => gemfile_or_environment,
|
28
28
|
:link_path => "https://groups.google.com/d/msg/rubyonrails-security/23fiuwb1NBA/MQVM1-5GkPMJ"
|
29
29
|
end
|
@@ -13,14 +13,14 @@ class Brakeman::CheckFilterSkipping < Brakeman::BaseCheck
|
|
13
13
|
warn :warning_type => "Default Routes",
|
14
14
|
:warning_code => :CVE_2011_2929,
|
15
15
|
:message => "Versions before 3.0.10 have a vulnerability which allows filters to be bypassed: CVE-2011-2929",
|
16
|
-
:confidence =>
|
16
|
+
:confidence => :high,
|
17
17
|
:gem_info => gemfile_or_environment,
|
18
18
|
:link_path => "https://groups.google.com/d/topic/rubyonrails-security/NCCsca7TEtY/discussion"
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
22
|
def uses_arbitrary_actions?
|
23
|
-
tracker.routes.each do |
|
23
|
+
tracker.routes.each do |_name, actions|
|
24
24
|
if actions.include? :allow_all_actions
|
25
25
|
return true
|
26
26
|
end
|
@@ -29,7 +29,7 @@ class Brakeman::CheckForgerySetting < Brakeman::BaseCheck
|
|
29
29
|
:warning_type => "Cross-Site Request Forgery",
|
30
30
|
:warning_code => :csrf_not_protected_by_raising_exception,
|
31
31
|
:message => "protect_from_forgery should be configured with 'with: :exception'",
|
32
|
-
:confidence =>
|
32
|
+
:confidence => :medium,
|
33
33
|
:file => controller.file
|
34
34
|
}
|
35
35
|
|
@@ -50,7 +50,7 @@ class Brakeman::CheckForgerySetting < Brakeman::BaseCheck
|
|
50
50
|
opts = {
|
51
51
|
:controller => :ApplicationController,
|
52
52
|
:warning_type => "Cross-Site Request Forgery",
|
53
|
-
:confidence =>
|
53
|
+
:confidence => :high
|
54
54
|
}.merge opts
|
55
55
|
|
56
56
|
warn opts
|
@@ -18,7 +18,7 @@ class Brakeman::CheckHeaderDoS < Brakeman::BaseCheck
|
|
18
18
|
warn :warning_type => "Denial of Service",
|
19
19
|
:warning_code => :CVE_2013_6414,
|
20
20
|
:message => message,
|
21
|
-
:confidence =>
|
21
|
+
:confidence => :medium,
|
22
22
|
:gem_info => gemfile_or_environment,
|
23
23
|
:link_path => "https://groups.google.com/d/msg/ruby-security-ann/A-ebV4WxzKg/KNPTbX8XAQUJ"
|
24
24
|
end
|
@@ -18,10 +18,10 @@ class Brakeman::CheckI18nXSS < Brakeman::BaseCheck
|
|
18
18
|
return
|
19
19
|
end
|
20
20
|
|
21
|
-
warn :warning_type => "Cross
|
21
|
+
warn :warning_type => "Cross-Site Scripting",
|
22
22
|
:warning_code => :CVE_2013_4491,
|
23
23
|
:message => message,
|
24
|
-
:confidence =>
|
24
|
+
:confidence => :medium,
|
25
25
|
:gem_info => gemfile_or_environment(:i18n),
|
26
26
|
:link_path => "https://groups.google.com/d/msg/ruby-security-ann/pLrh6DUw998/bLFEyIO4k_EJ"
|
27
27
|
end
|
@@ -23,15 +23,13 @@ class Brakeman::CheckJRubyXML < Brakeman::BaseCheck
|
|
23
23
|
tracker.check_initializers(:"ActiveSupport::XmlMini", :backend=).each do |result|
|
24
24
|
arg = result.call.first_arg
|
25
25
|
|
26
|
-
if string? arg and arg.value == "REXML"
|
27
|
-
return
|
28
|
-
end
|
26
|
+
return if string? arg and arg.value == "REXML"
|
29
27
|
end
|
30
28
|
|
31
29
|
warn :warning_type => "File Access",
|
32
30
|
:warning_code => :CVE_2013_1856,
|
33
31
|
:message => "Rails #{rails_version} with JRuby has a vulnerability in XML parser: upgrade to #{fix_version} or patch",
|
34
|
-
:confidence =>
|
32
|
+
:confidence => :high,
|
35
33
|
:gem_info => gemfile_or_environment,
|
36
34
|
:link => "https://groups.google.com/d/msg/rubyonrails-security/KZwsQbYsOiI/5kUV7dSCJGwJ"
|
37
35
|
end
|
@@ -16,12 +16,12 @@ class Brakeman::CheckJSONEncoding < Brakeman::BaseCheck
|
|
16
16
|
end
|
17
17
|
|
18
18
|
if tracker.find_call(:methods => [:to_json, :encode]).any?
|
19
|
-
confidence =
|
19
|
+
confidence = :high
|
20
20
|
else
|
21
|
-
confidence =
|
21
|
+
confidence = :medium
|
22
22
|
end
|
23
23
|
|
24
|
-
warn :warning_type => "Cross
|
24
|
+
warn :warning_type => "Cross-Site Scripting",
|
25
25
|
:warning_code => :CVE_2015_3226,
|
26
26
|
:message => message,
|
27
27
|
:confidence => confidence,
|
@@ -40,7 +40,7 @@ class Brakeman::CheckJSONEncoding < Brakeman::BaseCheck
|
|
40
40
|
s(:args),
|
41
41
|
s(:self))))))
|
42
42
|
|
43
|
-
tracker.initializers.any? do |
|
43
|
+
tracker.initializers.any? do |_name, initializer|
|
44
44
|
initializer == workaround
|
45
45
|
end
|
46
46
|
end
|
@@ -30,7 +30,7 @@ class Brakeman::CheckJSONParsing < Brakeman::BaseCheck
|
|
30
30
|
warn :warning_type => "Remote Code Execution",
|
31
31
|
:warning_code => :CVE_2013_0333,
|
32
32
|
:message => message,
|
33
|
-
:confidence =>
|
33
|
+
:confidence => :high,
|
34
34
|
:gem_info => gem_info,
|
35
35
|
:link_path => "https://groups.google.com/d/topic/rubyonrails-security/1h2DR63ViGo/discussion"
|
36
36
|
end
|
@@ -71,11 +71,11 @@ class Brakeman::CheckJSONParsing < Brakeman::BaseCheck
|
|
71
71
|
(version >= "1.5.5" and version < "1.6.0")
|
72
72
|
|
73
73
|
warning_type = "Denial of Service"
|
74
|
-
confidence =
|
74
|
+
confidence = :medium
|
75
75
|
message = "#{name} gem version #{version} has a symbol creation vulnerablity: upgrade to "
|
76
76
|
|
77
77
|
if version >= "1.7.0"
|
78
|
-
confidence =
|
78
|
+
confidence = :high
|
79
79
|
warning_type = "Remote Code Execution"
|
80
80
|
message = "#{name} gem version #{version} has a remote code vulnerablity: upgrade to 1.7.7"
|
81
81
|
elsif version >= "1.6.0"
|
@@ -83,12 +83,12 @@ class Brakeman::CheckJSONParsing < Brakeman::BaseCheck
|
|
83
83
|
elsif version >= "1.5.0"
|
84
84
|
message << "1.5.5"
|
85
85
|
else
|
86
|
-
confidence =
|
86
|
+
confidence = :weak
|
87
87
|
message << "1.5.5"
|
88
88
|
end
|
89
89
|
|
90
|
-
if confidence ==
|
91
|
-
confidence =
|
90
|
+
if confidence == :medium and uses_json_parse?
|
91
|
+
confidence = :high
|
92
92
|
end
|
93
93
|
|
94
94
|
warn :warning_type => warning_type,
|
@@ -70,7 +70,7 @@ class Brakeman::CheckLinkTo < Brakeman::CheckCrossSiteScripting
|
|
70
70
|
|
71
71
|
message = "Unescaped #{friendly_type_of input} in link_to"
|
72
72
|
|
73
|
-
warn_xss(result, message, input,
|
73
|
+
warn_xss(result, message, input, :high)
|
74
74
|
end
|
75
75
|
|
76
76
|
# Check if we should warn about the specified method
|
@@ -81,8 +81,8 @@ class Brakeman::CheckLinkTo < Brakeman::CheckCrossSiteScripting
|
|
81
81
|
method = match.method
|
82
82
|
return false if IGNORE_MODEL_METHODS.include? method
|
83
83
|
|
84
|
-
confidence =
|
85
|
-
confidence =
|
84
|
+
confidence = :medium
|
85
|
+
confidence = :high if likely_model_attribute? match
|
86
86
|
warn_xss(result, "Unescaped model attribute in link_to", match, confidence)
|
87
87
|
end
|
88
88
|
|
@@ -93,14 +93,14 @@ class Brakeman::CheckLinkTo < Brakeman::CheckCrossSiteScripting
|
|
93
93
|
|
94
94
|
message = "Unescaped #{friendly_type_of matched} in link_to"
|
95
95
|
|
96
|
-
warn_xss(result, message, @matched,
|
96
|
+
warn_xss(result, message, @matched, :medium)
|
97
97
|
end
|
98
98
|
|
99
99
|
# Create a warn for this xss
|
100
100
|
def warn_xss(result, message, user_input, confidence)
|
101
101
|
add_result(result)
|
102
102
|
warn :result => result,
|
103
|
-
:warning_type => "Cross
|
103
|
+
:warning_type => "Cross-Site Scripting",
|
104
104
|
:warning_code => :xss_link_to,
|
105
105
|
:message => message,
|
106
106
|
:user_input => user_input,
|
@@ -36,7 +36,7 @@ class Brakeman::CheckLinkToHref < Brakeman::CheckLinkTo
|
|
36
36
|
@matched = false
|
37
37
|
url_arg = process call.second_arg
|
38
38
|
|
39
|
-
if
|
39
|
+
if check_argument? url_arg
|
40
40
|
url_arg = url_arg.first_arg
|
41
41
|
end
|
42
42
|
|
@@ -48,47 +48,53 @@ class Brakeman::CheckLinkToHref < Brakeman::CheckLinkTo
|
|
48
48
|
unless duplicate? result or call_on_params? url_arg or ignore_interpolation? url_arg, input.match
|
49
49
|
add_result result
|
50
50
|
warn :result => result,
|
51
|
-
:warning_type => "Cross
|
51
|
+
:warning_type => "Cross-Site Scripting",
|
52
52
|
:warning_code => :xss_link_to_href,
|
53
53
|
:message => message,
|
54
54
|
:user_input => input,
|
55
|
-
:confidence =>
|
55
|
+
:confidence => :high,
|
56
56
|
:link_path => "link_to_href"
|
57
57
|
end
|
58
|
-
elsif
|
58
|
+
elsif not tracker.options[:ignore_model_output] and input = has_immediate_model?(url_arg)
|
59
|
+
return if ignore_model_call? url_arg, input or duplicate? result
|
60
|
+
add_result result
|
61
|
+
|
62
|
+
message = "Potentially unsafe model attribute in link_to href"
|
63
|
+
|
64
|
+
warn :result => result,
|
65
|
+
:warning_type => "Cross-Site Scripting",
|
66
|
+
:warning_code => :xss_link_to_href,
|
67
|
+
:message => message,
|
68
|
+
:user_input => input,
|
69
|
+
:confidence => :weak,
|
70
|
+
:link_path => "link_to_href"
|
71
|
+
end
|
72
|
+
end
|
59
73
|
|
60
|
-
|
61
|
-
|
74
|
+
def check_argument? url_arg
|
75
|
+
return unless call? url_arg
|
62
76
|
|
63
|
-
|
64
|
-
|
65
|
-
# an array
|
77
|
+
target = url_arg.target
|
78
|
+
method = url_arg.method
|
66
79
|
|
67
|
-
|
80
|
+
method == :url_for or
|
81
|
+
method == :h or
|
82
|
+
cgi_escaped? target, method
|
83
|
+
end
|
68
84
|
|
69
|
-
|
70
|
-
|
71
|
-
# and :only_path, then MAYBE you could trigger a javascript:/data:
|
72
|
-
# attack.
|
85
|
+
def ignore_model_call? url_arg, exp
|
86
|
+
return true unless call? exp
|
73
87
|
|
74
|
-
|
75
|
-
|
76
|
-
message = "Unsafe model attribute in link_to href"
|
77
|
-
elsif @matched.type == :params and not call_on_params? @matched.match
|
78
|
-
message = "Unsafe parameter value in link_to href"
|
79
|
-
end
|
88
|
+
target = exp.target
|
89
|
+
method = exp.method
|
80
90
|
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
:confidence => CONFIDENCE[:med],
|
89
|
-
:link_path => "link_to_href"
|
90
|
-
end
|
91
|
-
end
|
91
|
+
return true unless model_find_call? target
|
92
|
+
|
93
|
+
return true unless method.to_s =~ /url|uri|link|page|site/
|
94
|
+
|
95
|
+
ignore_call? target, method or
|
96
|
+
IGNORE_MODEL_METHODS.include? method or
|
97
|
+
ignore_interpolation? url_arg, exp
|
92
98
|
end
|
93
99
|
|
94
100
|
#Ignore situations where the href is an interpolated string
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'brakeman/checks/base_check'
|
2
2
|
|
3
|
-
#Check for cross
|
3
|
+
#Check for cross-site scripting vulnerability in mail_to :encode => :javascript
|
4
4
|
#with certain versions of Rails (< 2.3.11 or < 3.0.4).
|
5
5
|
#
|
6
6
|
#http://groups.google.com/group/rubyonrails-security/browse_thread/thread/f02a48ede8315f81
|
@@ -23,7 +23,7 @@ class Brakeman::CheckMailTo < Brakeman::BaseCheck
|
|
23
23
|
:warning_type => "Mail Link",
|
24
24
|
:warning_code => :CVE_2011_0446,
|
25
25
|
:message => message,
|
26
|
-
:confidence =>
|
26
|
+
:confidence => :high,
|
27
27
|
:gem_info => gemfile_or_environment,
|
28
28
|
:link_path => "https://groups.google.com/d/topic/rubyonrails-security/8CpI7egxX4E/discussion"
|
29
29
|
end
|