Skip to content

Commit a511da4

Browse files
committed
New feature: winshock
This commit implements a detection of Winshock from 2014 (aka MS14-066, CVE-2014-6321). It does that by analyzing * the ciphers supported -- MS' rollup patch introduced new GCM ciphers * AND grabbing the server banner which should match IIS 8.0 oder IIS 8.5 Admittedly this is not a strong detection. But it worked in the cases I tested (no RDP yet). The other known method remotely testing for it against IIS is using a patched openssl binary (see #331 (comment)) -- the diff "jules" (hi) provided a while back. That seems to stem from securitysift albeit his decription was not complete and he didn't provide a PoC (I've seen also polarssl + a little bit of python here: https://vimeo.com/112089813 The catch is securitysift's method, is not as trivial to implement and it dosses the sass.exe process, see: http://www.securitysift.com/exploiting-ms14-066-cve-2014-6321-aka-winshock/. * Todo: man page This commit also removes -BB from the help. We haven't settled yet finally where we go with short options for the cmd line for vulnerabilities. One is for sure though: Using one letter uppercase doesn't scale. As winshock can be executed with --WS and --winshock --BB brings that in line. For now also -BB works (as -WS) but it isn't advertised anymore.
1 parent b6bab1e commit a511da4

1 file changed

Lines changed: 113 additions & 8 deletions

File tree

testssl.sh

Lines changed: 113 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17416,6 +17416,102 @@ run_beast(){
1741617416
return 0
1741717417
}
1741817418

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

1742017516
# https://web.archive.org/web/20200324101422/http://www.isg.rhul.ac.uk/tls/Lucky13.html
1742117517
# Paper: https://doi.org/10.1109/SP.2013.42
@@ -18855,7 +18951,7 @@ single check as <options> ("$PROG_NAME URI" does everything except -E and -g):
1885518951
-H, --heartbleed tests for Heartbleed vulnerability
1885618952
-I, --ccs, --ccs-injection tests for CCS injection vulnerability
1885718953
-T, --ticketbleed tests for Ticketbleed vulnerability in BigIP loadbalancers
18858-
-BB, --robot tests for Return of Bleichenbacher's Oracle Threat (ROBOT) vulnerability
18954+
--BB, --robot tests for Return of Bleichenbacher's Oracle Threat (ROBOT) vulnerability
1885918955
-R, --renegotiation tests for renegotiation vulnerabilities
1886018956
-C, --compression, --crime tests for CRIME vulnerability (TLS compression issue)
1886118957
-B, --breach tests for BREACH vulnerability (HTTP compression issue)
@@ -18864,6 +18960,7 @@ single check as <options> ("$PROG_NAME URI" does everything except -E and -g):
1886418960
-W, --sweet32 tests 64 bit block ciphers (3DES, RC2 and IDEA): SWEET32 vulnerability
1886518961
-A, --beast tests for BEAST vulnerability
1886618962
-L, --lucky13 tests for LUCKY13
18963+
--WS, --winshock tests for winshock vulnerability
1886718964
-F, --freak tests for FREAK vulnerability
1886818965
-J, --logjam tests for LOGJAM vulnerability
1886918966
-D, --drown tests for DROWN vulnerability
@@ -21170,6 +21267,7 @@ initialize_globals() {
2117021267
do_fs=false
2117121268
do_protocols=false
2117221269
do_rc4=false
21270+
do_winshock=false
2117321271
do_grease=false
2117421272
do_renego=false
2117521273
do_cipherlists=false
@@ -21207,6 +21305,7 @@ set_scanning_defaults() {
2120721305
do_header=true
2120821306
do_fs=true
2120921307
do_rc4=true
21308+
do_winshock=false
2121021309
do_protocols=true
2121121310
do_renego=true
2121221311
do_cipherlists=true
@@ -21215,9 +21314,9 @@ set_scanning_defaults() {
2121521314
do_tls_fallback_scsv=true
2121621315
do_client_simulation=true
2121721316
if "$OFFENSIVE"; then
21218-
VULN_COUNT=16
21317+
VULN_COUNT=17
2121921318
else
21220-
VULN_COUNT=12
21319+
VULN_COUNT=13
2122121320
fi
2122221321
do_rating=true
2122321322
}
@@ -21229,7 +21328,7 @@ count_do_variables() {
2122921328

2123021329
for gbl in do_allciphers do_vulnerabilities do_beast do_lucky13 do_breach do_ccs_injection do_ticketbleed do_cipher_per_proto do_crime \
2123121330
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 \
21232-
do_cipherlists do_server_defaults do_server_preference do_ssl_poodle do_tls_fallback_scsv \
21331+
do_cipherlists do_server_defaults do_server_preference do_ssl_poodle do_tls_fallback_scsv do_winshock \
2123321332
do_sweet32 do_client_simulation do_cipher_match do_tls_sockets do_mass_testing do_display_only do_rating; do
2123421333
"${!gbl}" && let true_nr++
2123521334
done
@@ -21242,7 +21341,7 @@ debug_globals() {
2124221341

2124321342
for gbl in do_allciphers do_vulnerabilities do_beast do_lucky13 do_breach do_ccs_injection do_ticketbleed do_cipher_per_proto do_crime \
2124421343
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 \
21245-
do_cipherlists do_server_defaults do_server_preference do_ssl_poodle do_tls_fallback_scsv \
21344+
do_cipherlists do_server_defaults do_server_preference do_ssl_poodle do_tls_fallback_scsv do_winshock \
2124621345
do_sweet32 do_client_simulation do_cipher_match do_tls_sockets do_mass_testing do_display_only do_rating; do
2124721346
printf "%-22s = %s\n" $gbl "${!gbl}"
2124821347
done
@@ -21448,11 +21547,12 @@ parse_cmd_line() {
2144821547
do_logjam=true
2144921548
do_beast=true
2145021549
do_lucky13=true
21550+
do_winshock=true
2145121551
do_rc4=true
2145221552
if "$OFFENSIVE"; then
21453-
VULN_COUNT=16
21553+
VULN_COUNT=17
2145421554
else
21455-
VULN_COUNT=12
21555+
VULN_COUNT=13
2145621556
fi
2145721557
;;
2145821558
--ids-friendly)
@@ -21470,7 +21570,7 @@ parse_cmd_line() {
2147021570
do_ticketbleed=true
2147121571
let "VULN_COUNT++"
2147221572
;;
21473-
-BB|--robot)
21573+
-BB|--BB|--robot)
2147421574
do_robot=true
2147521575
;;
2147621576
-R|--renegotiation)
@@ -21518,6 +21618,10 @@ parse_cmd_line() {
2151821618
do_lucky13=true
2151921619
let "VULN_COUNT++"
2152021620
;;
21621+
-WS|--WS|--winshock)
21622+
do_winshock=true
21623+
let "VULN_COUNT++"
21624+
;;
2152121625
-4|--rc4|--appelbaum)
2152221626
do_rc4=true
2152321627
let "VULN_COUNT++"
@@ -22024,6 +22128,7 @@ lets_roll() {
2202422128
"$do_logjam" && { run_logjam; ret=$(($? + ret)); stopwatch run_logjam; }
2202522129
"$do_beast" && { run_beast; ret=$(($? + ret)); stopwatch run_beast; }
2202622130
"$do_lucky13" && { run_lucky13; ret=$(($? + ret)); stopwatch run_lucky13; }
22131+
"$do_winshock" && { run_winshock; ret=$(($? + ret)); stopwatch run_winshock; }
2202722132
"$do_rc4" && { run_rc4; ret=$(($? + ret)); stopwatch run_rc4; }
2202822133

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

0 commit comments

Comments
 (0)