dradis-nexpose 3.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +11 -0
  3. data/.rspec +2 -0
  4. data/CHANGELOG.md +3 -0
  5. data/CONTRIBUTING.md +3 -0
  6. data/Gemfile +19 -0
  7. data/LICENSE +339 -0
  8. data/README.md +29 -0
  9. data/Rakefile +1 -0
  10. data/dradis-nexpose.gemspec +35 -0
  11. data/lib/dradis-nexpose.rb +12 -0
  12. data/lib/dradis/plugins/nexpose.rb +11 -0
  13. data/lib/dradis/plugins/nexpose/engine.rb +9 -0
  14. data/lib/dradis/plugins/nexpose/field_processor.rb +89 -0
  15. data/lib/dradis/plugins/nexpose/formats/full.rb +152 -0
  16. data/lib/dradis/plugins/nexpose/formats/simple.rb +76 -0
  17. data/lib/dradis/plugins/nexpose/gem_version.rb +19 -0
  18. data/lib/dradis/plugins/nexpose/importer.rb +34 -0
  19. data/lib/dradis/plugins/nexpose/version.rb +13 -0
  20. data/lib/nexpose/endpoint.rb +81 -0
  21. data/lib/nexpose/node.rb +117 -0
  22. data/lib/nexpose/scan.rb +65 -0
  23. data/lib/nexpose/service.rb +101 -0
  24. data/lib/nexpose/vulnerability.rb +95 -0
  25. data/lib/tasks/thorfile.rb +26 -0
  26. data/spec/fixtures/files/full.xml +144 -0
  27. data/spec/fixtures/files/simple.xml +53 -0
  28. data/spec/nexpose_upload_spec.rb +154 -0
  29. data/spec/spec_helper.rb +13 -0
  30. data/templates/full_node.fields +8 -0
  31. data/templates/full_node.sample +65 -0
  32. data/templates/full_node.template +13 -0
  33. data/templates/full_scan.fields +5 -0
  34. data/templates/full_scan.sample +6 -0
  35. data/templates/full_scan.template +9 -0
  36. data/templates/full_service.fields +4 -0
  37. data/templates/full_service.sample +17 -0
  38. data/templates/full_service.template +11 -0
  39. data/templates/full_vulnerability.fields +13 -0
  40. data/templates/full_vulnerability.sample +59 -0
  41. data/templates/full_vulnerability.template +34 -0
  42. data/templates/simple_port.fields +2 -0
  43. data/templates/simple_port.sample +23 -0
  44. data/templates/simple_port.template +5 -0
  45. metadata +176 -0
