dawnscanner 2.0.0.rc5 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 72a87bbf8ef2496a0afd46d528d72e054f5dae05ebd931c7def8f99be76961da
4
- data.tar.gz: 67625dd36903d067ecf28c8581b130d1b2c612a3b26ded963e2868bb95efb853
3
+ metadata.gz: cd4bbcfe33df2cf77a454baf00629653a49480c6606e8ed20c06ded4313c3dfb
4
+ data.tar.gz: 0a0e41109d47d2f634f2ecafc1b68c1b2596156054594c6221a9ddabd04dbc23
5
5
  SHA512:
6
- metadata.gz: e6621edd0430c27a88d8813e5ca57475466ff8ea6d262cc7f324890d521a10d1f24f055004fdfa4ccb36e9131d1ea6f6d8957e17d26a54846194706279e617a2
7
- data.tar.gz: ec14c1e7804f38e5bcb6f87ea7d05afedc83206db846eaec197d4e5be5b48f9ee1059fb87d21ddbab52e023fb2f0a7cc74bc90517be9e62a0e81d9810b93137e
6
+ metadata.gz: 40fb06e99f9cd958a0b5e1c95b52593d250a7aabb6cfd6623cb82561a88b250f1815a7ac6b81a1c4a9a1c2c3b5781d59225070adb0a776b31d0377efd33e7cc7
7
+ data.tar.gz: d1a37d012779435d7d8ef91161911126bdf3e0fcccb28ad113276a3036bf2cb6590d32757cccb240a845979e7667f2f8045f24a261bd8dcacabef6a81dbe0534
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 3
1
+ 3.1
data/Changelog.md CHANGED
@@ -14,7 +14,6 @@ _latest update: mer 29 mar 2023, 18:32:56, CEST_
14
14
  invoke dawn the right way or use the 'dawn help' command
15
15
  * Added a new debug\_verbosely API for engines and checks
16
16
  * Removed rake osvdb[name] and rake cve[name] tasks
17
- * Adding telemetry
18
17
  * Dawn::Utils include refactory. Now it's available application wide
19
18
  * debug information refactory.
20
19
  * engine class, apply_all method now accepts an optional parameter containing a
data/README.md CHANGED
@@ -1,36 +1,15 @@
1
1
  # Dawnscanner - The raising security scanner for ruby web applications
2
2
 
3
- dawnscanner is a source code scanner designed to review your web applications for
3
+ dawn is a source code scanner designed to review your web applications for
4
4
  security issues.
5
5
 
6
- dawnscanner is able to scan web applications written in Ruby and it supports all
6
+ The tool is able to scan web applications written in Ruby and it supports all
7
7
  major MVC (Model View Controller) frameworks, out of the box:
8
8
 
