Version in base suite: 3.2.7+dfsg-1+deb13u2 Base version: freeradius_3.2.7+dfsg-1+deb13u2 Target version: freeradius_3.2.7+dfsg-1+deb13u3 Base file: /srv/ftp-master.debian.org/ftp/pool/main/f/freeradius/freeradius_3.2.7+dfsg-1+deb13u2.dsc Target file: /srv/ftp-master.debian.org/policy/pool/main/f/freeradius/freeradius_3.2.7+dfsg-1+deb13u3.dsc changelog | 13 patches/Incorrect-use-of-randomness-in-EAP-FAST-could-expose-the-PAC.patch | 48 ++ patches/Insufficient-bounds-checking-on-TLVs-and-values-for-EAP-FAST.patch | 228 ++++++++++ patches/Insufficient-length-checks-in-EAP-MSCHAPv2-responses-1.patch | 51 ++ patches/Insufficient-length-checks-in-EAP-MSCHAPv2-responses-2.patch | 75 +++ patches/Insufficient-length-checks-in-EAP-MSCHAPv2-responses-3.patch | 32 + patches/Insufficient-length-checks-in-EAP-MSCHAPv2-responses-4.patch | 22 patches/Insufficient-validation-of-EAP-SIM-IdentityLength.patch | 198 ++++++++ patches/Malformed-TLVs-in-TEAP-could-cause-an-infinite-loop.patch | 41 + patches/Possible-stack-overflow-in-EAP-FAST.patch | 62 ++ patches/Tweak-bounds-for-NAS-Filter-Rule.patch | 41 + patches/Unauthenticated-out-of-bounds-write-in-the-DHCP-option-encoder.patch | 105 ++++ patches/Use-after-free-in-TTLS.patch | 30 + patches/increase-buffer-size.patch | 25 + patches/series | 16 15 files changed, 987 insertions(+) dpkg-source: warning: cannot verify inline signature for /srv/release.debian.org/tmp/tmp6kr5jm5_/freeradius_3.2.7+dfsg-1+deb13u2.dsc: no acceptable signature found dpkg-source: warning: cannot verify inline signature for /srv/release.debian.org/tmp/tmp6kr5jm5_/freeradius_3.2.7+dfsg-1+deb13u3.dsc: no acceptable signature found diff -Nru freeradius-3.2.7+dfsg/debian/changelog freeradius-3.2.7+dfsg/debian/changelog --- freeradius-3.2.7+dfsg/debian/changelog 2025-12-06 20:56:45.000000000 +0000 +++ freeradius-3.2.7+dfsg/debian/changelog 2026-12-01 07:38:39.000000000 +0000 @@ -1,3 +1,16 @@ +freeradius (3.2.7+dfsg-1+deb13u3) trixie-security; urgency=medium + + * Cherry-Pick multiple patches in EAP from the 2026.11.25 security + advisory (Closes: #1154627) + - (CVE-2026-127029) EAP-SIM + - (CVE-2026-127030) EAP-FAST + - (no CVE) EAP-TTLS + - (no CVE) EAP-MSCHAPv2 + * Cherry-pick fix for crash parsing a long NAS-Filter-Rule. + Thanks to Santiago Ruano Rincón + + -- Bernhard Schmidt Tue, 01 Dec 2026 08:38:39 +0100 + freeradius (3.2.7+dfsg-1+deb13u2) trixie; urgency=medium [ Didier Raboud ] diff -Nru freeradius-3.2.7+dfsg/debian/patches/Incorrect-use-of-randomness-in-EAP-FAST-could-expose-the-PAC.patch freeradius-3.2.7+dfsg/debian/patches/Incorrect-use-of-randomness-in-EAP-FAST-could-expose-the-PAC.patch --- freeradius-3.2.7+dfsg/debian/patches/Incorrect-use-of-randomness-in-EAP-FAST-could-expose-the-PAC.patch 1970-01-01 00:00:00.000000000 +0000 +++ freeradius-3.2.7+dfsg/debian/patches/Incorrect-use-of-randomness-in-EAP-FAST-could-expose-the-PAC.patch 2026-12-01 07:38:39.000000000 +0000 @@ -0,0 +1,48 @@ +From 708852c4a185822e9150128f5ca667696d9c469f Mon Sep 17 00:00:00 2001 +From: "Alan T. DeKok" +Date: Wed, 14 Oct 2026 16:39:13 +0200 +Subject: [PATCH] Fix incorrect use of randomness in EAP-FAST which affects PAC + +This commit fixes a high-severity security issue which lets an +attacker decrypt the PAC for EAP-FAST + +This issue was found by Anthropic using agents to study the security +of open source projects, with help from Ada Logics. Claude was used +to find the issue. The team from Ada Logics manuaally validated the +issue, created a Proof-of-Concept, created the report, and and +notified the FreeRADIUS maintainers via email at the provided +security@freeradius.org address. + +The FreeRADIUS team validated the issue, then created and validated +the fix in coordination with Anthropic and Ada Logics. + +The Ada Logics team includes Arthur Chan, David Korcyznski, and Adam +Korcyznski. +--- + src/modules/rlm_eap/types/rlm_eap_fast/eap_fast.c | 13 ++++++++++++- + 1 file changed, 12 insertions(+), 1 deletion(-) + +diff --git a/src/modules/rlm_eap/types/rlm_eap_fast/eap_fast.c b/src/modules/rlm_eap/types/rlm_eap_fast/eap_fast.c +index 1be121370ddf..5fa406d83e95 100644 +--- a/src/modules/rlm_eap/types/rlm_eap_fast/eap_fast.c ++++ b/src/modules/rlm_eap/types/rlm_eap_fast/eap_fast.c +@@ -267,7 +267,18 @@ static void eap_fast_send_pac_tunnel(REQUEST *request, tls_session_t *tls_sessio + + rad_assert(PAC_A_ID_LENGTH <= EVP_GCM_TLS_TAG_LEN); + memcpy(pac.opaque.aad, t->a_id, PAC_A_ID_LENGTH); +- rad_assert(RAND_bytes(pac.opaque.iv, sizeof(pac.opaque.iv)) != 0); ++ ++ /* ++ * Generating the IV is not optional. Do NOT put the ++ * call to RAND_bytes() into an assertion, because the ++ * build compiles assertions out when the build defines ++ * NDEBUG. ++ */ ++ if (RAND_bytes(pac.opaque.iv, sizeof(pac.opaque.iv)) != 1) { ++ RERROR("Failed generating random IV for the PAC-Opaque"); ++ return; ++ } ++ + dlen = eap_fast_encrypt((unsigned const char *)&opaque_plaintext, sizeof(opaque_plaintext), + t->a_id, PAC_A_ID_LENGTH, t->pac_opaque_key, pac.opaque.iv, + pac.opaque.data, pac.opaque.tag); diff -Nru freeradius-3.2.7+dfsg/debian/patches/Insufficient-bounds-checking-on-TLVs-and-values-for-EAP-FAST.patch freeradius-3.2.7+dfsg/debian/patches/Insufficient-bounds-checking-on-TLVs-and-values-for-EAP-FAST.patch --- freeradius-3.2.7+dfsg/debian/patches/Insufficient-bounds-checking-on-TLVs-and-values-for-EAP-FAST.patch 1970-01-01 00:00:00.000000000 +0000 +++ freeradius-3.2.7+dfsg/debian/patches/Insufficient-bounds-checking-on-TLVs-and-values-for-EAP-FAST.patch 2026-12-01 07:38:39.000000000 +0000 @@ -0,0 +1,228 @@ +From 217e3db904b39c6e5e8999daacb54a56160765ac Mon Sep 17 00:00:00 2001 +From: "Alan T. DeKok" +Date: Fri, 11 Sep 2026 15:48:21 -0400 +Subject: [PATCH] Do better bounds checking on TLVs and values for EAP-FAST. + +Issues reported by TristanInSec@gmail.com +--- + .../rlm_eap/types/rlm_eap_fast/eap_fast.c | 68 +++++++++++++------ + 1 file changed, 48 insertions(+), 20 deletions(-) + +diff --git a/src/modules/rlm_eap/types/rlm_eap_fast/eap_fast.c b/src/modules/rlm_eap/types/rlm_eap_fast/eap_fast.c +index 93dea229973c..89c790d55dec 100644 +--- a/src/modules/rlm_eap/types/rlm_eap_fast/eap_fast.c ++++ b/src/modules/rlm_eap/types/rlm_eap_fast/eap_fast.c +@@ -318,7 +318,7 @@ static int eap_fast_verify(REQUEST *request, tls_session_t *tls_session, uint8_t + + while (remaining > 0) { + if (remaining < 4) { +- RDEBUG2("EAP-FAST TLV is too small (%u) to contain a EAP-FAST TLV header", remaining); ++ REDEBUG2("EAP-FAST TLV is too small (%u) to contain a EAP-FAST TLV header", remaining); + return 0; + } + +@@ -338,7 +338,7 @@ static int eap_fast_verify(REQUEST *request, tls_session_t *tls_session, uint8_t + present |= 1 << attr; + + if (num[EAP_FAST_TLV_EAP_PAYLOAD] > 1) { +- RDEBUG("Too many EAP-Payload TLVs"); ++ REDEBUG("Too many EAP-Payload TLVs"); + unexpected: + for (int i = 0; i < EAP_FAST_TLV_MAX; i++) + if (present & (1 << i)) +@@ -348,13 +348,13 @@ static int eap_fast_verify(REQUEST *request, tls_session_t *tls_session, uint8_t + } + + if (num[EAP_FAST_TLV_INTERMED_RESULT] > 1) { +- RDEBUG("Too many Intermediate-Result TLVs"); ++ REDEBUG("Too many Intermediate-Result TLVs"); + goto unexpected; + } + break; + default: + if ((data[0] & 0x80) != 0) { +- RDEBUG("Unknown mandatory TLV %02x", attr); ++ REDEBUG("Unknown mandatory TLV %02x", attr); + goto unexpected; + } + +@@ -370,7 +370,7 @@ static int eap_fast_verify(REQUEST *request, tls_session_t *tls_session, uint8_t + remaining -= 4; + + if (length > remaining) { +- RDEBUG2("EAP-FAST TLV %u is longer than room remaining in the packet (%u > %u).", attr, ++ REDEBUG2("EAP-FAST TLV %u is longer than room remaining in the packet (%u > %u).", attr, + length, remaining); + return 0; + } +@@ -383,7 +383,7 @@ static int eap_fast_verify(REQUEST *request, tls_session_t *tls_session, uint8_t + * of the TLCs, die. + */ + if (remaining < length) { +- RDEBUG2("EAP-FAST TLV overflows packet!"); ++ REDEBUG2("EAP-FAST TLV overflows packet!"); + return 0; + } + +@@ -396,7 +396,7 @@ static int eap_fast_verify(REQUEST *request, tls_session_t *tls_session, uint8_t + uint16_t status; + + if (length < 2) { +- RDEBUG("EAP-FAST TLV %u is too short. Expected 2, got %d.", attr, length); ++ REDEBUG("EAP-FAST TLV %u is too short. Expected 2, got %d.", attr, length); + return 0; + } + +@@ -404,12 +404,12 @@ static int eap_fast_verify(REQUEST *request, tls_session_t *tls_session, uint8_t + status = ntohs(status); + + if (status == EAP_FAST_TLV_RESULT_FAILURE) { +- RDEBUG("EAP-FAST TLV %u indicates failure. Rejecting request.", attr); ++ REDEBUG("EAP-FAST TLV %u indicates failure. Rejecting request.", attr); + return 0; + } + + if (status != EAP_FAST_TLV_RESULT_SUCCESS) { +- RDEBUG("EAP-FAST TLV %u contains unknown value. Rejecting request.", attr); ++ REDEBUG("EAP-FAST TLV %u contains unknown value. Rejecting request.", attr); + goto unexpected; + } + } +@@ -425,12 +425,12 @@ static int eap_fast_verify(REQUEST *request, tls_session_t *tls_session, uint8_t + * Check if the peer mixed & matched TLVs. + */ + if ((num[EAP_FAST_TLV_NAK] > 0) && (num[EAP_FAST_TLV_NAK] != total)) { +- RDEBUG("NAK TLV sent with non-NAK TLVs. Rejecting request."); ++ REDEBUG("NAK TLV sent with non-NAK TLVs. Rejecting request."); + goto unexpected; + } + + if (num[EAP_FAST_TLV_INTERMED_RESULT] > 0 && num[EAP_FAST_TLV_RESULT]) { +- RDEBUG("NAK TLV sent with non-NAK TLVs. Rejecting request."); ++ REDEBUG("NAK TLV sent with non-NAK TLVs. Rejecting request."); + goto unexpected; + } + +@@ -440,13 +440,13 @@ static int eap_fast_verify(REQUEST *request, tls_session_t *tls_session, uint8_t + switch (t->stage) { + case TLS_SESSION_HANDSHAKE: + if (present) { +- RDEBUG("Unexpected TLVs in TLS Session Handshake stage"); ++ REDEBUG("Unexpected TLVs in TLS Session Handshake stage"); + goto unexpected; + } + break; + case AUTHENTICATION: + if (present != 1 << EAP_FAST_TLV_EAP_PAYLOAD) { +- RDEBUG("Unexpected TLVs in authentication stage"); ++ REDEBUG("Unexpected TLVs in authentication stage"); + goto unexpected; + } + break; +@@ -456,25 +456,25 @@ static int eap_fast_verify(REQUEST *request, tls_session_t *tls_session, uint8_t + ? 1 << EAP_FAST_TLV_RESULT + : 1 << EAP_FAST_TLV_INTERMED_RESULT; + if (present & ~(bits | (1 << EAP_FAST_TLV_CRYPTO_BINDING) | (1 << EAP_FAST_TLV_PAC))) { +- RDEBUG("Unexpected TLVs in cryptobind checking stage"); ++ REDEBUG("Unexpected TLVs in cryptobind checking stage"); + goto unexpected; + } + break; + } + case PROVISIONING: + if (present & ~((1 << EAP_FAST_TLV_PAC) | (1 << EAP_FAST_TLV_RESULT))) { +- RDEBUG("Unexpected TLVs in provisioning stage"); ++ REDEBUG("Unexpected TLVs in provisioning stage"); + goto unexpected; + } + break; + case COMPLETE: + if (present) { +- RDEBUG("Unexpected TLVs in complete stage"); ++ REDEBUG("Unexpected TLVs in complete stage"); + goto unexpected; + } + break; + default: +- RDEBUG("Unexpected stage %d", t->stage); ++ REDEBUG("Unexpected stage %d", t->stage); + return 0; + } + +@@ -504,6 +504,16 @@ static ssize_t eap_fast_decode_vp(TALLOC_CTX *request, DICT_ATTR const *parent, + */ + if (attr_len == 0) return 0; + ++ if (attr_len < dict_attr_sizes[parent->type][0]) { ++ REDEBUG("TLV %s has invalid length %u < %u", parent->name, attr_len, dict_attr_sizes[parent->type][0]); ++ return -1; ++ } ++ ++ if (attr_len > dict_attr_sizes[parent->type][1]) { ++ REDEBUG("TLV %s has invalid length %u > %u", parent->name, attr_len, dict_attr_sizes[parent->type][1]); ++ return -1; ++ } ++ + /* + * And now that we've verified the basic type + * information, decode the actual p. +@@ -629,9 +639,10 @@ VALUE_PAIR *eap_fast_fast2vp(REQUEST *request, SSL *ssl, uint8_t const *data, si + VALUE_PAIR *vp = NULL; + DICT_ATTR const *da; + +- if (!fast_da) ++ if (!fast_da) { + fast_da = dict_attrbyvalue(PW_FREERADIUS_EAP_FAST_TLV, VENDORPEC_FREERADIUS); +- rad_assert(fast_da != NULL); ++ rad_assert(fast_da != NULL); ++ } + + if (!out) { + out = talloc(request, vp_cursor_t); +@@ -645,6 +656,11 @@ VALUE_PAIR *eap_fast_fast2vp(REQUEST *request, SSL *ssl, uint8_t const *data, si + while (data_left > 0) { + ssize_t decoded; + ++ if (data_left < 4) { ++ RDEBUG2("Data is too short for TLV header"); ++ return NULL; ++ } ++ + /* FIXME do something with mandatory */ + + memcpy(&attr, data, sizeof(attr)); +@@ -656,6 +672,11 @@ VALUE_PAIR *eap_fast_fast2vp(REQUEST *request, SSL *ssl, uint8_t const *data, si + data += 4; + data_left -= 4; + ++ if (length > data_left) { ++ RDEBUG2("TLV header Length field overflows available data"); ++ return NULL; ++ } ++ + /* + * Look up the TLV. + * +@@ -668,7 +689,10 @@ VALUE_PAIR *eap_fast_fast2vp(REQUEST *request, SSL *ssl, uint8_t const *data, si + goto next_attr; + } + if (da->type == PW_TYPE_TLV) { +- eap_fast_fast2vp(request, ssl, data, length, da, out); ++ if (!eap_fast_fast2vp(request, ssl, data, length, da, out)) { ++ RDEBUG2("Contents of %s are malformed", da->name); ++ return NULL; ++ } + goto next_attr; + } + decoded = eap_fast_decode_vp(request, da, data, length, &vp); +@@ -1241,6 +1265,10 @@ PW_CODE eap_fast_process(eap_handler_t *eap_session, tls_session_t *tls_session) + } + + fast_vps = eap_fast_fast2vp(request, tls_session->ssl, data, data_len, NULL, NULL); ++ if (!fast_vps) { ++ RDEBUG("Phase 2: Tunneled FAST data is malformed."); ++ return PW_CODE_ACCESS_REJECT; ++ } + + RDEBUG("Got Tunneled FAST TLVs"); + rdebug_pair_list(L_DBG_LVL_1, request, fast_vps, NULL); diff -Nru freeradius-3.2.7+dfsg/debian/patches/Insufficient-length-checks-in-EAP-MSCHAPv2-responses-1.patch freeradius-3.2.7+dfsg/debian/patches/Insufficient-length-checks-in-EAP-MSCHAPv2-responses-1.patch --- freeradius-3.2.7+dfsg/debian/patches/Insufficient-length-checks-in-EAP-MSCHAPv2-responses-1.patch 1970-01-01 00:00:00.000000000 +0000 +++ freeradius-3.2.7+dfsg/debian/patches/Insufficient-length-checks-in-EAP-MSCHAPv2-responses-1.patch 2026-12-01 07:38:39.000000000 +0000 @@ -0,0 +1,51 @@ +From 97e60237b9c63ef7c91cddc9097c6b26b2530a32 Mon Sep 17 00:00:00 2001 +From: "Alan T. DeKok" +Date: Thu, 26 Feb 2026 11:03:22 -0500 +Subject: [PATCH] add more checks and complaints + +--- + .../types/rlm_eap_mschapv2/rlm_eap_mschapv2.c | 16 +++++++++++++++- + 1 file changed, 15 insertions(+), 1 deletion(-) + +diff --git a/src/modules/rlm_eap/types/rlm_eap_mschapv2/rlm_eap_mschapv2.c b/src/modules/rlm_eap/types/rlm_eap_mschapv2/rlm_eap_mschapv2.c +index c1a00450e647..8bdcf936dab1 100644 +--- a/src/modules/rlm_eap/types/rlm_eap_mschapv2/rlm_eap_mschapv2.c ++++ b/src/modules/rlm_eap/types/rlm_eap_mschapv2/rlm_eap_mschapv2.c +@@ -419,15 +419,23 @@ static int CC_HINT(nonnull) mod_process(void *arg, eap_handler_t *handler) + */ + if (ccode == PW_EAP_MSCHAPV2_CHGPASSWD) { + VALUE_PAIR *cpw; +- int mschap_id = eap_ds->response->type.data[1]; ++ int mschap_id; + int copied = 0 ,seq = 1; + ++ if (eap_ds->response->type.length < 544) { ++ RDEBUG2("Password change has invalid length %zu < 544", ++ eap_ds->response->type.length); ++ return 0; ++ } ++ + RDEBUG2("Password change packet received"); + + challenge = pair_make_request("MS-CHAP-Challenge", NULL, T_OP_EQ); + if (!challenge) return 0; + fr_pair_value_memcpy(challenge, data->challenge, MSCHAPV2_CHALLENGE_LEN); + ++ mschap_id = eap_ds->response->type.data[1]; ++ + cpw = pair_make_request("MS-CHAP2-CPW", NULL, T_OP_EQ); + cpw->vp_length = 68; + +@@ -562,6 +570,12 @@ static int CC_HINT(nonnull) mod_process(void *arg, eap_handler_t *handler) + * The MS-Length field is 5 + value_size + length + * of name, which is put after the response. + */ ++ if (eap_ds->response->type.length < (5 + MSCHAPV2_RESPONSE_LEN + 1)) { ++ REDEBUG("MS-CHAPv2 response packet is too short %zu < %d", ++ eap_ds->response->type.length, 5 + MSCHAPV2_RESPONSE_LEN + 1); ++ return 0; ++ } ++ + length = (eap_ds->response->type.data[2] << 8) | eap_ds->response->type.data[3]; + if ((length < (5 + 49)) || (length > (256 + 5 + 49))) { + REDEBUG("Response contains contradictory length %zu %d", length, 5 + 49); diff -Nru freeradius-3.2.7+dfsg/debian/patches/Insufficient-length-checks-in-EAP-MSCHAPv2-responses-2.patch freeradius-3.2.7+dfsg/debian/patches/Insufficient-length-checks-in-EAP-MSCHAPv2-responses-2.patch --- freeradius-3.2.7+dfsg/debian/patches/Insufficient-length-checks-in-EAP-MSCHAPv2-responses-2.patch 1970-01-01 00:00:00.000000000 +0000 +++ freeradius-3.2.7+dfsg/debian/patches/Insufficient-length-checks-in-EAP-MSCHAPv2-responses-2.patch 2026-12-01 07:38:39.000000000 +0000 @@ -0,0 +1,75 @@ +From 4beea8114e95a8f1526193e27b2063ac482f92be Mon Sep 17 00:00:00 2001 +From: "Alan T. DeKok" +Date: Wed, 18 Mar 2026 11:01:54 -0400 +Subject: [PATCH] various bug fixes in rlm_eap_mschapv2 + +--- + .../types/rlm_eap_mschapv2/rlm_eap_mschapv2.c | 23 ++++++++++++++----- + 1 file changed, 17 insertions(+), 6 deletions(-) + +diff --git a/src/modules/rlm_eap/types/rlm_eap_mschapv2/rlm_eap_mschapv2.c b/src/modules/rlm_eap/types/rlm_eap_mschapv2/rlm_eap_mschapv2.c +index 58f172c90eab..9efb6cb727b1 100644 +--- a/src/modules/rlm_eap/types/rlm_eap_mschapv2/rlm_eap_mschapv2.c ++++ b/src/modules/rlm_eap/types/rlm_eap_mschapv2/rlm_eap_mschapv2.c +@@ -44,6 +44,17 @@ static CONF_PARSER module_config[] = { + CONF_PARSER_TERMINATOR + }; + ++/* ++ * 0 1 2 3 ++ * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 ++ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ++ * | Code | Identifier | Length | ++ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ++ * | Type | OpCode | MS-CHAPv2-ID | MS-Length... ++ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ++ * | MS-Length | Data... ++ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ++ */ + + static void fix_mppe_keys(eap_handler_t *handler, mschapv2_opaque_t *data) + { +@@ -423,8 +434,8 @@ static int CC_HINT(nonnull) mod_process(void *arg, eap_handler_t *handler) + int mschap_id; + int copied = 0 ,seq = 1; + +- if (eap_ds->response->type.length < 544) { +- RDEBUG2("Password change has invalid length %zu < 544", ++ if (eap_ds->response->type.length < 586) { ++ RDEBUG2("Password change has invalid length %zu < 586", + eap_ds->response->type.length); + return 0; + } +@@ -492,19 +503,19 @@ static int CC_HINT(nonnull) mod_process(void *arg, eap_handler_t *handler) + + case PW_EAP_MSCHAPV2_SUCCESS: + /* +- * we sent a success to the client; some clients send a ++ * we request->code = PW_EAP_SUCCESS; + + fr_pair_list_mcopy_by_num(request->reply, &request->reply->vps, &data->mppe_keys, 0, 0, TAG_ANY); + /* FALL-THROUGH */ + +- case PW_EAP_MSCHAPV2_ACK: + #ifdef WITH_PROXY + /* + * It's a success. Don't proxy it. +@@ -578,8 +589,8 @@ static int CC_HINT(nonnull) mod_process(void *arg, eap_handler_t *handler) + } + + length = (eap_ds->response->type.data[2] << 8) | eap_ds->response->type.data[3]; +- if ((length < (5 + 49)) || (length > (256 + 5 + 49))) { +- REDEBUG("Response contains contradictory length %zu %d", length, 5 + 49); ++ if ((length < (5 + 49)) || (length > (256 + 5 + 49)) || (length != (eap_ds->response->type.length - 5))) { ++ REDEBUG("Response contains invalid length %zd", length); + return 0; + } + diff -Nru freeradius-3.2.7+dfsg/debian/patches/Insufficient-length-checks-in-EAP-MSCHAPv2-responses-3.patch freeradius-3.2.7+dfsg/debian/patches/Insufficient-length-checks-in-EAP-MSCHAPv2-responses-3.patch --- freeradius-3.2.7+dfsg/debian/patches/Insufficient-length-checks-in-EAP-MSCHAPv2-responses-3.patch 1970-01-01 00:00:00.000000000 +0000 +++ freeradius-3.2.7+dfsg/debian/patches/Insufficient-length-checks-in-EAP-MSCHAPv2-responses-3.patch 2026-12-01 07:38:39.000000000 +0000 @@ -0,0 +1,32 @@ +From 965fe93450231ca79a6d983c215da21f3208ec6c Mon Sep 17 00:00:00 2001 +From: "Alan T. DeKok" +Date: Wed, 18 Mar 2026 12:39:47 -0400 +Subject: [PATCH] break out length checks into separate error message + +--- + .../types/rlm_eap_mschapv2/rlm_eap_mschapv2.c | 12 ++++++++++-- + 1 file changed, 10 insertions(+), 2 deletions(-) + +diff --git a/src/modules/rlm_eap/types/rlm_eap_mschapv2/rlm_eap_mschapv2.c b/src/modules/rlm_eap/types/rlm_eap_mschapv2/rlm_eap_mschapv2.c +index 9efb6cb727b1..9af1239d11e5 100644 +--- a/src/modules/rlm_eap/types/rlm_eap_mschapv2/rlm_eap_mschapv2.c ++++ b/src/modules/rlm_eap/types/rlm_eap_mschapv2/rlm_eap_mschapv2.c +@@ -589,8 +589,16 @@ static int CC_HINT(nonnull) mod_process(void *arg, eap_handler_t *handler) + } + + length = (eap_ds->response->type.data[2] << 8) | eap_ds->response->type.data[3]; +- if ((length < (5 + 49)) || (length > (256 + 5 + 49)) || (length != (eap_ds->response->type.length - 5))) { +- REDEBUG("Response contains invalid length %zd", length); ++ if ((length < (5 + 49)) || (length > (256 + 5 + 49))) { ++ REDEBUG("Response contains invalid MS-Length %zd"); ++ return 0; ++ } ++ ++ /* ++ * type.length is already updated to remove the EAP header. ++ */ ++ if (length != eap_ds->response->type.length) { ++ REDEBUG("Response contains invalid MS-Length %zd vs %zd", length, eap_ds->response->type.length); + return 0; + } + diff -Nru freeradius-3.2.7+dfsg/debian/patches/Insufficient-length-checks-in-EAP-MSCHAPv2-responses-4.patch freeradius-3.2.7+dfsg/debian/patches/Insufficient-length-checks-in-EAP-MSCHAPv2-responses-4.patch --- freeradius-3.2.7+dfsg/debian/patches/Insufficient-length-checks-in-EAP-MSCHAPv2-responses-4.patch 1970-01-01 00:00:00.000000000 +0000 +++ freeradius-3.2.7+dfsg/debian/patches/Insufficient-length-checks-in-EAP-MSCHAPv2-responses-4.patch 2026-12-01 07:38:39.000000000 +0000 @@ -0,0 +1,22 @@ +From 7f95b43bbe7d61cfb4b6866f44b2f387a179fae8 Mon Sep 17 00:00:00 2001 +From: "Alan T. DeKok" +Date: Wed, 18 Mar 2026 12:46:11 -0400 +Subject: [PATCH] typo + +--- + src/modules/rlm_eap/types/rlm_eap_mschapv2/rlm_eap_mschapv2.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/modules/rlm_eap/types/rlm_eap_mschapv2/rlm_eap_mschapv2.c b/src/modules/rlm_eap/types/rlm_eap_mschapv2/rlm_eap_mschapv2.c +index 9af1239d11e5..75f0ac8c714b 100644 +--- a/src/modules/rlm_eap/types/rlm_eap_mschapv2/rlm_eap_mschapv2.c ++++ b/src/modules/rlm_eap/types/rlm_eap_mschapv2/rlm_eap_mschapv2.c +@@ -590,7 +590,7 @@ static int CC_HINT(nonnull) mod_process(void *arg, eap_handler_t *handler) + + length = (eap_ds->response->type.data[2] << 8) | eap_ds->response->type.data[3]; + if ((length < (5 + 49)) || (length > (256 + 5 + 49))) { +- REDEBUG("Response contains invalid MS-Length %zd"); ++ REDEBUG("Response contains invalid MS-Length %zd", length); + return 0; + } + diff -Nru freeradius-3.2.7+dfsg/debian/patches/Insufficient-validation-of-EAP-SIM-IdentityLength.patch freeradius-3.2.7+dfsg/debian/patches/Insufficient-validation-of-EAP-SIM-IdentityLength.patch --- freeradius-3.2.7+dfsg/debian/patches/Insufficient-validation-of-EAP-SIM-IdentityLength.patch 1970-01-01 00:00:00.000000000 +0000 +++ freeradius-3.2.7+dfsg/debian/patches/Insufficient-validation-of-EAP-SIM-IdentityLength.patch 2026-12-01 07:38:39.000000000 +0000 @@ -0,0 +1,198 @@ +From 8e8a991c040cbb30f21f928f2b406c702e171b2e Mon Sep 17 00:00:00 2001 +From: "Alan T. DeKok" +Date: Tue, 15 Sep 2026 20:13:12 -0400 +Subject: [PATCH] make EAP-SIM independent of identity length. + +and avoid overflow on long identities. Issue found and reported +by Glen Saunders. +--- + src/modules/rlm_eap/libeap/eap_sim.h | 2 +- + src/modules/rlm_eap/libeap/eapcrypto.c | 61 +++++-------------- + src/modules/rlm_eap/radeapclient.c | 12 +++- + .../rlm_eap/types/rlm_eap_sim/rlm_eap_sim.c | 22 ++++--- + 4 files changed, 39 insertions(+), 58 deletions(-) + +diff --git a/src/modules/rlm_eap/libeap/eap_sim.h b/src/modules/rlm_eap/libeap/eap_sim.h +index 0d92f67eb4a3..96f9585fbb7f 100644 +--- a/src/modules/rlm_eap/libeap/eap_sim.h ++++ b/src/modules/rlm_eap/libeap/eap_sim.h +@@ -85,7 +85,7 @@ int unmap_eapsim_basictypes(RADIUS_PACKET *r, uint8_t *attr, unsigned int attrle + + struct eapsim_keys { + /* inputs */ +- uint8_t identity[MAX_STRING_LEN]; ++ uint8_t *identity; + unsigned int identitylen; + uint8_t nonce_mt[EAPSIM_NONCEMT_SIZE]; + uint8_t rand[3][EAPSIM_RAND_SIZE]; +diff --git a/src/modules/rlm_eap/libeap/eapcrypto.c b/src/modules/rlm_eap/libeap/eapcrypto.c +index 6322115a6697..6ff7a38a3a27 100644 +--- a/src/modules/rlm_eap/libeap/eapcrypto.c ++++ b/src/modules/rlm_eap/libeap/eapcrypto.c +@@ -38,52 +38,21 @@ void eapsim_calculate_keys(struct eapsim_keys *ek) + { + fr_sha1_ctx context; + uint8_t fk[160]; +- unsigned char buf[MAX_STRING_LEN + 3 * EAPSIM_KC_SIZE + EAPSIM_NONCEMT_SIZE + MAX_STRING_LEN + 2]; +- unsigned char *p; +- unsigned int blen; +- +- p = buf; +- memcpy(p, ek->identity, ek->identitylen); p = p+ek->identitylen; +- memcpy(p, ek->Kc[0], EAPSIM_KC_SIZE); p = p+EAPSIM_KC_SIZE; +- memcpy(p, ek->Kc[1], EAPSIM_KC_SIZE); p = p+EAPSIM_KC_SIZE; +- memcpy(p, ek->Kc[2], EAPSIM_KC_SIZE); p = p+EAPSIM_KC_SIZE; +- memcpy(p, ek->nonce_mt, sizeof(ek->nonce_mt)); p=p+sizeof(ek->nonce_mt); +- memcpy(p, ek->versionlist, ek->versionlistlen);p=p+ek->versionlistlen; +- memcpy(p, ek->versionselect, sizeof(ek->versionselect)); p=p+sizeof(ek->versionselect); +- /* *p++ = ek->versionselect[1]; */ +- +- blen = p - buf; +- +-#if defined(TEST_CASE) || defined(DUMP_EAPSIM_KEYS) +- { +- unsigned int i, j, k; +- +- j=0; k=0; +- +- printf("SHA1buffer was: "); +- for (i = 0; i < blen; i++) { +- if(j==4) { +- printf("_"); +- j=0; +- } +- if(k==20) { +- printf("\n "); +- k=0; +- j=0; +- } +- j++; +- k++; +- +- printf("%02x", buf[i]); +- } +- printf("\n"); +- } +-#endif +- + +- /* do the master key first */ ++ /* ++ * Hash the inputs as they are walked, rather than packing ++ * them into one buffer first. The identity is caller ++ * supplied and has no length limit, so any such buffer ++ * would have to be bounds checked, or it would overflow. ++ */ + fr_sha1_init(&context); +- fr_sha1_update(&context, buf, blen); ++ fr_sha1_update(&context, ek->identity, ek->identitylen); ++ fr_sha1_update(&context, ek->Kc[0], EAPSIM_KC_SIZE); ++ fr_sha1_update(&context, ek->Kc[1], EAPSIM_KC_SIZE); ++ fr_sha1_update(&context, ek->Kc[2], EAPSIM_KC_SIZE); ++ fr_sha1_update(&context, ek->nonce_mt, sizeof(ek->nonce_mt)); ++ fr_sha1_update(&context, ek->versionlist, ek->versionlistlen); ++ fr_sha1_update(&context, ek->versionselect, sizeof(ek->versionselect)); + fr_sha1_final(ek->master_key, &context); + + /* +@@ -225,7 +194,7 @@ void eapsim_dump_mk(struct eapsim_keys *ek) + #include + + struct eapsim_keys inputkey1 = { +- {'e', 'a', 'p', 's','i','m' }, ++ (uint8_t *) "eapsim", + 6, + 0x4d, 0x6c, 0x40, 0xde, 0x48, 0x3a, 0xdd, 0x99, /* nonce_mt */ + 0x50, 0x90, 0x2c, 0x40, 0x24, 0xce, 0x76, 0x5e, +@@ -247,7 +216,7 @@ struct eapsim_keys inputkey1 = { + }; + + struct eapsim_keys inputkey2 = { +- {'1','2','4','4','0','7','0','1','0','0','0','0','0','0','0','1','@','e','a','p','s','i','m','.','f','o','o'}, ++ (uint8_t *) "1244070100000001@eapsim.foo", + 27, + 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, /* nonce_mt */ + 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10, +diff --git a/src/modules/rlm_eap/radeapclient.c b/src/modules/rlm_eap/radeapclient.c +index b946a87497e9..3018718b742c 100644 +--- a/src/modules/rlm_eap/radeapclient.c ++++ b/src/modules/rlm_eap/radeapclient.c +@@ -82,6 +82,7 @@ typedef struct rc_transaction rc_transaction_t; + */ + typedef struct rc_eap_sim_context { + struct eapsim_keys keys; ++ uint8_t *identity; + } rc_eap_sim_context_t; + + typedef struct rc_eap_md5_context { +@@ -922,7 +923,7 @@ static int rc_process_eap_start(rc_eap_context_t *eap_context, + } + newvp = fr_pair_afrom_num(rep, PW_EAP_SIM_IDENTITY, 0); + +- idlen = strlen(vp->vp_strvalue); ++ idlen = vp->vp_length; + p = talloc_zero_array(newvp, uint8_t, idlen + 2); + no_idlen = htons(idlen); + memcpy(p, &no_idlen, 2); +@@ -931,8 +932,13 @@ static int rc_process_eap_start(rc_eap_context_t *eap_context, + + fr_pair_replace(&(rep->vps), newvp); + +- /* record it */ +- memcpy(eap_context->eap.sim.keys.identity, vp->vp_strvalue, idlen); ++ /* ++ * Record it. The keys are used in a later round ++ * trip, by which time this packet is gone, so the ++ * identity has to be copied and not referenced. ++ */ ++ MEM(eap_context->eap.sim.identity = talloc_memdup(eap_context, vp->vp_strvalue, vp->vp_length)); ++ eap_context->eap.sim.keys.identity = eap_context->eap.sim.identity; + eap_context->eap.sim.keys.identitylen = idlen; + } + +diff --git a/src/modules/rlm_eap/types/rlm_eap_sim/rlm_eap_sim.c b/src/modules/rlm_eap/types/rlm_eap_sim/rlm_eap_sim.c +index 38fe997a5f0f..1962f1b12567 100644 +--- a/src/modules/rlm_eap/types/rlm_eap_sim/rlm_eap_sim.c ++++ b/src/modules/rlm_eap/types/rlm_eap_sim/rlm_eap_sim.c +@@ -313,27 +313,33 @@ static int eap_sim_sendchallenge(eap_handler_t *handler) + newvp->vp_integer = ess->sim_id++; + fr_pair_replace(outvps, newvp); + +- /* +- * Make a copy of the identity +- */ +- ess->keys.identitylen = strlen(handler->identity); +- memcpy(ess->keys.identity, handler->identity, ess->keys.identitylen); ++ TALLOC_FREE(ess->keys.identity); + + /* + * Use the SIM identity, if available + */ + newvp = fr_pair_find_by_num(*invps, PW_EAP_SIM_IDENTITY, 0, TAG_ANY); +- if (newvp && newvp->vp_length > 2) { ++ if (newvp && (newvp->vp_length > 2)) { + uint16_t len; + + memcpy(&len, newvp->vp_octets, sizeof(uint16_t)); + len = ntohs(len); +- if (len <= newvp->vp_length - 2 && len <= MAX_STRING_LEN) { ++ if (len <= newvp->vp_length - 2) { ++ MEM(ess->keys.identity = talloc_memdup(handler, newvp->vp_octets + 2, len)); + ess->keys.identitylen = len; +- memcpy(ess->keys.identity, newvp->vp_octets + 2, ess->keys.identitylen); + } + } + ++ /* ++ * There was no AT_IDENTITY, the above checks found it to ++ * be malformed. Fall back to using the EAP identity. ++ */ ++ if (!ess->keys.identity) { ++ ess->keys.identitylen = strlen(handler->identity); ++ MEM(ess->keys.identity = talloc_memdup(handler, handler->identity, ++ ess->keys.identitylen)); ++ } ++ + /* + * All set, calculate keys! + */ diff -Nru freeradius-3.2.7+dfsg/debian/patches/Malformed-TLVs-in-TEAP-could-cause-an-infinite-loop.patch freeradius-3.2.7+dfsg/debian/patches/Malformed-TLVs-in-TEAP-could-cause-an-infinite-loop.patch --- freeradius-3.2.7+dfsg/debian/patches/Malformed-TLVs-in-TEAP-could-cause-an-infinite-loop.patch 1970-01-01 00:00:00.000000000 +0000 +++ freeradius-3.2.7+dfsg/debian/patches/Malformed-TLVs-in-TEAP-could-cause-an-infinite-loop.patch 2026-12-01 07:38:39.000000000 +0000 @@ -0,0 +1,41 @@ +From 1d41026e12f00c3c44ead4e5932c752e4499118d Mon Sep 17 00:00:00 2001 +From: "Alan T. DeKok" +Date: Sat, 24 Oct 2026 14:32:23 -0400 +Subject: [PATCH] ignore zero-length TLVs in TEAP + +--- + src/modules/rlm_eap/types/rlm_eap_teap/eap_teap.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/src/modules/rlm_eap/types/rlm_eap_teap/eap_teap.c b/src/modules/rlm_eap/types/rlm_eap_teap/eap_teap.c +index 014f2a695829..027614894b59 100644 +--- a/src/modules/rlm_eap/types/rlm_eap_teap/eap_teap.c ++++ b/src/modules/rlm_eap/types/rlm_eap_teap/eap_teap.c +@@ -649,6 +649,7 @@ static ssize_t eap_teap_decode_vp(TALLOC_CTX *request, DICT_ATTR const *parent, + RERROR("eap_teap_decode_vp: Invalid arguments"); + return -1; + } ++ *out = NULL; + + /* + * Silently ignore zero-length attributes. +@@ -839,12 +840,19 @@ VALUE_PAIR *eap_teap_teap2vp(REQUEST *request, UNUSED SSL *ssl, uint8_t const *d + RDEBUG3("Phase 2: Skipping unsupported TLV %s", da->name); + goto next_attr; + } ++ + decoded = eap_teap_decode_vp(request, da, data, length, &vp); + if (decoded < 0) { + REDEBUG3("Phase 2: Failed decoding %s: %s", da->name, fr_strerror()); + goto next_attr; + } + ++ /* ++ * Zero-length TLVs are ignored, and do not create a VP. Merging ++ * the VP from the previous TLV would link that VP to itself. ++ */ ++ if (!decoded) goto next_attr; ++ + fr_cursor_merge(out, vp); + + next_attr: diff -Nru freeradius-3.2.7+dfsg/debian/patches/Possible-stack-overflow-in-EAP-FAST.patch freeradius-3.2.7+dfsg/debian/patches/Possible-stack-overflow-in-EAP-FAST.patch --- freeradius-3.2.7+dfsg/debian/patches/Possible-stack-overflow-in-EAP-FAST.patch 1970-01-01 00:00:00.000000000 +0000 +++ freeradius-3.2.7+dfsg/debian/patches/Possible-stack-overflow-in-EAP-FAST.patch 2026-12-01 07:38:39.000000000 +0000 @@ -0,0 +1,62 @@ +From 064567a08f3b9d9b4863fab6060fafe296ac7de9 Mon Sep 17 00:00:00 2001 +From: "Alan T. DeKok" +Date: Wed, 14 Oct 2026 16:30:58 +0200 +Subject: [PATCH] Fix possible stack overflow in EAP-FAST + +This commit fixes a high-severity security issue related to possible +stack overflow in the EAP-FAST handshake process. + +This issue was found by Anthropic using agents to study the security +of open source projects, with help from Ada Logics. Claude was used +to find the issue. The team from Ada Logics manuaally validated the +issue, created a Proof-of-Concept, created the report, and and +notified the FreeRADIUS maintainers via email at the provided +security@freeradius.org address. + +The FreeRADIUS team validated the issue, then created and validated +the fix in coordination with Anthropic and Ada Logics. + +The Ada Logics team includes Arthur Chan, David Korcyznski, and Adam +Korcyznski. +--- + .../rlm_eap/types/rlm_eap_fast/rlm_eap_fast.c | 20 +++++++++++++++++++ + 1 file changed, 20 insertions(+) + +diff --git a/src/modules/rlm_eap/types/rlm_eap_fast/rlm_eap_fast.c b/src/modules/rlm_eap/types/rlm_eap_fast/rlm_eap_fast.c +index d1f45b7976b0..7c268e335185 100644 +--- a/src/modules/rlm_eap/types/rlm_eap_fast/rlm_eap_fast.c ++++ b/src/modules/rlm_eap/types/rlm_eap_fast/rlm_eap_fast.c +@@ -270,6 +270,15 @@ static int _session_ticket(SSL *s, uint8_t const *data, int len, void *arg) + + RDEBUG("PAC provided via ClientHello SessionTicket extension"); + ++ /* ++ * Check that the ticket is large enough to contain a ++ * header, before we read the header. ++ */ ++ if (len < (int) sizeof(opaque->hdr)) { ++ errmsg = "PAC is too small to contain a header"; ++ goto error; ++ } ++ + if ((ntohs(opaque->hdr.type) & EAP_FAST_TLV_TYPE) != PAC_INFO_PAC_OPAQUE) { + errmsg = "PAC is not of type Opaque"; + error: +@@ -303,6 +312,17 @@ static int _session_ticket(SSL *s, uint8_t const *data, int len, void *arg) + goto error; + } + ++ /* ++ * eap_fast_decrypt() writes the decrypted data to ++ * opaque_plaintext, which is a fixed-size structure on ++ * the stack. Bound the length by that structure, and ++ * not by the size of the ticket that the peer sent. ++ */ ++ if ((size_t) length > sizeof(*opaque) - sizeof(opaque->hdr)) { ++ errmsg = "PAC is too long"; ++ goto error; ++ } ++ + if (memcmp(opaque->aad, t->a_id, PAC_A_ID_LENGTH)) { + errmsg = "PAC has incorrect A_ID"; + goto error; diff -Nru freeradius-3.2.7+dfsg/debian/patches/Tweak-bounds-for-NAS-Filter-Rule.patch freeradius-3.2.7+dfsg/debian/patches/Tweak-bounds-for-NAS-Filter-Rule.patch --- freeradius-3.2.7+dfsg/debian/patches/Tweak-bounds-for-NAS-Filter-Rule.patch 1970-01-01 00:00:00.000000000 +0000 +++ freeradius-3.2.7+dfsg/debian/patches/Tweak-bounds-for-NAS-Filter-Rule.patch 2026-12-01 07:38:39.000000000 +0000 @@ -0,0 +1,41 @@ +From b7569a202439a41f9d7c7a0a83e4c4c781c9ebb7 Mon Sep 17 00:00:00 2001 +From: "Alan T. DeKok" +Date: Thu, 12 Mar 2026 10:09:09 -0400 +Subject: [PATCH] tweak bounds for NAS-Filter-Rule + +--- + src/lib/radius.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/src/lib/radius.c b/src/lib/radius.c +index fd951966f8ed..14ca5b140dd3 100644 +--- a/src/lib/radius.c ++++ b/src/lib/radius.c +@@ -3307,16 +3307,16 @@ static ssize_t data2vp_nas_filter_rule(TALLOC_CTX *ctx, + p++; + continue; + } +- *(q++) = *(p++); + + /* + * Not much reason to have rules which + * are too long. + */ +- if ((size_t) (q - buffer) > sizeof(buffer)) { ++ if ((size_t) (q - buffer) >= sizeof(buffer)) { + fr_strerror_printf("decode NAS-Filter-Rule: decoded attribute is too long"); + return -1; + } ++ *(q++) = *(p++); + } + + /* +@@ -3326,7 +3326,7 @@ static ssize_t data2vp_nas_filter_rule(TALLOC_CTX *ctx, + attr = attr_end; + } + +- if (q == buffer) return attr + attr[2] - start; ++ if (q == buffer) return attr - start; + + vp = fr_pair_afrom_da(ctx, da); + if (!vp) { diff -Nru freeradius-3.2.7+dfsg/debian/patches/Unauthenticated-out-of-bounds-write-in-the-DHCP-option-encoder.patch freeradius-3.2.7+dfsg/debian/patches/Unauthenticated-out-of-bounds-write-in-the-DHCP-option-encoder.patch --- freeradius-3.2.7+dfsg/debian/patches/Unauthenticated-out-of-bounds-write-in-the-DHCP-option-encoder.patch 1970-01-01 00:00:00.000000000 +0000 +++ freeradius-3.2.7+dfsg/debian/patches/Unauthenticated-out-of-bounds-write-in-the-DHCP-option-encoder.patch 2026-12-01 07:38:39.000000000 +0000 @@ -0,0 +1,105 @@ +From 48145a599b1d437aa0af50ce3225fe63a5543dd5 Mon Sep 17 00:00:00 2001 +From: "Alan T. DeKok" +Date: Mon, 10 Aug 2026 13:48:54 -0400 +Subject: [PATCH] more size checking in fr_dhcp_encode_option() + +Issue found by A. Ramos +--- + src/modules/proto_dhcp/dhcp.c | 23 +++++++++++++++++++---- + 1 file changed, 19 insertions(+), 4 deletions(-) + +diff --git a/src/modules/proto_dhcp/dhcp.c b/src/modules/proto_dhcp/dhcp.c +index b2e368eba680..007865454e64 100644 +--- a/src/modules/proto_dhcp/dhcp.c ++++ b/src/modules/proto_dhcp/dhcp.c +@@ -1294,20 +1294,24 @@ static ssize_t fr_dhcp_vp2data(uint8_t *out, size_t outlen, VALUE_PAIR *vp) + break; + + case PW_TYPE_SHORT: ++ fr_assert(vp->vp_length == 2); + p[0] = (vp->vp_short >> 8) & 0xff; + p[1] = vp->vp_short & 0xff; + break; + + case PW_TYPE_INTEGER: ++ fr_assert(vp->vp_length == 4); + lvalue = htonl(vp->vp_integer); + memcpy(p, &lvalue, 4); + break; + + case PW_TYPE_IPV4_ADDR: ++ fr_assert(vp->vp_length == 4); + memcpy(p, &vp->vp_ipaddr, 4); + break; + + case PW_TYPE_ETHERNET: ++ fr_assert(vp->vp_length == 6); + memcpy(p, vp->vp_ether, 6); + break; + +@@ -1496,6 +1500,8 @@ ssize_t fr_dhcp_encode_option(UNUSED TALLOC_CTX *ctx, uint8_t *out, size_t outle + size_t freespace = outlen; + ssize_t len; + ++ if (outlen < 2) return -1; /* insufficient room for an option */ ++ + vp = fr_cursor_current(cursor); + if (!vp) return -1; + +@@ -1553,6 +1559,8 @@ ssize_t fr_dhcp_encode_option(UNUSED TALLOC_CTX *ctx, uint8_t *out, size_t outle + return 0; + } + ++ fr_assert(len <= freespace); ++ + p += len; + *opt_len += len; + freespace -= len; +@@ -1565,7 +1573,7 @@ ssize_t fr_dhcp_encode_option(UNUSED TALLOC_CTX *ctx, uint8_t *out, size_t outle + int fr_dhcp_encode(RADIUS_PACKET *packet) + { + unsigned int i; +- uint8_t *p; ++ uint8_t *p, *end; + vp_cursor_t cursor; + VALUE_PAIR *vp; + uint32_t lvalue; +@@ -1584,6 +1592,7 @@ int fr_dhcp_encode(RADIUS_PACKET *packet) + + packet->data_len = MAX_PACKET_SIZE; + packet->data = talloc_zero_array(packet, uint8_t, packet->data_len); ++ end = packet->data + packet->data_len; + + /* XXX Ugly ... should be set by the caller */ + if (packet->code == 0) packet->code = PW_DHCP_NAK; +@@ -1825,6 +1834,8 @@ int fr_dhcp_encode(RADIUS_PACKET *packet) + break; + + case PW_TYPE_OCTETS: /* only for Client HW Address */ ++ if (packet->data[2] > 16) continue; ++ + fr_pair_value_memcpy(vp, p, packet->data[2]); + break; + +@@ -1867,14 +1878,18 @@ int fr_dhcp_encode(RADIUS_PACKET *packet) + * and sub options. + */ + while ((vp = fr_cursor_current(&cursor))) { ++ if ((end - p) < 2) break; ++ + len = fr_dhcp_encode_option(packet, p, packet->data_len - (p - packet->data), &cursor); + if (len < 0) break; + p += len; + }; + +- p[0] = 0xff; /* end of option option */ +- p[1] = 0x00; +- p += 2; ++ if ((end - p) >= 2) { ++ p[0] = 0xff; /* end of option option */ ++ p[1] = 0x00; ++ p += 2; ++ } + dhcp_size = p - packet->data; + + /* diff -Nru freeradius-3.2.7+dfsg/debian/patches/Use-after-free-in-TTLS.patch freeradius-3.2.7+dfsg/debian/patches/Use-after-free-in-TTLS.patch --- freeradius-3.2.7+dfsg/debian/patches/Use-after-free-in-TTLS.patch 1970-01-01 00:00:00.000000000 +0000 +++ freeradius-3.2.7+dfsg/debian/patches/Use-after-free-in-TTLS.patch 2026-12-01 07:38:39.000000000 +0000 @@ -0,0 +1,30 @@ +From 1010ef8a7dd619e75c66520a8edb82548f79c0e5 Mon Sep 17 00:00:00 2001 +From: "Alan T. DeKok" +Date: Fri, 20 Nov 2026 16:21:01 -0800 +Subject: [PATCH] reset vp to NULL before going to the next attribute + +Issue found by Ozgun Kultekin +--- + src/modules/rlm_eap/types/rlm_eap_ttls/ttls.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/modules/rlm_eap/types/rlm_eap_ttls/ttls.c b/src/modules/rlm_eap/types/rlm_eap_ttls/ttls.c +index 825dbda0cfeb..05fa29c94a3b 100644 +--- a/src/modules/rlm_eap/types/rlm_eap_ttls/ttls.c ++++ b/src/modules/rlm_eap/types/rlm_eap_ttls/ttls.c +@@ -253,7 +253,6 @@ static VALUE_PAIR *diameter2vp(REQUEST *request, REQUEST *fake, SSL *ssl, + buffer[1] = size + 2; + memcpy(buffer + 2, data, size); + +- vp = NULL; + decoded = rad_attr2vp(packet, NULL, NULL, NULL, + buffer, size + 2, &vp); + if (decoded < 0) { +@@ -440,6 +439,7 @@ static VALUE_PAIR *diameter2vp(REQUEST *request, REQUEST *fake, SSL *ssl, + fr_cursor_insert(&out, vp); + + next_attr: ++ vp = NULL; + if (data_left <= attr_len) break; + + data_left -= attr_len; diff -Nru freeradius-3.2.7+dfsg/debian/patches/increase-buffer-size.patch freeradius-3.2.7+dfsg/debian/patches/increase-buffer-size.patch --- freeradius-3.2.7+dfsg/debian/patches/increase-buffer-size.patch 1970-01-01 00:00:00.000000000 +0000 +++ freeradius-3.2.7+dfsg/debian/patches/increase-buffer-size.patch 2026-12-01 07:38:39.000000000 +0000 @@ -0,0 +1,25 @@ +From b4f08a6bf47bd67184ebafe14cc29140a28ea0eb Mon Sep 17 00:00:00 2001 +From: "Alan T. DeKok" +Date: Thu, 2 Apr 2026 09:45:29 -0400 +Subject: [PATCH] increase buffer size + +--- + src/modules/rlm_eap/libeap/eapcrypto.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/modules/rlm_eap/libeap/eapcrypto.c b/src/modules/rlm_eap/libeap/eapcrypto.c +index f57714b6df..6322115a66 100644 +--- a/src/modules/rlm_eap/libeap/eapcrypto.c ++++ b/src/modules/rlm_eap/libeap/eapcrypto.c +@@ -38,7 +38,7 @@ void eapsim_calculate_keys(struct eapsim_keys *ek) + { + fr_sha1_ctx context; + uint8_t fk[160]; +- unsigned char buf[256]; ++ unsigned char buf[MAX_STRING_LEN + 3 * EAPSIM_KC_SIZE + EAPSIM_NONCEMT_SIZE + MAX_STRING_LEN + 2]; + unsigned char *p; + unsigned int blen; + +-- +2.53.0 + diff -Nru freeradius-3.2.7+dfsg/debian/patches/series freeradius-3.2.7+dfsg/debian/patches/series --- freeradius-3.2.7+dfsg/debian/patches/series 2025-12-06 20:56:45.000000000 +0000 +++ freeradius-3.2.7+dfsg/debian/patches/series 2026-12-01 07:38:39.000000000 +0000 @@ -7,3 +7,19 @@ snakeoil-certs.diff fips.patch wrap-crl_dp-checks-in-if-certs--lookup-=.patch +# 2026.06.01 Multiple issues in <3.0.28 and <3.2.9 +Tweak-bounds-for-NAS-Filter-Rule.patch +# 2026.11.25 Multiple issues in <3.0.29 and <3.2.11 +Use-after-free-in-TTLS.patch +Insufficient-length-checks-in-EAP-MSCHAPv2-responses-1.patch +Insufficient-length-checks-in-EAP-MSCHAPv2-responses-2.patch +Insufficient-length-checks-in-EAP-MSCHAPv2-responses-3.patch +Insufficient-length-checks-in-EAP-MSCHAPv2-responses-4.patch +Insufficient-bounds-checking-on-TLVs-and-values-for-EAP-FAST.patch +Possible-stack-overflow-in-EAP-FAST.patch +Unauthenticated-out-of-bounds-write-in-the-DHCP-option-encoder.patch +Incorrect-use-of-randomness-in-EAP-FAST-could-expose-the-PAC.patch +increase-buffer-size.patch # Prequesite for next one +Insufficient-validation-of-EAP-SIM-IdentityLength.patch +# TODO: Don't apply cleanly, not enabled by default +#Malformed-TLVs-in-TEAP-could-cause-an-infinite-loop.patch