owasp-glue 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGES +27 -0
  3. data/FEATURES +19 -0
  4. data/README.md +117 -0
  5. data/bin/glue +67 -0
  6. data/lib/glue.rb +317 -0
  7. data/lib/glue/event.rb +14 -0
  8. data/lib/glue/filters.rb +41 -0
  9. data/lib/glue/filters/base_filter.rb +19 -0
  10. data/lib/glue/filters/jira_one_time_filter.rb +57 -0
  11. data/lib/glue/filters/remove_all_filter.rb +16 -0
  12. data/lib/glue/filters/zap_consdensing_filter.rb +76 -0
  13. data/lib/glue/finding.rb +52 -0
  14. data/lib/glue/mounters.rb +55 -0
  15. data/lib/glue/mounters/base_mounter.rb +31 -0
  16. data/lib/glue/mounters/docker_mounter.rb +44 -0
  17. data/lib/glue/mounters/filesystem_mounter.rb +20 -0
  18. data/lib/glue/mounters/git_mounter.rb +52 -0
  19. data/lib/glue/mounters/iso_mounter.rb +42 -0
  20. data/lib/glue/mounters/url_mounter.rb +28 -0
  21. data/lib/glue/options.rb +269 -0
  22. data/lib/glue/reporters.rb +50 -0
  23. data/lib/glue/reporters/base_reporter.rb +21 -0
  24. data/lib/glue/reporters/csv_reporter.rb +19 -0
  25. data/lib/glue/reporters/jira_reporter.rb +59 -0
  26. data/lib/glue/reporters/json_reporter.rb +20 -0
  27. data/lib/glue/reporters/text_reporter.rb +19 -0
  28. data/lib/glue/scanner.rb +28 -0
  29. data/lib/glue/tasks.rb +124 -0
  30. data/lib/glue/tasks/av.rb +42 -0
  31. data/lib/glue/tasks/base_task.rb +80 -0
  32. data/lib/glue/tasks/brakeman.rb +58 -0
  33. data/lib/glue/tasks/bundle-audit.rb +95 -0
  34. data/lib/glue/tasks/checkmarx.rb +60 -0
  35. data/lib/glue/tasks/dawnscanner.rb +55 -0
  36. data/lib/glue/tasks/eslint.rb +69 -0
  37. data/lib/glue/tasks/fim.rb +60 -0
  38. data/lib/glue/tasks/findsecbugs.rb +90 -0
  39. data/lib/glue/tasks/npm.rb +58 -0
  40. data/lib/glue/tasks/nsp.rb +65 -0
  41. data/lib/glue/tasks/owasp-dep-check.rb +117 -0
  42. data/lib/glue/tasks/patterns.json +394 -0
  43. data/lib/glue/tasks/pmd.rb +63 -0
  44. data/lib/glue/tasks/retirejs.rb +107 -0
  45. data/lib/glue/tasks/scanjs-eslintrc +106 -0
  46. data/lib/glue/tasks/scanjs.rb +31 -0
  47. data/lib/glue/tasks/sfl.rb +67 -0
  48. data/lib/glue/tasks/snyk.rb +81 -0
  49. data/lib/glue/tasks/test.rb +47 -0
  50. data/lib/glue/tasks/zap.rb +99 -0
  51. data/lib/glue/tracker.rb +47 -0
  52. data/lib/glue/util.rb +36 -0
  53. data/lib/glue/version.rb +3 -0
  54. metadata +294 -0
