metasploit_data_models 2.0.9 → 2.0.10

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
  SHA1:
3
- metadata.gz: 68993323d9d315d4b1f73688ffc1692fa5d02bcc
4
- data.tar.gz: b49feeb97bc0e3ed89f9f1e3a73d09431d3bb579
3
+ metadata.gz: 70db351f3274f8e22c99897e9ee4febd348d3d22
4
+ data.tar.gz: cf7cf03e4a06f8735c7ad27c8e8f370592d435f9
5
5
  SHA512:
6
- metadata.gz: ac2a5b0f5a99211bfaa52bae1af30e1be14f8f441f64796fe536549d7f1be9d7ec591e2fe4e66ba086ce56b783dc326ffa6451f7fd3145df204bb932fcd96f42
7
- data.tar.gz: 260dd10da7bede6d443989501d19545f84faffdfaa734c155827b0d2446fcdef88ba45af800f62ae70777934d6f84324cd7544e13a35ad7ffd9167f91f21b23f
6
+ metadata.gz: 30dac12c039790293a1dbefb23721d44878e8f86d87b768ddbde27d33904e7ce7563c4a9defdab7383d9fcea62a143b0a06fbacee81d622d278bf34e35a898ee
7
+ data.tar.gz: 4d14a6744deb4951cfb8405227b44ce3b337e44079ba69556a8cb9617873d0125efffcac286a25b2d83f56cd6d34c4ee2f1371b6d4f43fcb80ee09370639ee44
checksums.yaml.gz.sig CHANGED
Binary file
@@ -2,7 +2,7 @@
2
2
  # {Mdm::Module} namespace.
3
3
  class Mdm::Module::Detail < ActiveRecord::Base
4
4
  self.table_name = 'module_details'
5
-
5
+
6
6
  #
7
7
  # CONSTANTS
8
8
  #
@@ -192,6 +192,74 @@ class Mdm::Module::Detail < ActiveRecord::Base
192
192
  #
193
193
  # @return ['active', 'passive', nil]
194
194
 
195
+ #
196
+ # Scopes
197
+ #
198
+
199
+ scope :module_arch, ->(values) {
200
+ joins(Mdm::Module::Detail.join_association(:archs,Arel::Nodes::OuterJoin)).
201
+ where(Mdm::Module::Arch[:name].matches_any(values))
202
+ }
203
+
204
+ scope :module_author, ->(values) {
205
+ joins(Mdm::Module::Detail.join_association(:authors, Arel::Nodes::OuterJoin)).
206
+ where(
207
+ Mdm::Module::Author[:email].matches_any(values).or(
208
+ Mdm::Module::Author[:name].matches_any(values)
209
+ )
210
+ )
211
+ }
212
+
213
+ scope :module_name, ->(values) {
214
+ where(
215
+ Mdm::Module::Detail[:fullname].matches_any(values).or(
216
+ Mdm::Module::Detail[:name].matches_any(values)
217
+ )
218
+ )
219
+ }
220
+
221
+ scope :module_os_or_platform, ->(values) {
222
+ joins(
223
+ Mdm::Module::Detail.join_association(:platforms, Arel::Nodes::OuterJoin),
224
+ Mdm::Module::Detail.join_association(:targets, Arel::Nodes::OuterJoin)
225
+ ).where(
226
+ Mdm::Module::Platform[:name].matches_any(values).or(
227
+ Mdm::Module::Target[:name].matches_any(values)
228
+ )
229
+ )
230
+ }
231
+
232
+ scope :module_ref, ->(values) {
233
+ joins(Mdm::Module::Detail.join_association(:refs, Arel::Nodes::OuterJoin)).
234
+ where(Mdm::Module::Ref[:name].matches_any(values))
235
+ }
236
+
237
+ scope :module_stance, ->(values) { where(Mdm::Module::Detail[:stance].matches_any(values)) }
238
+
239
+ scope :module_text, ->(values) {
240
+ joins(
241
+ Mdm::Module::Detail.join_association(:actions, Arel::Nodes::OuterJoin),
242
+ Mdm::Module::Detail.join_association(:archs, Arel::Nodes::OuterJoin),
243
+ Mdm::Module::Detail.join_association(:authors, Arel::Nodes::OuterJoin),
244
+ Mdm::Module::Detail.join_association(:platforms, Arel::Nodes::OuterJoin),
245
+ Mdm::Module::Detail.join_association(:refs, Arel::Nodes::OuterJoin),
246
+ Mdm::Module::Detail.join_association(:targets, Arel::Nodes::OuterJoin)
247
+ ).where(
248
+ Mdm::Module::Detail[:description].matches_any(values).or(
249
+ Mdm::Module::Detail[:fullname].matches_any(values).or(
250
+ Mdm::Module::Detail[:name].matches_any(values).or(
251
+ Mdm::Module::Action[:name].matches_any(values).or(
252
+ Mdm::Module::Arch[:name].matches_any(values).or(
253
+ Mdm::Module::Author[:name].matches_any(values).or(
254
+ Mdm::Module::Platform[:name].matches_any(values).or(
255
+ Mdm::Module::Ref[:name].matches_any(values).or(
256
+ Mdm::Module::Target[:name].matches_any(values)
257
+ )))))))))
258
+ }
259
+
260
+
261
+ scope :module_type, ->(values) { where(Mdm::Module::Detail[:mtype].matches_any(values)) }
262
+
195
263
  #
