dawnscanner 1.6.5 → 1.6.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/.gitignore +1 -0
- data/.ruby-version +1 -1
- data/Changelog.md +15 -1
- data/KnowledgeBase.md +26 -2
- data/README.md +2 -2
- data/Rakefile +77 -0
- data/VERSION +1 -1
- data/checksum/dawnscanner-1.6.5.gem.sha1 +1 -0
- data/doc/{dawnscanner.yaml.sample → dawnscanner.yml.sample} +3 -11
- data/lib/dawn/core.rb +1 -1
- data/lib/dawn/kb/basic_check.rb +4 -4
- data/lib/dawn/kb/cve_2011_4319.rb +1 -0
- data/lib/dawn/kb/cve_2014_7829.rb +1 -0
- data/lib/dawn/kb/cve_2016_5697.rb +30 -0
- data/lib/dawn/kb/cve_2016_6316.rb +33 -0
- data/lib/dawn/kb/cve_2016_6317.rb +32 -0
- data/lib/dawn/kb/cve_2016_6582.rb +43 -0
- data/lib/dawn/kb/dependency_check.rb +0 -4
- data/lib/dawn/kb/osvdb_132234.rb +34 -0
- data/lib/dawn/kb/version_check.rb +1 -1
- data/lib/dawn/knowledge_base.rb +11 -1
- data/lib/dawn/knowledge_base_experimental.rb +245 -0
- data/lib/dawn/version.rb +4 -4
- data/spec/lib/dawn/codesake_knowledgebase_spec.rb +20 -0
- data/spec/lib/kb/cve_2014_7829_spec.rb +1 -1
- data/spec/lib/kb/cve_2016_5697_spec.rb +15 -0
- data/spec/lib/kb/cve_2016_6316_spec.rb +44 -0
- data/spec/lib/kb/cve_2016_6317_spec.rb +35 -0
- data/spec/lib/kb/cve_2016_6582_spec.rb +29 -0
- data/spec/lib/kb/osvdb_132234_spec.rb +15 -0
- data/spec/lib/kb/yamilize_kb_spec.rb +12 -0
- metadata +22 -3
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9554074ea8ea6a732a5c4e82027be718bf0b71a5
|
4
|
+
data.tar.gz: 161fa46fbf73e6c269ab097f1ef57cb60642c958
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2152cb6e7ab3427d8b7da640a2241d9ae59df6dada0b6d84869c23f100281c780273f71a92e48c40f51c26bc080b065a00d94e93f089448a7a717432a3ee7801
|
7
|
+
data.tar.gz: c0a5e4b389247fd2e64ade0f448dc15f9473c79e2a07a8bbb419554b21aa3109dd3799450194a4a61fb104ea5571c8fc24e997b310744c21454bc7bab38fc74a
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/.gitignore
CHANGED
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.3.
|
1
|
+
2.3.1
|
data/Changelog.md
CHANGED
@@ -5,7 +5,21 @@ It supports [Sinatra](http://www.sinatrarb.com),
|
|
5
5
|
[Padrino](http://www.padrinorb.com) and [Ruby on Rails](http://rubyonrails.org)
|
6
6
|
frameworks.
|
7
7
|
|
8
|
-
_latest update: Tue
|
8
|
+
_latest update: Tue Nov 1 18:59:51 CET 2016_
|
9
|
+
|
10
|
+
## Version 1.6.6 - codename: Tow Mater (2016-11-01)
|
11
|
+
|
12
|
+
* Changed config filename to dawnscanner.yml
|
13
|
+
* Adding a check for CVE-2016-5697: XML signature wrapping attack in ruby-saml
|
14
|
+
* Adding a check for CVE-2016-6316: Possible XSS Vulnerability in Action View
|
15
|
+
* Adding a check for CVE-2016-6317: Unsafe Query Generation Risk in Active
|
16
|
+
Record
|
17
|
+
* Adding a check for CVE-2016-6582: Doorkeeper gem does not revoke tokens &
|
18
|
+
uses wrong auth/auth method
|
19
|
+
* Issue #172 - Adding a check for OSVDB-132234: rack-attack Gem for Ruby
|
20
|
+
missing normalization before request path processing. Please note that OSVDB
|
21
|
+
it has been shutted down, however I was not able to find a CVE entry for
|
22
|
+
this.
|
9
23
|
|
10
24
|
## Version 1.6.5 - codename: Tow Mater (2016-09-30)
|
11
25
|
|
data/KnowledgeBase.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Dawnscanner Knowledge base
|
2
2
|
|
3
|
-
The knowledge base library for dawnscanner version 1.6.
|
3
|
+
The knowledge base library for dawnscanner version 1.6.6 contains 235 security checks.
|
4
4
|
---
|
5
5
|
* Simple Form XSS - 20131129: There is a XSS vulnerability on Simple Form's label, hint and error options. When Simple Form creates a label, hint or error message it marks the text as being HTML safe, even though it may contain HTML tags. In applications where the text of these helpers can be provided by the users, malicious values can be provided and Simple Form will mark it as safe.
|
6
6
|
* [CVE-2004-0755](http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2004-0755): The FileStore capability in CGI::Session for Ruby before 1.8.1, and possibly PStore, creates files with insecure permissions, which can allow local users to steal session information and hijack sessions.
|
@@ -421,6 +421,28 @@ XML documents with carefully crafted entity expansion strings which can cause th
|
|
421
421
|
controller or a view may be vulnerable to a code injection.
|
422
422
|
* CVE-2016-2098: There is a possible remote code execution vulnerability in Action Pack. Applications that pass unverified user input to the render method in a
|
423
423
|
controller or a view may be vulnerable to a code injection.
|
424
|
+
* [CVE-2016-5697](http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2016-5697): ruby-saml prior to version 1.3.0 is vulnerable to an XML signature wrapping attack in the specific scenario where there was a signature that referenced at the same time 2 elements (but past the scheme validator process since 1 of the element was inside the encrypted assertion).
|
425
|
+
* CVE-2016-5697: ruby-saml prior to version 1.3.0 is vulnerable to an XML signature wrapping attack in the specific scenario where there was a signature that referenced at the same time 2 elements (but past the scheme validator process since 1 of the element was inside the encrypted assertion).
|
426
|
+
* [CVE-2016-6316](http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2016-6316): Text declared as "HTML safe" when passed as an attribute value to a tag helper will not have quotes escaped which can lead to an XSS attack.
|
427
|
+
* CVE-2016-6316: Text declared as "HTML safe" when passed as an attribute value to a tag helper will not have quotes escaped which can lead to an XSS attack.
|
428
|
+
* [CVE-2016-6317](http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2016-6317): Due to the way Active Record interprets parameters in combination with the way that JSON parameters are parsed, it is possible for an attacker to issue unexpected database queries with “IS NULL” or empty where clauses. This issue does not let an attacker insert arbitrary values into an SQL query, however they can cause the query to check for NULL or eliminate a WHERE clause when most users wouldn’t expect it.
|
429
|
+
* CVE-2016-6317: Due to the way Active Record interprets parameters in combination with the way that JSON parameters are parsed, it is possible for an attacker to issue unexpected database queries with “IS NULL” or empty where clauses. This issue does not let an attacker insert arbitrary values into an SQL query, however they can cause the query to check for NULL or eliminate a WHERE clause when most users wouldn’t expect it.
|
430
|
+
* [CVE-2016-6582](http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2016-6582): Doorkeeper failed to implement OAuth 2.0 Token Revocation (RFC 7009) in the following ways:
|
431
|
+
|
432
|
+
Public clients making valid, unauthenticated calls to revoke a token would not have their token revoked
|
433
|
+
Requests were not properly authenticating the client credentials but were, instead, looking at the access token in a second location
|
434
|
+
Because of 2, the requests were also not authorizing confidential clients’ ability to revoke a given token. It should only revoke tokens that belong to it.
|
435
|
+
The security implication is: OAuth 2.0 clients who "log out" a user expect to have the corresponding access & refresh tokens revoked, preventing an attacker who may have already hijacked the session from continuing to impersonate the victim. Because of the bug described above, this is not the case. As far as OWASP is concerned, this counts as broken authentication design.
|
436
|
+
|
437
|
+
MITRE has assigned CVE-2016-6582 due to the security issues raised. An attacker, thanks to 1, can replay a hijacked session after a victim logs out/revokes their token. Additionally, thanks to 2 & 3, an attacker via a compromised confidential client could "grief" other clients by revoking their tokens (albeit this is an exceptionally narrow attack with little value).
|
438
|
+
* CVE-2016-6582: Doorkeeper failed to implement OAuth 2.0 Token Revocation (RFC 7009) in the following ways:
|
439
|
+
|
440
|
+
Public clients making valid, unauthenticated calls to revoke a token would not have their token revoked
|
441
|
+
Requests were not properly authenticating the client credentials but were, instead, looking at the access token in a second location
|
442
|
+
Because of 2, the requests were also not authorizing confidential clients’ ability to revoke a given token. It should only revoke tokens that belong to it.
|
443
|
+
The security implication is: OAuth 2.0 clients who "log out" a user expect to have the corresponding access & refresh tokens revoked, preventing an attacker who may have already hijacked the session from continuing to impersonate the victim. Because of the bug described above, this is not the case. As far as OWASP is concerned, this counts as broken authentication design.
|
444
|
+
|
445
|
+
MITRE has assigned CVE-2016-6582 due to the security issues raised. An attacker, thanks to 1, can replay a hijacked session after a victim logs out/revokes their token. Additionally, thanks to 2 & 3, an attacker via a compromised confidential client could "grief" other clients by revoking their tokens (albeit this is an exceptionally narrow attack with little value).
|
424
446
|
* [OSVDB-105971](http://osvdb.org/show/osvdb/105971): sfpagent Gem for Ruby contains a flaw that is triggered as JSON[body] input is not properly sanitized when handling module names with shell metacharacters. This may allow a context-dependent attacker to execute arbitrary commands.
|
425
447
|
* OSVDB-105971: sfpagent Gem for Ruby contains a flaw that is triggered as JSON[body] input is not properly sanitized when handling module names with shell metacharacters. This may allow a context-dependent attacker to execute arbitrary commands.
|
426
448
|
* [OSVDB-108569](http://osvdb.org/show/osvdb/108569): backup_checksum Gem for Ruby contains a flaw in /lib/backup/cli/utility.rb that is triggered as the program displays password information in plaintext in the process list. This may allow a local attacker to gain access to password information.
|
@@ -453,6 +475,8 @@ controller or a view may be vulnerable to a code injection.
|
|
453
475
|
* OSVDB_120857: refile Gem for Ruby contains a flaw that is triggered when input is not sanitized when handling the 'remote_image_url' field in a form, where 'image' is the name of the attachment. This may allow a remote attacker to execute arbitrary shell commands.
|
454
476
|
* [OSVDB_121701](http://osvdb.org/show/osvdb/121701): open-uri-cached Gem for Ruby contains a flaw that is due to the program creating temporary files in a predictable, unsafe manner when using YAML. This may allow a local attacker to gain elevated privileges.
|
455
477
|
* OSVDB_121701: open-uri-cached Gem for Ruby contains a flaw that is due to the program creating temporary files in a predictable, unsafe manner when using YAML. This may allow a local attacker to gain elevated privileges.
|
478
|
+
* [OSVDB_132234](http://osvdb.org/show/osvdb/132234): When using rack-attack with a rails app, developers expect the request path to be normalized. In particular, trailing slashes are stripped so a request path "/login/" becomes "/login" by the time you're in ActionController. Since Rack::Attack runs before ActionDispatch, the request path is not yet normalized. This can cause throttles and blacklists to not work as expected. E.g., a throttle: throttle('logins', ...) {|req| req.path == "/login" } would not match a request to '/login/', though Rails would route '/login/' to the same '/login' action.
|
479
|
+
* OSVDB_132234: When using rack-attack with a rails app, developers expect the request path to be normalized. In particular, trailing slashes are stripped so a request path "/login/" becomes "/login" by the time you're in ActionController. Since Rack::Attack runs before ActionDispatch, the request path is not yet normalized. This can cause throttles and blacklists to not work as expected. E.g., a throttle: throttle('logins', ...) {|req| req.path == "/login" } would not match a request to '/login/', though Rails would route '/login/' to the same '/login' action.
|
456
480
|
* Owasp Ror CheatSheet: Command Injection: Ruby offers a function called "eval" which will dynamically build new Ruby code based on Strings. It also has a number of ways to call system commands. While the power of these commands is quite useful, extreme care should be taken when using them in a Rails based application. Usually, its just a bad idea. If need be, a whitelist of possible values should be used and any input should be validated as thoroughly as possible. The Ruby Security Reviewer's Guide has a section on injection and there are a number of OWASP references for it, starting at the top: Command Injection.
|
457
481
|
* Owasp Ror CheatSheet: Cross Site Request Forgery: Ruby on Rails has specific, built in support for CSRF tokens. To enable it, or ensure that it is enabled, find the base ApplicationController and look for the protect_from_forgery directive. Note that by default Rails does not provide CSRF protection for any HTTP GET request.
|
458
482
|
* Owasp Ror CheatSheet: Session management: By default, Ruby on Rails uses a Cookie based session store. What that means is that unless you change something, the session will not expire on the server. That means that some default applications may be vulnerable to replay attacks. It also means that sensitive information should never be put in the session.
|
@@ -481,4 +505,4 @@ Setting this to true will essentially strip out any host information.
|
|
481
505
|
This check will analyze the source code looking for the following patterns: XXX, TO_CHECK, CHECKME, CHECK and FIXME
|
482
506
|
|
483
507
|
|
484
|
-
_Last updated: Tue
|
508
|
+
_Last updated: Tue 01 Nov 18:59:32 CET 2016_
|
data/README.md
CHANGED
@@ -18,13 +18,13 @@ box:
|
|
18
18
|
[![Build Status](https://travis-ci.org/thesp0nge/dawnscanner.png?branch=master)](https://travis-ci.org/thesp0nge/dawnscanner)
|
19
19
|
[![Dependency Status](https://gemnasium.com/thesp0nge/dawnscanner.png)](https://gemnasium.com/thesp0nge/dawnscanner)
|
20
20
|
[![Coverage Status](https://coveralls.io/repos/thesp0nge/dawnscanner/badge.png)](https://coveralls.io/r/thesp0nge/dawnscanner)
|
21
|
-
[![
|
21
|
+
[![Code Triagers Badge](https://www.codetriage.com/thesp0nge/dawnscanner/badges/users.svg)](https://www.codetriage.com/thesp0nge/dawnscanner)
|
22
22
|
[![Inline docs](http://inch-ci.org/github/thesp0nge/dawnscanner.png?branch=master)](http://inch-ci.org/github/thesp0nge/dawnscanner)
|
23
23
|
[![Gitter](https://badges.gitter.im/thesp0nge/dawnscanner.svg)](https://gitter.im/thesp0nge/dawnscanner?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
|
24
24
|
|
25
25
|
---
|
26
26
|
|
27
|
-
dawnscanner version 1.6.
|
27
|
+
dawnscanner version 1.6.6 has 235 security checks loaded in its knowledge
|
28
28
|
base. Most of them are CVE bulletins applying to gems or the ruby interpreter
|
29
29
|
itself. There are also some check coming from Owasp Ruby on Rails cheatsheet.
|
30
30
|
|
data/Rakefile
CHANGED
@@ -8,6 +8,7 @@ require 'cucumber/rake/task'
|
|
8
8
|
require 'fileutils'
|
9
9
|
require "dawn/utils"
|
10
10
|
require "dawn/knowledge_base"
|
11
|
+
require "dawn/knowledge_base_experimental"
|
11
12
|
|
12
13
|
Cucumber::Rake::Task.new(:features) do |t|
|
13
14
|
t.cucumber_opts = "features --format pretty -x"
|
@@ -279,6 +280,32 @@ namespace :kb do
|
|
279
280
|
end
|
280
281
|
|
281
282
|
end
|
283
|
+
desc 'Pack the library for shipping'
|
284
|
+
|
285
|
+
task :pack do
|
286
|
+
YAML_KB = File.join(Dir.pwd, 'db')
|
287
|
+
__kb_pack
|
288
|
+
end
|
289
|
+
|
290
|
+
desc 'Transform all checks to YAML file and pack the library for shipping'
|
291
|
+
task :to_yaml do
|
292
|
+
YAML_KB = File.join(Dir.pwd, 'db')
|
293
|
+
FileUtils.rm_rf YAML_KB
|
294
|
+
FileUtils.mkdir_p YAML_KB
|
295
|
+
|
296
|
+
Dawn::KnowledgeBase.new.all.each do |check|
|
297
|
+
out_dir = File.join(YAML_KB, check.check_family.to_s)
|
298
|
+
FileUtils.mkdir_p(out_dir) unless Dir.exists? out_dir
|
299
|
+
|
300
|
+
filename = File.join(out_dir, check.name.gsub(" ", "_").gsub("-", "_") + '.yml')
|
301
|
+
open(filename, 'w') do |f|
|
302
|
+
f.puts(check.to_yaml)
|
303
|
+
end
|
304
|
+
puts "#{filename} created"
|
305
|
+
end
|
306
|
+
|
307
|
+
__kb_pack
|
308
|
+
end
|
282
309
|
|
283
310
|
desc 'Creates a KnowledgeBase.md file'
|
284
311
|
task :create do
|
@@ -363,3 +390,53 @@ namespace :rubysec do
|
|
363
390
|
|
364
391
|
end
|
365
392
|
end
|
393
|
+
|
394
|
+
def __kb_pack
|
395
|
+
if Dir.exists? "#{YAML_KB}/bulletin"
|
396
|
+
system "tar cfvz #{YAML_KB}/bulletin.tar.gz #{YAML_KB}/bulletin"
|
397
|
+
system "rm -rf #{YAML_KB}/bulletin"
|
398
|
+
system "shasum -a 256 #{YAML_KB}/bulletin.tar.gz > #{YAML_KB}/bulletin.tar.gz.sig"
|
399
|
+
end
|
400
|
+
|
401
|
+
if Dir.exists? "#{YAML_KB}/generic_check"
|
402
|
+
system "tar cfvz #{YAML_KB}/generic_check.tar.gz #{YAML_KB}/generic_check"
|
403
|
+
system "rm -rf #{YAML_KB}/generic_check"
|
404
|
+
system "shasum -a 256 #{YAML_KB}/generic_check.tar.gz > #{YAML_KB}/generic_check.tar.gz.sig"
|
405
|
+
end
|
406
|
+
|
407
|
+
if Dir.exists? "#{YAML_KB}/owasp_ror_cheatsheet"
|
408
|
+
system "tar cfvz #{YAML_KB}/owasp_ror_cheatsheet.tar.gz #{YAML_KB}/owasp_ror_cheatsheet"
|
409
|
+
system "rm -rf #{YAML_KB}/owasp_ror_cheatsheet"
|
410
|
+
system "shasum -a 256 #{YAML_KB}/owasp_ror_cheatsheet.tar.gz > #{YAML_KB}/owasp_ror_cheatsheet.tar.gz.sig"
|
411
|
+
end
|
412
|
+
|
413
|
+
if Dir.exists? "#{YAML_KB}/code_style"
|
414
|
+
system "tar cfvz #{YAML_KB}/code_style.tar.gz #{YAML_KB}/code_style"
|
415
|
+
system "rm -rf #{YAML_KB}/code_style"
|
416
|
+
system "shasum -a 256 #{YAML_KB}/code_style.tar.gz > #{YAML_KB}/code_style.tar.gz.sig"
|
417
|
+
end
|
418
|
+
if Dir.exists? "#{YAML_KB}/code_quality"
|
419
|
+
system "tar cfvz #{YAML_KB}/code_quality.tar.gz #{YAML_KB}/code_quality"
|
420
|
+
system "rm -rf #{YAML_KB}/code_quality"
|
421
|
+
system "shasum -a 256 #{YAML_KB}/code_quality.tar.gz > #{YAML_KB}/code_quality.tar.gz.sig"
|
422
|
+
end
|
423
|
+
if Dir.exists? "#{YAML_KB}/owasp_top_10"
|
424
|
+
system "tar cfvz #{YAML_KB}/owasp_top_10.tar.gz #{YAML_KB}/owasp_top_10"
|
425
|
+
system "rm -rf #{YAML_KB}/owasp_top_10"
|
426
|
+
system "shasum -a 256 #{YAML_KB}/owasp_top_10.tar.gz > #{YAML_KB}/owasp_top_10.tar.gz.sig"
|
427
|
+
end
|
428
|
+
|
429
|
+
|
430
|
+
open(File.join(YAML_KB, "kb.yaml"), 'w') do |f|
|
431
|
+
f.puts(Dawn::KnowledgeBaseExperimental.kb_descriptor)
|
432
|
+
end
|
433
|
+
puts "kb.yaml created"
|
434
|
+
system "shasum -a 256 #{YAML_KB}/kb.yaml > #{YAML_KB}/kb.yaml.sig"
|
435
|
+
|
436
|
+
system "tar cfvz #{YAML_KB}/signatures.tar.gz #{YAML_KB}/*.tar.gz.sig"
|
437
|
+
system "rm -rf #{YAML_KB}/*.tar.gz.sig "
|
438
|
+
puts "#{YAML_KB}/signatures.tar.gz created"
|
439
|
+
|
440
|
+
puts "Library ready to be shipped"
|
441
|
+
|
442
|
+
end
|
data/VERSION
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
90a9f067e183bc8cc2dc5be00c158dad2b81b09d
|
@@ -1,5 +1,6 @@
|
|
1
1
|
---
|
2
2
|
config:
|
3
|
+
:kb: yaml
|
3
4
|
:verbose: false
|
4
5
|
:output: console
|
5
6
|
:mvc: ''
|
@@ -11,16 +12,7 @@ config:
|
|
11
12
|
:enabled_checks:
|
12
13
|
- :generic_check
|
13
14
|
- :code_quality
|
14
|
-
- :
|
15
|
+
- :bulletin
|
15
16
|
- :code_style
|
16
17
|
- :owasp_ror_cheatsheet
|
17
|
-
- :
|
18
|
-
- :owasp_top_10_2
|
19
|
-
- :owasp_top_10_3
|
20
|
-
- :owasp_top_10_4
|
21
|
-
- :owasp_top_10_5
|
22
|
-
- :owasp_top_10_6
|
23
|
-
- :owasp_top_10_7
|
24
|
-
- :owasp_top_10_8
|
25
|
-
- :owasp_top_10_9
|
26
|
-
- :owasp_top_10_10
|
18
|
+
- :owasp_top_10
|
data/lib/dawn/core.rb
CHANGED
data/lib/dawn/kb/basic_check.rb
CHANGED
@@ -54,7 +54,7 @@ module Dawn
|
|
54
54
|
# + owasp_ror_cheatsheet
|
55
55
|
# + owasp_top_10_n (where n is a number between 1 and 10)
|
56
56
|
attr_accessor :check_family
|
57
|
-
ALLOWED_FAMILIES = [:generic_check, :code_quality, :
|
57
|
+
ALLOWED_FAMILIES = [:generic_check, :code_quality, :bulletin, :code_style, :owasp_ror_cheatsheet, :owasp_top_10]
|
58
58
|
|
59
59
|
# This is the check severity level. It tells how dangerous is the
|
60
60
|
# vulnerability for you application.
|
@@ -120,7 +120,7 @@ module Dawn
|
|
120
120
|
#
|
121
121
|
# I don't want to manually fix 150+ ruby files to add something I can
|
122
122
|
# deal here
|
123
|
-
@check_family = :
|
123
|
+
@check_family = :bulletin if !options[:name].nil? && (options[:name].start_with?('CVE-') || options[:name].start_with?('OSVDB'))
|
124
124
|
|
125
125
|
if $logger.nil?
|
126
126
|
# This is the old codesake-commons logging.
|
@@ -155,11 +155,11 @@ module Dawn
|
|
155
155
|
end
|
156
156
|
|
157
157
|
def family
|
158
|
-
return "CVE bulletin"
|
158
|
+
return "CVE or OSVDB bulletin" if @check_family == :bulletin
|
159
159
|
return "Ruby coding style" if @check_family == :code_style
|
160
160
|
return "Ruby code quality check" if @check_family == :code_quality
|
161
161
|
return "Owasp Ruby on Rails cheatsheet" if @check_family == :owasp_ror_cheatsheet
|
162
|
-
return "Owasp Top 10" if @check_family
|
162
|
+
return "Owasp Top 10" if @check_family.== :owasp_top_10
|
163
163
|
return "Unknown"
|
164
164
|
end
|
165
165
|
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module Dawn
|
2
|
+
module Kb
|
3
|
+
# Automatically created with rake on 2016-10-02
|
4
|
+
class CVE_2016_5697
|
5
|
+
include DependencyCheck
|
6
|
+
|
7
|
+
def initialize
|
8
|
+
title = "XML signature wrapping attack"
|
9
|
+
message = "ruby-saml prior to version 1.3.0 is vulnerable to an XML signature wrapping attack in the specific scenario where there was a signature that referenced at the same time 2 elements (but past the scheme validator process since 1 of the element was inside the encrypted assertion)."
|
10
|
+
super({
|
11
|
+
:title=>title,
|
12
|
+
:name=> "CVE-2016-5697",
|
13
|
+
:cve=>"2016-5697",
|
14
|
+
:osvdb=>"",
|
15
|
+
:cvss=>"",
|
16
|
+
:release_date => Date.new(2016, 6, 24),
|
17
|
+
:cwe=>"",
|
18
|
+
:owasp=>"A9",
|
19
|
+
:applies=>["rails", "sinatra", "padrino"],
|
20
|
+
:kind=>Dawn::KnowledgeBase::DEPENDENCY_CHECK,
|
21
|
+
:message=>message,
|
22
|
+
:mitigation=>"Please upgrade ruby-saml gem to version 1.3.0 which implements 3 extra validations to mitigate this kind of attack.",
|
23
|
+
:aux_links=>['https://github.com/onelogin/ruby-saml/commit/a571f52171e6bfd87db59822d1d9e8c38fb3b995']
|
24
|
+
})
|
25
|
+
self.safe_dependencies = [{:name=>"ruby-saml", :version=>['1.3.0']}]
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module Dawn
|
2
|
+
module Kb
|
3
|
+
# Automatically created with rake on 2016-10-02
|
4
|
+
class CVE_2016_6316
|
5
|
+
include DependencyCheck
|
6
|
+
|
7
|
+
def initialize
|
8
|
+
title = "Possible XSS Vulnerability in Action View"
|
9
|
+
message = "Text declared as \"HTML safe\" when passed as an attribute value to a tag helper will not have quotes escaped which can lead to an XSS attack."
|
10
|
+
super({
|
11
|
+
:title=>title,
|
12
|
+
:name=> "CVE-2016-6316",
|
13
|
+
:cve=>"2016-6316",
|
14
|
+
:osvdb=>"",
|
15
|
+
:cvss=>"AV:N/AC:M/Au:N/C:N/I:P/A:N",
|
16
|
+
:release_date => Date.new(2016, 8, 11),
|
17
|
+
:cwe=>"",
|
18
|
+
:owasp=>"A9",
|
19
|
+
:applies=>["rails", "sinatra", "padrino"],
|
20
|
+
:kind=>Dawn::KnowledgeBase::DEPENDENCY_CHECK,
|
21
|
+
:message=>message,
|
22
|
+
:mitigation=>"Please upgrade actionview gem to version 3.2.22.3, 4.2.7.1, 5.0.0.1 or install latest version.",
|
23
|
+
:aux_links=>['https://groups.google.com/forum/#!topic/rubyonrails-security/I-VWr034ouk']
|
24
|
+
})
|
25
|
+
self.safe_dependencies = [{:name=>"actionview", :version=>['3.2.22.3', '4.2.7.1', '5.0.0.1']}]
|
26
|
+
self.not_affected = {:name=>"actionview", :version=>['1.x.x', '2.x.x']}
|
27
|
+
|
28
|
+
self.save_minor=true
|
29
|
+
self.save_major=true
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module Dawn
|
2
|
+
module Kb
|
3
|
+
# Automatically created with rake on 2016-10-02
|
4
|
+
class CVE_2016_6317
|
5
|
+
include DependencyCheck
|
6
|
+
|
7
|
+
def initialize
|
8
|
+
title = "Unsafe Query Generation Risk in Active Record"
|
9
|
+
message = "Due to the way Active Record interprets parameters in combination with the way that JSON parameters are parsed, it is possible for an attacker to issue unexpected database queries with “IS NULL” or empty where clauses. This issue does not let an attacker insert arbitrary values into an SQL query, however they can cause the query to check for NULL or eliminate a WHERE clause when most users wouldn’t expect it."
|
10
|
+
|
11
|
+
super({
|
12
|
+
:title=>title,
|
13
|
+
:name=> "CVE-2016-6317",
|
14
|
+
:cve=>"2016-6317",
|
15
|
+
:osvdb=>"",
|
16
|
+
:cvss=>"AV:N/AC:L/Au:N/C:N/I:P/A:N",
|
17
|
+
:release_date => Date.new(2016, 8, 11),
|
18
|
+
:cwe=>"",
|
19
|
+
:owasp=>"A9",
|
20
|
+
:applies=>["rails", "sinatra", "padrino"],
|
21
|
+
:kind=>Dawn::KnowledgeBase::DEPENDENCY_CHECK,
|
22
|
+
:message=>message,
|
23
|
+
:mitigation=>"Please upgrade activerecord gem to version 4.2.7.1. Please note that versions 5.0.0 or later are not affected.",
|
24
|
+
:aux_links=>['https://groups.google.com/forum/#!topic/rubyonrails-security/rgO20zYW33s']
|
25
|
+
})
|
26
|
+
self.safe_dependencies = [{:name=>"activerecord", :version=>['4.2.7.1']}]
|
27
|
+
self.not_affected = {:name=>"activerecord", :version=>['1.x.x', '2.x.x', '3.x.x', '4.0.x', '4.1.x', '5.0.x']}
|
28
|
+
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module Dawn
|
2
|
+
module Kb
|
3
|
+
# Automatically created with rake on 2016-10-02
|
4
|
+
class CVE_2016_6582
|
5
|
+
# Include the testing skeleton for this CVE
|
6
|
+
# include PatternMatchCheck
|
7
|
+
include DependencyCheck
|
8
|
+
# include RubyVersionCheck
|
9
|
+
|
10
|
+
def initialize
|
11
|
+
title = "Doorkeeper gem does not revoke tokens & uses wrong auth/auth method"
|
12
|
+
message = "Doorkeeper failed to implement OAuth 2.0 Token Revocation (RFC 7009) in the following ways:
|
13
|
+
|
14
|
+
Public clients making valid, unauthenticated calls to revoke a token would not have their token revoked
|
15
|
+
Requests were not properly authenticating the client credentials but were, instead, looking at the access token in a second location
|
16
|
+
Because of 2, the requests were also not authorizing confidential clients’ ability to revoke a given token. It should only revoke tokens that belong to it.
|
17
|
+
The security implication is: OAuth 2.0 clients who \"log out\" a user expect to have the corresponding access & refresh tokens revoked, preventing an attacker who may have already hijacked the session from continuing to impersonate the victim. Because of the bug described above, this is not the case. As far as OWASP is concerned, this counts as broken authentication design.
|
18
|
+
|
19
|
+
MITRE has assigned CVE-2016-6582 due to the security issues raised. An attacker, thanks to 1, can replay a hijacked session after a victim logs out/revokes their token. Additionally, thanks to 2 & 3, an attacker via a compromised confidential client could \"grief\" other clients by revoking their tokens (albeit this is an exceptionally narrow attack with little value)."
|
20
|
+
|
21
|
+
|
22
|
+
super({
|
23
|
+
:title=>title,
|
24
|
+
:name=> "CVE-2016-6582",
|
25
|
+
:cve=>"",
|
26
|
+
:osvdb=>"",
|
27
|
+
:cvss=>"",
|
28
|
+
:release_date => Date.new(2016, 8, 18),
|
29
|
+
:cwe=>"",
|
30
|
+
:owasp=>"A9",
|
31
|
+
:applies=>["rails", "sinatra", "padrino"],
|
32
|
+
:kind=>Dawn::KnowledgeBase::DEPENDENCY_CHECK,
|
33
|
+
:message=>message,
|
34
|
+
:mitigation=>"Please upgrade doorkeeper gem to version 4.2.0 or later.",
|
35
|
+
:aux_links=>['http://www.openwall.com/lists/oss-security/2016/08/19/2']
|
36
|
+
})
|
37
|
+
self.safe_dependencies = [{:name=>"doorkeeper", :version=>['4.2.0']}]
|
38
|
+
|
39
|
+
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -42,10 +42,6 @@ module Dawn
|
|
42
42
|
@mitigated = true if dep[:name] == @aux_mitigation_gem[:name] unless @aux_mitigation_gem.nil?
|
43
43
|
|
44
44
|
@safe_dependencies.each do |safe_dep|
|
45
|
-
if safe_dep[:name] == "rails"
|
46
|
-
debug_me "Forcing save_minor flag for rails gem dependency check"
|
47
|
-
self.save_minor = true
|
48
|
-
end
|
49
45
|
|
50
46
|
if dep[:name] == safe_dep[:name]
|
51
47
|
v = Dawn::Kb::VersionCheck.new(
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module Dawn
|
2
|
+
module Kb
|
3
|
+
# Automatically created with rake on 2016-10-02
|
4
|
+
class OSVDB_132234
|
5
|
+
# Include the testing skeleton for this Security Check
|
6
|
+
# include PatternMatchCheck
|
7
|
+
include DependencyCheck
|
8
|
+
# include RubyVersionCheck
|
9
|
+
|
10
|
+
def initialize
|
11
|
+
title = "rack-attack Gem for Ruby missing normalization before request path processing"
|
12
|
+
message = "When using rack-attack with a rails app, developers expect the request path to be normalized. In particular, trailing slashes are stripped so a request path \"/login/\" becomes \"/login\" by the time you're in ActionController. Since Rack::Attack runs before ActionDispatch, the request path is not yet normalized. This can cause throttles and blacklists to not work as expected. E.g., a throttle: throttle('logins', ...) {|req| req.path == \"/login\" } would not match a request to '/login/', though Rails would route '/login/' to the same '/login' action."
|
13
|
+
|
14
|
+
super({
|
15
|
+
:title=>title,
|
16
|
+
:name=> "OSVDB_132234",
|
17
|
+
:cve=>"",
|
18
|
+
:osvdb=>"132234",
|
19
|
+
:cvss=>"",
|
20
|
+
:release_date => Date.new(2015, 12, 15),
|
21
|
+
:cwe=>"",
|
22
|
+
:owasp=>"A9",
|
23
|
+
:applies=>["rails"],
|
24
|
+
:kind=>Dawn::KnowledgeBase::DEPENDENCY_CHECK,
|
25
|
+
:message=>message,
|
26
|
+
:mitigation=>"Please upgrade rack-attack gem to version 4.3.1 or later.",
|
27
|
+
:aux_links=>['https://github.com/kickstarter/rack-attack/releases/tag/v4.3.1']
|
28
|
+
})
|
29
|
+
self.safe_dependencies = [{:name=>"rack-attack", :version=>['4.3.1']}]
|
30
|
+
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -364,7 +364,7 @@ module Dawn
|
|
364
364
|
# we have a non vulnerable major, but the minor is and there is an higher version in array
|
365
365
|
# eg. we detected v1.3.2, safe version is 1.3.3 and there is also a safe 2.x.x
|
366
366
|
return debug_me_and_return_false("#{detected_version} has a major version vulnerable but honoring save_major_fix") if major && @save_major_fix
|
367
|
-
return debug_me_and_return_false("#{detected_version} has a minor version vulnerable but honoring save_minor_fix") if minor
|
367
|
+
return debug_me_and_return_false("#{detected_version} has a minor version vulnerable but honoring save_minor_fix") if minor and @save_minor_fix
|
368
368
|
return true if major && minor
|
369
369
|
return true if ! major && minor && patch && ! @save_major_fix && ! @save_minor_fix
|
370
370
|
return true if major && !@save_major_fix
|
data/lib/dawn/knowledge_base.rb
CHANGED
@@ -267,6 +267,10 @@ require "dawn/kb/cve_2016_0752"
|
|
267
267
|
require "dawn/kb/cve_2016_0753"
|
268
268
|
require "dawn/kb/cve_2016_2097"
|
269
269
|
require "dawn/kb/cve_2016_2098"
|
270
|
+
require "dawn/kb/cve_2016_5697"
|
271
|
+
require "dawn/kb/cve_2016_6316"
|
272
|
+
require "dawn/kb/cve_2016_6317"
|
273
|
+
require "dawn/kb/cve_2016_6582"
|
270
274
|
|
271
275
|
# OSVDB
|
272
276
|
|
@@ -286,6 +290,7 @@ require "dawn/kb/osvdb_119927"
|
|
286
290
|
require "dawn/kb/osvdb_120415"
|
287
291
|
require "dawn/kb/osvdb_120857"
|
288
292
|
require "dawn/kb/osvdb_121701"
|
293
|
+
require "dawn/kb/osvdb_132234"
|
289
294
|
|
290
295
|
|
291
296
|
|
@@ -569,6 +574,10 @@ module Dawn
|
|
569
574
|
Dawn::Kb::CVE_2016_0753.new,
|
570
575
|
Dawn::Kb::CVE_2016_2097.new,
|
571
576
|
Dawn::Kb::CVE_2016_2098.new,
|
577
|
+
Dawn::Kb::CVE_2016_5697.new,
|
578
|
+
Dawn::Kb::CVE_2016_6316.new,
|
579
|
+
Dawn::Kb::CVE_2016_6317.new,
|
580
|
+
Dawn::Kb::CVE_2016_6582.new,
|
572
581
|
|
573
582
|
|
574
583
|
# OSVDB Checks are still here since are all about dependencies
|
@@ -588,6 +597,7 @@ module Dawn
|
|
588
597
|
Dawn::Kb::OSVDB_120415.new,
|
589
598
|
Dawn::Kb::OSVDB_120857.new,
|
590
599
|
Dawn::Kb::OSVDB_121701.new,
|
600
|
+
Dawn::Kb::OSVDB_132234.new,
|
591
601
|
]
|
592
602
|
# END @cve_security_checks array
|
593
603
|
# START @owasp_ror_cheatsheet_checks array
|
@@ -611,7 +621,7 @@ module Dawn
|
|
611
621
|
|
612
622
|
ret = []
|
613
623
|
ret += @aux_checks
|
614
|
-
ret += @cve_security_checks if @enabled_checks.include?(:
|
624
|
+
ret += @cve_security_checks if @enabled_checks.include?(:bulletin)
|
615
625
|
ret += @owasp_ror_cheatsheet_checks if @enabled_checks.include?(:owasp_ror_cheatsheet)
|
616
626
|
ret += @code_quality_checks if @enabled_checks.include?(:code_quality)
|
617
627
|
|
@@ -0,0 +1,245 @@
|
|
1
|
+
require 'singleton'
|
2
|
+
|
3
|
+
# For HTTPS communication to check for KB updates and to fetch them
|
4
|
+
require 'net/http'
|
5
|
+
require 'uri'
|
6
|
+
|
7
|
+
require 'yaml'
|
8
|
+
require 'digest'
|
9
|
+
|
10
|
+
module Dawn
|
11
|
+
# This is the YAML powered experimental knowledge base
|
12
|
+
#
|
13
|
+
# When the old KB format, using Ruby classes will be marked as deprecated,
|
14
|
+
# than this one will be the official.
|
15
|
+
#
|
16
|
+
# Dawnscanner KB will be a bunch of YAML file, stored in a hierachy of
|
17
|
+
# directories resembling security checks family. A digital signature will be
|
18
|
+
# also available to prevent KB tampering.
|
19
|
+
#
|
20
|
+
# This class will be accountable for:
|
21
|
+
# + check for KB upgrade
|
22
|
+
# + fetching the KB file from the Internet
|
23
|
+
# + verifying the database signature
|
24
|
+
# + reading YAML file, creating the security check array
|
25
|
+
#
|
26
|
+
# Another big change will be the MVC passed as constructor parameter, so only
|
27
|
+
# the checks regarding the particular app, will be loaded in the security
|
28
|
+
# check array. This should speed up BasicCheck internal routines.
|
29
|
+
#
|
30
|
+
# Class usage will be very simple. After getting the singleton instance, you
|
31
|
+
# will load the KB content. The load method will be also responsible about
|
32
|
+
# all relevant checks.
|
33
|
+
#
|
34
|
+
# Example
|
35
|
+
#
|
36
|
+
# require "dawn/knowledge_base_experimental"
|
37
|
+
#
|
38
|
+
# ...
|
39
|
+
#
|
40
|
+
# d = Dawn::KnowledgeBaseExperimental.instance
|
41
|
+
# d.update if d.update?
|
42
|
+
# d.load
|
43
|
+
#
|
44
|
+
# Last update: Fri Oct 7 08:03:43 CEST 2016
|
45
|
+
class KnowledgeBaseExperimental
|
46
|
+
include Dawn::Utils
|
47
|
+
include Singleton
|
48
|
+
|
49
|
+
GEM_CHECK = :rubygem_check
|
50
|
+
DEPENDENCY_CHECK = :dependency_check
|
51
|
+
PATTERN_MATCH_CHECK = :pattern_match_check
|
52
|
+
RUBY_VERSION_CHECK = :ruby_version_check
|
53
|
+
OS_CHECK = :os_check
|
54
|
+
COMBO_CHECK = :combo_check
|
55
|
+
CUSTOM_CHECK = :custom_check
|
56
|
+
|
57
|
+
REMOTE_KB_URL_PREFIX = "https://dawnscanner.org/data/"
|
58
|
+
FILES = %w(kb.yaml bulletin.tar.gz generic_check.tar.gz owasp_ror_cheatsheet.tar.gz code_style.tar.gz code_quality.tar.gz owasp_top_10.tar.gz signatures.tar.gz)
|
59
|
+
|
60
|
+
|
61
|
+
attr_reader :security_checks
|
62
|
+
attr_reader :descriptor
|
63
|
+
attr_reader :path
|
64
|
+
|
65
|
+
def initialize(options={})
|
66
|
+
if $logger.nil?
|
67
|
+
require 'dawn/logger'
|
68
|
+
$logger = Logger.new(STDOUT)
|
69
|
+
$logger.helo "knowledge-base-experimental", Dawn::VERSION
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
def find(name)
|
76
|
+
end
|
77
|
+
|
78
|
+
def self.kb_descriptor
|
79
|
+
{:kb=>{:version=>"0.0.1", :revision=>Time.now.strftime("%Y%m%d"), :api=>Dawn::VERSION}}.to_yaml
|
80
|
+
end
|
81
|
+
|
82
|
+
def update?
|
83
|
+
FileUtils.mkdir_p("tmp")
|
84
|
+
begin
|
85
|
+
response = Net::HTTP.get URI(REMOTE_KB_URL_PREFIX + "kb.yaml")
|
86
|
+
open("tmp/kb.yaml", "w") do |f|
|
87
|
+
f.puts(response)
|
88
|
+
end
|
89
|
+
response = Net::HTTP.get URI(REMOTE_KB_URL_PREFIX + "kb.yaml.sig")
|
90
|
+
open("tmp/kb.yaml.sig", "w") do |f|
|
91
|
+
f.puts(response)
|
92
|
+
end
|
93
|
+
rescue Exception => e
|
94
|
+
$logger.error e.to_s
|
95
|
+
return false
|
96
|
+
end
|
97
|
+
|
98
|
+
# Verify kb.yaml signature
|
99
|
+
|
100
|
+
YAML.load(response)
|
101
|
+
end
|
102
|
+
|
103
|
+
def all
|
104
|
+
@security_checks
|
105
|
+
end
|
106
|
+
|
107
|
+
# Load security checks from db/ folder.
|
108
|
+
#
|
109
|
+
# options - The list of the options to be passed to KB. It can contain:
|
110
|
+
# + enabled_checks: an array of security checks that must be enabled
|
111
|
+
# [:generic_check, :code_quality, :bulletin, :code_style, :owasp_ror_cheatsheet, :owasp_top_10]
|
112
|
+
# + mvc: the mvc name for the target application, in order for the KB to
|
113
|
+
# deselect all security checks that don't fit the code to be
|
114
|
+
# reviewed.
|
115
|
+
# + path: the path for the KB root folder. Please note that #{Dir.pwd}/db
|
116
|
+
# is the default location.
|
117
|
+
#
|
118
|
+
# Returns an array of security checks, matching the mvc to be reviewed and
|
119
|
+
# the enabled check list or an empty array if an error occured.
|
120
|
+
def load(options={})
|
121
|
+
@security_checks = []
|
122
|
+
$path = File.join(Dir.pwd, "db")
|
123
|
+
|
124
|
+
enabled_checks = options[:enabled_checks] unless options[:enabled_checks].nil?
|
125
|
+
mvc = options[:mvc] unless options[:mvc].nil?
|
126
|
+
$path = options[:path] unless options[:path].nil?
|
127
|
+
|
128
|
+
unless __valid?
|
129
|
+
$logger.error "An invalid library it has been found. Please use --recovery flag to force fresh install from dawnscanner.org"
|
130
|
+
return []
|
131
|
+
end
|
132
|
+
|
133
|
+
unless __load?
|
134
|
+
$logger.error "The library must be consumed with dawnscanner up to v#{$descriptor["kb"]["api"]}. You are using dawnscanner v#{Dawn::VERSION}"
|
135
|
+
return []
|
136
|
+
end
|
137
|
+
|
138
|
+
# TODO: untar and unzip from here (look for it in Google)
|
139
|
+
if __packed?
|
140
|
+
$logger.info "a packed knowledge base it has been found. Unpacking it"
|
141
|
+
__unpack
|
142
|
+
end
|
143
|
+
|
144
|
+
enabled_checks.each do |d|
|
145
|
+
|
146
|
+
dir = File.join($path, d)
|
147
|
+
|
148
|
+
# Please note that if we enter in this branch, it means someone
|
149
|
+
# tampered the KB between the previous __valid? check and this point.
|
150
|
+
# Of course this is a very rare situation, but we must handle it.
|
151
|
+
unless Dir.exists?(dir)
|
152
|
+
$logger.critical "Missing check directory #{dir}"
|
153
|
+
$logger.error "An invalid library it has been found. Please use --recovery flag to force fresh install from dawnscanner.org"
|
154
|
+
return []
|
155
|
+
end
|
156
|
+
|
157
|
+
# Enumerate all YAML file in the give dir
|
158
|
+
|
159
|
+
end
|
160
|
+
|
161
|
+
end
|
162
|
+
|
163
|
+
def dump(verbose=false)
|
164
|
+
puts "Security checks currently supported:"
|
165
|
+
i=0
|
166
|
+
KnowledgeBaseExperimental.instance.all.each do |check|
|
167
|
+
i+=1
|
168
|
+
if verbose
|
169
|
+
puts "Name: #{check.name}\tCVSS: #{check.cvss_score}\tReleased: #{check.release_date}"
|
170
|
+
puts "Description\n#{check.message}"
|
171
|
+
puts "Remediation\n#{check.remediation}\n\n"
|
172
|
+
else
|
173
|
+
puts "#{check.name}"
|
174
|
+
end
|
175
|
+
end
|
176
|
+
puts "-----\nTotal: #{i}"
|
177
|
+
|
178
|
+
end
|
179
|
+
|
180
|
+
private
|
181
|
+
|
182
|
+
def __verify_hash(original, computed)
|
183
|
+
t=original.split(' ')
|
184
|
+
return false if t.length != 2
|
185
|
+
return (t[0] == computed)
|
186
|
+
end
|
187
|
+
|
188
|
+
def __valid?
|
189
|
+
|
190
|
+
lines = ""
|
191
|
+
|
192
|
+
unless File.exists?(File.join($path, "kb.yaml"))
|
193
|
+
$logger.error "Missing kb.yaml in #{path}. Giving up"
|
194
|
+
return false
|
195
|
+
end
|
196
|
+
|
197
|
+
unless File.exists?(File.join($path, "kb.yaml.sig"))
|
198
|
+
$logger.error "Missing kb.yaml signature in #{path}. Giving up"
|
199
|
+
return false
|
200
|
+
end
|
201
|
+
|
202
|
+
lines = File.read(File.join($path, "kb.yaml"))
|
203
|
+
hash_file = Digest::SHA256.hexdigest lines
|
204
|
+
hash_orig = File.read(File.join($path, "kb.yaml.sig"))
|
205
|
+
|
206
|
+
v = __verify_hash(hash_orig, hash_file)
|
207
|
+
if v
|
208
|
+
$logger.info("good kb.yaml file found. Reading knowledge base descriptor")
|
209
|
+
@descriptor = YAML.load(lines)
|
210
|
+
else
|
211
|
+
$logger.error("kb.yaml signature mismatch. Found #{hash_file} while expecting #{hash_orig}. Giving up")
|
212
|
+
return false
|
213
|
+
end
|
214
|
+
|
215
|
+
return true
|
216
|
+
end
|
217
|
+
|
218
|
+
# Check if the local KB is packet or not.
|
219
|
+
#
|
220
|
+
# Returns true if at least one KB tarball file it has been found in the
|
221
|
+
# local DB path
|
222
|
+
def __packed?
|
223
|
+
FILES.each do |fn|
|
224
|
+
return true if fn.end_with? 'tar.gz' and File.exists?(File.join($path, fn))
|
225
|
+
end
|
226
|
+
return false
|
227
|
+
end
|
228
|
+
|
229
|
+
def __unpack
|
230
|
+
|
231
|
+
end
|
232
|
+
|
233
|
+
def __load?
|
234
|
+
api = $descriptor["kb"]["api"]
|
235
|
+
v = Dawn::VERSION
|
236
|
+
require "dawn/kb/version_check"
|
237
|
+
|
238
|
+
vc = VersionCheck.new
|
239
|
+
return true if vc.is_higher?(api, v) # => true if v > api
|
240
|
+
return false
|
241
|
+
end
|
242
|
+
|
243
|
+
|
244
|
+
end
|
245
|
+
end
|
data/lib/dawn/version.rb
CHANGED
@@ -1179,4 +1179,24 @@ it "must have test for CVE-2016-2097" do
|
|
1179
1179
|
expect(sc).not_to be_nil
|
1180
1180
|
expect(sc.class).to eq(Dawn::Kb::CVE_2016_2097)
|
1181
1181
|
end
|
1182
|
+
it "must have test for OSVDB_132234" do
|
1183
|
+
sc = kb.find("OSVDB_132234")
|
1184
|
+
expect(sc).not_to be_nil
|
1185
|
+
expect(sc.class).to eq(Dawn::Kb::OSVDB_132234)
|
1186
|
+
end
|
1187
|
+
it "must have test for CVE-2016-6317" do
|
1188
|
+
sc = kb.find("CVE-2016-6317")
|
1189
|
+
expect(sc).not_to be_nil
|
1190
|
+
expect(sc.class).to eq(Dawn::Kb::CVE_2016_6317)
|
1191
|
+
end
|
1192
|
+
it "must have test for CVE-2016-6316" do
|
1193
|
+
sc = kb.find("CVE-2016-6316")
|
1194
|
+
expect(sc).not_to be_nil
|
1195
|
+
expect(sc.class).to eq(Dawn::Kb::CVE_2016_6316)
|
1196
|
+
end
|
1197
|
+
it "must have test for CVE-2016-5697" do
|
1198
|
+
sc = kb.find("CVE-2016-5697")
|
1199
|
+
expect(sc).not_to be_nil
|
1200
|
+
expect(sc.class).to eq(Dawn::Kb::CVE_2016_5697)
|
1201
|
+
end
|
1182
1202
|
end
|
@@ -2,7 +2,7 @@ require 'spec_helper'
|
|
2
2
|
describe "The CVE-2014-7829 vulnerability" do
|
3
3
|
before(:all) do
|
4
4
|
@check = Dawn::Kb::CVE_2014_7829.new
|
5
|
-
|
5
|
+
@check.debug = true
|
6
6
|
end
|
7
7
|
it "is reported when vulnerable rails gem is used (3.2.20)" do
|
8
8
|
@check.dependencies = [{:name=>"rails", :version=>'3.2.20'}]
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
describe "The CVE-2016-5697 vulnerability" do
|
3
|
+
before(:all) do
|
4
|
+
@check = Dawn::Kb::CVE_2016_5697.new
|
5
|
+
# @check.debug = true
|
6
|
+
end
|
7
|
+
it "is reported when the vulnerable gem is detected" do
|
8
|
+
@check.dependencies = [{:name=>"ruby-saml", :version=>"1.2.9"}]
|
9
|
+
expect(@check.vuln?).to eq(true)
|
10
|
+
end
|
11
|
+
it "is not reported when a fixed release is detected" do
|
12
|
+
@check.dependencies = [{:name=>"ruby-saml", :version=>"1.3.0"}]
|
13
|
+
expect(@check.vuln?).to eq(false)
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
describe "The CVE-2016-6316 vulnerability" do
|
3
|
+
before(:all) do
|
4
|
+
@check = Dawn::Kb::CVE_2016_6316.new
|
5
|
+
# @check.debug = true
|
6
|
+
end
|
7
|
+
it "is reported when the vulnerable gem is detected" do
|
8
|
+
@check.dependencies = [{:name=>"actionview", :version=>"3.2.22.2"}]
|
9
|
+
expect(@check.vuln?).to eq(true)
|
10
|
+
end
|
11
|
+
it "is reported when the vulnerable gem is detected" do
|
12
|
+
@check.dependencies = [{:name=>"actionview", :version=>"5.0.0.0"}]
|
13
|
+
expect(@check.vuln?).to eq(true)
|
14
|
+
end
|
15
|
+
it "is reported when the vulnerable gem is detected" do
|
16
|
+
@check.dependencies = [{:name=>"actionview", :version=>"4.2.6"}]
|
17
|
+
expect(@check.vuln?).to eq(true)
|
18
|
+
end
|
19
|
+
|
20
|
+
it "is not reported when a fixed release is detected" do
|
21
|
+
@check.dependencies = [{:name=>"actionview", :version=>"3.0.0"}]
|
22
|
+
expect(@check.vuln?).to eq(false)
|
23
|
+
end
|
24
|
+
it "is not reported when a fixed release is detected" do
|
25
|
+
@check.dependencies = [{:name=>"actionview", :version=>"2.2.0"}]
|
26
|
+
expect(@check.vuln?).to eq(false)
|
27
|
+
end
|
28
|
+
it "is not reported when a fixed release is detected" do
|
29
|
+
@check.dependencies = [{:name=>"actionview", :version=>"1.2.0"}]
|
30
|
+
expect(@check.vuln?).to eq(false)
|
31
|
+
end
|
32
|
+
it "is not reported when a fixed release is detected" do
|
33
|
+
@check.dependencies = [{:name=>"actionview", :version=>"3.2.22.3"}]
|
34
|
+
expect(@check.vuln?).to eq(false)
|
35
|
+
end
|
36
|
+
it "is not reported when a fixed release is detected" do
|
37
|
+
@check.dependencies = [{:name=>"actionview", :version=>"4.2.7.1"}]
|
38
|
+
expect(@check.vuln?).to eq(false)
|
39
|
+
end
|
40
|
+
it "is not reported when a fixed release is detected" do
|
41
|
+
@check.dependencies = [{:name=>"actionview", :version=>"5.0.0.1"}]
|
42
|
+
expect(@check.vuln?).to eq(false)
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
describe "The CVE-2016-6317 vulnerability" do
|
3
|
+
before(:all) do
|
4
|
+
@check = Dawn::Kb::CVE_2016_6317.new
|
5
|
+
# @check.debug = true
|
6
|
+
end
|
7
|
+
it "is reported when the vulnerable gem is detected" do
|
8
|
+
@check.dependencies = [{:name=>"activerecord", :version=>"4.2.7.0"}]
|
9
|
+
expect(@check.vuln?).to eq(true)
|
10
|
+
end
|
11
|
+
it "is not reported when a fixed release is detected" do
|
12
|
+
@check.dependencies = [{:name=>"activerecord", :version=>"4.2.7.1"}]
|
13
|
+
expect(@check.vuln?).to eq(false)
|
14
|
+
end
|
15
|
+
it "is not reported when a fixed release is detected" do
|
16
|
+
@check.dependencies = [{:name=>"activerecord", :version=>"4.1.0"}]
|
17
|
+
expect(@check.vuln?).to eq(false)
|
18
|
+
end
|
19
|
+
it "is not reported when a fixed release is detected" do
|
20
|
+
@check.dependencies = [{:name=>"activerecord", :version=>"3.1.0"}]
|
21
|
+
expect(@check.vuln?).to eq(false)
|
22
|
+
end
|
23
|
+
it "is not reported when a fixed release is detected" do
|
24
|
+
@check.dependencies = [{:name=>"activerecord", :version=>"2.1.0"}]
|
25
|
+
expect(@check.vuln?).to eq(false)
|
26
|
+
end
|
27
|
+
it "is not reported when a fixed release is detected" do
|
28
|
+
@check.dependencies = [{:name=>"activerecord", :version=>"1.1.0"}]
|
29
|
+
expect(@check.vuln?).to eq(false)
|
30
|
+
end
|
31
|
+
it "is not reported when a fixed release is detected" do
|
32
|
+
@check.dependencies = [{:name=>"activerecord", :version=>"5.0.0"}]
|
33
|
+
expect(@check.vuln?).to eq(false)
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
describe "The CVE-2016-6582 vulnerability" do
|
3
|
+
before(:all) do
|
4
|
+
@check = Dawn::Kb::CVE_2016_6582.new
|
5
|
+
# @check.debug = true
|
6
|
+
end
|
7
|
+
it "is reported when the vulnerable gem is detected" do
|
8
|
+
@check.dependencies = [{:name=>"doorkeeper", :version=>"1.2.0"}]
|
9
|
+
expect(@check.vuln?).to eq(true)
|
10
|
+
end
|
11
|
+
it "is reported when the vulnerable gem is detected" do
|
12
|
+
@check.dependencies = [{:name=>"doorkeeper", :version=>"2.5.0"}]
|
13
|
+
expect(@check.vuln?).to eq(true)
|
14
|
+
end
|
15
|
+
it "is reported when the vulnerable gem is detected" do
|
16
|
+
@check.dependencies = [{:name=>"doorkeeper", :version=>"3.9.0"}]
|
17
|
+
expect(@check.vuln?).to eq(true)
|
18
|
+
end
|
19
|
+
|
20
|
+
it "is reported when the vulnerable gem is detected" do
|
21
|
+
@check.dependencies = [{:name=>"doorkeeper", :version=>"4.1.0"}]
|
22
|
+
expect(@check.vuln?).to eq(true)
|
23
|
+
end
|
24
|
+
|
25
|
+
it "is not reported when a fixed release is detected" do
|
26
|
+
@check.dependencies = [{:name=>"doorkeeper", :version=>"4.2.0"}]
|
27
|
+
expect(@check.vuln?).to eq(false)
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
describe "The OSVDB_132234 vulnerability" do
|
3
|
+
before(:all) do
|
4
|
+
@check = Dawn::Kb::OSVDB_132234.new
|
5
|
+
# @check.debug = true
|
6
|
+
end
|
7
|
+
it "is reported when the vulnerable gem is detected" do
|
8
|
+
@check.dependencies = [{:name=>"rack-attack", :version=>"4.3.0"}]
|
9
|
+
expect(@check.vuln?).to eq(true)
|
10
|
+
end
|
11
|
+
it "is not reported when a fixed release is detected" do
|
12
|
+
@check.dependencies = [{:name=>"rack-attack", :version=>"4.3.1"}]
|
13
|
+
expect(@check.vuln?).to eq(false)
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
describe "The Knowledge base must be converted to YAML" do
|
3
|
+
before(:all) do
|
4
|
+
@dep_check = Dawn::Kb::CVE_2013_2513.new
|
5
|
+
@combo_check = Dawn::Kb::CVE_2008_4310.new
|
6
|
+
@ruby_ver_check = Dawn::Kb::CVE_2004_0755.new
|
7
|
+
@os_check = Dawn::Kb::CVE_2008_4310.new
|
8
|
+
@gem_check = Dawn::Kb::CVE_2015_4020.new
|
9
|
+
@pattern_check = Dawn::Kb::NotRevisedCode.new
|
10
|
+
# @check.debug = true
|
11
|
+
end
|
12
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dawnscanner
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.6.
|
4
|
+
version: 1.6.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paolo Perego
|
@@ -30,7 +30,7 @@ cert_chain:
|
|
30
30
|
jm6Bw8fGx65GCWIdgMhH/P0icixcnyrnotnnOrEcmPudIlgEN9qaUYcguOfFBhTH
|
31
31
|
1sGpM7KzrYHU8qJJPrdaX0ezIDL4cN/kA/DxYTfUiMw=
|
32
32
|
-----END CERTIFICATE-----
|
33
|
-
date: 2016-
|
33
|
+
date: 2016-11-01 00:00:00.000000000 Z
|
34
34
|
dependencies:
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
36
|
name: cvss
|
@@ -320,13 +320,14 @@ files:
|
|
320
320
|
- checksum/dawnscanner-1.6.2.gem.sha1
|
321
321
|
- checksum/dawnscanner-1.6.3.gem.sha1
|
322
322
|
- checksum/dawnscanner-1.6.4.gem.sha1
|
323
|
+
- checksum/dawnscanner-1.6.5.gem.sha1
|
323
324
|
- code_of_conduct.md
|
324
325
|
- dawnscanner.gemspec
|
325
326
|
- doc/dawn_1_0_announcement.md
|
326
327
|
- doc/dawn_1_1_announcement.md
|
327
328
|
- doc/dawn_1_2_announcement.md
|
328
329
|
- doc/dawn_1_5_announcement.md
|
329
|
-
- doc/dawnscanner.
|
330
|
+
- doc/dawnscanner.yml.sample
|
330
331
|
- doc/new_knowledge_base_v1.0.md
|
331
332
|
- features/dawn_complains_about_an_incorrect_command_line.feature.disabled
|
332
333
|
- features/dawn_scan_a_secure_sinatra_app.feature.disabled
|
@@ -543,6 +544,10 @@ files:
|
|
543
544
|
- lib/dawn/kb/cve_2016_0753.rb
|
544
545
|
- lib/dawn/kb/cve_2016_2097.rb
|
545
546
|
- lib/dawn/kb/cve_2016_2098.rb
|
547
|
+
- lib/dawn/kb/cve_2016_5697.rb
|
548
|
+
- lib/dawn/kb/cve_2016_6316.rb
|
549
|
+
- lib/dawn/kb/cve_2016_6317.rb
|
550
|
+
- lib/dawn/kb/cve_2016_6582.rb
|
546
551
|
- lib/dawn/kb/dependency_check.rb
|
547
552
|
- lib/dawn/kb/deprecation_check.rb
|
548
553
|
- lib/dawn/kb/gem_check.rb
|
@@ -564,6 +569,7 @@ files:
|
|
564
569
|
- lib/dawn/kb/osvdb_120415.rb
|
565
570
|
- lib/dawn/kb/osvdb_120857.rb
|
566
571
|
- lib/dawn/kb/osvdb_121701.rb
|
572
|
+
- lib/dawn/kb/osvdb_132234.rb
|
567
573
|
- lib/dawn/kb/owasp_ror_cheatsheet.rb
|
568
574
|
- lib/dawn/kb/owasp_ror_cheatsheet/check_for_backup_files.rb
|
569
575
|
- lib/dawn/kb/owasp_ror_cheatsheet/check_for_safe_redirect_and_forward.rb
|
@@ -578,6 +584,7 @@ files:
|
|
578
584
|
- lib/dawn/kb/simpleform_xss_20131129.rb
|
579
585
|
- lib/dawn/kb/version_check.rb
|
580
586
|
- lib/dawn/knowledge_base.rb
|
587
|
+
- lib/dawn/knowledge_base_experimental.rb
|
581
588
|
- lib/dawn/logger.rb
|
582
589
|
- lib/dawn/padrino.rb
|
583
590
|
- lib/dawn/rails.rb
|
@@ -683,6 +690,10 @@ files:
|
|
683
690
|
- spec/lib/kb/cve_2016_0753_spec.rb
|
684
691
|
- spec/lib/kb/cve_2016_2097_spec.rb
|
685
692
|
- spec/lib/kb/cve_2016_2098_spec.rb
|
693
|
+
- spec/lib/kb/cve_2016_5697_spec.rb
|
694
|
+
- spec/lib/kb/cve_2016_6316_spec.rb
|
695
|
+
- spec/lib/kb/cve_2016_6317_spec.rb
|
696
|
+
- spec/lib/kb/cve_2016_6582_spec.rb
|
686
697
|
- spec/lib/kb/osvdb_105971_spec.rb
|
687
698
|
- spec/lib/kb/osvdb_108530_spec.rb
|
688
699
|
- spec/lib/kb/osvdb_108563_spec.rb
|
@@ -699,7 +710,9 @@ files:
|
|
699
710
|
- spec/lib/kb/osvdb_120415_spec.rb
|
700
711
|
- spec/lib/kb/osvdb_120857_spec.rb
|
701
712
|
- spec/lib/kb/osvdb_121701_spec.rb
|
713
|
+
- spec/lib/kb/osvdb_132234_spec.rb
|
702
714
|
- spec/lib/kb/owasp_ror_cheatsheet_disabled.rb
|
715
|
+
- spec/lib/kb/yamilize_kb_spec.rb
|
703
716
|
- spec/spec_helper.rb
|
704
717
|
- support/bootstrap.js
|
705
718
|
- support/bootstrap.min.css
|
@@ -829,6 +842,10 @@ test_files:
|
|
829
842
|
- spec/lib/kb/cve_2016_0753_spec.rb
|
830
843
|
- spec/lib/kb/cve_2016_2097_spec.rb
|
831
844
|
- spec/lib/kb/cve_2016_2098_spec.rb
|
845
|
+
- spec/lib/kb/cve_2016_5697_spec.rb
|
846
|
+
- spec/lib/kb/cve_2016_6316_spec.rb
|
847
|
+
- spec/lib/kb/cve_2016_6317_spec.rb
|
848
|
+
- spec/lib/kb/cve_2016_6582_spec.rb
|
832
849
|
- spec/lib/kb/osvdb_105971_spec.rb
|
833
850
|
- spec/lib/kb/osvdb_108530_spec.rb
|
834
851
|
- spec/lib/kb/osvdb_108563_spec.rb
|
@@ -845,5 +862,7 @@ test_files:
|
|
845
862
|
- spec/lib/kb/osvdb_120415_spec.rb
|
846
863
|
- spec/lib/kb/osvdb_120857_spec.rb
|
847
864
|
- spec/lib/kb/osvdb_121701_spec.rb
|
865
|
+
- spec/lib/kb/osvdb_132234_spec.rb
|
848
866
|
- spec/lib/kb/owasp_ror_cheatsheet_disabled.rb
|
867
|
+
- spec/lib/kb/yamilize_kb_spec.rb
|
849
868
|
- spec/spec_helper.rb
|
metadata.gz.sig
CHANGED
Binary file
|