@@ -0,0 +1,117 @@
1
+ require 'glue/tasks/base_task'
2
+ require 'glue/util'
3
+ require 'rexml/document'
4
+ require 'rexml/streamlistener'
5
+ include REXML
6
+
7
+ # SAX Like Parser for OWASP DEP CHECK XML.
8
+ class Glue::DepCheckListener
9
+ include StreamListener
10
+
11
+ def initialize(task)
12
+ @task = task
13
+ @count = 0
14
+ @sw = ""
15
+ @url = ""
16
+ @desc = ""
17
+ @cwe = ""
18
+ @cvss = ""
19
+ @name = ""
20
+ @fingerprint = ""
21
+ end
22
+
23
+ def tag_start(name, attrs)
24
+ case name
25
+ when "vulnerability"
26
+ @count = @count + 1
27
+ # Glue.debug "Grabbed #{@count} vulns."
28
+ @sw = ""
29
+ @url = ""
30
+ @desc = ""
31
+ @cwe = ""
32
+ @cvss = ""
33
+ @name = ""
34
+ @fingerprint = ""
35
+ end
36
+ end
37
+
38
+ def tag_end(name)
39
+ case name
40
+ when "name"
41
+ if @text =~ /\D/
42
+ @name = @text
43
+ end
44
+ when "cvssScore"
45
+ @cvss = @text
46
+ when "cwe"
47
+ @cwe = @text
48
+ when "description"
49
+ @desc = @text
50
+ when "vulnerableSoftware"
51
+ @sw = ""
52
+ when "software"
53
+ @sw << ", " << @text
54
+ when "url"
55
+ @url << ", " << @text
56
+ when "vulnerability"
57
+ detail = @sw + "\n"+ @url
58
+ description = @desc + "\n" + @cwe
59
+ @fingerprint = @sw+"-"+@name
60
+ puts "Fingerprint: #{@fingerprint}"
61
+ puts "Vuln: #{@name} CVSS: #{@cvss} Description #{description} Detail #{detail}"
62
+ @task.report @name, description, detail, @cvss, @fingerprint
63
+ end
64
+ end
65
+
66
+ def text(text)
67
+ @text = text
68
+ end
69
+ end
70
+
71
+ class Glue::OWASPDependencyCheck < Glue::BaseTask
72
+
73
+ Glue::Tasks.add self
74
+ include Glue::Util
75
+
76
+ def initialize(trigger,tracker)
77
+ super(trigger,tracker)
78
+ @name = "OWASP Dependency Check"
79
+ @description = "Dependency analysis for Java and .NET"
80
+ @stage = :code
81
+ @labels << "code" << "java" << ".net"
82
+ end
83
+
84
+ def run
85
+ Glue.notify "#{@name}"
86
+ rootpath = @trigger.path
87
+ @result= runsystem(true, "/home/glue/tools/dependency-check/bin/dependency-check.sh", "-a", "Glue", "-f", "XML", "-out", "#{rootpath}", "-s", "#{rootpath}")
88
+ end
89
+
90
+ def analyze
91
+ path = @trigger.path + "/dependency-check-report.xml"
92
+ begin
93
+ Glue.debug "Parsing report #{path}"
94
+ get_warnings(path)
95
+ rescue Exception => e
96
+ Glue.notify "Problem running OWASP Dep Check ... skipped."
97
+ Glue.notify e.message
98
+ raise e
99
+ end
100
+ end
101
+
102
+ def supported?
103
+ supported=runsystem(true, "/home/pipe/line/tools//dependency-check/bin/dependency-check.sh", "-v")
104
+ if supported =~ /command not found/
105
+ Glue.notify "Install dependency-check."
106
+ return false
107
+ else
108
+ return true
109
+ end
110
+ end
111
+
112
+ def get_warnings(path)
113
+ listener = Glue::DepCheckListener.new(self)
114
+ parser = Parsers::StreamParser.new(File.new(path), listener)
115
+ parser.parse
116
+ end
117
+ end
@@ -0,0 +1,394 @@
1
+ [
2
+ {
3
+ "part": "filename",
4
+ "type": "regex",
5
+ "pattern": "\\A.*_rsa\\z",
6
+ "caption": "Private SSH key",
7
+ "description": null
8
+ },
9
+ {
10
+ "part": "filename",
11
+ "type": "regex",
12
+ "pattern": "\\A.*_dsa\\z",
13
+ "caption": "Private SSH key",
14
+ "description": null
15
+ },
16
+ {
17
+ "part": "filename",
18
+ "type": "regex",
19
+ "pattern": "\\A.*_ed25519\\z",
20
+ "caption": "Private SSH key",
21
+ "description": null
22
+ },
23
+ {
24
+ "part": "filename",
25
+ "type": "regex",
26
+ "pattern": "\\A.*_ecdsa\\z",
27
+ "caption": "Private SSH key",
28
+ "description": null
29
+ },
30
+ {
31
+ "part": "extension",
32
+ "type": "match",
33
+ "pattern": "pem",
34
+ "caption": "Potential cryptographic private key",
35
+ "description": null
36
+ },
37
+ {
38
+ "part": "extension",
39
+ "type": "regex",
40
+ "pattern": "\\Akey(pair)?\\z",
41
+ "caption": "Potential cryptographic private key",
42
+ "description": null
43
+ },
44
+ {
45
+ "part": "extension",
46
+ "type": "match",
47
+ "pattern": "pkcs12",
48
+ "caption": "Potential cryptographic key bundle",
49
+ "description": null
50
+ },
51
+ {
52
+ "part": "extension",
53
+ "type": "match",
54
+ "pattern": "pfx",
55
+ "caption": "Potential cryptographic key bundle",
56
+ "description": null
57
+ },
58
+ {
59
+ "part": "extension",
60
+ "type": "match",
61
+ "pattern": "p12",
62
+ "caption": "Potential cryptographic key bundle",
63
+ "description": null
64
+ },
65
+ {
66
+ "part": "extension",
67
+ "type": "match",
68
+ "pattern": "asc",
69
+ "caption": "Potential cryptographic key bundle",
70
+ "description": null
71
+ },
72
+ {
73
+ "part": "filename",
74
+ "type": "match",
75
+ "pattern": "otr.private_key",
76
+ "caption": "Pidgin OTR private key",
77
+ "description": null
78
+ },
79
+ {
80
+ "part": "filename",
81
+ "type": "regex",
82
+ "pattern": "\\A\\.?(bash_|zsh_|z)?history\\z",
83
+ "caption": "Shell command history file",
84
+ "description": null
85
+ },
86
+ {
87
+ "part": "filename",
88
+ "type": "regex",
89
+ "pattern": "\\A\\.?mysql_history\\z",
90
+ "caption": "MySQL client command history file",
91
+ "description": null
92
+ },
93
+ {
94
+ "part": "filename",
95
+ "type": "regex",
96
+ "pattern": "\\A\\.?psql_history\\z",
97
+ "caption": "PostgreSQL client command history file",
98
+ "description": null
99
+ },
100
+ {
101
+ "part": "filename",
102
+ "type": "regex",
103
+ "pattern": "\\A\\.?irb_history\\z",
104
+ "caption": "Ruby IRB console history file",
105
+ "description": null
106
+ },
107
+ {
108
+ "part": "path",
109
+ "type": "regex",
110
+ "pattern": "\\.?purple\\/accounts\\.xml\\z",
111
+ "caption": "Pidgin chat client account configuration file",
112
+ "description": null
113
+ },
114
+ {
115
+ "part": "path",
116
+ "type": "regex",
117
+ "pattern": "\\.?xchat2?\\/servlist_?\\.conf\\z",
118
+ "caption": "Hexchat/XChat IRC client server list configuration file",
119
+ "description": null
120
+ },
121
+ {
122
+ "part": "path",
123
+ "type": "regex",
124
+ "pattern": "\\.?irssi\\/config\\z",
125
+ "caption": "Irssi IRC client configuration file",
126
+ "description": null
127
+ },
128
+ {
129
+ "part": "path",
130
+ "type": "regex",
131
+ "pattern": "\\.?recon-ng\\/keys\\.db\\z",
132
+ "caption": "Recon-ng web reconnaissance framework API key database",
133
+ "description": null
134
+ },
135
+ {
136
+ "part": "filename",
137
+ "type": "regex",
138
+ "pattern": "\\A\\.?dbeaver-data-sources.xml\\z",
139
+ "caption": "DBeaver SQL database manager configuration file",
140
+ "description": null
141
+ },
142
+ {
143
+ "part": "filename",
144
+ "type": "regex",
145
+ "pattern": "\\A\\.?muttrc\\z",
146
+ "caption": "Mutt e-mail client configuration file",
147
+ "description": null
148
+ },
149
+ {
150
+ "part": "filename",
151
+ "type": "regex",
152
+ "pattern": "\\A\\.?s3cfg\\z",
153
+ "caption": "S3cmd configuration file",
154
+ "description": null
155
+ },
156
+ {
157
+ "part": "filename",
158
+ "type": "regex",
159
+ "pattern": "\\A\\.?trc\\z",
160
+ "caption": "T command-line Twitter client configuration file",
161
+ "description": null
162
+ },
163
+ {
164
+ "part": "extension",
165
+ "type": "match",
166
+ "pattern": "ovpn",
167
+ "caption": "OpenVPN client configuration file",
168
+ "description": null
169
+ },
170
+ {
171
+ "part": "filename",
172
+ "type": "regex",
173
+ "pattern": "\\A\\.?gitrobrc\\z",
174
+ "caption": "Well, this is awkward... Gitrob configuration file",
175
+ "description": null
176
+ },
177
+ {
178
+ "part": "filename",
179
+ "type": "regex",
180
+ "pattern": "\\A\\.?(bash|zsh)rc\\z",
181
+ "caption": "Shell configuration file",
182
+ "description": "Shell configuration files might contain information such as server hostnames, passwords and API keys."
183
+ },
184
+ {
185
+ "part": "filename",
186
+ "type": "regex",
187
+ "pattern": "\\A\\.?(bash_|zsh_)?profile\\z",
188
+ "caption": "Shell profile configuration file",
189
+ "description": "Shell configuration files might contain information such as server hostnames, passwords and API keys."
190
+ },
191
+ {
192
+ "part": "filename",
193
+ "type": "regex",
194
+ "pattern": "\\A\\.?(bash_|zsh_)?aliases\\z",
195
+ "caption": "Shell command alias configuration file",
196
+ "description": "Shell configuration files might contain information such as server hostnames, passwords and API keys."
197
+ },
198
+ {
199
+ "part": "filename",
200
+ "type": "match",
201
+ "pattern": "secret_token.rb",
202
+ "caption": "Ruby On Rails secret token configuration file",
203
+ "description": "If the Rails secret token is known, it can allow for remote code execution. (http://www.exploit-db.com/exploits/27527/)"
204
+ },
205
+ {
206
+ "part": "filename",
207
+ "type": "match",
208
+ "pattern": "omniauth.rb",
209
+ "caption": "OmniAuth configuration file",
210
+ "description": "The OmniAuth configuration file might contain client application secrets."
211
+ },
212
+ {
213
+ "part": "filename",
214
+ "type": "match",
215
+ "pattern": "carrierwave.rb",
216
+ "caption": "Carrierwave configuration file",
217
+ "description": "Can contain credentials for online storage systems such as Amazon S3 and Google Storage."
218
+ },
219
+ {
220
+ "part": "filename",
221
+ "type": "match",
222
+ "pattern": "schema.rb",
223
+ "caption": "Ruby On Rails database schema file",
224
+ "description": "Contains information on the database schema of a Ruby On Rails application."
225
+ },
226
+ {
227
+ "part": "filename",
228
+ "type": "match",
229
+ "pattern": "database.yml",
230
+ "caption": "Potential Ruby On Rails database configuration file",
231
+ "description": "Might contain database credentials."
232
+ },
233
+ {
234
+ "part": "filename",
235
+ "type": "match",
236
+ "pattern": "settings.py",
237
+ "caption": "Django configuration file",
238
+ "description": "Might contain database credentials, online storage system credentials, secret keys, etc."
239
+ },
240
+ {
241
+ "part": "filename",
242
+ "type": "regex",
243
+ "pattern": "\\A(.*)?config(\\.inc)?\\.php\\z",
244
+ "caption": "PHP configuration file",
245
+ "description": "Might contain credentials and keys."
246
+ },
247
+ {
248
+ "part": "extension",
249
+ "type": "match",
250
+ "pattern": "kdb",
251
+ "caption": "KeePass password manager database file",
252
+ "description": null
253
+ },
254
+ {
255
+ "part": "extension",
256
+ "type": "match",
257
+ "pattern": "agilekeychain",
258
+ "caption": "1Password password manager database file",
259
+ "description": null
260
+ },
261
+ {
262
+ "part": "extension",
263
+ "type": "match",
264
+ "pattern": "keychain",
265
+ "caption": "Apple Keychain database file",
266
+ "description": null
267
+ },
268
+ {
269
+ "part": "extension",
270
+ "type": "regex",
271
+ "pattern": "\\Akey(store|ring)\\z",
272
+ "caption": "GNOME Keyring database file",
273
+ "description": null
274
+ },
275
+ {
276
+ "part": "extension",
277
+ "type": "match",
278
+ "pattern": "log",
279
+ "caption": "Log file",
280
+ "description": "Log files might contain information such as references to secret HTTP endpoints, session IDs, user information, passwords and API keys."
281
+ },
282
+ {
283
+ "part": "extension",
284
+ "type": "match",
285
+ "pattern": "pcap",
286
+ "caption": "Network traffic capture file",
287
+ "description": null
288
+ },
289
+ {
290
+ "part": "extension",
291
+ "type": "regex",
292
+ "pattern": "\\Asql(dump)?\\z",
293
+ "caption": "SQL dump file",
294
+ "description": null
295
+ },
296
+ {
297
+ "part": "extension",
298
+ "type": "match",
299
+ "pattern": "gnucash",
300
+ "caption": "GnuCash database file",
301
+ "description": null
302
+ },
303
+ {
304
+ "part": "filename",
305
+ "type": "regex",
306
+ "pattern": "backup",
307
+ "caption": "Contains word: backup",
308
+ "description": null
309
+ },
310
+ {
311
+ "part": "filename",
312
+ "type": "regex",
313
+ "pattern": "dump",
314
+ "caption": "Contains word: dump",
315
+ "description": null
316
+ },
317
+ {
318
+ "part": "filename",
319
+ "type": "regex",
320
+ "pattern": "password",
321
+ "caption": "Contains word: password",
322
+ "description": null
323
+ },
324
+ {
325
+ "part": "filename",
326
+ "type": "regex",
327
+ "pattern": "private.*key",
328
+ "caption": "Contains words: private, key",
329
+ "description": null
330
+ },
331
+ {
332
+ "part": "filename",
333
+ "type": "match",
334
+ "pattern": "jenkins.plugins.publish_over_ssh.BapSshPublisherPlugin.xml",
335
+ "caption": "Jenkins publish over SSH plugin file",
336
+ "description": null
337
+ },
338
+ {
339
+ "part": "filename",
340
+ "type": "match",
341
+ "pattern": "credentials.xml",
342
+ "caption": "Potential Jenkins credentials file",
343
+ "description": null
344
+ },
345
+ {
346
+ "part": "filename",
347
+ "type": "regex",
348
+ "pattern": "\\A\\.?htpasswd\\z",
349
+ "caption": "Apache htpasswd file",
350
+ "description": null
351
+ },
352
+ {
353
+ "part": "filename",
354
+ "type": "regex",
355
+ "pattern": "\\A\\.?netrc\\z",
356
+ "caption": "Configuration file for auto-login process",
357
+ "description": "Might contain username and password."
358
+ },
359
+ {
360
+ "part": "extension",
361
+ "type": "match",
362
+ "pattern": "kwallet",
363
+ "caption": "KDE Wallet Manager database file",
364
+ "description": null
365
+ },
366
+ {
367
+ "part": "filename",
368
+ "type": "match",
369
+ "pattern": "LocalSettings.php",
370
+ "caption": "Potential MediaWiki configuration file",
371
+ "description": null
372
+ },
373
+ {
374
+ "part": "extension",
375
+ "type": "match",
376
+ "pattern": "tblk",
377
+ "caption": "Tunnelblick VPN configuration file",
378
+ "description": null
379
+ },
380
+ {
381
+ "part": "path",
382
+ "type": "regex",
383
+ "pattern": "\\A\\.?gem/credentials\\z",
384
+ "caption": "Rubygems credentials file",
385
+ "description": "Might contain API key for a rubygems.org account."
386
+ },
387
+ {
388
+ "part": "filename",
389
+ "type": "regex",
390
+ "pattern": "\\A*\\.pubxml(\\.user)?\\z",
391
+ "caption": "Potential MSBuild publish profile",
392
+ "description": null
393
+ }
394
+ ]