Files
Nikola Pajkovsky 22908fd7da Fix use-after-free of PSK binder pointer on packet growth
tls_construct_ctos_psk() reserved the resumption binder
with WPACKET_sub_allocate_bytes_u8() and kept the returned pointer.
Reserving the external PSK binder afterwards can grow the packet
and relocate its backing buffer, leaving the resumption binder pointer
dangling.  tls_psk_do_binder() then wrote the binder into freed memory.

Record the binder end offsets instead and convert them to pointers
only after both binders and their enclosing lengths have been allocated.

Add test_psk_binder_growth to sslapitest for SHA-256 and SHA-384.
It offers both a resumption ticket and an external PSK, sizes the packet
so the first binder ends exactly at the buffer end, and uses a secure
BUF_MEM so growth always relocates.  Both binders are then verified.
Without the fix, ASan reports a heap-use-after-free.

Fixes: 9368f86526 "Add TLSv1.3 client side external PSK support"
Assisted-by: pi:GLM-5.3-Flash-EXL3
Assisted-by: OpenAI:gpt-6.1-sol
Signed-off-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Bob Beck <beck@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Merge-date: Tue Oct 27 17:55:26 2026
Merged-from: https://github.com/openssl/openssl/pull/33293
(cherry picked from commit 88db43c5a9)
2026-10-27 18:58:51 +01:00
..
2025-12-09 01:00:43 -07:00
2026-09-26 13:48:07 +02:00
2026-09-29 13:55:15 +00:00
2025-12-09 01:00:43 -07:00
2025-12-09 01:00:43 -07:00
2025-12-09 01:00:43 -07:00
2025-12-09 01:00:43 -07:00
2025-12-09 01:00:43 -07:00
2025-12-09 01:00:43 -07:00
2025-12-09 01:00:43 -07:00
2026-04-07 12:15:45 +00:00
2025-12-09 01:00:43 -07:00
2025-12-09 01:00:43 -07:00
2026-08-25 11:46:17 +00:00
2026-06-09 11:44:35 +00:00
2025-12-09 01:00:43 -07:00
2025-03-12 13:35:59 +00:00
2025-12-09 01:00:43 -07:00
2026-08-25 11:46:17 +00:00
2025-12-09 01:00:43 -07:00
2025-12-09 01:00:43 -07:00
2026-06-30 12:54:49 +02:00
2025-03-12 13:35:59 +00:00
2025-12-09 01:00:43 -07:00
2025-12-09 01:00:43 -07:00
2026-06-09 11:44:35 +00:00
2026-09-29 13:55:15 +00:00
2025-12-09 01:00:43 -07:00
2025-12-09 01:00:43 -07:00