Skip to content

tls: bound the CertificateRequest certificate-type count - #415

Open
tinic wants to merge 1 commit into
eclipse-threadx:masterfrom
tinic:amiga-tls-certreq-bounds
Open

tls: bound the CertificateRequest certificate-type count#415
tinic wants to merge 1 commit into
eclipse-threadx:masterfrom
tinic:amiga-tls-certreq-bounds

Conversation

@tinic

@tinic tinic commented Jul 31, 2026

Copy link
Copy Markdown

_nx_secure_tls_process_certificate_request() read the certificate-type count out of the message before establishing that the message had a byte in it.

The only guard is

if (length >= message_length)

which sits inside the NX_SECURE_TLS_TLS_1_3_ENABLED arm, above the else. For TLS 1.2 nothing runs before

cert_types_length = packet_buffer[length];

with length still 0, so a zero-length CertificateRequest reads one byte past the record buffer. The sanity test that follows compares cert_types_length against message_length, which is after the read.

A server sends CertificateRequest and chooses its length, so this is reachable by any peer a client connects to.

Found by a fuzz driver over the client handshake path and confirmed under AddressSanitizer.

_nx_secure_tls_process_certificate_request() read the certificate-type
count out of the message before establishing that the message had a byte
in it.

The only guard is

    if (length >= message_length)

which sits inside the NX_SECURE_TLS_TLS_1_3_ENABLED arm, above the else.
For TLS 1.2 nothing runs before

    cert_types_length = packet_buffer[length];

with length still 0, so a zero-length CertificateRequest reads one byte
past the record buffer. The sanity test that follows compares
cert_types_length against message_length, which is after the read.

A server sends CertificateRequest and chooses its length, so this is
reachable by any peer a client connects to.

Found by a fuzz driver over the client handshake path and confirmed under
AddressSanitizer.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant