Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
Brakeman
提交
5dc5db41
B
Brakeman
项目概览
李少辉-开发者
/
Brakeman
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
B
Brakeman
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
5dc5db41
编写于
6月 12, 2012
作者:
J
Justin Collins
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add check for CVE-2012-2695
上级
e807ed13
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
48 addition
and
5 deletion
+48
-5
lib/brakeman/checks/check_sql.rb
lib/brakeman/checks/check_sql.rb
+12
-0
test/tests/test_rails2.rb
test/tests/test_rails2.rb
+9
-2
test/tests/test_rails3.rb
test/tests/test_rails3.rb
+9
-1
test/tests/test_rails31.rb
test/tests/test_rails31.rb
+9
-1
test/tests/test_rails_with_xss_plugin.rb
test/tests/test_rails_with_xss_plugin.rb
+9
-1
未找到文件。
lib/brakeman/checks/check_sql.rb
浏览文件 @
5dc5db41
...
...
@@ -43,6 +43,9 @@ class Brakeman::CheckSQL < Brakeman::BaseCheck
Brakeman
.
debug
"Checking version of Rails for CVE-2012-2661"
check_rails_version_for_cve_2012_2661
Brakeman
.
debug
"Checking version of Rails for CVE-2012-2695"
check_rails_version_for_cve_2012_2695
Brakeman
.
debug
"Processing possible SQL calls"
calls
.
each
do
|
c
|
process_result
c
...
...
@@ -104,6 +107,15 @@ class Brakeman::CheckSQL < Brakeman::BaseCheck
end
end
def
check_rails_version_for_cve_2012_2695
if
version_between?
(
"2.0.0"
,
"3.0.0"
)
||
version_between?
(
"3.0.0"
,
"3.0.13"
)
||
version_between?
(
"3.1.0"
,
"3.1.5"
)
||
version_between?
(
"3.2.0"
,
"3.2.5"
)
warn
:warning_type
=>
'SQL Injection'
,
:message
=>
'All versions of Rails before 3.0.14, 3.1.6, and 3.2.6 contain a SQL Injection Vulnerability: CVE-2012-2695; Upgrade to 3.2.6, 3.1.6, 3.0.14'
,
:confidence
=>
CONFIDENCE
[
:high
],
:file
=>
gemfile_or_environment
end
end
def
process_scope_with_block
model_name
,
args
scope_name
=
args
[
1
][
1
]
block
=
args
[
-
1
][
-
1
]
...
...
test/tests/test_rails2.rb
浏览文件 @
5dc5db41
...
...
@@ -12,13 +12,13 @@ class Rails2Tests < Test::Unit::TestCase
:controller
=>
1
,
:model
=>
2
,
:template
=>
27
,
:warning
=>
2
7
}
:warning
=>
2
8
}
else
@expected
||=
{
:controller
=>
1
,
:model
=>
2
,
:template
=>
27
,
:warning
=>
2
8
}
:warning
=>
2
9
}
end
end
...
...
@@ -172,6 +172,13 @@ class Rails2Tests < Test::Unit::TestCase
:confidence
=>
0
end
def
test_rails_cve_2012_2695
assert_warning
:type
=>
:warning
,
:warning_type
=>
"SQL Injection"
,
:message
=>
/CVE-2012-2695/
,
:confidence
=>
0
end
def
test_sql_injection_find_by_sql
assert_warning
:type
=>
:warning
,
:warning_type
=>
"SQL Injection"
,
...
...
test/tests/test_rails3.rb
浏览文件 @
5dc5db41
...
...
@@ -15,7 +15,7 @@ class Rails3Tests < Test::Unit::TestCase
:controller
=>
1
,
:model
=>
5
,
:template
=>
22
,
:warning
=>
2
5
:warning
=>
2
6
}
end
...
...
@@ -183,6 +183,14 @@ class Rails3Tests < Test::Unit::TestCase
:file
=>
/Gemfile/
end
def
test_rails_cve_2012_2695
assert_warning
:type
=>
:warning
,
:warning_type
=>
"SQL Injection"
,
:message
=>
/CVE-2012-2695/
,
:confidence
=>
0
,
:file
=>
/Gemfile/
end
def
test_sql_injection_find_by_sql
assert_warning
:type
=>
:warning
,
:warning_type
=>
"SQL Injection"
,
...
...
test/tests/test_rails31.rb
浏览文件 @
5dc5db41
...
...
@@ -15,7 +15,7 @@ class Rails31Tests < Test::Unit::TestCase
:model
=>
0
,
:template
=>
4
,
:controller
=>
1
,
:warning
=>
39
}
:warning
=>
40
}
end
def
test_without_protection
...
...
@@ -96,6 +96,14 @@ class Rails31Tests < Test::Unit::TestCase
:file
=>
/Gemfile/
end
def
test_rails_cve_2012_2695
assert_warning
:type
=>
:warning
,
:warning_type
=>
"SQL Injection"
,
:message
=>
/CVE-2012-2695/
,
:confidence
=>
0
,
:file
=>
/Gemfile/
end
def
test_sql_injection_scope_lambda
assert_warning
:type
=>
:warning
,
:warning_type
=>
"SQL Injection"
,
...
...
test/tests/test_rails_with_xss_plugin.rb
浏览文件 @
5dc5db41
...
...
@@ -11,7 +11,7 @@ class RailsWithXssPluginTests < Test::Unit::TestCase
:controller
=>
1
,
:model
=>
3
,
:template
=>
1
,
:warning
=>
1
2
}
:warning
=>
1
3
}
end
def
report
...
...
@@ -136,6 +136,14 @@ class RailsWithXssPluginTests < Test::Unit::TestCase
:file
=>
/Gemfile/
end
def
test_rails_cve_2012_2695
assert_warning
:type
=>
:warning
,
:warning_type
=>
"SQL Injection"
,
:message
=>
/CVE-2012-2695/
,
:confidence
=>
0
,
:file
=>
/Gemfile/
end
def
test_sql_injection_12
assert_warning
:type
=>
:warning
,
:warning_type
=>
"SQL Injection"
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录