|
| 1 | +From a4fe712399f0a679f0951c12d3758cf9264f3cdc Mon Sep 17 00:00:00 2001 |
| 2 | +From: Tobias Brunner <tobias@strongswan.org> |
| 3 | +Date: Thu, 5 Mar 2026 12:43:12 +0100 |
| 4 | +Subject: [PATCH] eap-ttls: Prevent crash if AVP length header field is invalid |
| 5 | + |
| 6 | +The length field in the AVP header includes the 8 bytes of the header |
| 7 | +itself. Not checking for that and later subtracting it causes an |
| 8 | +integer underflow that usually triggers a crash when accessing a |
| 9 | +NULL pointer that resulted from the failing chunk_alloc() call because |
| 10 | +of the high value. |
| 11 | + |
| 12 | +The attempted allocations for invalid lengths (0-7) are 0xfffffff8, |
| 13 | +0xfffffffc, or 0x100000000 (0 on 32-bit hosts), so this doesn't result |
| 14 | +in a buffer overflow even if the allocation succeeds. |
| 15 | + |
| 16 | +Fixes: 79f2102cb442 ("implemented server side support for EAP-TTLS") |
| 17 | +Fixes: CVE-2026-25075 |
| 18 | +Signed-off-by: Azure Linux Security Servicing Account <azurelinux-security@microsoft.com> |
| 19 | +Upstream-reference: https://download.strongswan.org/security/CVE-2026-25075/strongswan-4.5.0-6.0.4_eap_ttls_avp_len.patch |
| 20 | +--- |
| 21 | + src/libcharon/plugins/eap_ttls/eap_ttls_avp.c | 4 ++-- |
| 22 | + 1 file changed, 2 insertions(+), 2 deletions(-) |
| 23 | + |
| 24 | +diff --git a/src/libcharon/plugins/eap_ttls/eap_ttls_avp.c b/src/libcharon/plugins/eap_ttls/eap_ttls_avp.c |
| 25 | +index 06389f7..2983bd0 100644 |
| 26 | +--- a/src/libcharon/plugins/eap_ttls/eap_ttls_avp.c |
| 27 | ++++ b/src/libcharon/plugins/eap_ttls/eap_ttls_avp.c |
| 28 | +@@ -119,7 +119,7 @@ METHOD(eap_ttls_avp_t, process, status_t, |
| 29 | + chunk_free(&this->input); |
| 30 | + this->inpos = 0; |
| 31 | + |
| 32 | +- if (!success) |
| 33 | ++ if (!success || avp_len < AVP_HEADER_LEN) |
| 34 | + { |
| 35 | + DBG1(DBG_IKE, "received invalid AVP header"); |
| 36 | + return FAILED; |
| 37 | +@@ -130,7 +130,7 @@ METHOD(eap_ttls_avp_t, process, status_t, |
| 38 | + return FAILED; |
| 39 | + } |
| 40 | + this->process_header = FALSE; |
| 41 | +- this->data_len = avp_len - 8; |
| 42 | ++ this->data_len = avp_len - AVP_HEADER_LEN; |
| 43 | + this->input = chunk_alloc(this->data_len + (4 - avp_len) % 4); |
| 44 | + } |
| 45 | + |
| 46 | +-- |
| 47 | +2.45.4 |
| 48 | + |
0 commit comments