dradis-qualys 3.18.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,5 @@
1
+ require "spec_helper"
2
+
3
+ describe Qualys::Element do
4
+ pending "create some unit tests for the Qualys::Element wrapper class"
5
+ end
@@ -0,0 +1,190 @@
1
+ require 'spec_helper'
2
+ require 'ostruct'
3
+
4
+ module Dradis::Plugins
5
+ describe 'Qualys upload plugin' do
6
+ before(:each) do
7
+ # Stub template service
8
+ templates_dir = File.expand_path('../../../templates', __FILE__)
9
+ expect_any_instance_of(Dradis::Plugins::TemplateService)
10
+ .to receive(:default_templates_dir).and_return(templates_dir)
11
+
12
+ # Init services
13
+ plugin = Dradis::Plugins::Qualys
14
+
15
+ @content_service = Dradis::Plugins::ContentService::Base.new(
16
+ logger: Logger.new(STDOUT),
17
+ plugin: plugin
18
+ )
19
+
20
+ @importer = Dradis::Plugins::Qualys::Importer.new(
21
+ content_service: @content_service
22
+ )
23
+
24
+ # Stub dradis-plugins methods
25
+ #
26
+ # They return their argument hashes as objects mimicking
27
+ # Nodes, Issues, etc
28
+ allow(@content_service).to receive(:create_node) do |args|
29
+ obj = OpenStruct.new(args)
30
+ obj.define_singleton_method(:set_property) { |_, __| }
31
+ obj
32
+ end
33
+ allow(@content_service).to receive(:create_issue) do |args|
34
+ OpenStruct.new(args)
35
+ end
36
+ allow(@content_service).to receive(:create_evidence) do |args|
37
+ OpenStruct.new(args)
38
+ end
39
+ end
40
+
41
+ let(:example_xml) { 'spec/fixtures/files/simple.xml' }
42
+
43
+ def run_import!
44
+ @importer.import(file: example_xml)
45
+ end
46
+
47
+ it "creates nodes as needed" do
48
+ expect_to_create_node_with(label: '10.0.155.160')
49
+
50
+ run_import!
51
+ end
52
+
53
+ # Issues and evidences from vulns
54
+ # There are 7 vulns/infos/services in total:
55
+ # - DNS Host Name
56
+ # - Host Scan Time
57
+ # - Open TCP Services List
58
+ # - Web Server Version
59
+ # - TCP/IP: Sequence number in both hosts
60
+ # - Web server: Apache 1.3
61
+ # - Web server: ETag
62
+
63
+ it "creates issues from vulns" do
64
+ expect_to_create_issue_with(
65
+ text: "DNS Host Name"
66
+ )
67
+
68
+ expect_to_create_issue_with(
69
+ text: "Host Scan Time"
70
+ )
71
+
72
+ expect_to_create_issue_with(
73
+ text: "Open TCP Services List"
74
+ )
75
+
76
+ expect_to_create_issue_with(
77
+ text: "Web Server Version"
78
+ )
79
+
80
+ expect_to_create_issue_with(
81
+ text: "TCP Sequence Number Approximation Based Denial of Service"
82
+ )
83
+
84
+ expect_to_create_issue_with(
85
+ text: "Apache 1.3 HTTP Server Expect Header Cross-Site Scripting"
86
+ )
87
+
88
+ expect_to_create_issue_with(
89
+ text: "Apache Web Server ETag Header Information Disclosure Weakness"
90
+ )
91
+
92
+ run_import!
93
+ end
94
+
95
+ it "creates evidence from vulns" do
96
+ expect_to_create_evidence_with(
97
+ content: "IP address\tHost name\n10.0.155.160\tNo registered hostname\n",
98
+ issue: "DNS Host Name",
99
+ node_label: "10.0.155.160"
100
+ )
101
+
102
+ expect_to_create_evidence_with(
103
+ content: "Scan duration: 5445 seconds\n\nStart time: Fri, Dec 20 2011, 17:38:59 GMT\n\nEnd time: Fri, Dec 20 2011, 19:09:44 GMT",
104
+ issue: "Host Scan Time",
105
+ node_label: "10.0.155.160"
106
+ )
107
+
108
+ expect_to_create_evidence_with(
109
+ content: "\tDescription\tService Detected\tOS On Redirected Port\n80\twww\tWorld Wide Web HTTP\thttp",
110
+ issue: "Open TCP Services List",
111
+ node_label: "10.0.155.160"
112
+ )
113
+
114
+ expect_to_create_evidence_with(
115
+ content: "Server Version\tServer Banner\nApache 1.3\tApache",
116
+ issue: "Web Server Version",
117
+ node_label: "10.0.155.160"
118
+ )
119
+
120
+ expect_to_create_evidence_with(
121
+ content: "Tested on port 80 with an injected SYN/RST offset by 16 bytes.",
122
+ issue: "TCP Sequence Number Approximation Based Denial of Service",
123
+ node_label: "10.0.155.160"
124
+ )
125
+ expect_to_create_evidence_with(
126
+ content: "HTTP/1.1 417 Expectation Failed\nDate: Fri, 20 Dec 2011 19:05:57 GMT",
127
+ issue: "Apache 1.3 HTTP Server Expect Header Cross-Site Scripting",
128
+ node_label: "10.0.155.160"
129
+ )
130
+ expect_to_create_evidence_with(
131
+ content: "3bee-4f12-00794aef",
132
+ issue: "Apache Web Server ETag Header Information Disclosure Weakness",
133
+ node_label: "10.0.155.160"
134
+ )
135
+
136
+ run_import!
137
+ end
138
+
139
+ # A VULN is not required to have a RESULT element.
140
+ # See:
141
+ # https://github.com/securityroots/dradispro-tracker/issues/8
142
+ # https://qualysapi.qualys.eu/qwebhelp/fo_help/reports/report_dtd.htm
143
+ context "when an issue has no RESULT element" do
144
+ #let(:example_xml) { 'spec/fixtures/files/no_result.xml' }
145
+
146
+ it "detects an issue without a RESULT element and applies (n/a)" do
147
+ # 1 node should be created:
148
+ expect_to_create_node_with(label: '10.0.155.160')
149
+
150
+ # There is 1 vuln in total:
151
+ # - TCP/IP: Sequence number in both hosts
152
+ # Each one should create 1 issue and 1 evidence
153
+ expect_to_create_issue_with(
154
+ text: "Sequence Number Approximation Based Denial of Service"
155
+ )
156
+
157
+ expect_to_create_evidence_with(
158
+ content: "n/a",
159
+ issue: "Sequence Number Approximation Based Denial of Service",
160
+ node_label: "10.0.155.160"
161
+ )
162
+
163
+ @importer.import(file: 'spec/fixtures/files/no_result.xml')
164
+ end
165
+ end
166
+
167
+
168
+ def expect_to_create_node_with(label:)
169
+ expect(@content_service).to receive(:create_node).with(
170
+ hash_including label: label
171
+ ).once
172
+ end
173
+
174
+ def expect_to_create_issue_with(text:)
175
+ expect(@content_service).to receive(:create_issue) do |args|
176
+ expect(args[:text]).to include text
177
+ OpenStruct.new(args)
178
+ end.once
179
+ end
180
+
181
+ def expect_to_create_evidence_with(content:, issue:, node_label:)
182
+ expect(@content_service).to receive(:create_evidence) do |args|
183
+ expect(args[:content]).to include content
184
+ expect(args[:issue].text).to include issue
185
+ expect(args[:node].label).to eq node_label
186
+ end.once
187
+ end
188
+
189
+ end
190
+ end
@@ -0,0 +1,10 @@
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
+ end
@@ -0,0 +1,16 @@
1
+ element.number
2
+ element.severity
3
+ element.cveid
4
+ element.title
5
+ element.last_update
6
+ element.cvss_base
7
+ element.cvss_temporal
8
+ element.pci_flag
9
+ element.vendor_reference_list
10
+ element.cve_id_list
11
+ element.bugtraq_id_list
12
+ element.diagnosis
13
+ element.consequence
14
+ element.solution
15
+ element.compliance
16
+ element.result
@@ -0,0 +1,35 @@
1
+ <?xml version="1.0"?>
2
+ <CAT value="Web server" port="443" protocol="tcp">
3
+ <VULN number="42366" severity="3" cveid="CVE-2011-3389">
4
+ <TITLE><![CDATA[SSLv3.0/TLSv1.0 Protocol Weak CBC Mode Vulnerability]]></TITLE>
5
+ <LAST_UPDATE><![CDATA[2011-12-30T18:56:26Z]]></LAST_UPDATE>
6
+ <CVSS_BASE>4.3</CVSS_BASE>
7
+ <CVSS_TEMPORAL>3.5</CVSS_TEMPORAL>
8
+ <PCI_FLAG>0</PCI_FLAG>
9
+ <CVE_ID_LIST>
10
+ <CVE_ID>
11
+ <ID><![CDATA[CVE-2011-3389]]></ID>
12
+ <URL><![CDATA[http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2011-3389]]></URL>
13
+ </CVE_ID>
14
+ </CVE_ID_LIST>
15
+ <DIAGNOSIS><![CDATA[SSLv 3.0 and TLS v1.0 protocols are used to provide integrity, authenticity and privacy to other protocols such as HTTP and LDAP. They provide these services by using encryption for privacy, x509 certificates for authenticity and one-way hash functions for integrity. To encrypt data SSL and TLS can use block ciphers, which are encryption algorithms that can encrypt only a fixed block of original data to an encrypted block of the same size. Note that these cihpers will always obtain the same resulting block for the same original blockof data. To achieve difference in the output the output of encryption is XORed with yet another block of the same size referred to as initialization vectors (IV). A special mode of operation for block ciphers known as CBC (cipher block chaining) uses one IV for the initial block and the result of the previous block for each subsequent block to obtain difference in the output of block cipher encryption.
16
+ <P>
17
+ In SSLv3.0 and TLSv1.0 implementation the choice CBC mode usage was poor because the entire traffic shares one CBC session with single set of initial IVs. The rest of the IV are as mentioned above results of the encryption of the previous blocks. The subsequent IV are available to the eavesdroppers. This allows an attacker with the capability to inject arbitrary traffic into the plain-text stream (to be encrypted by the client) to verify their guess of the plain-text preceding the injected block. If the attackers guess is correct then the output of the encryption will be the same for two blocks.
18
+ <P>For low entropy data it is possible to guess the plain-text block with relatively few number of attempts. For example for data that has 1000 possibilities the number of attempts can be 500.
19
+ <P>For more information please see <A HREF="http://eprint.iacr.org/2006/136.pdf" TARGET="_blank">a paper by Gregory V. Bard.</A>]]></DIAGNOSIS>
20
+ <CONSEQUENCE><![CDATA[Recently attacks against the web authentication cookies have been described which used this vulnerability. If the authentication cookie is guessed by the attacker then the attacker can impersonate the legitimate user on the Web site which accepts the authentication cookie.]]></CONSEQUENCE>
21
+ <SOLUTION><![CDATA[This attack was identified in 2004 and later revisions of TLS protocol which contain a fix for this. If possible, upgrade to TLSv1.1 or TLSv1.2. If upgrading to TLSv1.1 or TLSv1.2 is not possible, then disabling CBC mode ciphers will remove the vulnerability.
22
+ <P>
23
+ Openssl.org has posted information including countermeasures. Refer to the following link for further details:
24
+ <A HREF="https://www.openssl.org/~bodo/tls-cbc.txt" TARGET="_blank">Security of CBC Ciphersuites in SSL/TLS</A>
25
+ <P>
26
+ Setting your SSL server to prioritize RC4 ciphers mitigates this vulnerability. Microsoft has posted information including workarounds for IIS at <A HREF="http://technet.microsoft.com/en-us/security/advisory/2588513" TARGET="_blank">KB2588513</A>.
27
+ <P>
28
+ Using the following SSL configuration in Apache mitigates this vulnerability:<P>
29
+ SSLHonorCipherOrder On<BR>
30
+ SSLCipherSuite RC4-SHA:HIGH:!ADH<BR>]]></SOLUTION>
31
+ <RESULT format="table"><![CDATA[Available non CBC cipher Server&apos;s choice SSL version
32
+ RC4-SHA EDH-RSA-DES-CBC3-SHA SSLv3
33
+ RC4-SHA EDH-RSA-DES-CBC3-SHA TLSv1]]></RESULT>
34
+ </VULN>
35
+ </CAT>
@@ -0,0 +1,35 @@
1
+ #[Title]#
2
+ %element.title%
3
+
4
+
5
+ #[Severity]#
6
+ %element.severity%
7
+
8
+
9
+ #[CVE]#
10
+ %element.cveid%
11
+
12
+
13
+ #[CVSS]#
14
+ Base: %element.cvss_base%
15
+ Temporal: %element.cvss_temporal%
16
+
17
+
18
+ #[Diagnosis]#
19
+ %element.diagnosis%
20
+
21
+
22
+ #[Consequence]#
23
+ %element.consequence%
24
+
25
+
26
+ #[Solution]#
27
+ %element.solution%
28
+
29
+
30
+ #[Result]#
31
+ %element.result%
32
+
33
+
34
+ #[CVEList]#
35
+ %element.cve_id_list%
@@ -0,0 +1,6 @@
1
+ evidence.cat_fqdn
2
+ evidence.cat_misc
3
+ evidence.cat_port
4
+ evidence.cat_protocol
5
+ evidence.cat_value
6
+ evidence.result
@@ -0,0 +1,35 @@
1
+ <?xml version="1.0"?>
2
+ <CAT value="Web server" port="443" protocol="tcp">
3
+ <VULN number="42366" severity="3" cveid="CVE-2011-3389">
4
+ <TITLE><![CDATA[SSLv3.0/TLSv1.0 Protocol Weak CBC Mode Vulnerability]]></TITLE>
5
+ <LAST_UPDATE><![CDATA[2011-12-30T18:56:26Z]]></LAST_UPDATE>
6
+ <CVSS_BASE>4.3</CVSS_BASE>
7
+ <CVSS_TEMPORAL>3.5</CVSS_TEMPORAL>
8
+ <PCI_FLAG>0</PCI_FLAG>
9
+ <CVE_ID_LIST>
10
+ <CVE_ID>
11
+ <ID><![CDATA[CVE-2011-3389]]></ID>
12
+ <URL><![CDATA[http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2011-3389]]></URL>
13
+ </CVE_ID>
14
+ </CVE_ID_LIST>
15
+ <DIAGNOSIS><![CDATA[SSLv 3.0 and TLS v1.0 protocols are used to provide integrity, authenticity and privacy to other protocols such as HTTP and LDAP. They provide these services by using encryption for privacy, x509 certificates for authenticity and one-way hash functions for integrity. To encrypt data SSL and TLS can use block ciphers, which are encryption algorithms that can encrypt only a fixed block of original data to an encrypted block of the same size. Note that these cihpers will always obtain the same resulting block for the same original blockof data. To achieve difference in the output the output of encryption is XORed with yet another block of the same size referred to as initialization vectors (IV). A special mode of operation for block ciphers known as CBC (cipher block chaining) uses one IV for the initial block and the result of the previous block for each subsequent block to obtain difference in the output of block cipher encryption.
16
+ <P>
17
+ In SSLv3.0 and TLSv1.0 implementation the choice CBC mode usage was poor because the entire traffic shares one CBC session with single set of initial IVs. The rest of the IV are as mentioned above results of the encryption of the previous blocks. The subsequent IV are available to the eavesdroppers. This allows an attacker with the capability to inject arbitrary traffic into the plain-text stream (to be encrypted by the client) to verify their guess of the plain-text preceding the injected block. If the attackers guess is correct then the output of the encryption will be the same for two blocks.
18
+ <P>For low entropy data it is possible to guess the plain-text block with relatively few number of attempts. For example for data that has 1000 possibilities the number of attempts can be 500.
19
+ <P>For more information please see <A HREF="http://eprint.iacr.org/2006/136.pdf" TARGET="_blank">a paper by Gregory V. Bard.</A>]]></DIAGNOSIS>
20
+ <CONSEQUENCE><![CDATA[Recently attacks against the web authentication cookies have been described which used this vulnerability. If the authentication cookie is guessed by the attacker then the attacker can impersonate the legitimate user on the Web site which accepts the authentication cookie.]]></CONSEQUENCE>
21
+ <SOLUTION><![CDATA[This attack was identified in 2004 and later revisions of TLS protocol which contain a fix for this. If possible, upgrade to TLSv1.1 or TLSv1.2. If upgrading to TLSv1.1 or TLSv1.2 is not possible, then disabling CBC mode ciphers will remove the vulnerability.
22
+ <P>
23
+ Openssl.org has posted information including countermeasures. Refer to the following link for further details:
24
+ <A HREF="https://www.openssl.org/~bodo/tls-cbc.txt" TARGET="_blank">Security of CBC Ciphersuites in SSL/TLS</A>
25
+ <P>
26
+ Setting your SSL server to prioritize RC4 ciphers mitigates this vulnerability. Microsoft has posted information including workarounds for IIS at <A HREF="http://technet.microsoft.com/en-us/security/advisory/2588513" TARGET="_blank">KB2588513</A>.
27
+ <P>
28
+ Using the following SSL configuration in Apache mitigates this vulnerability:<P>
29
+ SSLHonorCipherOrder On<BR>
30
+ SSLCipherSuite RC4-SHA:HIGH:!ADH<BR>]]></SOLUTION>
31
+ <RESULT format="table"><![CDATA[Available non CBC cipher Server&apos;s choice SSL version
32
+ RC4-SHA EDH-RSA-DES-CBC3-SHA SSLv3
33
+ RC4-SHA EDH-RSA-DES-CBC3-SHA TLSv1]]></RESULT>
34
+ </VULN>
35
+ </CAT>
@@ -0,0 +1,11 @@
1
+ #[Category]#
2
+ %evidence.cat_value%
3
+
4
+ #[Protocol]#
5
+ %evidence.cat_protocol%
6
+
7
+ #[Port]#
8
+ %evidence.cat_port%
9
+
10
+ #[Output]#
11
+ %evidence.result%
metadata ADDED
@@ -0,0 +1,168 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: dradis-qualys
3
+ version: !ruby/object:Gem::Version
4
+ version: 3.18.0
5
+ platform: ruby
6
+ authors:
7
+ - Daniel Martin
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2020-07-22 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: dradis-plugins
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '3.6'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '3.6'
27
+ - !ruby/object:Gem::Dependency
28
+ name: nokogiri
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.3'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.3'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.6'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.6'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '10.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '10.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec-rails
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: combustion
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: 0.5.2
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: 0.5.2
97
+ description: This add-on allows you to upload and parse output produced from Qualys
98
+ Vulnerability Scanner into Dradis.
99
+ email:
100
+ - etd@nomejortu.com
101
+ executables: []
102
+ extensions: []
103
+ extra_rdoc_files: []
104
+ files:
105
+ - ".github/issue_template.md"
106
+ - ".github/pull_request_template.md"
107
+ - ".gitignore"
108
+ - ".rspec"
109
+ - CHANGELOG.md
110
+ - CONTRIBUTING.md
111
+ - Gemfile
112
+ - LICENSE
113
+ - README.md
114
+ - Rakefile
115
+ - dradis-qualys.gemspec
116
+ - lib/dradis-qualys.rb
117
+ - lib/dradis/plugins/qualys.rb
118
+ - lib/dradis/plugins/qualys/engine.rb
119
+ - lib/dradis/plugins/qualys/field_processor.rb
120
+ - lib/dradis/plugins/qualys/gem_version.rb
121
+ - lib/dradis/plugins/qualys/importer.rb
122
+ - lib/dradis/plugins/qualys/version.rb
123
+ - lib/qualys/element.rb
124
+ - lib/tasks/thorfile.rb
125
+ - spec/.keep
126
+ - spec/fixtures/files/no_result.xml
127
+ - spec/fixtures/files/simple.xml
128
+ - spec/fixtures/files/two_hosts_common_issue.xml
129
+ - spec/qualys/element_spec.rb
130
+ - spec/qualys/importer_spec.rb
131
+ - spec/spec_helper.rb
132
+ - templates/element.fields
133
+ - templates/element.sample
134
+ - templates/element.template
135
+ - templates/evidence.fields
136
+ - templates/evidence.sample
137
+ - templates/evidence.template
138
+ homepage: http://dradisframework.org
139
+ licenses:
140
+ - GPL-2
141
+ metadata: {}
142
+ post_install_message:
143
+ rdoc_options: []
144
+ require_paths:
145
+ - lib
146
+ required_ruby_version: !ruby/object:Gem::Requirement
147
+ requirements:
148
+ - - ">="
149
+ - !ruby/object:Gem::Version
150
+ version: '0'
151
+ required_rubygems_version: !ruby/object:Gem::Requirement
152
+ requirements:
153
+ - - ">="
154
+ - !ruby/object:Gem::Version
155
+ version: '0'
156
+ requirements: []
157
+ rubygems_version: 3.1.2
158
+ signing_key:
159
+ specification_version: 4
160
+ summary: Qualys add-on for the Dradis Framework.
161
+ test_files:
162
+ - spec/.keep
163
+ - spec/fixtures/files/no_result.xml
164
+ - spec/fixtures/files/simple.xml
165
+ - spec/fixtures/files/two_hosts_common_issue.xml
166
+ - spec/qualys/element_spec.rb
167
+ - spec/qualys/importer_spec.rb
168
+ - spec/spec_helper.rb