heimdall_tools 1.3.25 → 1.3.26

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e4df7bca9817498eb093beeb713b5d421e5b9be3f2bbc3660acfedf8cf2ebc1c
4
- data.tar.gz: 6425078310c5715719e97aa14986d68f660193ecb9b4a62e06cedd8883b72ee6
3
+ metadata.gz: 9f56dbda2e34eb3d1f7377fe8cd0c496fc954c16396462f968cbf701fef4b11c
4
+ data.tar.gz: 0ea42e897e8917ac936ff1fc1772913bf5f1784e61525957dfda400345e527c3
5
5
  SHA512:
6
- metadata.gz: 58f8e947227ffe8f7140e4c02c35a451c92009c83bd1df4a2cdde6f08ec8ae746515301ffa3eb625bffbf460fa814f1d6517360e7a77dea12a30abf81a560cee
7
- data.tar.gz: fb20d39c219c61bc045c5480eb6dab99a53609a993757f3c78f57993559fdc1d2642bd1166ce1df397664c1d97dfb2b342b3617767c1b9a26fbfa7acbc5b40fd
6
+ metadata.gz: 52ee2ddabcc9e2856e1170970267f07ca74c8eb99ab1ea5d2a6533eb7cb13cd7fc0ad32ae0e0d3dee1fd95bc95f08801cc68afa5541c60958977606cf7d36d30
7
+ data.tar.gz: e7b5ed794eb99fb31c07615c5aca117538cc636fa221d540fc21a509f59f669d98a819a762815fd26c574d3236d9dafe3e8eaaa9b6c48eeccde4622a058c02a4
data/CHANGELOG.md CHANGED
@@ -2,7 +2,19 @@
2
2
 
3
3
  ## [Unreleased](https://github.com/mitre/heimdall_tools/tree/HEAD)
4
4
 