196
264
  # Validations
197
265
  #
@@ -1,6 +1,6 @@
1
1
  module MetasploitDataModels
2
2
  # VERSION is managed by GemRelease
3
- VERSION = '2.0.9'
3
+ VERSION = '2.0.10'
4
4
 
5
5
  # @return [String]
6
6
  #
@@ -66,23 +66,23 @@ RSpec.describe Mdm::Module::Detail, type: :model do
66
66
  it "maps 'auxiliary' to 'auxiliary'" do
67
67
  expect(directory_by_type['auxiliary']).to eq('auxiliary')
68
68
  end
69
-
69
+
70
70
  it "maps 'encoder' to 'encoders'" do
71
71
  expect(directory_by_type['encoder']).to eq('encoders')
72
72
  end
73
-
73
+
74
74
  it "maps 'exploit' to 'exploits'" do
75
75
  expect(directory_by_type['exploit']).to eq('exploits')
76
76
  end
77
-
77
+
78
78
  it "maps 'nop' to 'nops'" do
79
79
  expect(directory_by_type['nop']).to eq('nops')
80
80
  end
81
-
81
+
82
82
  it "maps 'payload' to 'payloads'" do
83
83
  expect(directory_by_type['payload']).to eq('payloads')
84
84
  end
85
-
85
+
86
86
  it "maps 'post' to 'post'" do
87
87
  expect(directory_by_type['post']).to eq('post')
88
88
  end
@@ -233,6 +233,206 @@ RSpec.describe Mdm::Module::Detail, type: :model do
233
233
  end
234
234
  end
235
235
 
