Skip to content

Commit 023005f

Browse files
committed
remove false positive for winshock bc of wrong protocol
Also a cipher exclusion list was added, see #1719
1 parent edf6697 commit 023005f

1 file changed

Lines changed: 45 additions & 14 deletions

File tree

testssl.sh

Lines changed: 45 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17437,17 +17437,23 @@ 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.
17440+
# This is a quick test for Winshock, MS14-066, a vulnerability in the TLS stack of Microsoft which leads to RCE.
17441+
# This vulnerability affected all SChannel services -- most notably RDP (port 3398 normally). See
17442+
# https://support.microsoft.com/en-us/help/2992611/ms14-066-vulnerability-in-schannel-could-allow-remote-code-execution-n
17443+
# and http://www.securitysift.com/exploiting-ms14-066-cve-2014-6321-aka-winshock for "exploiting"/crashing lsass.exe.
17444+
#
1744317445
# What we do here is giving a hint, as with the Rollup patch MS introduced later is to supply the additional ciphers
1744417446
# 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
1744517447
# = DHE-RSA-AES256-GCM-SHA384 DHE-RSA-AES128-GCM-SHA256 AES256-GCM-SHA384 AES128-GCM-SHA256.
1744617448
# 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
17449+
# Also we check whether TLS 1.3 is available and some ciphers (ARIA, CCM, CAMELLIA and CHACHAPOLY). Those ciphers could
17450+
# also be retrieved from our array TLS_CIPHER_RFC_NAME[i] and using TLS_CIPHER_HEXCODE[i]. The latter will be done later.
1744817451
#
1744917452
run_winshock() {
1745017453
local ws_ciphers_hex='00,9F, 00,9D, 00,9E, 00,9C'
17454+
local aria_ciphers='C0,3D,C0,3F,C0,41,C0,43,C0,45,C0,47,C0,49,C0,4B,C0,4D,C0,4F,C0,51,C0,53,C0,55,C0,57,C0,59,C0,5B,C0,5D,C0,5F,C0,61,C0,63,C0,65,C0,67,C0,69,C0,6B,C0,6D,C0,6F,C0,71,C0,3C,C0,3E,C0,40,C0,42,C0,44,C0,46,C0,48,C0,4A,C0,4C,C0,4E,C0,50,C0,52,C0,54,C0,56,C0,58,C0,5A,C0,5C,C0,5E,C0,60,C0,62,C0,64,C0,66,C0,68,C0,6A,C0,6C,C0,6E,C0,70'
17455+
local camellia_ciphers='C0,9B,C0,99,C0,97,C0,95,C0,77,C0,73,00,C4,00,C3,00,C2,00,C1,00,88,00,87,00,86,00,85,00,C5,00,89,C0,79,C0,75,00,C0,00,84,C0,7B,C0,7D,C0,7F,C0,81,C0,83,C0,85,C0,87,C0,89,C0,8B,C0,8D,C0,8F,C0,91,C0,93,C0,76,C0,72,00,BE,00,BD,00,BC,00,BB,00,45,00,44,00,43,00,42,00,BF,00,46,C0,78,C0,74,00,BA,00,41,C0,9A,C0,98,C0,96,C0,94,C0,7A,C0,7C,C0,7E,C0,80,C0,82,C0,84,C0,86,C0,88,C0,8A,C0,8C,C0,8E,C0,90,C0,92'
17456+
local chacha_ccm_ciphers='CC,14,CC,13,CC,15,CC,A9,CC,A8,CC,AA,C0,AF,C0,AD,C0,A3,C0,9F,CC,AE,CC,AD,CC,AC,C0,AB,C0,A7,C0,A1,C0,9D,CC,AB,C0,A9,C0,A5,16,B7,16,B8,13,04,13,05,C0,AE,C0,AC,C0,A2,C0,9E,C0,AA,C0,A6,C0,A0,C0,9C,C0,A8,C0,A4'
1745117457
local -i sclient_success=0
1745217458
local is_iis8=true
1745317459
local server_banner=""
@@ -17464,8 +17470,10 @@ run_winshock() {
1746417470

1746517471
if [[ "$(has_server_protocol "tls1_3")" -eq 0 ]] ; then
1746617472
# 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"
17473+
pr_svrty_best "not vulnerable (OK)"
17474+
debugme echo " - TLS 1.3 found"
17475+
fileout "$jsonID" "OK" "not vulnerable " "$cve" "$cwe"
17476+
outln
1746917477
return 0
1747017478
fi
1747117479

@@ -17476,14 +17484,36 @@ run_winshock() {
1747617484
return 0
1747717485
fi
1747817486

17479-
# Now we have RDP and HTTP left
17480-
tls_sockets "01" "${ws_ciphers_hex}, 00,ff"
17487+
# Now we check whether any CAMELLIA, ARIA, CCM or CHACHA cipher is available.
17488+
# We do this in two shots in order to stay below the 128 cipher limit
17489+
tls_sockets "03" "${aria_ciphers},${chacha_ccm_ciphers}, 00,ff"
1748117490
sclient_success=$?
17482-
[[ "$sclient_success" -eq 2 ]] && sclient_success=0
17483-
if [[ $sclient_success -eq 0 ]]; then
17491+
if [[ $sclient_success -eq 0 ]] || [[ "$sclient_success" -eq 2 ]]; then
17492+
pr_svrty_best "not vulnerable (OK)"
17493+
debugme echo " - ARIA, CHACHA or CCM ciphers found"
17494+
fileout "$jsonID" "OK" "not vulnerable " "$cve" "$cwe"
17495+
outln
17496+
return 0
17497+
fi
17498+
tls_sockets "03" "${camellia_ciphers}, 00,ff"
17499+
sclient_success=$?
17500+
if [[ $sclient_success -eq 0 ]] || [[ "$sclient_success" -eq 2 ]]; then
17501+
pr_svrty_best "not vulnerable (OK)"
17502+
debugme echo " - CAMELLIA ciphers found"
17503+
fileout "$jsonID" "OK" "not vulnerable " "$cve" "$cwe"
17504+
outln
17505+
return 0
17506+
fi
17507+
17508+
# Now we have RDP and HTTP left and need to check the fixed ciphers
17509+
tls_sockets "03" "${ws_ciphers_hex}, 00,ff"
17510+
sclient_success=$?
17511+
if [[ $sclient_success -eq 0 ]] || [[ "$sclient_success" -eq 2 ]]; then
1748417512
# has rollup ciphers
17485-
prln_svrty_best "not vulnerable (OK)"
17513+
pr_svrty_best "not vulnerable (OK)"
17514+
debugme echo " - GCM rollup ciphers found"
1748617515
fileout "$jsonID" "OK" "not vulnerable" "$cve" "$cwe"
17516+
outln
1748717517
return 0
1748817518
elif [[ $sclient_success -ne 1 ]]; then
1748917519
prln_warning "check failed, connect problem"
@@ -17492,14 +17522,15 @@ run_winshock() {
1749217522
fi
1749317523

1749417524
if [[ $SERVICE != HTTP ]] && [[ $PORT == 3389 ]]; then
17495-
# We take a guess here.
17525+
# We take a guess here for RDP as we don't have a banner
1749617526
out "probably "
1749717527
pr_svrty_critical "vulnerable (NOT ok)"
1749817528
outln " - check patches locally to confirm"
1749917529
fileout "${jsonID}" "CRITICAL" "probably vulnerable (NOT OK). Check patches locally to confirm"
17530+
return 0
1750017531
fi
1750117532

17502-
# Now we have potentially vulnerable HTTP servers left where we garb the server banner.
17533+
# Now we have potentially vulnerable HTTP servers left where we grab the server banner.
1750317534
# First choice for that is the HTTP header # file which we retrieved in a default run.
1750417535
# From the service detection we also should have a header though as a fall back.
1750517536
if [[ -s $HEADERFILE ]]; then
@@ -17509,7 +17540,7 @@ run_winshock() {
1750917540
else
1751017541
# We can't use run_http_header here as it messes up the screen. We could automatically
1751117542
# run it when --winshock is requested though but this should suffice here.
17512-
prln_warning "check failed, rerun with cmd line option--header "
17543+
prln_warning "check failed, rerun with cmd line option --header "
1751317544
fileout "$jsonID" "WARN" "check failed, connect problem" "$cve" "$cwe"
1751417545
return 1
1751517546
fi

0 commit comments

Comments
 (0)