Skip to content

Commit d2d684e

Browse files
authored
Merge pull request #3029 from testssl/fix_fix_2809
Address missing extended_master secret extension properly
2 parents 7c47d8a + cff949b commit d2d684e

1 file changed

Lines changed: 26 additions & 21 deletions

File tree

testssl.sh

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -10726,8 +10726,9 @@ run_server_defaults() {
1072610726
outln "(none)"
1072710727
fileout "TLS_extensions" "INFO" "(none)"
1072810728
else
10729-
#FIXME: we rather want to have the chance to print each ext in italics or another format.
10730-
# Atm is a string of quoted strings -- that needs to be fixed at the root then
10729+
#FIXME: we rather want to print each ext in italics or another format.
10730+
# Atm it's a string of quoted strings -- that needs to be fixed at the
10731+
# the root then.
1073110732
# out_row_aligned_max_width() places line breaks at space characters.
1073210733
# So, in order to prevent the text for an extension from being broken
1073310734
# across lines, temporarily replace space characters within the text
@@ -10740,32 +10741,36 @@ run_server_defaults() {
1074010741
tls_extensions="${tls_extensions:1}"
1074110742
fileout "TLS_extensions" "INFO" "$tls_extensions"
1074210743
tls_extensions="${tls_extensions// /{}"
10743-
tls_extensions="${tls_extensions//\"{\"/\" \"}"
10744-
tls_extensions="$(out_row_aligned_max_width "$tls_extensions" " " $TERM_WIDTH)"
10745-
tls_extensions="${tls_extensions//{/ }"
10744+
tls_extensions="${tls_extensions//'{\"'/'" "'}"
10745+
#tls_extensions="${tls_extensions//\"{\"/\" \"}" # blank command for deconfusing vim's syntax hiliting
10746+
tls_extensions="$(out_row_aligned_max_width "$tls_extensions" ' ' $TERM_WIDTH)"
10747+
tls_extensions="${tls_extensions//\{/ }"
1074610748
outln "$tls_extensions"
1074710749
fi
1074810750

10749-
# We want to check whether the (for >=TLS 1.2) mandatory "extended master secret" extension is supported by
10750-
# the server. Otherwise it would violate RFC 9325 https://www.rfc-editor.org/rfc/rfc9325#section-3.5
10751-
# and cause connection problems.
10751+
# We want to check whether the (for <=TLS 1.2) mandatory "extended master secret" extension is supported by
10752+
# the server. Otherwise it would violate RFC 9325 https://www.rfc-editor.org/rfc/rfc9325#section-3.5. Also:
10753+
# "If a server implementing this document receives the "extended_master_secret" extension, it MUST
10754+
# include the extension in its ServerHello message". (https://www.rfc-editor.org/rfc/rfc7627.html#section-5.2).
10755+
1075210756
jsonID="TLS_misses_extension_23"
10753-
if [[ $(has_server_protocol "tls1_2") -eq 1 ]] && [[ $(has_server_protocol "tls1_3") -eq 1 ]] ; then
10754-
:
10755-
elif [[ $tls_extensions =~ \#23 ]]; then
10756-
# Was the last handshake >= TLS 1.2 ?
10757-
if grep -qE 'Protocol.*(TLSv1.3|TLSv1.2)' $TEMPDIR/$NODEIP.parse_tls_serverhello.txt ; then
10758-
fileout "$jsonID" "INFO" "Extended master secret extension detected"
10759-
debugme outln "${spaces}Extended master secret extension detected"
10757+
if [[ $tls_extensions =~ \#23 ]]; then
10758+
if "$TLS13_ONLY"; then
10759+
# this shouldn't happen
10760+
fileout "$jsonID" "LOW" "Misconfiguration: Extended master secret extension detected for TLS 1.3 only"
10761+
debugme outln "${spaces}Misconfiguration: Extended master secret extension detected for TLS 1.3 only"
1076010762
else
10761-
out "$spaces"
10762-
prln_warning "Fixme: Server supports TLS 1.2 or 1.3 but last ServerHello was < TLS 1.2"
10763-
fileout "$jsonID" "WARN" "Server supports TLS 1.2 or 1.3 but last ServerHello was < TLS 1.2"
10763+
if grep -qE 'Protocol.*(TLSv1.)' $TEMPDIR/$NODEIP.parse_tls_serverhello.txt ; then
10764+
fileout "$jsonID" "INFO" "Extended master secret extension detected"
10765+
debugme outln "${spaces}Extended master secret extension detected"
10766+
fi
10767+
# We don't worry about SSL3.0 here. It should have been tested before withg testssl.sh --
10768+
# though it's mentioned in https://www.rfc-editor.org/rfc/rfc7627.html#section-6.4
1076410769
fi
10765-
else
10770+
elif ! "$TLS13_ONLY"; then
1076610771
out "$spaces"
10767-
prln_svrty_medium "No extended master secret extension, violates RFC 9325 & may cause connection problems"
10768-
fileout "$jsonID" "MEDIUM" "No extended master secret extension, violates RFC 9325 & may cause connection problems"
10772+
prln_svrty_medium "No extended master secret extension, violates RFC 7627/9325 & may cause connection problems"
10773+
fileout "$jsonID" "MEDIUM" "No extended master secret extension, violates RFC 7627/9325 & may cause connection problems"
1076910774
fi
1077010775

1077110776
pr_bold " Session Ticket RFC 5077 hint "

0 commit comments

Comments
 (0)