236
+ context 'scopes' do
237
+
238
+ before(:each) do
239
+ @ms12_020 = FactoryGirl.create(:mdm_module_detail,
240
+ name: "MS12-020 Microsoft Remote Desktop Use-After-Free DoS",
241
+ fullname: 'auxiliary/dos/windows/rdp/ms12_020_maxchannelids',
242
+ description: "This module exploits the MS12-020 RDP vulnerability originally discovered and\n reported by Luigi Auriemma. The flaw can be found in the way the T.125\n ConnectMCSPDU packet is handled in the maxChannelIDs field, which will result\n an invalid pointer being used, therefore causing a denial-of-service condition.",
243
+ mtype: 'auxiliary',
244
+ stance: 'aggressive')
245
+ @ms08_067 = FactoryGirl.create(:mdm_module_detail,
246
+ name: "MS08-067 Microsoft Server Service Relative Path Stack Corruption",
247
+ fullname: 'exploit/windows/smb/ms08_067_netapi',
248
+ description: "This module exploits a parsing flaw in the path canonicalization code of\n NetAPI32.dll through the Server Service. This module is capable of bypassing\n NX on some operating systems and service packs. The correct target must be\n used to prevent the Server Service (along with a dozen others in the same\n process) from crashing. Windows XP targets seem to handle multiple successful\n exploitation events, but 2003 targets will often crash or hang on subsequent\n attempts. This is just the first version of this module, full support for\n NX bypass on 2003, along with other platforms, is still in development.",
249
+ mtype: 'exploit',
250
+ stance: 'aggressive')
251
+ @ms06_040 = FactoryGirl.create(:mdm_module_detail,
252
+ name: "MS06-040 Microsoft Server Service NetpwPathCanonicalize Overflow",
253
+ fullname: 'exploit/windows/smb/ms06_040_netapi',
254
+ description: "This module exploits a stack buffer overflow in the NetApi32 CanonicalizePathName() function\n using the NetpwPathCanonicalize RPC call in the Server Service. It is likely that\n other RPC calls could be used to exploit this service. This exploit will result in\n a denial of service on Windows XP SP2 or Windows 2003 SP1. A failed exploit attempt\n will likely result in a complete reboot on Windows 2000 and the termination of all\n SMB-related services on Windows XP. The default target for this exploit should succeed\n on Windows NT 4.0, Windows 2000 SP0-SP4+, Windows XP SP0-SP1 and Windows 2003 SP0.",
255
+ mtype: 'exploit',
256
+ stance: 'aggressive')
257
+ @cve_2012_0507 = FactoryGirl.create(:mdm_module_detail,
258
+ name: "Java AtomicReferenceArray Type Violation Vulnerability",
259
+ fullname: 'exploit/multi/browser/java_atomicreferencearray',
260
+ description: "This module exploits a vulnerability due to the fact that\n AtomicReferenceArray uses the Unsafe class to store a reference in an\n array directly, which may violate type safety if not used properly.\n This allows a way to escape the JRE sandbox, and load additional classes\n in order to perform malicious operations.",
261
+ mtype: 'exploit',
262
+ stance: 'passive')
263
+ @cve_2010_0425 = FactoryGirl.create(:mdm_module_detail,
264
+ name: "PHP Remote File Include Generic Code Execution",
265
+ fullname: 'exploit/unix/webapp/php_include',
266
+ description: "This module can be used to exploit any generic PHP file include vulnerability,\n where the application includes code like the following:\n\n <?php include($_GET['path']); ?>",
267
+ mtype: 'exploit',
268
+ stance: 'aggressive')
269
+
270
+ @author1 = "hdm <x@hdm.io>"
271
+ @author2 = "jduck <jduck@metasploit.com>"
272
+ @author3 = "juan vazquez <juan.vazquez@metasploit.com>"
273
+ @author4 = "egypt <egypt@metasploit.com>"
274
+
275
+ FactoryGirl.create(:mdm_module_author, detail: @ms12_020, name: @author2)
276
+ FactoryGirl.create(:mdm_module_author, detail: @ms08_067, name: @author1)
277
+ FactoryGirl.create(:mdm_module_author, detail: @ms08_067, name: @author2)
278
+ FactoryGirl.create(:mdm_module_author, detail: @ms06_040, name: @author1)
279
+ FactoryGirl.create(:mdm_module_author, detail: @cve_2012_0507, name: @author3)
280
+ FactoryGirl.create(:mdm_module_author, detail: @cve_2012_0507, name: @author4)
281
+
282
+ FactoryGirl.create(:mdm_module_platform, detail: @ms12_020, name: 'windows')
283
+ FactoryGirl.create(:mdm_module_platform, detail: @ms08_067, name: 'windows')
284
+ FactoryGirl.create(:mdm_module_platform, detail: @ms06_040, name: 'windows')
285
+ FactoryGirl.create(:mdm_module_platform, detail: @cve_2012_0507, name: 'linux')
286
+ FactoryGirl.create(:mdm_module_platform, detail: @cve_2012_0507, name: 'java')
287
+
288
+ FactoryGirl.create(:mdm_module_arch, detail: @cve_2012_0507, name: '["ppc"]')
289
+ FactoryGirl.create(:mdm_module_arch, detail: @cve_2012_0507, name: '["x86"]')
290
+ FactoryGirl.create(:mdm_module_arch, detail: @cve_2012_0507, name: '["java"]')
291
+ FactoryGirl.create(:mdm_module_arch, detail: @cve_2010_0425, name: 'php')
292
+
293
+ FactoryGirl.create(:mdm_module_ref, detail: @ms12_020, name: 'EDB-18606')
294
+ FactoryGirl.create(:mdm_module_ref, detail: @ms12_020, name: 'MSB-MS12-020')
295
+ FactoryGirl.create(:mdm_module_ref, detail: @ms12_020, name: 'CVE-2012-0002')
296
+ FactoryGirl.create(:mdm_module_ref, detail: @ms08_067, name: 'MSB-MS08-067')
297
+ FactoryGirl.create(:mdm_module_ref, detail: @ms08_067, name: 'OSVDB-49243')
298
+ FactoryGirl.create(:mdm_module_ref, detail: @ms08_067, name: 'CVE-2008-4250')
299
+ FactoryGirl.create(:mdm_module_ref, detail: @ms06_040, name: 'MSB-MS06-040')
300
+ FactoryGirl.create(:mdm_module_ref, detail: @ms06_040, name: 'BID-19409')
301
+ FactoryGirl.create(:mdm_module_ref, detail: @ms06_040, name: 'OSVDB-27845')
302
+ FactoryGirl.create(:mdm_module_ref, detail: @ms06_040, name: 'CVE-2006-3439')
303
+ FactoryGirl.create(:mdm_module_ref, detail: @cve_2012_0507, name: 'BID-52161')
304
+ FactoryGirl.create(:mdm_module_ref, detail: @cve_2012_0507, name: 'OSVDB-80724')
305
+ FactoryGirl.create(:mdm_module_ref, detail: @cve_2012_0507, name: 'CVE-2012-0507')
306
+
307
+ FactoryGirl.create(:mdm_module_target, detail: @ms08_067, name: 'Windows 2003 SP2 English (NX)')
308
+ FactoryGirl.create(:mdm_module_target, detail: @ms08_067, name: 'Windows 2003 SP2 English (NO NX)')
309
+ FactoryGirl.create(:mdm_module_target, detail: @ms08_067, name: 'Windows 2003 SP1 English (NX)')
310
+ FactoryGirl.create(:mdm_module_target, detail: @ms08_067, name: 'Windows 2003 SP1 English (NO NX)')
311
+ FactoryGirl.create(:mdm_module_target, detail: @ms08_067, name: 'Windows XP SP3 English (NX)')
312
+ FactoryGirl.create(:mdm_module_target, detail: @ms08_067, name: 'Windows XP SP3 English (AlwaysOn NX)')
313
+ FactoryGirl.create(:mdm_module_target, detail: @ms08_067, name: 'Windows XP SP2 English (NX)')
314
+ FactoryGirl.create(:mdm_module_target, detail: @ms08_067, name: 'Windows XP SP2 English (AlwaysOn NX)')
315
+ FactoryGirl.create(:mdm_module_target, detail: @ms08_067, name: 'Automatic Targeting')
316
+ FactoryGirl.create(:mdm_module_target, detail: @ms06_040, name: '(wcscpy) Windows 2003 SP0')
317
+ FactoryGirl.create(:mdm_module_target, detail: @ms06_040, name: '(stack) Windows XP SP1 English')
318
+ FactoryGirl.create(:mdm_module_target, detail: @ms06_040, name: '(wcscpy) Windows XP SP0/SP1')
319
+ FactoryGirl.create(:mdm_module_target, detail: @ms06_040, name: '(wcscpy) Windows NT 4.0 / Windows 2000 SP0-SP4')
320
+ FactoryGirl.create(:mdm_module_target, detail: @ms06_040, name: '(wcscpy) Automatic (NT 4.0, 2000 SP0-SP4, XP SP0-SP1)')
321
+ FactoryGirl.create(:mdm_module_target, detail: @cve_2012_0507, name: 'Linux x86 (Native Payload)')
322
+ FactoryGirl.create(:mdm_module_target, detail: @cve_2012_0507, name: 'Mac OS X x86 (Native Payload)')
323
+ FactoryGirl.create(:mdm_module_target, detail: @cve_2012_0507, name: 'Mac OS X PPC (Native Payload)')
324
+ FactoryGirl.create(:mdm_module_target, detail: @cve_2012_0507, name: 'Windows x86 (Native Payload)')
325
+ FactoryGirl.create(:mdm_module_target, detail: @cve_2012_0507, name: 'Generic (Java Payload)')
326
+ FactoryGirl.create(:mdm_module_target, detail: @cve_2010_0425, name: 'Automatic')
327
+ end
328
+
329
+ context '#module_arch' do
330
+ it 'finds all modules with a stance matching "java"' do
331
+ expect(Mdm::Module::Detail.module_arch(['%java%']).uniq).to contain_exactly(@cve_2012_0507)
332
+ end
333
+ it 'finds all modules with a stance matching "pass"' do
334
+ expect(Mdm::Module::Detail.module_arch(['%java%', '%php%']).uniq).to contain_exactly(@cve_2012_0507, @cve_2010_0425)
335
+ end
336
+ end
337
+
338
+ context '#module_author' do
339
+ it 'finds all modules with author matching "Juan"' do
340
+ expect(Mdm::Module::Detail.module_author(['%juan%'])).to contain_exactly(@cve_2012_0507)
341
+ end
342
+
343
+ it 'finds all modules for author matching "hdm"' do
344
+ expect(Mdm::Module::Detail.module_author(['%hdm%'])).to contain_exactly(@ms08_067, @ms06_040)
345
+ end
346
+ it 'finds all modules with authors matching "juan", "jduck"' do
347
+ expect(Mdm::Module::Detail.module_author(['%juan%','%jduck%'])).to contain_exactly(@ms12_020,@ms08_067,@cve_2012_0507)
348
+ end
349
+ end
350
+
351
+ context '#module_name' do
352
+ it 'finds all modules with name matching "DoS"' do
353
+ expect(Mdm::Module::Detail.module_name(['%DoS%'])).to contain_exactly(@ms12_020)
354
+ end
355
+
356
+ it 'finds all modules with name matching "netapi"' do
357
+ expect(Mdm::Module::Detail.module_name(['%netapi%'])).to contain_exactly(@ms08_067, @ms06_040)
358
+ end
359
+
360
+ it 'finds all modules with name matching "browser"' do
361
+ expect(Mdm::Module::Detail.module_name(['%browser%'])).to contain_exactly(@cve_2012_0507)
362
+ end
363
+ end
364
+
365
+ context '#module_os_or_platform' do
366
+ it 'finds all modules with a platform matching "linux"' do
367
+ expect(Mdm::Module::Detail.module_os_or_platform(['%linux%']).uniq).to contain_exactly(@cve_2012_0507)
368
+ end
369
+
370
+ it 'finds all modules with a platform matching "windows"' do
371
+ expect(Mdm::Module::Detail.module_os_or_platform(['%windows%']).uniq).to contain_exactly(
372
+ @ms12_020,@ms08_067,@ms06_040,@cve_2012_0507)
373
+ end
374
+ end
375
+
376
+ context 'module_ref' do
377
+ it 'finds all modules with a reff matching "CVE-2012"' do
378
+ expect(Mdm::Module::Detail.module_ref(['%CVE-2012%']).uniq).to contain_exactly(
379
+ @ms12_020,@cve_2012_0507)
380
+ end
381
+ it 'finds all modules with a reff matching "EDB"' do
382
+ expect(Mdm::Module::Detail.module_ref(['%EDB%']).uniq).to contain_exactly(@ms12_020)
383
+ end
384
+ end
385
+
386
+ context '#module_stance' do
387
+ it 'finds all modules with a stance matching "agg"' do
388
+ expect(Mdm::Module::Detail.module_stance(['%agg%']).uniq).to contain_exactly(
389
+ @ms12_020,@ms08_067,@ms06_040,@cve_2010_0425)
390
+ end
391
+ it 'finds all modules with a stance matching "pass"' do
392
+ expect(Mdm::Module::Detail.module_stance(['%pass%']).uniq).to contain_exactly(@cve_2012_0507)
393
+ end
394
+ end
395
+
396
+ context '#module_text' do
397
+ it 'finds all modules with a description matching "ConnectMCSPDU"' do
398
+ expect(Mdm::Module::Detail.module_text(['%ConnectMCSPDU%']).uniq).to contain_exactly(@ms12_020)
399
+ end
400
+ it 'finds all modules with a fullname matching "smb/ms0"' do
401
+ expect(Mdm::Module::Detail.module_text(['%smb/ms0%']).uniq).to contain_exactly(@ms08_067,@ms06_040)
402
+ end
403
+ it 'finds all modules with a name matching "Microsoft Server Service"' do
404
+ expect(Mdm::Module::Detail.module_text(['%Microsoft Server Service%']).uniq).to contain_exactly(@ms08_067,@ms06_040)
405
+ end
406
+ it 'finds all modules with a arch matching "php"' do
407
+ expect(Mdm::Module::Detail.module_text(['%php%']).uniq).to contain_exactly(@cve_2010_0425)
408
+ end
409
+ it 'finds all modules with a author matching "jduck"' do
410
+ expect(Mdm::Module::Detail.module_text(['%jduck%']).uniq).to contain_exactly(@ms12_020,@ms08_067)
411
+ end
412
+ it 'finds all modules with a platform matching "linux"' do
413
+ expect(Mdm::Module::Detail.module_text(['%linux%']).uniq).to contain_exactly(@cve_2012_0507)
414
+ end
415
+ it 'finds all modules with a ref matching "MSB-MS"' do
416
+ expect(Mdm::Module::Detail.module_text(['%MSB-MS%']).uniq).to contain_exactly(@ms12_020,@ms08_067,@ms06_040)
417
+ end
418
+ it 'finds all modules with a target matching "Auto"' do
419
+ expect(Mdm::Module::Detail.module_text(['%Auto%']).uniq).to contain_exactly(@ms08_067,@ms06_040,@cve_2010_0425)
420
+ end
421
+ end
422
+
423
+ context 'module_type' do
424
+ it 'finds all modules with a mtype matching "aux"' do
425
+ expect(Mdm::Module::Detail.module_type(['%aux%']).uniq).to contain_exactly(@ms12_020)
426
+ end
427
+ it 'finds all modules with a mtype matching "exp"' do
428
+ expect(Mdm::Module::Detail.module_type(['%exp%']).uniq).to contain_exactly(
429
+ @ms08_067,@ms06_040,@cve_2012_0507,@cve_2010_0425)
430
+ end
431
+ end
432
+
433
+
434
+ end
435
+
236
436
  context 'validations' do
237
437
  it { is_expected.to validate_inclusion_of(:mtype).in_array(types) }
238
438
 
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metasploit_data_models
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.9
4
+ version: 2.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Huckins
@@ -91,7 +91,7 @@ cert_chain:
91
91
  G+Hmcg1v810agasPdoydE0RTVZgEOOMoQ07qu7JFXVWZ9ZQpHT7qJATWL/b2csFG
92
92
  8mVuTXnyJOKRJA==
93
93
  -----END CERTIFICATE-----
94
- date: 2016-11-21 00:00:00.000000000 Z
94
+ date: 2016-12-01 00:00:00.000000000 Z
95
95
  dependencies:
96
96
  - !ruby/object:Gem::Dependency
97
97
  name: metasploit-yard
metadata.gz.sig CHANGED
Binary file