Skip to content

Commit edf6697

Browse files
authored
Merge pull request #1718 from drwetter/winshock
New feature: winshock
2 parents 794bbe3 + 0e54075 commit edf6697

5 files changed

Lines changed: 118 additions & 6 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
* Percent output char problem fixed
1313
* Several display/output fixes
1414
* BREACH check: list all compression methods and add brotli
15+
* test for winshock vulnerability
1516
* Security fix: DNS input
1617
* Don't use external pwd anymore
1718
* STARTTLS: XMPP server support

doc/testssl.1

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,9 @@ Security headers (X\-Frame\-Options, X\-XSS\-Protection, Expect\-CT,\.\.\. , CSP
385385
\fB\-L, \-\-lucky13\fR Checks for LUCKY13 vulnerability\. It checks for the presence of CBC ciphers in TLS versions 1\.0 \- 1\.2\.
386386
.
387387
.P
388+
\fB\-WS, \-\-winshock\fR Checks for Winshock vulnerability\. It tests for absence of GCM ciphers which were introduced in the fix and correlates that with the server banner\.
389+
.
390+
.P
388391
\fB\-4, \-\-rc4, \-\-appelbaum\fR Checks which RC4 stream ciphers are being offered\.
389392
.
390393
.SS "OUTPUT OPTIONS"

doc/testssl.1.html

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

doc/testssl.1.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,8 @@ Also for multiple server certificates are being checked for as well as for the c
254254

255255
`-L, --lucky13` Checks for LUCKY13 vulnerability. It checks for the presence of CBC ciphers in TLS versions 1.0 - 1.2.
256256

257+
`-WS, --winshock` Checks for Winshock vulnerability. It tests for absence of GCM ciphers which were introduced in the fix and correlates that with the server banner.
258+
257259
`-4, --rc4, --appelbaum` Checks which RC4 stream ciphers are being offered.
258260

259261

testssl.sh

Lines changed: 110 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17437,6 +17437,101 @@ run_beast(){
1743717437
return 0
1743817438
}
1743917439

17440+
# This is a quick test for Winshock, MS14-066, a vulnerability in the TLS stack of Microsoft which
17441+
# leads to RCE. See https://support.microsoft.com/en-us/help/2992611/ms14-066-vulnerability-in-schannel-could-allow-remote-code-execution-n
17442+
# and http://www.securitysift.com/exploiting-ms14-066-cve-2014-6321-aka-winshock for exploiting.
17443+
# What we do here is giving a hint, as with the Rollup patch MS introduced later is to supply the additional ciphers
17444+
# TLS_DHE_RSA_WITH_AES_256_GCM_SHA384 TLS_DHE_RSA_WITH_AES_128_GCM_SHA256 TLS_RSA_WITH_AES_256_GCM_SHA384 TLS_RSA_WITH_AES_128_GCM_SHA256
17445+
# = DHE-RSA-AES256-GCM-SHA384 DHE-RSA-AES128-GCM-SHA256 AES256-GCM-SHA384 AES128-GCM-SHA256.
17446+
# We check for those (in sockets only to avoid overhead) and for port 443 we also grab the server banner to be more sure.
17447+
# This vulnerability affected all SChannel services -- most notably RDP (port 3398 normally -- but other than
17448+
#
17449+
run_winshock() {
17450+
local ws_ciphers_hex='00,9F, 00,9D, 00,9E, 00,9C'
17451+
local -i sclient_success=0
17452+
local is_iis8=true
17453+
local server_banner=""
17454+
local cve="CVE-2014-6321"
17455+
local cwe="CWE-94"
17456+
local jsonID="winshock"
17457+
17458+
if [[ $VULN_COUNT -le $VULN_THRESHLD ]]; then
17459+
outln
17460+
pr_headlineln " Testing for winshock vulnerability "
17461+
outln
17462+
fi
17463+
pr_bold " Winshock"; out " ($cve), experimental "
17464+
17465+
if [[ "$(has_server_protocol "tls1_3")" -eq 0 ]] ; then
17466+
# There's no MS server supporting TLS 1.3. Winshock was way back in time
17467+
prln_svrty_best "not vulnerable (OK)"
17468+
fileout "$jsonID" "OK" "not vulnerable, TLS 1.3 only" "$cve" "$cwe"
17469+
return 0
17470+
fi
17471+
17472+
# Next we weed out is whether we run HTTP or RDP (on standard port)
17473+
if [[ $SERVICE != HTTP ]] && [[ $PORT != 3389 ]]; then
17474+
prln_svrty_best "not vulnerable (OK) - no HTTP or RDP"
17475+
fileout "$jsonID" "OK" "not vulnerable - no HTTP or RDP" "$cve" "$cwe"
17476+
return 0
17477+
fi
17478+
17479+
# Now we have RDP and HTTP left
17480+
tls_sockets "01" "${ws_ciphers_hex}, 00,ff"
17481+
sclient_success=$?
17482+
[[ "$sclient_success" -eq 2 ]] && sclient_success=0
17483+
if [[ $sclient_success -eq 0 ]]; then
17484+
# has rollup ciphers
17485+
prln_svrty_best "not vulnerable (OK)"
17486+
fileout "$jsonID" "OK" "not vulnerable" "$cve" "$cwe"
17487+
return 0
17488+
elif [[ $sclient_success -ne 1 ]]; then
17489+
prln_warning "check failed, connect problem"
17490+
fileout "$jsonID" "WARN" "check failed, connect problem" "$cve" "$cwe"
17491+
return 1
17492+
fi
17493+
17494+
if [[ $SERVICE != HTTP ]] && [[ $PORT == 3389 ]]; then
17495+
# We take a guess here.
17496+
out "probably "
17497+
pr_svrty_critical "vulnerable (NOT ok)"
17498+
outln " - check patches locally to confirm"
17499+
fileout "${jsonID}" "CRITICAL" "probably vulnerable (NOT OK). Check patches locally to confirm"
17500+
fi
17501+
17502+
# Now we have potentially vulnerable HTTP servers left where we garb the server banner.
17503+
# First choice for that is the HTTP header # file which we retrieved in a default run.
17504+
# From the service detection we also should have a header though as a fall back.
17505+
if [[ -s $HEADERFILE ]]; then
17506+
server_banner="$(grep -Eai '^Server:' $HEADERFILE)"
17507+
elif [[ -s "$TEMPDIR/$NODEIP.service_detection.txt" ]]; then
17508+
server_banner="$(grep -Eai '^Server:' "$TEMPDIR/$NODEIP.service_detection.txt")"
17509+
else
17510+
# We can't use run_http_header here as it messes up the screen. We could automatically
17511+
# run it when --winshock is requested though but this should suffice here.
17512+
prln_warning "check failed, rerun with cmd line option--header "
17513+
fileout "$jsonID" "WARN" "check failed, connect problem" "$cve" "$cwe"
17514+
return 1
17515+
fi
17516+
if [[ $server_banner =~ Microsoft-IIS\/8.5 ]]; then
17517+
# Windows 2012 R2 is less likely than Windows 2012
17518+
out "probably "
17519+
pr_svrty_critical "vulnerable (NOT ok)"
17520+
outln " - check patches locally to confirm"
17521+
fileout "${jsonID}" "CRITICAL" "probably vulnerable (NOT OK). Check patches locally to confirm"
17522+
elif [[ $server_banner =~ Microsoft-IIS\/8.0 ]]; then
17523+
out "likely "
17524+
pr_svrty_critical "VULNERABLE (NOT ok)"
17525+
outln " - check patches locally to confirm"
17526+
fileout "${jsonID}" "CRITICAL" "likely vulnerable (NOT OK). Check patches locally to confirm"
17527+
else
17528+
pr_svrty_best "not vulnerable (OK)"
17529+
outln " - doesn't seem to be IIS 8.x"
17530+
fileout "$jsonID" "OK" "not vulnerable - doesn't seem to be IIS 8.x" "$cve" "$cwe"
17531+
fi
17532+
return 0
17533+
}
17534+
1744017535

1744117536
# https://web.archive.org/web/20200324101422/http://www.isg.rhul.ac.uk/tls/Lucky13.html
1744217537
# Paper: https://doi.org/10.1109/SP.2013.42
@@ -18885,6 +18980,7 @@ single check as <options> ("$PROG_NAME URI" does everything except -E and -g):
1888518980
-W, --sweet32 tests 64 bit block ciphers (3DES, RC2 and IDEA): SWEET32 vulnerability
1888618981
-A, --beast tests for BEAST vulnerability
1888718982
-L, --lucky13 tests for LUCKY13
18983+
-WS, --winshock tests for winshock vulnerability
1888818984
-F, --freak tests for FREAK vulnerability
1888918985
-J, --logjam tests for LOGJAM vulnerability
1889018986
-D, --drown tests for DROWN vulnerability
@@ -21191,6 +21287,7 @@ initialize_globals() {
2119121287
do_fs=false
2119221288
do_protocols=false
2119321289
do_rc4=false
21290+
do_winshock=false
2119421291
do_grease=false
2119521292
do_renego=false
2119621293
do_cipherlists=false
@@ -21228,6 +21325,7 @@ set_scanning_defaults() {
2122821325
do_header=true
2122921326
do_fs=true
2123021327
do_rc4=true
21328+
do_winshock=false
2123121329
do_protocols=true
2123221330
do_renego=true
2123321331
do_cipherlists=true
@@ -21236,9 +21334,9 @@ set_scanning_defaults() {
2123621334
do_tls_fallback_scsv=true
2123721335
do_client_simulation=true
2123821336
if "$OFFENSIVE"; then
21239-
VULN_COUNT=16
21337+
VULN_COUNT=17
2124021338
else
21241-
VULN_COUNT=12
21339+
VULN_COUNT=13
2124221340
fi
2124321341
do_rating=true
2124421342
}
@@ -21250,7 +21348,7 @@ count_do_variables() {
2125021348

2125121349
for gbl in do_allciphers do_vulnerabilities do_beast do_lucky13 do_breach do_ccs_injection do_ticketbleed do_cipher_per_proto do_crime \
2125221350
do_freak do_logjam do_drown do_header do_heartbleed do_mx_all_ips do_fs do_protocols do_rc4 do_grease do_robot do_renego \
21253-
do_cipherlists do_server_defaults do_server_preference do_ssl_poodle do_tls_fallback_scsv \
21351+
do_cipherlists do_server_defaults do_server_preference do_ssl_poodle do_tls_fallback_scsv do_winshock \
2125421352
do_sweet32 do_client_simulation do_cipher_match do_tls_sockets do_mass_testing do_display_only do_rating; do
2125521353
"${!gbl}" && let true_nr++
2125621354
done
@@ -21263,7 +21361,7 @@ debug_globals() {
2126321361

2126421362
for gbl in do_allciphers do_vulnerabilities do_beast do_lucky13 do_breach do_ccs_injection do_ticketbleed do_cipher_per_proto do_crime \
2126521363
do_freak do_logjam do_drown do_header do_heartbleed do_mx_all_ips do_fs do_protocols do_rc4 do_grease do_robot do_renego \
21266-
do_cipherlists do_server_defaults do_server_preference do_ssl_poodle do_tls_fallback_scsv \
21364+
do_cipherlists do_server_defaults do_server_preference do_ssl_poodle do_tls_fallback_scsv do_winshock \
2126721365
do_sweet32 do_client_simulation do_cipher_match do_tls_sockets do_mass_testing do_display_only do_rating; do
2126821366
printf "%-22s = %s\n" $gbl "${!gbl}"
2126921367
done
@@ -21469,11 +21567,12 @@ parse_cmd_line() {
2146921567
do_logjam=true
2147021568
do_beast=true
2147121569
do_lucky13=true
21570+
do_winshock=true
2147221571
do_rc4=true
2147321572
if "$OFFENSIVE"; then
21474-
VULN_COUNT=16
21573+
VULN_COUNT=17
2147521574
else
21476-
VULN_COUNT=12
21575+
VULN_COUNT=13
2147721576
fi
2147821577
;;
2147921578
--ids-friendly)
@@ -21539,6 +21638,10 @@ parse_cmd_line() {
2153921638
do_lucky13=true
2154021639
let "VULN_COUNT++"
2154121640
;;
21641+
-WS|--winshock)
21642+
do_winshock=true
21643+
let "VULN_COUNT++"
21644+
;;
2154221645
-4|--rc4|--appelbaum)
2154321646
do_rc4=true
2154421647
let "VULN_COUNT++"
@@ -22045,6 +22148,7 @@ lets_roll() {
2204522148
"$do_logjam" && { run_logjam; ret=$(($? + ret)); stopwatch run_logjam; }
2204622149
"$do_beast" && { run_beast; ret=$(($? + ret)); stopwatch run_beast; }
2204722150
"$do_lucky13" && { run_lucky13; ret=$(($? + ret)); stopwatch run_lucky13; }
22151+
"$do_winshock" && { run_winshock; ret=$(($? + ret)); stopwatch run_winshock; }
2204822152
"$do_rc4" && { run_rc4; ret=$(($? + ret)); stopwatch run_rc4; }
2204922153

2205022154
fileout_section_header $section_number true && ((section_number++))

0 commit comments

Comments
 (0)