openvpn/src
Arne Schwabe 4472265ea2 Ensure that buffer of freed session are not used
In a race condition an old TLS session could still try to send a packet but
also get replaced by a new session. In this case, the buffer of the new
session is still referenced. Add the check_session_buf_not_used function
to mitigate this problem.

Also make the check if the to_link pointer is in one of the memory
regions a bit better even though this not make a difference with the
way we use these structs. But better safe than sorry.

A better solution to remove the TM_INITIAL state and handle reconnecting
session in their own complete tls_multi is a more involved fix that requires
a lot more refactoring.

CVE: 2026-40215
Reported-By: XlabAI Team of Tencent Xuanwu Lab (xlabai@tencent.com)
Reported-By: Guannan Wang (wgnbuaa@gmail.com
Reported-By: Zhanpeng Liu (pkugenuine@gmail.com)
Reported-By: Guancheng Li (lgcpku@gmail.com)
Signed-off-by: Arne Schwabe <arne@rfc2549.org>

Change-Id: I7c5fa2a7a2563b7a8955d386411f3ceffe5b092f
Private-URL: https://github.com/OpenVPN/openvpn-private-issues/issues/112
Acked-by: Gert Doering <gert@greenie.muc.de>
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit b2a15fb84d85790eeae4a2e12b431cbfd0b0302f)
2026-04-22 09:16:23 +02:00
..
compat Update Copyright statements to 2024 2024-03-18 18:49:36 +01:00
openvpn Ensure that buffer of freed session are not used 2026-04-22 09:16:23 +02:00
openvpnmsica openvpnmsica: Fix setting of iTicks in schedule_adapter_delete 2026-04-05 12:17:28 +02:00
openvpnserv interactive.c: harden pipe handling against misbehaving clients 2025-11-27 12:04:19 +01:00
plugins auth-pam: fix discards 'const' qualifier from pointer target type 2026-02-19 10:34:02 +01:00
tapctl Update Copyright statements to 2024 2024-03-18 18:49:36 +01:00
Makefile.am Update Copyright statements to 2024 2024-03-18 18:49:36 +01:00