@@ -17180,31 +17180,33 @@ run_ccs_injection(){
17180
17180
# 0A: Unexpected message
17181
17181
# 28: Handshake failure
17182
17182
if [[ -z "${tls_hello_ascii:0:12}" ]]; then
17183
- # empty reply
17183
+ # empty reply which is the normal case
17184
17184
pr_svrty_best "not vulnerable (OK)"
17185
17185
if [[ $retval -eq 3 ]]; then
17186
17186
fileout "$jsonID" "OK" "not vulnerable (timed out)" "$cve" "$cwe"
17187
17187
else
17188
17188
fileout "$jsonID" "OK" "not vulnerable" "$cve" "$cwe"
17189
17189
fi
17190
- elif [[ "${tls_hello_ascii:0:4}" == "1503" ]]; then
17191
- if [[ ! "${tls_hello_ascii:5:2}" =~ 03|02|01|00 ]]; then
17190
+ elif [[ "${tls_hello_ascii:0:4}" == 1503 ]]; then
17191
+ # check for protocol. No protocol ==> test failed
17192
+ if [[ ! "${tls_hello_ascii:4:2}" =~ 03|02|01|00 ]]; then
17192
17193
pr_warning "test failed "
17193
17194
out "no proper TLS reply (debug info: protocol sent: 1503${tls_hexcode#x03, x}, reply: ${tls_hello_ascii:0:14}"
17194
17195
fileout "$jsonID" "DEBUG" "test failed, around line $LINENO, debug info (${tls_hello_ascii:0:14})" "$cve" "$cwe" "$hint"
17195
17196
ret=1
17196
- elif [[ "$byte6" == "15" ]]; then
17197
+ # now handle more TLS alerts (https://datatracker.ietf.org/doc/html/rfc5246#appendix-A.3)
17198
+ elif [[ "$byte6" == 15 ]]; then
17197
17199
# decryption failed received
17198
17200
pr_svrty_critical "VULNERABLE (NOT ok)"
17199
17201
fileout "$jsonID" "CRITICAL" "VULNERABLE" "$cve" "$cwe" "$hint"
17200
17202
set_grade_cap "F" "Vulnerable to CCS injection"
17201
- elif [[ "$byte6" == "0A" ]] || [[ "$byte6" == "28" ]]; then
17203
+ elif [[ "$byte6" == "0A" ]] || [[ "$byte6" == 28 ]]; then
17202
17204
# Unexpected message / Handshake failure received
17203
17205
pr_warning "likely "
17204
17206
out "not vulnerable (OK)"
17205
17207
out " - alert description type: $byte6"
17206
17208
fileout "$jsonID" "WARN" "probably not vulnerable but received 0x${byte6} instead of 0x15" "$cve" "$cwe" "$hint"
17207
- elif [[ "$byte6" == "14" ]]; then
17209
+ elif [[ "$byte6" == 14 ]]; then
17208
17210
# bad_record_mac -- this is not "not vulnerable"
17209
17211
out "likely "
17210
17212
pr_svrty_critical "VULNERABLE (NOT ok)"
@@ -17217,7 +17219,7 @@ run_ccs_injection(){
17217
17219
out ", suspicious error code \"$byte6\" returned. Please report"
17218
17220
fileout "$jsonID" "CRITICAL" "likely VULNERABLE with $byte6" "$cve" "$cwe" "$hint"
17219
17221
fi
17220
- elif [[ $STARTTLS_PROTOCOL == " mysql" ]] && [[ "${tls_hello_ascii:14:12}" == " 233038533031" ]]; then
17222
+ elif [[ $STARTTLS_PROTOCOL == mysql ]] && [[ "${tls_hello_ascii:14:12}" == 233038533031 ]]; then
17221
17223
# MySQL community edition (yaSSL) returns a MySQL error instead of a TLS Alert
17222
17224
# Error: #08S01 Bad handshake
17223
17225
pr_svrty_best "not vulnerable (OK)"
0 commit comments