@@ -17180,31 +17180,33 @@ run_ccs_injection(){
1718017180# 0A: Unexpected message
1718117181# 28: Handshake failure
1718217182 if [[ -z "${tls_hello_ascii:0:12}" ]]; then
17183- # empty reply
17183+ # empty reply, this preply is the normal case
1718417184 pr_svrty_best "not vulnerable (OK)"
1718517185 if [[ $retval -eq 3 ]]; then
1718617186 fileout "$jsonID" "OK" "not vulnerable (timed out)" "$cve" "$cwe"
1718717187 else
1718817188 fileout "$jsonID" "OK" "not vulnerable" "$cve" "$cwe"
1718917189 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
1719217193 pr_warning "test failed "
1719317194 out "no proper TLS reply (debug info: protocol sent: 1503${tls_hexcode#x03, x}, reply: ${tls_hello_ascii:0:14}"
1719417195 fileout "$jsonID" "DEBUG" "test failed, around line $LINENO, debug info (${tls_hello_ascii:0:14})" "$cve" "$cwe" "$hint"
1719517196 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
1719717199 # decryption failed received
1719817200 pr_svrty_critical "VULNERABLE (NOT ok)"
1719917201 fileout "$jsonID" "CRITICAL" "VULNERABLE" "$cve" "$cwe" "$hint"
1720017202 set_grade_cap "F" "Vulnerable to CCS injection"
17201- elif [[ "$byte6" == "0A" ]] || [[ "$byte6" == "28" ]]; then
17203+ elif [[ "$byte6" == "0A" ]] || [[ "$byte6" == 28 ]]; then
1720217204 # Unexpected message / Handshake failure received
1720317205 pr_warning "likely "
1720417206 out "not vulnerable (OK)"
1720517207 out " - alert description type: $byte6"
1720617208 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
1720817210 # bad_record_mac -- this is not "not vulnerable"
1720917211 out "likely "
1721017212 pr_svrty_critical "VULNERABLE (NOT ok)"
@@ -17217,7 +17219,7 @@ run_ccs_injection(){
1721717219 out ", suspicious error code \"$byte6\" returned. Please report"
1721817220 fileout "$jsonID" "CRITICAL" "likely VULNERABLE with $byte6" "$cve" "$cwe" "$hint"
1721917221 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
1722117223 # MySQL community edition (yaSSL) returns a MySQL error instead of a TLS Alert
1722217224 # Error: #08S01 Bad handshake
1722317225 pr_svrty_best "not vulnerable (OK)"
0 commit comments