5
- [Full Changelog](https://github.com/mitre/heimdall_tools/compare/v1.3.24...HEAD)
5
+ [Full Changelog](https://github.com/mitre/heimdall_tools/compare/v1.3.25...HEAD)
6
+
7
+ **Implemented enhancements:**
8
+
9
+ - Converter: Nessus Transform for Audit results and vulnerability scan results [\#29](https://github.com/mitre/heimdall_tools/issues/29)
10
+
11
+ **Merged pull requests:**
12
+
13
+ - Nessus Mapper [\#45](https://github.com/mitre/heimdall_tools/pull/45) ([rx294](https://github.com/rx294))
14
+
15
+ ## [v1.3.25](https://github.com/mitre/heimdall_tools/tree/v1.3.25) (2020-04-16)
16
+
17
+ [Full Changelog](https://github.com/mitre/heimdall_tools/compare/v1.3.24...v1.3.25)
6
18
 
7
19
  **Closed issues:**
8
20
 
data/README.md CHANGED
@@ -113,13 +113,32 @@ burpsuite_mapper translates an BurpSuite Pro exported XML results file into HDF
113
113
  USAGE: heimdall_tools burpsuite_mapper [OPTIONS] -x <burpsuite-xml> -o <scan-results.json>
114
114
 
115
115
  FLAGS:
116
- -x --json <zap-json> : path to BurpSuitePro exported XML results file.
116
+ -x <burpsuite_xml> : path to BurpSuitePro exported XML results file.
117
117
  -o --output <scan-results> : path to output scan-results json.
118
118
  -V --verbose : verbose run [optional].
119
119
 
120
120
  example: heimdall_tools burpsuite_mapper -x burpsuite_results.xml -o scan_results.json
121
121
  ```
122
122
 
123
+ ## nessus_mapper
124
+
125
+ nessus_mapper translates an Nessus exported XML results file into HDF format json to be viewable in Heimdall
126
+
127
+ The current iteration maps all plugin families except 'Policy Compliance'
128
+
129
+ A separate HDF JSON is generated for each host reported in the Nessus Report.
130
+
131
+ ```
132
+ USAGE: heimdall_tools nessus_mapper [OPTIONS] -x <nessus-results-xml> -o <hdf-file-prefix>
133
+
134
+ FLAGS:
135
+ -x <nessus-results-xml> : path to BurpSuitePro exported XML results file.
136
+ -o --output_prefix <prefix> : path to output scan-results json.
137
+ -V --verbose : verbose run [optional].
138
+
139
+ example: heimdall_tools nessus_mapper -x nessus-results.xml -o test-env
140
+ ```
141
+
123
142
  ## version
124
143
 
125
144
  Prints out the gem version
@@ -0,0 +1,108 @@
1
+ pluginFamily,pluginID,NIST-ID,Rev
2
+ AIX Local Security Checks,*,SI-2|RA-5,4
3
+ Amazon Linux Local Security Checks,*,SI-2|RA-5,4
4
+ CentOS Local Security Checks,*,SI-2|RA-5,4
5
+ Debian Local Security Checks,*,SI-2|RA-5,4
6
+ F5 Networks Local Security Checks,*,SI-2|RA-5,4
7
+ Fedora Local Security Checks,*,SI-2|RA-5,4
8
+ FreeBSD Local Security Checks,*,SI-2|RA-5,4
9
+ Gentoo Local Security Checks,*,SI-2|RA-5,4
10
+ HP-UX Local Security Checks,*,SI-2|RA-5,4
11
+ Huawei Local Security Checks,*,SI-2|RA-5,4
12
+ Junos Local Security Checks,*,SI-2|RA-5,4
13
+ MacOS X Local Security Checks,*,SI-2|RA-5,4
14
+ Mandriva Local Security Checks,*,SI-2|RA-5,4
15
+ NewStart CGSL Local Security Checks,*,SI-2|RA-5,4
16
+ Oracle Linux Local Security Checks,*,SI-2|RA-5,4
17
+ OracleVM Local Security Checks,*,SI-2|RA-5,4
18
+ Palo Alto Local Security Checks,*,SI-2|RA-5,4
19
+ PhotonOS Local Security Checks,*,SI-2|RA-5,4
20
+ Red Hat Local Security Checks,*,SI-2|RA-5,4
21
+ Scientific Linux Local Security Checks,*,SI-2|RA-5,4
22
+ Slackware Local Security Checks,*,SI-2|RA-5,4
23
+ Solaris Local Security Checks,*,SI-2|RA-5,4
24
+ SuSE Local Security Checks,*,SI-2|RA-5,4
25
+ Ubuntu Local Security Checks,*,SI-2|RA-5,4
26
+ VMware ESX Local Security Checks,*,SI-2|RA-5,4
27
+ Virtuozzo Local Security Checks,*,SI-2|RA-5,4
28
+ Backdoors,,,
29
+ Brute force attacks,,,
30
+ CGI abuses,,,
31
+ CGI abuses : XSS,,,
32
+ CISCO,,,
33
+ DNS,,,
34
+ Databases,,,
35
+ Default Unix Accounts,,,
36
+ Denial of Service,,,
37
+ FTP,,,
38
+ Firewalls,56310,SC-7,4
39
+ Gain a shell remotely,,,
40
+ General,133964,AC-3(4),4
41
+ General,117530,UM-1,4
42
+ General,110483,CM-7,4
43
+ General,95928,AC-2,4
44
+ General,90191,CM-8,4
45
+ General,86420,CM-8,4
46
+ General,70544,AC-17(2)|SC-13,4
47
+ General,66334,SI-2|RA-5,4
48
+ General,64582,CM-8,4
49
+ General,57582,SC-12,4
50
+ General,57041,AC-17(2)|SC-13,4
51
+ General,56984,AC-17(2)|SC-13,4
52
+ General,56468,CM-8,4
53
+ General,55472,CM-8,4
54
+ General,54615,CM-8,4
55
+ General,51192,SC-12,4
56
+ General,45590,CM-8,4
57
+ General,45432,CM-8,4
58
+ General,45410,SC-12,4
59
+ General,39520,SI-2|RA-5,4
60
+ General,35351,CM-8,4
61
+ General,34098,CM-8,4
62
+ General,33276,CM-8,4
63
+ General,25220,SC-8,4
64
+ General,25203,CM-8,4
65
+ General,25202,CM-8,4
66
+ General,22869,CM-8,4
67
+ General,21643,AC-17(2)|SC-13,4
68
+ General,12053,CM-8,4
69
+ General,11936,CM-8,4
70
+ General,10881,AC-17(2)|SC-13,4
71
+ General,10863,SC-12,4
72
+ General,10287,CM-8,4
73
+ General,10114,CM-6,4
74
+ Misc.,118237,CM-8,4
75
+ Misc.,97993,CM-8,4
76
+ Misc.,90707,CM-8,4
77
+ Misc.,84821,AC-17(2)|SC-13,4
78
+ Misc.,83875,AC-17(2)|SC-13,4
79
+ Misc.,70657,AC-17(2)|SC-13,4
80
+ Misc.,58651,AC-17,4
81
+ Mobile Devices,,,
82
+ Netware,,,
83
+ Peer-To-Peer File Sharing,,,
84
+ Policy Compliance,,,
85
+ Port scanners,14272,CM-8,4
86
+ RPC,53335,CM-8,4
87
+ RPC,10223,CM-8,4
88
+ SCADA,,,
89
+ SMTP problems,,,
90
+ SNMP,,,
91
+ Service detection,121010,AC-17(2)|SC-13,4
92
+ Service detection,104743,AC-17(2)|SC-13,4
93
+ Service detection,25221,CM-8,4
94
+ Service detection,22964,CM-8,4
95
+ Service detection,11111,CM-8,4
96
+ Service detection,10884,AU-8(1),4
97
+ Service detection,10267,AC-17(2),4
98
+ Settings,117887,UM-1,4
99
+ Settings,110095,UM-1,4
100
+ Settings,19506,UM-1,4
101
+ Web Servers,85805,SC-8|SC-13,4
102
+ Web Servers,84502,AC-17(2)|SC-13,4
103
+ Web Servers,43111,CM-8,4
104
+ Web Servers,24260,CM-8,4
105
+ Web Servers,10107,CM-8,4
106
+ Windows,,,
107
+ Windows : Microsoft Bulletins,,,
108
+ Windows : User management,,,
@@ -45,6 +45,21 @@ module HeimdallTools
45
45
  File.write(options[:output], hdf)
46
46
  end
47
47
 
48
+ desc 'nessus_mapper', 'nessus_mapper translates nessus xml report to HDF format Json be viewed on Heimdall'
49
+ long_desc Help.text(:nessus_mapper)
50
+ option :xml, required: true, aliases: '-x'
51
+ option :output_prefix, required: true, aliases: '-o'
52
+ option :verbose, type: :boolean, aliases: '-V'
53
+ def nessus_mapper
54
+ hdfs = HeimdallTools::NessusMapper.new(File.read(options[:xml])).to_hdf
55
+
56
+ hdfs.keys.each do | host |
57
+ File.write("#{options[:output_prefix]}-#{host}.json", hdfs[host])
58
+ puts "HDF Generated: #{options[:output_prefix]}-#{host}.json"
59
+ end
60
+
61
+ end
62
+
48
63
  desc 'version', 'prints version'
49
64
  def version
50
65
  puts VERSION
@@ -28,12 +28,14 @@ module HeimdallTools
28
28
  depends: NA_ARRAY,
29
29
  groups: NA_ARRAY,
30
30
  status: 'loaded',
31
- controls: NA_TAG)
31
+ controls: NA_TAG,
32
+ target_id: NA_TAG)
32
33
 
33
34
  @results_json = {}
34
35
  @results_json['platform'] = {}
35
36
  @results_json['platform']['name'] = 'Heimdall Tools'
36
37
  @results_json['platform']['release'] = HeimdallTools::VERSION
38
+ @results_json['platform']['target_id'] = target_id.to_s
37
39
  @results_json['version'] = HeimdallTools::VERSION
38
40
 
39
41
  @results_json['statistics'] = {}
@@ -0,0 +1,9 @@
1
+ nessus_mapper translates an Nessus exported XML results file into HDF format json to be viewable in Heimdall
2
+
3
+ The current iteration maps all plugin families except 'Policy Compliance'
4
+
5
+ A separate HDF JSON is generated for each host reported in the Nessus Report.
6
+
7
+ Examples:
8
+
9
+ heimdall_tools nessus_mapper -x nessus_results.xml -o file-prefix
@@ -0,0 +1,176 @@
1
+ require 'json'
2
+ require 'csv'
3
+ require 'heimdall_tools/hdf'
4
+ require 'utilities/xml_to_hash'
5
+
6
+ RESOURCE_DIR = Pathname.new(__FILE__).join('../../data')
7
+
8
+ NESSUS_PLUGINS_NIST_MAPPING_FILE = File.join(RESOURCE_DIR, 'nessus-plugins-nist-mapping.csv')
9
+
10
+ IMPACT_MAPPING = {
11
+ Info: 0.0,
12
+ Low: 0.3,
13
+ Medium: 0.5,
14
+ High: 0.7,
15
+ Critical: 0.9,
16
+ }.freeze
17
+
18
+ DEFAULT_NIST_TAG = ["unmapped"].freeze
19
+
20
+ NA_PLUGIN_OUTPUT = "This Nessus Plugin does not provide output message.".freeze
21
+
22
+ # rubocop:disable Metrics/AbcSize
23
+
24
+ module HeimdallTools
25
+ class NessusMapper
26
+ def initialize(nessus_xml, verbose = false)
27
+ @nessus_xml = nessus_xml
28
+ @verbose = verbose
29
+
30
+ begin
31
+ @cwe_nist_mapping = parse_mapper
32
+ @data = xml_to_hash(nessus_xml)
33
+
34
+ @reports = extract_report
35
+ @scaninfo = extract_scaninfo
36
+ rescue StandardError => e
37
+ raise "Invalid Nessus XML file provided Exception: #{e}"
38
+ end
39
+
40
+ end
41
+
42
+ def extract_report
43
+ begin
44
+ # When there are multiple hosts in the nessus report ReportHost field is an array
45
+ # When there is only one host in the nessus report ReportHost field is a hash
46
+ # Array() converts ReportHost to array in case there is only one host
47
+ reports = @data['NessusClientData_v2']['Report']['ReportHost']
48
+ reports.kind_of?(Array) ? reports : [reports]
49
+ rescue StandardError => e
50
+ raise "Invalid Nessus XML file provided Exception: #{e}"
51
+ end
52
+ end
53
+
54
+ def extract_scaninfo
55
+ begin
56
+ policy = @data['NessusClientData_v2']['Policy']
57
+ info = {}
58
+
59
+ info['policyName'] = policy['policyName']
60
+ info['version'] = policy['Preferences']['ServerPreferences']['preference'].select {|x| x['name'].eql? 'sc_version'}.first['value']
61
+ info
62
+ rescue StandardError => e
63
+ raise "Invalid Nessus XML file provided Exception: #{e}"
64
+ end
65
+ end
66
+
67
+ def extract_timestamp(report)
68
+ begin
69
+ timestamp = report['HostProperties']['tag'].select {|x| x['name'].eql? 'HOST_START'}.first['text']
70
+ rescue StandardError => e
71
+ raise "Invalid Nessus XML file provided Exception: #{e}"
72
+ end
73
+ end
74
+
75
+ def format_desc(issue)
76
+ desc = ''
77
+ desc += "Plugin Family: #{issue['pluginFamily']}; "
78
+ desc += "Port: #{issue['port']}; "
79
+ desc += "Protocol: #{issue['protocol']};"
80
+ desc
81
+ end
82
+
83
+ def finding(issue, timestamp)
84
+ finding = {}
85
+ finding['status'] = 'failed'
86
+ finding['code_desc'] = issue['plugin_output'] || NA_PLUGIN_OUTPUT
87
+ finding['run_time'] = NA_FLOAT
88
+ finding['start_time'] = timestamp
89
+ [finding]
90
+ end
91
+
92
+ def nist_tag(pluginfamily, pluginid)
93
+ entries = @cwe_nist_mapping.select { |x| (x[:pluginfamily].eql?(pluginfamily) && (x[:pluginid].eql?('*') || x[:pluginid].eql?(pluginid.to_i)) ) }
94
+ tags = entries.map { |x| [x[:nistid].split('|'), "Rev_#{x[:rev]}"] }
95
+ tags.empty? ? DEFAULT_NIST_TAG : tags.flatten.uniq
96
+ end
97
+
98
+ def impact(severity)
99
+ case severity
100
+ when "0"
101
+ IMPACT_MAPPING[:Info]
102
+ when "1"
103
+ IMPACT_MAPPING[:Low]
104
+ when "2"
105
+ IMPACT_MAPPING[:Medium]
106
+ when "3"
107
+ IMPACT_MAPPING[:High]
108
+ when "4"
109
+ IMPACT_MAPPING[:Critical]
110
+ else
111
+ -1
112
+ end
113
+ end
114
+
115
+ def parse_mapper
116
+ csv_data = CSV.read(NESSUS_PLUGINS_NIST_MAPPING_FILE, { encoding: 'UTF-8',
117
+ headers: true,
118
+ header_converters: :symbol,
119
+ converters: :all })
120
+ csv_data.map(&:to_hash)
121
+ end
122
+
123
+ def desc_tags(data, label)
124
+ { "data": data || NA_STRING, "label": label || NA_STRING }
125
+ end
126
+
127
+ # Nessus report could have multiple issue entries for multiple findings of same issue type.
128
+ # The meta data is identical across entries
129
+ # method collapse_duplicates return unique controls with applicable findings collapsed into it.
130
+ def collapse_duplicates(controls)
131
+ unique_controls = []
132
+
133
+ controls.map { |x| x['id'] }.uniq.each do |id|
134
+ collapsed_results = controls.select { |x| x['id'].eql?(id) }.map {|x| x['results']}
135
+ unique_control = controls.find { |x| x['id'].eql?(id) }
136
+ unique_control['results'] = collapsed_results.flatten
137
+ unique_controls << unique_control
138
+ end
139
+ unique_controls
140
+ end
141
+
142
+ def to_hdf
143
+ host_results = {}
144
+ @reports.each do | report|
145
+ # Under current version of the converter `Policy Compliance` items are ignored
146
+ report_items = report['ReportItem'].select {|x| !x['pluginFamily'].eql? 'Policy Compliance'}
147
+
148
+ controls = []
149
+ report_items.each do | item |
150
+ @item = {}
151
+ @item['id'] = item['pluginID'].to_s
152
+ @item['title'] = item['pluginName'].to_s
153
+ @item['desc'] = format_desc(item).to_s
154
+ @item['impact'] = impact(item['severity'])
155
+ @item['tags'] = {}
156
+ @item['descriptions'] = []
157
+ @item['refs'] = NA_ARRAY
158
+ @item['source_location'] = NA_HASH
159
+ @item['tags']['nist'] = nist_tag(item['pluginFamily'],item['pluginID'])
160
+ @item['code'] = ''
161
+ @item['results'] = finding(item, extract_timestamp(report))
162
+ controls << @item
163
+ end
164
+ controls = collapse_duplicates(controls)
165
+ results = HeimdallDataFormat.new(profile_name: "Nessus #{@scaninfo['policyName']}",
166
+ version: @scaninfo['version'],
167
+ title: "Nessus #{@scaninfo['policyName']}",
168
+ summary: "Nessus #{@scaninfo['policyName']}",
169
+ controls: controls,
170
+ target_id: report['name'])
171
+ host_results[report['name']] = results.to_hdf
172
+ end
173
+ host_results
174
+ end
175
+ end
176
+ end
@@ -9,4 +9,5 @@ module HeimdallTools
9
9
  autoload :ZapMapper, 'heimdall_tools/zap_mapper'
10
10
  autoload :SonarQubeMapper, 'heimdall_tools/sonarqube_mapper'
11
11
  autoload :BurpSuiteMapper, 'heimdall_tools/burpsuite_mapper'
12
+ autoload :NessusMapper, 'heimdall_tools/nessus_mapper'
12
13
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: heimdall_tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.25
4
+ version: 1.3.26
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Thew
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2020-04-28 00:00:00.000000000 Z
13
+ date: 2020-05-06 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: nokogiri
@@ -211,6 +211,7 @@ files:
211
211
  - exe/heimdall_tools
212
212
  - lib/data/cwe-nist-mapping.csv
213
213
  - lib/data/gitkeep
214
+ - lib/data/nessus-plugins-nist-mapping.csv
214
215
  - lib/data/owasp-nist-mapping.csv
215
216
  - lib/heimdall_tools.rb
216
217
  - lib/heimdall_tools/burpsuite_mapper.rb
@@ -221,8 +222,10 @@ files:
221
222
  - lib/heimdall_tools/help.rb
222
223
  - lib/heimdall_tools/help/burpsuite_mapper.md
223
224
  - lib/heimdall_tools/help/fortify_mapper.md
225
+ - lib/heimdall_tools/help/nessus_mapper.md
224
226
  - lib/heimdall_tools/help/sonarqube_mapper.md
225
227
  - lib/heimdall_tools/help/zap_mapper.md
228
+ - lib/heimdall_tools/nessus_mapper.rb
226
229
  - lib/heimdall_tools/sonarqube_mapper.rb
227
230
  - lib/heimdall_tools/version.rb
228
231
  - lib/heimdall_tools/zap_mapper.rb