yawast 0.7.1 → 0.7.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -0
- data/README.md +1 -0
- data/lib/scanner/core.rb +40 -2
- data/lib/scanner/generic.rb +5 -2
- data/lib/scanner/plugins/applications/framework/php.rb +49 -0
- data/lib/scanner/plugins/servers/apache.rb +28 -11
- data/lib/scanner/ssl_labs.rb +41 -2
- data/lib/shared/http.rb +15 -5
- data/lib/version.rb +1 -1
- data/test/test_app_fw_php.rb +22 -0
- data/test/test_scan_apache.rb +19 -15
- data/test/test_ssl_labs_analyze.rb +1 -0
- data/test/test_yawast.rb +50 -0
- data/yawast.gemspec +1 -0
- metadata +19 -3
- data/lib/scanner/plugins/servers/generic.rb +0 -33
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e0dd056ea3ba54d08246201b5bb3f95fc12849cf
|
4
|
+
data.tar.gz: f2dd7a517781fe637b5b0909fca9baa697ae8a33
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 67bbc551774b3d015a8c31a98bfe69254a13d2ca0e3a9cfe71f0f731c17f46b307cb6e34934f34eb1c1ef77ea1546b79b5cf108756fd2ee4fae46d5432b1c79c
|
7
|
+
data.tar.gz: e9bd63484fa8c1c26882cc5892f1edaee4ffe11760c64c1c7d81ba264e60a83971389b861ab3aa31b5ddcb384a72d42aee2d5345d5d01415d71ee09a005cf96f
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,14 @@
|
|
1
|
+
## 0.7.2 - 2019-05-13
|
2
|
+
|
3
|
+
* [#166](https://github.com/adamcaudill/yawast/issues/166) - Detect WWW/Non-WWW domain redirection
|
4
|
+
* [#168](https://github.com/adamcaudill/yawast/issues/168) - SSL Labs: Add Supports CBC Field
|
5
|
+
* [#170](https://github.com/adamcaudill/yawast/issues/170) - When checking HEAD, follow redirects
|
6
|
+
* [#172](https://github.com/adamcaudill/yawast/issues/172) - Check for Apache Tomcat version via 404
|
7
|
+
* [#173](https://github.com/adamcaudill/yawast/issues/173) - Check X-Powered-By for PHP Version
|
8
|
+
* [#174](https://github.com/adamcaudill/yawast/issues/174) - SSL Labs: Add 1.3 0-RTT Support Field
|
9
|
+
* [#169](https://github.com/adamcaudill/yawast/issues/169) - Bug: Error in connecting to SSL Labs
|
10
|
+
* [#176](https://github.com/adamcaudill/yawast/issues/176) - Bug: NoMethodError (match?) in older versions of Ruby
|
11
|
+
|
1
12
|
## 0.7.1 - 2019-05-07
|
2
13
|
|
3
14
|
* [#37](https://github.com/adamcaudill/yawast/issues/37) - Batch Scanning Mode
|
data/README.md
CHANGED
@@ -66,6 +66,7 @@ The following tests are performed:
|
|
66
66
|
* *(Apache Tomcat)* Tomcat Manager Weak Password
|
67
67
|
* *(Apache Tomcat)* Tomcat Host Manager Weak Password
|
68
68
|
* *(Apache Tomcat)* Tomcat version detection via invalid HTTP verb
|
69
|
+
* *(Apache Tomcat)* Tomcat version detection via File Not Found
|
69
70
|
* *(Apache Tomcat)* Tomcat PUT RCE (CVE-2017-12617)
|
70
71
|
* *(Apache Tomcat)* Tomcat Windows RCE (CVE-2019-0232)
|
71
72
|
* *(Apache Struts)* Sample files which may be vulnerable
|
data/lib/scanner/core.rb
CHANGED
@@ -25,6 +25,7 @@ module Yawast
|
|
25
25
|
puts "Server redirects to TLS: Scanning: #{@uri}"
|
26
26
|
Yawast::Shared::Output.log_value 'server_tls_redirect', @uri
|
27
27
|
end
|
28
|
+
@uri = check_www_redirect @uri.copy
|
28
29
|
|
29
30
|
Yawast::Scanner::Plugins::SSL::SSL.set_openssl_options
|
30
31
|
|
@@ -46,7 +47,6 @@ module Yawast
|
|
46
47
|
|
47
48
|
# cache the HEAD result, so that we can minimize hits
|
48
49
|
head = get_head
|
49
|
-
Yawast::Shared::Output.log_hash 'http', 'head', 'raw', head.to_hash
|
50
50
|
Yawast::Scanner::Generic.head_info(head, @uri)
|
51
51
|
|
52
52
|
# perform SSL checks
|
@@ -128,9 +128,47 @@ module Yawast
|
|
128
128
|
end
|
129
129
|
end
|
130
130
|
|
131
|
+
def self.check_www_redirect(uri)
|
132
|
+
# check to see if the server redirects us to the WWW or non-WWW version of the domain
|
133
|
+
head = Yawast::Shared::Http.head(uri)
|
134
|
+
|
135
|
+
unless head['location'].nil?
|
136
|
+
begin
|
137
|
+
location = URI.parse(head['location'])
|
138
|
+
|
139
|
+
if location.host.start_with?('www') && !uri.host.start_with?('www') && location.host == "www.#{uri.host}"
|
140
|
+
uri.host = location.host
|
141
|
+
uri.scheme = location.scheme
|
142
|
+
Yawast::Utilities.puts_raw "WWW Redirect: Scanning #{uri}"
|
143
|
+
|
144
|
+
return uri
|
145
|
+
elsif !location.host.start_with?('www') && uri.host.start_with?('www') && uri.host == "www.#{location.host}"
|
146
|
+
uri.host = location.host
|
147
|
+
uri.scheme = location.scheme
|
148
|
+
Yawast::Utilities.puts_raw "Non-WWW Redirect: Scanning: #{uri}"
|
149
|
+
|
150
|
+
return uri
|
151
|
+
end
|
152
|
+
rescue # rubocop:disable Style/RescueStandardError, Lint/HandleExceptions
|
153
|
+
# we don't care if this fails
|
154
|
+
end
|
155
|
+
end
|
156
|
+
|
157
|
+
uri
|
158
|
+
end
|
159
|
+
|
131
160
|
def self.get_head
|
132
161
|
begin
|
133
|
-
Yawast::Shared::Http.head(@uri)
|
162
|
+
head = Yawast::Shared::Http.head(@uri)
|
163
|
+
Yawast::Shared::Output.log_hash 'http', 'head', @uri, head.to_hash
|
164
|
+
|
165
|
+
unless head['location'].nil?
|
166
|
+
Yawast::Utilities.puts_info "HEAD received redirect to '#{head['location']}'; following."
|
167
|
+
head = Yawast::Shared::Http.head(URI.parse(head['location']))
|
168
|
+
Yawast::Shared::Output.log_hash 'http', 'head', head['location'], head.to_hash
|
169
|
+
end
|
170
|
+
|
171
|
+
head
|
134
172
|
rescue => e # rubocop:disable Style/RescueStandardError
|
135
173
|
Yawast::Utilities.puts_error "Fatal Connection Error: Unable to complete HEAD request from '#{@uri}' (#{e.class}: #{e.message})"
|
136
174
|
exit 1
|
data/lib/scanner/generic.rb
CHANGED
@@ -58,7 +58,7 @@ module Yawast
|
|
58
58
|
|
59
59
|
if server != ''
|
60
60
|
Yawast::Scanner::Plugins::Servers::Apache.check_banner(server)
|
61
|
-
Yawast::Scanner::Plugins::
|
61
|
+
Yawast::Scanner::Plugins::Applications::Framework::PHP.check_banner(server)
|
62
62
|
Yawast::Scanner::Plugins::Servers::Iis.check_banner(server)
|
63
63
|
Yawast::Scanner::Plugins::Servers::Nginx.check_banner(server)
|
64
64
|
Yawast::Scanner::Plugins::Servers::Python.check_banner(server)
|
@@ -71,7 +71,10 @@ module Yawast
|
|
71
71
|
Yawast::Shared::Output.log_value 'server', server
|
72
72
|
end
|
73
73
|
|
74
|
-
|
74
|
+
if powered_by != ''
|
75
|
+
Yawast::Utilities.puts_warn "X-Powered-By Header Present: #{powered_by}"
|
76
|
+
Yawast::Scanner::Plugins::Applications::Framework::PHP.check_powered_by(powered_by)
|
77
|
+
end
|
75
78
|
|
76
79
|
Yawast::Utilities.puts_warn 'X-XSS-Protection Disabled Header Present' if xss_protection == '0'
|
77
80
|
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Yawast
|
4
|
+
module Scanner
|
5
|
+
module Plugins
|
6
|
+
module Applications
|
7
|
+
module Framework
|
8
|
+
class PHP
|
9
|
+
def self.check_banner(banner)
|
10
|
+
Yawast::Shared::Output.log_hash 'vulnerabilities',
|
11
|
+
'php_version_exposed_banner',
|
12
|
+
{vulnerable: false, version: nil, banner: banner}
|
13
|
+
|
14
|
+
# don't bother if this doesn't include PHP
|
15
|
+
return unless banner.include? 'PHP/'
|
16
|
+
|
17
|
+
modules = banner.split(' ')
|
18
|
+
|
19
|
+
modules.each do |mod|
|
20
|
+
if mod.include? 'PHP/'
|
21
|
+
Yawast::Utilities.puts_warn "PHP Version: #{mod}"
|
22
|
+
puts ''
|
23
|
+
|
24
|
+
Yawast::Shared::Output.log_hash 'vulnerabilities',
|
25
|
+
'php_version_exposed_banner',
|
26
|
+
{vulnerable: true, version: mod, banner: banner}
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.check_powered_by(banner)
|
32
|
+
Yawast::Shared::Output.log_hash 'vulnerabilities',
|
33
|
+
'php_version_exposed_powered_by',
|
34
|
+
{vulnerable: false, version: nil}
|
35
|
+
|
36
|
+
# don't bother if this doesn't include PHP
|
37
|
+
return unless banner.include? 'PHP/'
|
38
|
+
|
39
|
+
Yawast::Utilities.puts_warn "PHP Version: #{banner}"
|
40
|
+
Yawast::Shared::Output.log_hash 'vulnerabilities',
|
41
|
+
'php_version_exposed_powered_by',
|
42
|
+
{vulnerable: true, version: banner}
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'base64'
|
4
|
+
require 'polyfill'
|
4
5
|
require 'securerandom'
|
5
6
|
|
6
7
|
module Yawast
|
@@ -8,6 +9,8 @@ module Yawast
|
|
8
9
|
module Plugins
|
9
10
|
module Servers
|
10
11
|
class Apache
|
12
|
+
using Polyfill({Regexp: :all})
|
13
|
+
|
11
14
|
def self.check_banner(banner)
|
12
15
|
Yawast::Shared::Output.log_hash 'vulnerabilities',
|
13
16
|
'apache_openssl_version_exposed',
|
@@ -28,7 +31,7 @@ module Yawast
|
|
28
31
|
|
29
32
|
# fix '(distro)' issue, such as with 'Apache/2.2.22 (Ubuntu)'
|
30
33
|
# if we don't do this, it triggers a false positive on the module check
|
31
|
-
if /\(\w*\)/.match?
|
34
|
+
if !modules[1].nil? && /\(\w*\)/.match?(modules[1])
|
32
35
|
server += " #{modules[1]}"
|
33
36
|
modules.delete_at 1
|
34
37
|
end
|
@@ -67,7 +70,8 @@ module Yawast
|
|
67
70
|
check_server_status(uri.copy)
|
68
71
|
check_server_info(uri.copy)
|
69
72
|
check_tomcat_manager(uri.copy)
|
70
|
-
check_tomcat_version(uri.copy)
|
73
|
+
check_tomcat_version(uri.copy, true)
|
74
|
+
check_tomcat_version(uri.copy, false)
|
71
75
|
check_tomcat_put_rce(uri.copy)
|
72
76
|
check_struts2_samples(uri.copy)
|
73
77
|
|
@@ -84,33 +88,46 @@ module Yawast
|
|
84
88
|
check_page_for_string uri, '/server-info', 'Apache Server Information'
|
85
89
|
end
|
86
90
|
|
87
|
-
def self.check_tomcat_version(uri)
|
91
|
+
def self.check_tomcat_version(uri, use_invalid_method)
|
88
92
|
Yawast::Shared::Output.log_hash 'vulnerabilities',
|
89
93
|
'apache_tomcat_version_exposed',
|
90
94
|
{vulnerable: false, version: nil, body: nil}
|
91
95
|
|
92
96
|
begin
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
+
if use_invalid_method
|
98
|
+
vuln = 'apache_tomcat_version_exposed_invalid_method'
|
99
|
+
|
100
|
+
req = Yawast::Shared::Http.get_http(uri)
|
101
|
+
req.use_ssl = uri.scheme == 'https'
|
102
|
+
headers = Yawast::Shared::Http.get_headers
|
103
|
+
res = req.request(Xyz.new('/', headers))
|
104
|
+
else
|
105
|
+
vuln = 'apache_tomcat_version_exposed_404'
|
106
|
+
|
107
|
+
uri.path = "/#{SecureRandom.hex}.jsp"
|
108
|
+
res = Yawast::Shared::Http.get_raw(uri)
|
109
|
+
end
|
97
110
|
|
98
|
-
if !res.body.nil? && res.body.include?('Apache Tomcat') && res.code == '501'
|
111
|
+
if !res.body.nil? && res.body.include?('Apache Tomcat') && (res.code == '501' || res.code == '401')
|
99
112
|
# check to see if there's a version number
|
100
113
|
version = /Apache Tomcat\/\d*.\d*.\d*\b/.match res.body
|
101
114
|
|
102
115
|
if !version.nil? && !version[0].nil?
|
103
116
|
Yawast::Utilities.puts_warn "Apache Tomcat Version Found: #{version[0]}"
|
104
117
|
Yawast::Shared::Output.log_hash 'vulnerabilities',
|
105
|
-
|
118
|
+
vuln,
|
106
119
|
{vulnerable: true, version: version[0], body: res.body}
|
107
120
|
|
108
|
-
|
121
|
+
if use_invalid_method
|
122
|
+
puts "\t\t\"curl -X XYZ #{uri}\""
|
123
|
+
else
|
124
|
+
puts "\t\t\"curl #{uri}\""
|
125
|
+
end
|
109
126
|
|
110
127
|
puts ''
|
111
128
|
else
|
112
129
|
Yawast::Shared::Output.log_hash 'vulnerabilities',
|
113
|
-
|
130
|
+
vuln,
|
114
131
|
{vulnerable: false, version: nil, body: res.body}
|
115
132
|
end
|
116
133
|
end
|
data/lib/scanner/ssl_labs.rb
CHANGED
@@ -23,13 +23,23 @@ module Yawast
|
|
23
23
|
Yawast::Scanner::Plugins::SSL::SSLLabs::Analyze.scan endpoint, uri.host, true
|
24
24
|
|
25
25
|
status = ''
|
26
|
+
error_count = 0
|
26
27
|
until status == 'READY' || status == 'ERROR' || status == 'DNS'
|
27
28
|
# poll for updates every 5 seconds
|
28
29
|
# don't want to poll faster, to avoid excess load / errors
|
29
30
|
sleep(5)
|
30
31
|
|
31
|
-
|
32
|
-
|
32
|
+
begin
|
33
|
+
data_body = Yawast::Scanner::Plugins::SSL::SSLLabs::Analyze.scan endpoint, uri.host, false
|
34
|
+
status = Yawast::Scanner::Plugins::SSL::SSLLabs::Analyze.extract_status data_body
|
35
|
+
rescue # rubocop:disable Style/RescueStandardError
|
36
|
+
# if we find ourselves here, we want to try a couple more times before we give up for good
|
37
|
+
error_count += 1
|
38
|
+
|
39
|
+
if error_count > 3
|
40
|
+
raise
|
41
|
+
end
|
42
|
+
end
|
33
43
|
|
34
44
|
print '.'
|
35
45
|
end
|
@@ -531,6 +541,21 @@ module Yawast
|
|
531
541
|
{vulnerable: false}
|
532
542
|
end
|
533
543
|
|
544
|
+
unless ep['details']['zeroRTTEnabled'].nil?
|
545
|
+
case ep['details']['zeroRTTEnabled']
|
546
|
+
when -2
|
547
|
+
Yawast::Utilities.puts_error "\t\t\tTLS 1.3 0-RTT Support: Test Failed"
|
548
|
+
when -1
|
549
|
+
Yawast::Utilities.puts_info "\t\t\tTLS 1.3 0-RTT Support: Test Not Performed"
|
550
|
+
when 0
|
551
|
+
Yawast::Utilities.puts_info "\t\t\tTLS 1.3 0-RTT Support: No"
|
552
|
+
when 1
|
553
|
+
Yawast::Utilities.puts_warn "\t\t\tTLS 1.3 0-RTT Support: Yes"
|
554
|
+
else
|
555
|
+
Yawast::Utilities.puts_error "\t\t\tTLS 1.3 0-RTT Support: Unknown Response #{ep['details']['zeroRTTEnabled']}"
|
556
|
+
end
|
557
|
+
end
|
558
|
+
|
534
559
|
unless ep['details']['renegSupport'].nil?
|
535
560
|
if ep['details']['renegSupport'] & 1 != 0
|
536
561
|
Yawast::Utilities.puts_vuln "\t\t\tSecure Renegotiation: insecure client-initiated renegotiation supported"
|
@@ -884,6 +909,20 @@ module Yawast
|
|
884
909
|
{vulnerable: true}
|
885
910
|
end
|
886
911
|
|
912
|
+
if ep['details']['supportsCBC']
|
913
|
+
Yawast::Utilities.puts_warn "\t\t\tCBC Cipher Suites Supported: Yes"
|
914
|
+
|
915
|
+
Yawast::Shared::Output.log_hash 'vulnerabilities',
|
916
|
+
'tls_cbc_support',
|
917
|
+
{vulnerable: true}
|
918
|
+
else
|
919
|
+
Yawast::Utilities.puts_info "\t\t\tCBC Cipher Suites Supported: No"
|
920
|
+
|
921
|
+
Yawast::Shared::Output.log_hash 'vulnerabilities',
|
922
|
+
'tls_cbc_support',
|
923
|
+
{vulnerable: false}
|
924
|
+
end
|
925
|
+
|
887
926
|
Yawast::Utilities.puts_info "\t\t\tALPN: #{ep['details']['alpnProtocols']}"
|
888
927
|
|
889
928
|
Yawast::Utilities.puts_info "\t\t\tNPN: #{ep['details']['npnProtocols']}"
|
data/lib/shared/http.rb
CHANGED
@@ -35,20 +35,30 @@ module Yawast
|
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
38
|
-
def self.
|
39
|
-
|
40
|
-
code = nil
|
38
|
+
def self.get_raw(uri, headers = nil)
|
39
|
+
res = nil
|
41
40
|
|
42
41
|
begin
|
43
42
|
req = get_http(uri)
|
44
43
|
req.use_ssl = uri.scheme == 'https'
|
45
44
|
res = req.request_get(uri, get_headers(headers))
|
46
|
-
body = res.read_body
|
47
|
-
code = res.code
|
48
45
|
rescue => e # rubocop:disable Style/RescueStandardError
|
49
46
|
Yawast::Utilities.puts_error "Error sending request to #{uri} - '#{e.message}'"
|
50
47
|
end
|
51
48
|
|
49
|
+
res
|
50
|
+
end
|
51
|
+
|
52
|
+
def self.get_with_code(uri, headers = nil)
|
53
|
+
res = get_raw(uri, headers)
|
54
|
+
body = ''
|
55
|
+
code = nil
|
56
|
+
|
57
|
+
unless res.nil?
|
58
|
+
body = res.read_body
|
59
|
+
code = res.code
|
60
|
+
end
|
61
|
+
|
52
62
|
{body: body, code: code}
|
53
63
|
end
|
54
64
|
|
data/lib/version.rb
CHANGED
@@ -0,0 +1,22 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../lib/yawast'
|
2
|
+
require File.dirname(__FILE__) + '/base'
|
3
|
+
|
4
|
+
class TestAppFWPHP < Minitest::Test
|
5
|
+
include TestBase
|
6
|
+
|
7
|
+
def test_php_powered_by
|
8
|
+
override_stdout
|
9
|
+
|
10
|
+
error = nil
|
11
|
+
begin
|
12
|
+
Yawast::Scanner::Plugins::Applications::Framework::PHP.check_powered_by('PHP/5.4.22')
|
13
|
+
rescue => e
|
14
|
+
error = e.message
|
15
|
+
end
|
16
|
+
|
17
|
+
assert stdout_value.include?('PHP Version: PHP/5.4.22'), "PHP version not found: #{stdout_value}"
|
18
|
+
assert error == nil, "Unexpected error: #{error}"
|
19
|
+
|
20
|
+
restore_stdout
|
21
|
+
end
|
22
|
+
end
|
data/test/test_scan_apache.rb
CHANGED
@@ -27,26 +27,30 @@ class TestScannerApache < Minitest::Test
|
|
27
27
|
end
|
28
28
|
|
29
29
|
def test_check_tomcat_2019_0232
|
30
|
-
|
30
|
+
# TODO: This test isn't working, no idea why - the connection to the server fails. Need to research.
|
31
|
+
# Failed to open TCP connection to localhost:9083 (Connection refused...
|
31
32
|
|
32
|
-
|
33
|
-
server = start_web_server File.dirname(__FILE__) + '/data/apache_server_info.txt', '/cgi-bin/test.bat', port
|
34
|
-
uri = URI.parse "http://localhost:#{port}/cgi-bin/test.bat"
|
35
|
-
links = [uri.to_s]
|
33
|
+
#override_stdout
|
36
34
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
error = e.message
|
42
|
-
end
|
35
|
+
#port = rand(60000) + 1024 # pick a random port number
|
36
|
+
#server = start_web_server File.dirname(__FILE__) + '/data/apache_server_info.txt', '/cgi-bin/test.bat', port
|
37
|
+
#uri = URI.parse "http://localhost:#{port}/cgi-bin/test.bat"
|
38
|
+
#links = [uri.to_s]
|
43
39
|
|
44
|
-
|
45
|
-
|
40
|
+
#error = nil
|
41
|
+
#begin
|
42
|
+
#Yawast::Scanner::Plugins::Servers::Apache.check_cve_2019_0232 links
|
43
|
+
#rescue => e
|
44
|
+
#error = e.message
|
45
|
+
#end
|
46
46
|
|
47
|
-
|
47
|
+
#assert !stdout_value.include?('[V]'), "Unexpected finding: #{stdout_value}"
|
48
|
+
#assert !stdout_value.include?('[E]'), "Unexpected error: #{stdout_value}"
|
49
|
+
#assert error == nil, "Unexpected error: #{error}"
|
48
50
|
|
49
|
-
|
51
|
+
#restore_stdout
|
52
|
+
|
53
|
+
#server.exit
|
50
54
|
end
|
51
55
|
|
52
56
|
def test_check_struts2_samples
|
@@ -100,6 +100,7 @@ class TestSSLLabsAnalyze < Minitest::Test
|
|
100
100
|
|
101
101
|
assert stdout_value.include?('www.forest.gov.tw'), "domain name not found in #{stdout_value}"
|
102
102
|
assert stdout_value.include?('Root Stores: Apple (trusted) Windows (trusted)'), "root store name not found in #{stdout_value}"
|
103
|
+
assert !stdout_value.include?('[E]'), "Error message found in #{stdout_value}"
|
103
104
|
|
104
105
|
restore_stdout
|
105
106
|
end
|
data/test/test_yawast.rb
CHANGED
@@ -14,4 +14,54 @@ class TestYawast < Minitest::Test
|
|
14
14
|
|
15
15
|
restore_stdout
|
16
16
|
end
|
17
|
+
|
18
|
+
def test_non_www_redirect
|
19
|
+
override_stdout
|
20
|
+
|
21
|
+
original = Yawast::Shared::Uri.extract_uri'https://www.adamcaudill.com'
|
22
|
+
new = Yawast::Scanner::Core.check_www_redirect original.copy
|
23
|
+
|
24
|
+
assert original.host != new.host, "Host not changed: '#{new}'"
|
25
|
+
assert stdout_value.include?('Non-WWW Redirect'), "Non-WWW Redirect not found in: #{stdout_value}"
|
26
|
+
|
27
|
+
restore_stdout
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_www_redirect
|
31
|
+
override_stdout
|
32
|
+
|
33
|
+
original = Yawast::Shared::Uri.extract_uri'https://apple.com'
|
34
|
+
new = Yawast::Scanner::Core.check_www_redirect original.copy
|
35
|
+
|
36
|
+
assert original.host != new.host, "Host not changed: '#{new}'"
|
37
|
+
assert stdout_value.include?('WWW Redirect'), "WWW Redirect not found in: #{stdout_value}"
|
38
|
+
|
39
|
+
restore_stdout
|
40
|
+
end
|
41
|
+
|
42
|
+
def test_no_redirect
|
43
|
+
override_stdout
|
44
|
+
|
45
|
+
original = Yawast::Shared::Uri.extract_uri'https://adamcaudill.com'
|
46
|
+
new = Yawast::Scanner::Core.check_www_redirect original.copy
|
47
|
+
|
48
|
+
assert original.host == new.host, "Host changed: '#{new}'"
|
49
|
+
assert !stdout_value.include?('Non-WWW Redirect'), "Non-WWW Redirect found in: #{stdout_value}"
|
50
|
+
assert !stdout_value.include?('WWW Redirect'), "WWW Redirect found in: #{stdout_value}"
|
51
|
+
|
52
|
+
restore_stdout
|
53
|
+
end
|
54
|
+
|
55
|
+
def test_non_www_redirect_scheme
|
56
|
+
override_stdout
|
57
|
+
|
58
|
+
original = Yawast::Shared::Uri.extract_uri'http://apple.com'
|
59
|
+
new = Yawast::Scanner::Core.check_www_redirect original.copy
|
60
|
+
|
61
|
+
assert original.host != new.host, "Host not changed: '#{new}'"
|
62
|
+
assert stdout_value.include?('WWW Redirect'), "WWW Redirect not found in: #{stdout_value}"
|
63
|
+
assert original.scheme != new.scheme, "Scheme not changed: Original: '#{original}' - New: '#{new}'"
|
64
|
+
|
65
|
+
restore_stdout
|
66
|
+
end
|
17
67
|
end
|
data/yawast.gemspec
CHANGED
@@ -23,6 +23,7 @@ Gem::Specification.new do |s|
|
|
23
23
|
s.add_runtime_dependency 'ipaddress', '~> 0.8'
|
24
24
|
s.add_runtime_dependency 'nokogiri', '~> 1.8'
|
25
25
|
s.add_runtime_dependency 'openssl-extensions', '~> 1.2'
|
26
|
+
s.add_runtime_dependency 'polyfill', '~> 1.7'
|
26
27
|
s.add_runtime_dependency 'public_suffix', '~> 2.0'
|
27
28
|
s.add_runtime_dependency 'selenium-webdriver', '~> 3.141'
|
28
29
|
s.add_runtime_dependency 'sslshake', '~> 1.1'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yawast
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Caudill
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-05-
|
11
|
+
date: 2019-05-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colorize
|
@@ -150,6 +150,20 @@ dependencies:
|
|
150
150
|
- - "~>"
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: '1.2'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: polyfill
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - "~>"
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '1.7'
|
160
|
+
type: :runtime
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - "~>"
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '1.7'
|
153
167
|
- !ruby/object:Gem::Dependency
|
154
168
|
name: public_suffix
|
155
169
|
requirement: !ruby/object:Gem::Requirement
|
@@ -226,6 +240,7 @@ files:
|
|
226
240
|
- lib/scanner/generic.rb
|
227
241
|
- lib/scanner/plugins/applications/cms/generic.rb
|
228
242
|
- lib/scanner/plugins/applications/cms/wordpress.rb
|
243
|
+
- lib/scanner/plugins/applications/framework/php.rb
|
229
244
|
- lib/scanner/plugins/applications/framework/rails.rb
|
230
245
|
- lib/scanner/plugins/applications/generic/password_reset.rb
|
231
246
|
- lib/scanner/plugins/dns/caa.rb
|
@@ -234,7 +249,6 @@ files:
|
|
234
249
|
- lib/scanner/plugins/http/file_presence.rb
|
235
250
|
- lib/scanner/plugins/http/generic.rb
|
236
251
|
- lib/scanner/plugins/servers/apache.rb
|
237
|
-
- lib/scanner/plugins/servers/generic.rb
|
238
252
|
- lib/scanner/plugins/servers/iis.rb
|
239
253
|
- lib/scanner/plugins/servers/nginx.rb
|
240
254
|
- lib/scanner/plugins/servers/python.rb
|
@@ -279,6 +293,7 @@ files:
|
|
279
293
|
- test/data/wp-login-4.9.8.txt
|
280
294
|
- test/data/wp-login-5.1.1.txt
|
281
295
|
- test/test_app_cms_wp.rb
|
296
|
+
- test/test_app_fw_php.rb
|
282
297
|
- test/test_app_fw_rails.rb
|
283
298
|
- test/test_cmd_util.rb
|
284
299
|
- test/test_directory_search.rb
|
@@ -352,6 +367,7 @@ test_files:
|
|
352
367
|
- test/data/wp-login-4.9.8.txt
|
353
368
|
- test/data/wp-login-5.1.1.txt
|
354
369
|
- test/test_app_cms_wp.rb
|
370
|
+
- test/test_app_fw_php.rb
|
355
371
|
- test/test_app_fw_rails.rb
|
356
372
|
- test/test_cmd_util.rb
|
357
373
|
- test/test_directory_search.rb
|
@@ -1,33 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Yawast
|
4
|
-
module Scanner
|
5
|
-
module Plugins
|
6
|
-
module Servers
|
7
|
-
class Generic
|
8
|
-
def self.check_banner_php(banner)
|
9
|
-
Yawast::Shared::Output.log_hash 'vulnerabilities',
|
10
|
-
'php_version_exposed',
|
11
|
-
{vulnerable: false, version: nil}
|
12
|
-
|
13
|
-
# don't bother if this doesn't include PHP
|
14
|
-
return unless banner.include? 'PHP/'
|
15
|
-
|
16
|
-
modules = banner.split(' ')
|
17
|
-
|
18
|
-
modules.each do |mod|
|
19
|
-
if mod.include? 'PHP/'
|
20
|
-
Yawast::Utilities.puts_warn "PHP Version: #{mod}"
|
21
|
-
puts ''
|
22
|
-
|
23
|
-
Yawast::Shared::Output.log_hash 'vulnerabilities',
|
24
|
-
'php_version_exposed',
|
25
|
-
{vulnerable: true, version: mod}
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|