@@ -0,0 +1,53 @@
1
+ <NeXposeSimpleXML version="1.0">
2
+ <generated>20111128T142609232</generated>
3
+ <devices>
4
+ <device address="1.1.1.1">
5
+ <fingerprint certainty="0.80">
6
+ <description>Linux 2.6.9-89.ELsmp</description>
7
+ <vendor>Linux</vendor>
8
+ <family>Linux</family>
9
+ <product>Linux</product>
10
+ <version>0.0.0</version>
11
+ <device-class></device-class>
12
+ <architecture>i686</architecture>
13
+ </fingerprint>
14
+ <vulnerabilities>
15
+ </vulnerabilities>
16
+ <services>
17
+ <service name="NTP" port="000" protocol="udp">
18
+ <fingerprint certainty="0.20">
19
+ <description>NTP 4.2</description>
20
+ <vendor></vendor>
21
+ <family>NTP</family>
22
+ <product>NTP</product>
23
+ <version>4.2</version>
24
+ </fingerprint>
25
+ <vulnerabilities>
26
+ <vulnerability id="ntpd-crypto" resultCode="VV">
27
+ <id type="cve">CVE-2009-1252</id>
28
+ <id type="bid">35017</id>
29
+ <id type="secunia">35137</id>
30
+ <id type="secunia">35138</id>
31
+ <id type="secunia">35166</id>
32
+ <id type="secunia">35169</id>
33
+ <id type="secunia">35243</id>
34
+ <id type="secunia">35253</id>
35
+ <id type="secunia">35308</id>
36
+ <id type="secunia">35336</id>
37
+ <id type="secunia">35388</id>
38
+ <id type="secunia">35416</id>
39
+ <id type="secunia">35630</id>
40
+ <id type="secunia">37470</id>
41
+ <id type="secunia">37471</id>
42
+ <id type="url">http://bugs.ntp.org/1151</id>
43
+ <id type="url">http://www.kb.cert.org/vuls/id/853097</id>
44
+ <id type="url">https://lists.ntp.org/pipermail/announce/2009-May/000062.html</id>
45
+ </vulnerability>
46
+ <vulnerability id="ntp-clock-radio, he cannot afford, wah wah wee wah" resultCode="VE">
47
+ </vulnerability>
48
+ </vulnerabilities>
49
+ </service>
50
+ </services>
51
+ </device>
52
+ </devices>
53
+ </NeXposeSimpleXML>
@@ -0,0 +1,154 @@
1
+ require 'spec_helper'
2
+ require 'ostruct'
3
+
4
+ describe 'Nexpose upload plugin' do
5
+ before(:each) do
6
+ # Stub template service
7
+ templates_dir = File.expand_path('../../templates', __FILE__)
8
+ expect_any_instance_of(Dradis::Plugins::TemplateService)
9
+ .to receive(:default_templates_dir).and_return(templates_dir)
10
+
11
+ # Init services
12
+ plugin = Dradis::Plugins::Nexpose
13
+
14
+ @content_service = Dradis::Plugins::ContentService.new(plugin: plugin)
15
+ template_service = Dradis::Plugins::TemplateService.new(plugin: plugin)
16
+
17
+ @importer = plugin::Importer.new(
18
+ content_service: @content_service,
19
+ template_service: template_service
20
+ )
21
+
22
+ # Stub dradis-plugins methods
23
+ #
24
+ # They return their argument hashes as objects mimicking
25
+ # Nodes, Issues, etc
26
+ allow(@content_service).to receive(:create_node) do |args|
27
+ OpenStruct.new(args)
28
+ end
29
+ allow(@content_service).to receive(:create_note) do |args|
30
+ OpenStruct.new(args)
31
+ end
32
+ allow(@content_service).to receive(:create_issue) do |args|
33
+ OpenStruct.new(args)
34
+ end
35
+ allow(@content_service).to receive(:create_evidence) do |args|
36
+ OpenStruct.new(args)
37
+ end
38
+ end
39
+
40
+ describe "Importer: Simple" do
41
+ it "creates nodes, issues, notes and an evidences as needed" do
42
+
43
+ expect(@content_service).to receive(:create_node).with(hash_including label: '1.1.1.1', type: :host).once
44
+
45
+ expect(@content_service).to receive(:create_note) do |args|
46
+ expect(args[:text]).to include("Host Description : Linux 2.6.9-89.ELsmp")
47
+ expect(args[:text]).to include("Scanner Fingerprint certainty : 0.80")
48
+ expect(args[:node].label).to eq("1.1.1.1")
49
+ end.once
50
+
51
+ expect(@content_service).to receive(:create_node) do |args|
52
+ expect(args[:label]).to eq('Generic Findings')
53
+ expect(args[:parent].label).to eq("1.1.1.1")
54
+ OpenStruct.new(args)
55
+ end.once
56
+
57
+ expect(@content_service).to receive(:create_node) do |args|
58
+ expect(args[:label]).to eq('udp-000')
59
+ expect(args[:parent].label).to eq("1.1.1.1")
60
+ OpenStruct.new(args)
61
+ end.once
62
+
63
+ expect(@content_service).to receive(:create_note) do |args|
64
+ expect(args[:text]).to include("#[Id]#\nntpd-crypto")
65
+ expect(args[:text]).to include("#[host]#\n1.1.1.1")
66
+ expect(args[:node].label).to eq("udp-000")
67
+ end.once
68
+
69
+ expect(@content_service).to receive(:create_note) do |args|
70
+ expect(args[:text]).to include("#[Id]#\nntp-clock-radio")
71
+ expect(args[:text]).to include("#[host]#\n1.1.1.1")
72
+ expect(args[:node].label).to eq("udp-000")
73
+ end.once
74
+
75
+ @importer.import(file: 'spec/fixtures/files/simple.xml')
76
+ end
77
+ end
78
+
79
+ describe "Importer: Full" do
80
+ it "creates nodes, issues, notes and an evidences as needed" do
81
+
82
+ expect(@content_service).to receive(:create_node).with(hash_including label: "Nexpose Scan Summary").once
83
+ expect(@content_service).to receive(:create_note) do |args|
84
+ expect(args[:text]).to include("#[Title]#\nUSDA_Internal (4)")
85
+ expect(args[:node].label).to eq("Nexpose Scan Summary")
86
+ end.once
87
+
88
+ expect(@content_service).to receive(:create_node).with(hash_including label: "1.1.1.1", type: :host).once
89
+ expect(@content_service).to receive(:create_note) do |args|
90
+ expect(args[:text]).to include("#[Host]#\n1.1.1.1")
91
+ expect(args[:node].label).to eq("1.1.1.1")
92
+ end.once
93
+
94
+ expect(@content_service).to receive(:create_node) do |args|
95
+ expect(args[:label]).to eq("123/udp (open)")
96
+ expect(args[:parent].label).to eq("1.1.1.1")
97
+ OpenStruct.new(args)
98
+ end.once
99
+ expect(@content_service).to receive(:create_note) do |args|
100
+ expect(args[:text]).to include("#[Title]#\nService name: NTP")
101
+ expect(args[:node].label).to eq("123/udp (open)")
102
+ end.once
103
+
104
+ expect(@content_service).to receive(:create_node) do |args|
105
+ expect(args[:label]).to eq("161/udp (open)")
106
+ expect(args[:parent].label).to eq("1.1.1.1")
107
+ OpenStruct.new(args)
108
+ end.once
109
+ expect(@content_service).to receive(:create_note) do |args|
110
+ expect(args[:text]).to include("#[Title]#\nService name: SNMP")
111
+ expect(args[:node].label).to eq("161/udp (open)")
112
+ end.once
113
+
114
+ expect(@content_service).to receive(:create_node).with(hash_including label: "Definitions").once
115
+
116
+ expect(@content_service).to receive(:create_issue) do |args|
117
+ expect(args[:text]).to include("#[Title]#\nApache HTTPD: error responses can expose cookies (CVE-2012-0053)")
118
+ expect(args[:id]).to eq("ntp-clock-variables-disclosure")
119
+ OpenStruct.new(args)
120
+ end.once
121
+
122
+ expect(@content_service).to receive(:create_issue) do |args|
123
+ expect(args[:text]).to include("#[Title]#\nApache HTTPD: ETag Inode Information Leakage (CVE-2003-1418)")
124
+ expect(args[:id]).to eq("ntp-clock-variables-disclosure")
125
+ OpenStruct.new(args)
126
+ end.once
127
+
128
+ expect(@content_service).to receive(:create_node).with(hash_including label: "1.1.1.1", type: :host).once
129
+
130
+ expect(@content_service).to receive(:create_evidence) do |args|
131
+ expect(args[:content]).to include("n/a")
132
+ expect(args[:issue].id).to eq("ntp-clock-variables-disclosure")
133
+ expect(args[:node].label).to eq("1.1.1.1")
134
+ end.once
135
+
136
+ @importer.import(file: 'spec/fixtures/files/full.xml')
137
+ end
138
+
139
+ # Regression test for github.com/dradis/dradis-nexpose/issues/1
140
+ it "populates solutions regardless they are wrapped in paragraphs or lists" do
141
+ expect(@content_service).to receive(:create_issue) do |args|
142
+ expect(args[:text]).to include("#[Solution]#\nApache HTTPD >= 2.0 and < 2.0.65")
143
+ OpenStruct.new(args)
144
+ end.once
145
+
146
+ expect(@content_service).to receive(:create_issue) do |args|
147
+ expect(args[:text]).to include("#[Solution]#\nYou can remove inode information from the ETag header")
148
+ OpenStruct.new(args)
149
+ end.once
150
+
151
+ @importer.import(file: 'spec/fixtures/files/full.xml')
152
+ end
153
+ end
154
+ end
@@ -0,0 +1,13 @@
1
+ require 'rubygems'
2
+ require 'bundler/setup'
3
+ require 'nokogiri'
4
+
5
+ require 'combustion'
6
+
7
+ Combustion.initialize!
8
+
9
+ RSpec.configure do |config|
10
+ # Filter which specs to run
11
+ config.filter_run :focus => true
12
+ config.run_all_when_everything_filtered = true
13
+ end
@@ -0,0 +1,8 @@
1
+ node.address
2
+ node.device_id
3
+ node.fingerprints
4
+ node.hardware_address
5
+ node.names
6
+ node.tests
7
+ node.status
8
+ node.software
@@ -0,0 +1,65 @@
1
+ <node
2
+ address="10.0.0.1"
3
+ status="alive"
4
+ device-id="211"
5
+ hardware-address="00:de:ad:be:ef:00">
6
+
7
+ <names>
8
+ <name>iPad.local</name>
9
+ <name>Ted's iPad</name>
10
+ </names>
11
+
12
+ <fingerprints>
13
+ <os
14
+ certainty="1.00"
15
+ device-class="Server"
16
+ vendor="Microsoft"
17
+ family="Windows"
18
+ product="Windows Server 2003, Standard Edition"
19
+ version="SP2"
20
+ arch="x86_64"/>
21
+
22
+ <os
23
+ certainty="0.85"
24
+ device-class="General"
25
+ vendor="Microsoft"
26
+ family="Windows"
27
+ product="Windows Server 2003"
28
+ version="SP2"/>
29
+ </fingerprints>
30
+
31
+ <software>
32
+ <fingerprint
33
+ certainty="1.00"
34
+ software-class="General"
35
+ vendor="Sun"
36
+ family="Java"
37
+ product="JRE"
38
+ version="1.6.0.22"/>
39
+
40
+ <fingerprint
41
+ certainty="1.00"
42
+ software-class="General"
43
+ vendor="Sun"
44
+ family="Java"
45
+ product="JRE"
46
+ version="1.6.0.24"/>
47
+ </software>
48
+
49
+ <tests>
50
+ <test status="not-vulnerable" id="cifs-generic-0001">
51
+ <Paragraph>
52
+ <Paragraph>Running vulnerable CIFS service.</Paragraph>
53
+ Was not able to authenticate to the CIFS service with no credentials.
54
+ </Paragraph>
55
+ </test>
56
+
57
+ <test status="vulnerable" id="cifs-generic-0001">
58
+ <Paragraph>
59
+ <Paragraph>Something vulnerable or bad.</Paragraph>
60
+ Stuff
61
+ </Paragraph>
62
+ </test>
63
+ </tests>
64
+ <endpoints/>
65
+ </node>
@@ -0,0 +1,13 @@
1
+ #[Host]#
2
+ %node.address%
3
+
4
+ #[Details]#
5
+ Status: %node.status%
6
+ Device id: %node.device_id%
7
+ HW address: %node.hardware_address%
8
+
9
+ #[Names]#
10
+ %node.names%
11
+
12
+ #[Software]#
13
+ %node.software%
@@ -0,0 +1,5 @@
1
+ scan.end_time
2
+ scan.name
3
+ scan.scan_id
4
+ scan.start_time
5
+ scan.status
@@ -0,0 +1,6 @@
1
+ <scan
2
+ id="287"
3
+ name="Localnet2"
4
+ startTime="20120104T100557571"
5
+ endTime="20120104T100629244"
6
+ status="finished"/>
@@ -0,0 +1,9 @@
1
+ #[Title]#
2
+ %scan.name% (%scan.scan_id%)
3
+
4
+ #[Timing]#
5
+ Start time: %scan.start_time%
6
+ End time: %scan.end_time%
7
+
8
+ #[Status]#
9
+ %scan.status%
@@ -0,0 +1,4 @@
1
+ service.configurations
2
+ service.fingerprints
3
+ service.name
4
+ service.tests
@@ -0,0 +1,17 @@
1
+ <service name="CIFS Name Service">
2
+ <fingerprints>
3
+ <fingerprint certainty="1.00" product="Windows Server 2003 R2 5.2"/>
4
+ </fingerprints>
5
+
6
+ <configuration>
7
+ <config name="advertised-name-1">DC1 (Computer Name)</config>
8
+ <config name="advertised-name-2">localdomain (Domain Name)</config>
9
+ <config name="advertised-name-3">xxxxx (File Server Service)</config>
10
+ <config name="advertised-name-4">TOR (Browser Service Elections)</config>
11
+ <config name="advertised-name-count">4</config>
12
+ <config name="mac-address">00:de:ad:be:ef:00</config>
13
+ </configuration>
14
+
15
+ <tests>
16
+ </tests>
17
+ </service>
@@ -0,0 +1,11 @@
1
+ #[Title]#
2
+ Service name: %service.name%
3
+
4
+ #[Fingerprinting]#
5
+ %service.fingerprints%
6
+
7
+ #[Configuration]#
8
+ %service.configurations%
9
+
10
+ #[Tests]#
11
+ %service.tests%
@@ -0,0 +1,13 @@
1
+ vulnerability.added
2
+ vulnerability.cvss_score
3
+ vulnerability.cvss_vector
4
+ vulnerability.description
5
+ vulnerability.modified
6
+ vulnerability.nexpose_id
7
+ vulnerability.pci_severity
8
+ vulnerability.published
9
+ vulnerability.references
10
+ vulnerability.severity
11
+ vulnerability.solution
12
+ vulnerability.tags
13
+ vulnerability.title
@@ -0,0 +1,59 @@
1
+ <vulnerability
2
+ id="CIFS-GENERIC-0001"
3
+ title="No password on CIFS Administrator account"
4
+ severity="8"
5
+ pciSeverity="5"
6
+ cvssScore="7.5"
7
+ cvssVector="(AV:N/AC:L/Au:N/C:P/I:P/A:P)"
8
+ published="19970101T000000000"
9
+ added="20041101T000000000"
10
+ modified="20111117T000000000">
11
+
12
+ <description>
13
+ <ContainerBlockElement>
14
+ <Paragraph>
15
+ Windows systems come with an administration account, "Administrator" in the default
16
+ installation. Furthermore, a Unix system administrator may choose the username "Administrator"
17
+ when configuring SAMBA. A common password used for this account is "" (no password). It is best
18
+ practice to remove default accounts, if possible. For accounts required by the system,
19
+ the default password should be changed.
20
+ </Paragraph>
21
+
22
+ <Paragraph>
23
+ This account grants full access to the system, making it most critical to secure.
24
+ </Paragraph>
25
+ </ContainerBlockElement>
26
+ </description>
27
+
28
+ <references>
29
+ <reference source="CVE">CVE-1999-0504</reference>
30
+ <reference source="CVE">CVE-1999-0506</reference>
31
+ <reference source="SANS-04">W5</reference>
32
+ </references>
33
+
34
+ <tags>
35
+ <tag>CIFS/SMB/NetBIOS</tag>
36
+ <tag>Default Account</tag>
37
+ <tag>Samba</tag>
38
+ <tag>UNIX</tag>
39
+ <tag>Windows</tag>
40
+ </tags>
41
+
42
+ <solution>
43
+ <ContainerBlockElement>
44
+ <Paragraph>
45
+ Choose a better password for the administrator account. A good
46
+ password should consist of a mix of lower- and upper-case characters,
47
+ numbers, and punctuation and should be at least 8 characters long.
48
+ </Paragraph>
49
+
50
+ <Paragraph>
51
+ In addition, the default account name of "Administrator" should be
52
+ changed to something less obvious. This will make simple brute force attempts
53
+ harder, as the malicious user must use other means to find the account name.
54
+ In all cases, the password should be changed to a well thought out (hard
55
+ to crack) value.
56
+ </Paragraph>
57
+ </ContainerBlockElement>
58
+ </solution>
59
+ </vulnerability>