[PATCH 06/15] AP: Reject (Re)Association Request without Security Profile element

Andrei Otcheretianski andrei.otcheretianski at intel.com
Tue Nov 24 00:53:02 PST 2026


From: Ilan Peer <ilan.peer at intel.com>

If a STA included the Security Profile element in its Authentication
frame, it must also include it in the (Re)Association Request frame.
Previously, only a mismatching element was rejected; a missing one was
accepted.

Remember whether the element was present in Authentication, also for
IEEE 802.1X Authentication, and reject the association if it is then
missing.

Signed-off-by: Ilan Peer <ilan.peer at intel.com>
---
 src/ap/ieee802_11.c | 19 +++++++++++++++++++
 src/ap/sta_info.h   |  1 +
 2 files changed, 20 insertions(+)

diff --git a/src/ap/ieee802_11.c b/src/ap/ieee802_11.c
index 0c29d79936..e1e0d4ada1 100644
--- a/src/ap/ieee802_11.c
+++ b/src/ap/ieee802_11.c
@@ -478,6 +478,9 @@ static u16 validate_security_profile(
 	if (!hapd->conf->security_profiles)
 		return WLAN_STATUS_SUCCESS;
 
+	if (!assoc)
+		sta->sec_prof_in_auth = !!elems->security_profile;
+
 	if (!elems->security_profile) {
 		/* No Security Profile element present - validation not needed
 		 */
@@ -3867,6 +3870,9 @@ static void handle_auth_802_1x(struct hostapd_data *hapd, struct sta_info *sta,
 		}
 
 		/* Validate Security Profile element, if present */
+		if (hapd->conf->security_profiles)
+			sta->sec_prof_in_auth = !!elems.security_profile;
+
 		if (hapd->conf->security_profiles && elems.security_profile) {
 			const struct security_profile_entry *sp = NULL;
 
@@ -7011,6 +7017,19 @@ static int __check_assoc_ies(struct hostapd_data *hapd, struct sta_info *sta,
 	}
 #endif /* CONFIG_P2P */
 
+	/*
+	 * A station that used a Security Profile element in Authentication has
+	 * security profiles activated and needs to include it here as well
+	 */
+	if (!assoc_wpa_sm && hapd->conf->security_profiles &&
+	    sta->sec_prof_in_auth && !elems->security_profile) {
+		wpa_printf(MSG_INFO,
+			   "Missing Security Profile element in (Re)Association Request frame");
+
+		resp = WLAN_STATUS_REJECTED_INVALID_SECURITY_PROFILE;
+		goto out;
+	}
+
 #ifdef CONFIG_IEEE8021X_AUTH
 	/* Per IEEE Std 802.11bi-2026, 12.16.6 ((Re)Association Request/Response
 	 * frame encryption), if IEEE 802.1X is used and FT protocol is not
diff --git a/src/ap/sta_info.h b/src/ap/sta_info.h
index 235f96b47c..2e9cf873d4 100644
--- a/src/ap/sta_info.h
+++ b/src/ap/sta_info.h
@@ -353,6 +353,7 @@ struct sta_info {
 	struct pasn_data *pasn;
 	bool sec_prof_used;
 #endif /* CONFIG_PASN */
+	bool sec_prof_in_auth;
 
 #ifdef CONFIG_IEEE80211BE
 	struct mld_info mld_info;
-- 
2.56.1




More information about the Hostap mailing list