9
9
  * [Ruby on Rails](http://rubyonrails.org)
10
10
  * [Sinatra](http://www.sinatrarb.com)
11
11
  * [Padrino](http://www.padrinorb.com)
12
12
 
13
- ## Quick update from April, 2019
14
-
15
- We just released version 2.0.0 release candidate 1 with a YAML powered revamped
16
- knowledge base. Please note that dawnscanner will include a telemetry facility
17
- sending a POST on https://dawnscanner.org/telemetry with an application id and
18
- some information about version and knowledge base.
19
-
20
- We won't now and ever collect your source code on our side.
21
-
22
- ## Quick update from November, 2018
23
-
24
- As you can see dawnscanner is on hold since more then an year. Sorry for that.
25
- It's life. I was overwhelmed by tons of stuff and I dedicated free time to
26
- Offensive Security certifications. True to be told, I'm starting OSCE journey
27
- really soon.
28
-
29
- The dawnscanner project will be updated soon with new security checks and
30
- kickstarted again.
31
-
32
- Paolo
33
-
34
13
  ---
35
14
 
36
15
  [![Gem Version](https://badge.fury.io/rb/dawnscanner.png)](http://badge.fury.io/rb/dawnscanner)
@@ -42,13 +21,13 @@ Paolo
42
21
 
43
22
  ---
44
23
 
45
- dawnscanner version 1.6.6 has 235 security checks loaded in its knowledge
46
- base. Most of them are CVE bulletins applying to gems or the ruby interpreter
47
- itself. There are also some check coming from Owasp Ruby on Rails cheatsheet.
24
+ dawn version 2.0 has 680+ security checks loaded in its knowledge base
25
+ which is weekly updated from the [National Vulnerability
26
+ Database](https://nvd.nist.gov/) by NIST.
48
27
 
49
- ## An overall introduction
28
+ ## A brief "how it works"
50
29
 
51
- When you run dawnscanner on your code it parses your project Gemfile.lock
30
+ When you run dawn on your code it parses your project Gemfile.lock
52
31
  looking for the gems used and it tries to detect the ruby interpreter version
53
32
  you are using or you declared in your ruby version management tool you like
54
33
  most (RVM, rbenv, ...).
@@ -57,244 +36,93 @@ Then the tool tries to detect the MVC framework your web application uses and
57
36
  it applies the security check accordingly. There checks designed to match rails
58
37
  application or checks that are appliable to any ruby code.
59
38
 
60
- dawnscanner can also understand the code in your views and to backtrack
39
+ dawn can also understand the code in your views and to backtrack
61
40
  sinks to spot cross site scripting and sql injections introduced by the code
62
- you actually wrote. In the project roadmap this is the code most of the future
63
- development effort will be focused on.
41
+ you actually wrote **(in the project roadmap this is the code most of the future
42
+ development effort will be focused on).**
64
43
 
65
- dawnscanner security scan result is a list of vulnerabilities with some
44
+ dawn security scan result is a list of vulnerabilities with some
66
45
  mitigation actions you want to follow in order to build a stronger web
67
46
  application.
68
47
 
69
48
  ## Installation
70
49
 
71
- You can install latest dawnscanner version, fetching it from
50
+ You can install latest dawn version, fetching it from
72
51
  [Rubygems](https://rubygems.org) by typing:
73
52
 
74
53
  ```
75
- $ gem install dawnscanner
76
- ```
77
-
78
- If you want to add dawn to your project Gemfile, you must add the following:
79
-
80
- group :development do
81
- gem 'dawnscanner', :require=>false
82
- end
83
-
84
- And then upgrade your bundle
85
-
86
- $ bundle install
87
-
88
- You may want to build it from source, so you have to check it out from github first:
89
-
90
- $ git clone https://github.com/thesp0nge/dawnscanner.git
91
- $ cd dawnscanner
92
- $ bundle install
93
- $ rake install
94
-
95
- And the dawnscanner gem will be built in a pkg directory and then installed
96
- on your system. Please note that you have to manage dependencies on your own
97
- this way. It makes sense only if you want to hack the code or something like
98
- that.
99
-
100
- ## Usage
101
-
102
- You can start your code review with dawnscanner very easily. Simply tell the tool
103
- where the project root directory.
104
-
105
- Underlying MVC framework is autodetected by dawnscanner using target Gemfile.lock
106
- file. If autodetect fails for some reason, the tool will complain about it and
107
- you have to specify if it's a rails, sinatra or padrino web application by
108
- hand.
109
-
110
- Basic usage is to specify some optional command line option to fit best your
111
- needs, and to specify the target directory where your code is stored.
112
-
113
- ```
114
- $ dawn [options] target
54
+ $ gem install dawnscanner
115
55
  ```
116
56
 
117
- In case of need, there is a quick command line option reference running
118
- ```dawn -h``` at your OS prompt.
119
-
120
- ```
121
- $ dawn -h
122
- Usage: dawn [options] target_directory
123
-
124
- Examples:
125
- $ dawn a_sinatra_webapp_directory
126
- $ dawn -C the_rails_blog_engine
127
- $ dawn -C --json a_sinatra_webapp_directory
128
- $ dawn --ascii-tabular-report my_rails_blog_ecommerce
129
- $ dawn --html -F my_report.html my_rails_blog_ecommerce
130
-
131
- -G, --gem-lock force dawn to scan only for vulnerabilities affecting dependencies in Gemfile.lock (DEPRECATED)
132
- -d, --dependencies force dawn to scan only for vulnerabilities affecting dependencies in Gemfile.lock
133
-
134
- Reporting
135
-
136
- -a, --ascii-tabular-report cause dawn to format findings using tables in ascii art (DEPRECATED)
137
- -j, --json cause dawn to format findings using json
138
- -K, --console cause dawn to format findings using plain ascii text
139
- -C, --count-only dawn will only count vulnerabilities (useful for scripts)
140
- -z, --exit-on-warn dawn will return number of found vulnerabilities as exit code
141
- -F, --file filename tells dawn to write output to filename
142
- -c, --config-file filename tells dawn to load configuration from filename
143
-
144
- Disable security check family
145
-
146
- --disable-cve-bulletins disable all CVE security checks
147
- --disable-code-quality disable all code quality checks
148
- --disable-code-style disable all code style checks
149
- --disable-owasp-ror-cheatsheet disable all Owasp Ruby on Rails cheatsheet checks
150
- --disable-owasp-top-10 disable all Owasp Top 10 checks
151
-
152
- Flags useful to query Dawn
153
-
154
- -S, --search-knowledge-base [check_name] search check_name in the knowledge base
155
- --list-knowledge-base list knowledge-base content
156
- --list-known-families list security check families contained in dawn's knowledge base
157
- --list-known-framework list ruby MVC frameworks supported by dawn
158
- --list-scan-registry list past scan informations stored in scan registry
159
-
160
- Service flags
161
-
162
- -D, --debug enters dawn debug mode
163
- -V, --verbose the output will be more verbose
164
- -v, --version show version information
165
- -h, --help show this help
166
- ```
57
+ After that, you need to download the [knowledge
58
+ base](https://github.com/thesp0nge/dawn_knowledge_base/releases) from
59
+ Github and unpack the archive to ```$HOME/dawnscanner/kb``` directory.
167
60
 
168
- ### Rake task
169
-
170
- To include dawnscanner in your rake task list, you simply have to put this line in
171
- your ```Rakefile```
61
+ A typical kb directory layout is similar to this:
172
62
 
173
63
  ```
174
- require 'dawn/tasks'
64
+ $ ll ~/dawnscanner/kb
65
+ total 56K
66
+ drwxr-xr-x 2 thesp0nge users 28K 29 mar 18.27 bulletin
67
+ drwxr-xr-x 2 thesp0nge users 72 7 lug 2021 generic_check
68
+ -rw-r--r-- 1 thesp0nge users 65 29 mar 17.06 kb.yaml
69
+ -rw-r--r-- 1 thesp0nge users 74 29 mar 17.06 kb.yaml.sig
70
+ drwxr-xr-x 2 thesp0nge users 4,0K 7 lug 2021 owasp_ror_cheatsheet
175
71
  ```
176
72
 
177
- Then executing ```$ rake -T``` you will have a ```dawn:run``` task you want to
178
- execute.
73
+ The knowledge base is structured this way:
74
+ * bulletin is the folder where all CVE downloaded from NIST are stored.
75
+ * generic_check is the folder with all custom checks for your code
76
+ * owasp_ror_cheatsheet is for the Owasp Ruby on Rails cheatsheet
77
+ recomendations
179
78
 
180
- ```
181
- $ rake -T
182
- ...
183
- rake dawn:run # Execute dawnscanner on the current directory
184
- ...
185
- ```
186
-
187
- ### Interacting with the knowledge base
188
-
189
- You can dump all security checks in the knowledge base this way
190
-
191
- ```
192
- $ dawn --list-knowledge-base
193
- ```
194
-
195
- Useful in scripts, you can use ```--search-knowledge-base``` or ```-S``` with
196
- as parameter the check name you want to see if it's implemented as a security
197
- control or not.
198
-
199
- ```
200
- $ dawn -S CVE-2013-6421
201
- 07:59:30 [*] dawn v1.1.0 is starting up
202
- CVE-2013-6421 found in knowledgebase.
203
-
204
- $ dawn -S this_test_does_not_exist
205
- 08:02:17 [*] dawn v1.1.0 is starting up
206
- this_test_does_not_exist not found in knowledgebase
207
- ```
208
-
209
- ### dawnscanner security scan in action
79
+ ## Usage
210
80
 
211
- As output, dawnscanner will put all security checks that are failed during the scan.
81
+ Starting from version 2.0, the tool uses subcommands to start specific tasks,
82
+ each of them with specific help messages.
212
83
 
213
- This the result of Codedake::dawnscanner running against a
214
- [Sinatra 1.4.2 web application](https://github.com/thesp0nge/railsberry2013) wrote for a talk I
215
- delivered in 2013 at [Railsberry conference](http://www.railsberry.com).
84
+ ### Scanning a project
216
85
 
217
- As you may see, dawnscanner first detects MVC running the application by
218
- looking at Gemfile.lock, than it discards all security checks not appliable to
219
- Sinatra (49 security checks, in version 1.0, especially designed for Ruby on
220
- Rails) and it applies them.
86
+ The scan subcommand tells dawn to scan the specified target for security
87
+ issues.
221
88
 
222
89
  ```
223
- $ dawn ~/src/hacking/railsberry2013
224
- 18:40:27 [*] dawn v1.1.0 is starting up
225
- 18:40:27 [$] dawn: scanning /Users/thesp0nge/src/hacking/railsberry2013
226
- 18:40:27 [$] dawn: sinatra v1.4.2 detected
227
- 18:40:27 [$] dawn: applying all security checks
228
- 18:40:27 [$] dawn: 109 security checks applied - 0 security checks skipped
229
- 18:40:27 [$] dawn: 1 vulnerabilities found
230
- 18:40:27 [!] dawn: CVE-2013-1800 check failed
231
- 18:40:27 [$] dawn: Severity: high
232
- 18:40:27 [$] dawn: Priority: unknown
233
- 18:40:27 [$] dawn: Description: The crack gem 0.3.1 and earlier for Ruby does not properly restrict casts of string values, which might allow remote attackers to conduct object-injection attacks and execute arbitrary code, or cause a denial of service (memory and CPU consumption) by leveraging Action Pack support for (1) YAML type conversion or (2) Symbol type conversion, a similar vulnerability to CVE-2013-0156.
234
- 18:40:27 [$] dawn: Solution: Please use crack gem version 0.3.2 or above. Correct your gemfile
235
- 18:40:27 [$] dawn: Evidence:
236
- 18:40:27 [$] dawn: Vulnerable crack gem version found: 0.3.1
237
- 18:40:27 [*] dawn is leaving
90
+ $ dawn scan target
238
91
  ```
239
92
 
240
- ---
93
+ At the moment results are available in text format only and they are stored in
94
+ a directory named with the scan timestamp, under
95
+ $HOME/dawnscanner/results/target, where target is the name of the application
96
+ being analyzed.
241
97
 
242
- When you run dawnscanner on a web application with up to date dependencies,
243
- it's likely to return a friendly _no vulnerabilities found_ message. Keep it up
244
- working that way!
98
+ ### Querying the knowledge base
245
99
 
246
- This is dawnscanner running against a Padrino web application I wrote for [a
247
- scorecard quiz game about application security](http://scorecard.armoredcode.com).
248
- Italian language only. Sorry.
100
+ Is it possible, with the kb subcommand, to query the knowledge base.
249
101
 
250
102
  ```
251
- 18:42:39 [*] dawn v1.1.0 is starting up
252
- 18:42:39 [$] dawn: scanning /Users/thesp0nge/src/CORE_PROJECTS/scorecard
253
- 18:42:39 [$] dawn: padrino v0.11.2 detected
254
- 18:42:39 [$] dawn: applying all security checks
255
- 18:42:39 [$] dawn: 109 security checks applied - 0 security checks skipped
256
- 18:42:39 [*] dawn: no vulnerabilities found.
257
- 18:42:39 [*] dawn is leaving
103
+ dawn kb find # Searches the knowledge base for a given security test
104
+ dawn kb help [COMMAND] # Describe subcommands or one specific subcommand
105
+ dawn kb lint # Checks knowledge base content for correcteness
106
+ dawn kb status # Checks the status of the knowledge base
107
+ dawn kb unpack # Unpacks security checks in KB library path
258
108
  ```
259
109
 
260
- If you need a fancy HTML report about your scan, just ask it to dawnscanner
261
- with the ```--html``` flag used with the ```--file``` since I wanto to save the
262
- HTML to disk.
263
-
264
- ```
265
- $ dawn /Users/thesp0nge/src/hacking/rt_first_app --html --file report.html
266
-
267
- 09:00:54 [*] dawn v1.1.0 is starting up
268
- 09:00:54 [*] dawn: report.html created (2952 bytes)
269
- 09:00:54 [*] dawn is leaving
270
- ```
271
-
272
- ---
273
-
274
110
  ## Useful links
275
111
 
276
- Project homepage: [http://dawnscanner.org](http://dawnscanner.org)
277
-
278
112
  Twitter profile: [@dawnscanner](https://twitter.com/dawnscanner)
279
-
280
113
  Github repository: [https://github.com/thesp0nge/dawnscanner](https://github.com/thesp0nge/dawnscanner)
281
114
 
282
- Mailing list: [https://groups.google.com/forum/#!forum/dawnscanner](https://groups.google.com/forum/#!forum/dawnscanner)
283
115
 
284
116
  ## Support us
285
117
 
286
118
  Feedbacks are great and we really love to hear your voice.
287
119
 
288
- If you're a proud dawnscanner user, if you find it useful, if you integrated
120
+ If you're a proud dawn user, if you find it useful, if you integrated
289
121
  it in your release process and if you want to openly support the project you
290
122
  can put your reference here. Just open an
291
123
  [issue](https://github.com/thesp0nge/dawnscanner/issues/new) with a statement saying
292
124
  how do you feel the tool and your company logo if any.
293
125
 
294
- More easily you can drop an email to
295
- [paolo@dawnscanner.org](mailto:paolo@dawnscanner.org) sending a statement about your
296
- success story and I'll put on the website.
297
-
298
126
  Thank you.
299
127
 
300
128
  ## Thanks to
@@ -310,7 +138,7 @@ Thank you.
310
138
 
311
139
  ## LICENSE
312
140
 
313
- Copyright (c) 2013-2016 Paolo Perego <paolo@dawnscanner.org>
141
+ Copyright (c) 2013-2023 Paolo Perego <paolo@armoredcode.com>
314
142
 
315
143
  MIT License
316
144
 
@@ -332,7 +160,3 @@ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
332
160
  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
333
161
  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
334
162
  WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
335
-
336
-
337
-
338
-
data/VERSION CHANGED
@@ -1,3 +1,3 @@
1
1
  # I removed codenames :-)
2
2
  # Code review is fun
3
- 2.0.0.rc5
3
+ 2.0.0
@@ -0,0 +1 @@
1
+ a3c19b2d55316c328e45c0f316216b56397f4ef3
data/code_of_conduct.md CHANGED
@@ -55,7 +55,7 @@ further defined and clarified by project maintainers.
55
55
  ## Enforcement
56
56
 
57
57
  Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
- reported by contacting the project team at paolo@dawnscanner.org. All
58
+ reported by contacting the project team at paolo@armoredcode.com. All
59
59
  complaints will be reviewed and investigated and will result in a response that
60
60
  is deemed necessary and appropriate to the circumstances. The project team is
61
61
  obligated to maintain confidentiality with regard to the reporter of an incident.
data/dawnscanner.gemspec CHANGED
@@ -1,7 +1,5 @@
1
1
  # -*- encoding: utf-8 -*-
2
- lib = File.expand_path('../lib', __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'dawn/version'
2
+ require_relative 'lib/dawn/version'
5
3
 
6
4
  Gem::Specification.new do |gem|
7
5
  gem.name = "dawnscanner"
@@ -90,14 +90,6 @@ module Dawn
90
90
 
91
91
  debug_me($config)
92
92
 
93
- $telemetry_url = $config[:telemetry][:endpoint] if $config[:telemetry][:enabled]
94
- debug_me("telemetry url is " + $telemetry_url) unless @telemetry_url.nil?
95
-
96
- $telemetry_id = $config[:telemetry][:id] if $config[:telemetry][:enabled]
97
- debug_me("telemetry id is " + $telemetry_id) unless @telemetry_id.nil?
98
-
99
- debug_me("telemetry is disabled in config file") unless $config[:telemetry][:enabled]
100
-
101
93
  engine = Dawn::Core.detect_mvc(target) unless options[:gemfile]
102
94
  engine = Dawn::GemfileLock.new(target) if options[:gemfile]
103
95
 
@@ -127,6 +119,7 @@ module Dawn
127
119
  end
128
120
 
129
121
  $logger.info("#{engine.count_vulnerabilities} issues found")
122
+ $logger.info("#{engine.checks.count} checks applied")
130
123
 
131
124
  Dawn::Reporter.new({:engine=>engine, :apply_all_code=>ret}).report
132
125
  $logger.bye
data/lib/dawn/core.rb CHANGED
@@ -123,7 +123,7 @@ module Dawn
123
123
 
124
124
  # If create_if_none flag is set to true, than I'll create a config file
125
125
  # on the current directory with the default configuration.
126
- conf = {:verbose=>false, :output=>"tabular", :mvc=>"", :gemfile_scan=>false, :gemfile_name=>"", :filename=>nil, :debug=>false, :exit_on_warn => false, :enabled_checks=> Dawn::Kb::BasicCheck::ALLOWED_FAMILIES, :telemetry=>{:enabled=>false, :endpoint=>"", :id=>""}}
126
+ conf = {:verbose=>false, :output=>"tabular", :mvc=>"", :gemfile_scan=>false, :gemfile_name=>"", :filename=>nil, :debug=>false, :exit_on_warn => false, :enabled_checks=> Dawn::Kb::BasicCheck::ALLOWED_FAMILIES}
127
127
 
128
128
  # Calculate the conf file path
129
129
  conf_path = File.expand_path('~') +'/.'+conf_name
@@ -138,7 +138,7 @@ module Dawn
138
138
  end
139
139
 
140
140
  def self.read_conf(file=nil)
141
- conf = {:verbose=>false, :output=>"tabular", :mvc=>"", :gemfile_scan=>false, :gemfile_name=>"", :filename=>nil, :debug=>false, :exit_on_warn => false, :enabled_checks=> Dawn::Kb::BasicCheck::ALLOWED_FAMILIES, :telemetry=>{:enabled=>false, :endpoint=>"", :id=>""}}
141
+ conf = {:verbose=>false, :output=>"tabular", :mvc=>"", :gemfile_scan=>false, :gemfile_name=>"", :filename=>nil, :debug=>false, :exit_on_warn => false, :enabled_checks=> Dawn::Kb::BasicCheck::ALLOWED_FAMILIES}
142
142
  begin
143
143
  debug_me("returning a default config") if file.nil? or ! File.exist?(file)
144
144
  return conf if file.nil?
@@ -151,7 +151,6 @@ module Dawn
151
151
 
152
152
  cf = YAML.load_file(file)
153
153
 
154
- tm = cf[:telemetry]
155
154
  cc = cf[:enabled_checks]
156
155
 
157
156
  # TODO
@@ -160,7 +159,6 @@ module Dawn
160
159
  conf[:debug] = cf["debug"] unless cf["debug"].nil?
161
160
  conf[:output] = cf["output"] unless cf["output"].nil?
162
161
  conf[:enabled_checks] = cc unless cc.nil?
163
- conf[:telemetry] = tm unless tm.nil?
164
162
 
165
163
  return conf
166
164
  end
data/lib/dawn/engine.rb CHANGED
@@ -270,8 +270,6 @@ module Dawn
270
270
  # otherwise
271
271
  def apply(name)
272
272
 
273
- telemetry
274
-
275
273
  # FIXME.20140325
276
274
  # Now if no checks are loaded because knowledge base was not previously called, apply and apply_all proudly refuse to run.
277
275
  # Reason is simple, load_knowledge_base now needs enabled check array
@@ -293,66 +291,13 @@ module Dawn
293
291
  false
294
292
  end
295
293
 
296
- def have_a_telemetry_id?
297
- debug_me ($telemetry_id != "" and ! $telemetry_id.nil?)
298
- return ($telemetry_id != "" and ! $telemetry_id.nil?)
299
-
300
- end
301
-
302
- def get_a_telemetry_id
303
- return "" if ($telemetry_url == "" or $telemetry_url.nil?)
304
- debug_me("T: " + $telemetry_url)
305
-
306
- url = URI.parse($telemetry_url+"/new")
307
- res = Net::HTTP.get_response(url)
308
-
309
- return "" unless res.code.to_i == 200
310
- return JSON.parse(res.body)["uuid"]
311
- end
312
-
313
- def telemetry
314
- unless $config[:telemetry][:enabled]
315
- debug_me("telemetry is disabled")
316
- return false
317
- end
318
-
319
- unless have_a_telemetry_id?
320
- $telemetry_id = get_a_telemetry_id
321
- $config[:telemetry][:id] = $telemetry_id
322
- debug_me($config)
323
- debug_me("saving config to " + $config_name)
324
- File.open($config_name, 'w') { |f| f.write $config.to_yaml }
325
- end
326
294
 
327
- debug_me("Telemetry ID is: " + $telemetry_id)
328
-
329
- uri=URI.parse($telemetry_url+"/"+$telemetry_id)
330
- header = {'Content-Type': 'text/json'}
331
- tele = { "kb_version" => Dawn::KnowledgeBase::VERSION ,
332
- "ip" => Socket.ip_address_list.detect{|intf| intf.ipv4_private?}.ip_address,
333
- "message"=> Dawn::KnowledgeBase
334
- }
335
- http = Net::HTTP.new(uri.host, uri.port)
336
- request = Net::HTTP::Post.new(uri.request_uri, header)
337
- request.body = tele.to_json
338
-
339
- begin
340
- response=http.request(request)
341
- debug_me(response.inspect)
342
- return true
343
- rescue => e
344
- $logger.error "telemetry: #{e.message}"
345
- return false
346
- end
347
- end
348
295
 
349
296
  def apply_all(checks_to_be_skipped=[])
350
297
  @scan_start = Time.now
351
298
  debug_me("I'm asked to skip those checks #{checks_to_be_skipped}")
352
299
  debug_me("SCAN STARTED: #{@scan_start}")
353
300
 
354
- telemetry
355
-
356
301
  if @checks.nil?
357
302
  $logger.error "you must load knowledge base before trying to apply security checks"
358
303
  @scan_stop = Time.now
@@ -456,15 +401,15 @@ module Dawn
456
401
  vc = nil
457
402
  vc = check.vulnerable_checks if check.kind == Dawn::KnowledgeBase::COMBO_CHECK
458
403
 
459
- @vulnerabilities << {:name=> check.name,
460
- :severity=>check.severity,
461
- :priority=>check.priority,
462
- :kind=>check.check_family,
463
- :message=>check.message,
464
- :remediation=>check.remediation,
465
- :evidences=>check.evidences,
466
- :cve_link=>check.cve_link,
467
- :cvss_score=>check.cvss_score,
404
+ @vulnerabilities << {:name=> check.name || "CVE-XXXX-YYYY",
405
+ :severity=>check.severity || "Unknown severity",
406
+ :priority=>check.priority || "Unknown priority",
407
+ :kind=>check.check_family || "Unknown kind",
408
+ :message=>check.message || "",
409
+ :remediation=>check.remediation || "",
410
+ :evidences=>check.evidences || [],
411
+ :cve_link=>check.cve_link || "No link",
412
+ :cvss_score=>check.cvss_score || "No score",
468
413
  :vulnerable_checks=>vc}
469
414
 
470
415
  end
@@ -31,6 +31,8 @@ module Dawn
31
31
  @dependencies.each do |dep|
32
32
  unless @vulnerable_version_array.nil? or @vulnerable_version_array.empty?
33
33
  if dep[:name] == @vulnerable_version_array[0][:name]
34
+ debug_me("DEP VERSION #{dep[:version]}")
35
+ debug_me("VULN_VER #{@vulnerable_version_array[0][:version]}")
34
36
  return false if @vulnerable_version_array[0][:version].nil? or @vulnerable_version_array[0][:version].empty?
35
37
  return true if @vulnerable_version_array[0][:version].include? dep[:version]
36
38
  end
data/lib/dawn/version.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  module Dawn
2
- VERSION = "2.0.0.rc5"
3
- RELEASE = "20230329"
4
- BUILD = "9"
5
- COMMIT = "gb57cda0"
2
+ VERSION = "2.0.0"
3
+ RELEASE = "20230413"
4
+ BUILD = "13"
5
+ COMMIT = "g23e6a59"
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dawnscanner
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.rc5
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paolo Perego
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-03-29 00:00:00.000000000 Z
11
+ date: 2023-04-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cvss
@@ -276,6 +276,7 @@ files:
276
276
  - checksum/dawnscanner-2.0.0.rc1.gem.sha1
277
277
  - checksum/dawnscanner-2.0.0.rc2.gem.sha1
278
278
  - checksum/dawnscanner-2.0.0.rc3.gem.sha1
279
+ - checksum/dawnscanner-2.0.0.rc5.gem.sha1
279
280
  - code_of_conduct.md
280
281
  - dawnscanner.gemspec
281
282
  - doc/change.sh
@@ -356,9 +357,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
356
357
  version: 2.3.0
357
358
  required_rubygems_version: !ruby/object:Gem::Requirement
358
359
  requirements:
359
- - - ">"
360
+ - - ">="
360
361
  - !ruby/object:Gem::Version
361
- version: 1.3.1
362
+ version: '0'
362
363
  requirements: []
363
364
  rubygems_version: 3.3.26
364
365
  signing_key: