Skip to contentSkip to conversation

wifi: mac80211: only accept IBSS channel switch from our own BSSID

PATCH In review Yingjie Cao 3 participants 7 messages Jun 23 – Jul 7

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 wifi: mac80211: only accept IBSS channel switch from our own BSSID

ieee80211_rx_bss_info() acts on a channel switch announcement (CSA) carried in a received beacon or probe response before it verifies that the frame's BSSID matches our own IBSS; it only checks that the SSID matches. ieee80211_rx_mgmt_spectrum_mgmt() acts on a spectrum management (channel switch) action frame without checking the BSSID at all.

Because of this, any station in radio range that knows the IBSS SSID (which is broadcast in cleartext) can inject a beacon or action frame carrying a CSA element that points at an unsupported channel. The switch then fails in ieee80211_ibss_process_chanswitch(), which queues csa_connection_drop_work and tears the whole IBSS down. The members rejoin and the attacker repeats, resulting in a persistent, unauthenticated denial of service. Encrypted IBSS networks are equally affected because beacons are not protected. Since both of these CSA entry points are IBSS-specific, the impact is confined to IBSS (ad-hoc) mode; managed-mode CSA is handled separately in mlme.c and is unaffected.

Only honour a channel switch that originates from our own IBSS, i.e. when the BSSID matches. A CSA carried in a beacon from a foreign BSSID that merely shares our SSID is now ignored; such a beacon remains a candidate for the normal IBSS merge path. A channel switch coming from a station in our own IBSS keeps working exactly as before.

Fixes cd7760e62c2a ("mac80211: add support for CSA in IBSS mode")
---
 net/mac80211/ibss.c | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)
net/mac80211/ibss.c +15 -4
index 97292ff51475..6440fd915aa5 100644
@@ -895,6 +895,10 @@ ieee80211_rx_mgmt_spectrum_mgmt(struct ieee80211_sub_if_data *sdata,
 	if (mgmt->u.action.action_code != WLAN_ACTION_SPCT_CHL_SWITCH)
 		return;
 
+	/* only act on channel switch frames coming from our own IBSS */
+	if (!ether_addr_equal(mgmt->bssid, sdata->u.ibss.bssid))
+		return;
+
 	if (!sdata->vif.bss_conf.csa_active)
 		ieee80211_ibss_process_chanswitch(sdata, elems, false);
 }
@@ -1111,14 +1115,21 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata,
 				sdata->u.ibss.ssid_len))
 		goto put_bss;
 
-	/* process channel switch */
-	if (sdata->vif.bss_conf.csa_active ||
-	    ieee80211_ibss_process_chanswitch(sdata, elems, true))
+	/* don't process beacons while a channel switch is in progress */
+	if (sdata->vif.bss_conf.csa_active)
 		goto put_bss;
 
 	/* same BSSID */
-	if (ether_addr_equal(cbss->bssid, sdata->u.ibss.bssid))
+	if (ether_addr_equal(cbss->bssid, sdata->u.ibss.bssid)) {
+		/*
+		 * Only act on a channel switch announcement that comes from
+		 * our own IBSS (i.e. matching BSSID). Acting on a CSA from a
+		 * foreign BSSID that merely shares our SSID would let any
+		 * station force us off-channel or tear the cell down.
+		 */
+		ieee80211_ibss_process_chanswitch(sdata, elems, true);
 		goto put_bss;
+	}
 
 	/* we use a fixed BSSID */
 	if (sdata->u.ibss.fixed_bssid)
Signature · 1 line
2.39.5 (Apple Git-154)
maintainer
#1 lore raw
Quoted 6 lines · Yingjie Cao

ieee80211_rx_bss_info() acts on a channel switch announcement (CSA) carried in a received beacon or probe response before it verifies that the frame's BSSID matches our own IBSS; it only checks that the SSID matches. ieee80211_rx_mgmt_spectrum_mgmt() acts on a spectrum management (channel switch) action frame without checking the BSSID at all.

Quoted 10 lines

Because of this, any station in radio range that knows the IBSS SSID (which is broadcast in cleartext) can inject a beacon or action frame carrying a CSA element that points at an unsupported channel. The switch then fails in ieee80211_ibss_process_chanswitch(), which queues csa_connection_drop_work and tears the whole IBSS down. The members rejoin and the attacker repeats, resulting in a persistent, unauthenticated denial of service. Encrypted IBSS networks are equally affected because beacons are not protected. Since both of these CSA entry points are IBSS-specific, the impact is confined to IBSS (ad-hoc) mode; managed-mode CSA is handled separately in mlme.c and is unaffected.

Once you rewrite this to be more honest, you'll see that the whole Cc stable thing and all is fairly much pointless?

Or have you not realised yet that stations can also trivially fake their MAC address?

johannes

maintainer
#2 lore raw
Quoted 18 lines · Johannes Berg
Quoted 6 lines · Yingjie Cao

ieee80211_rx_bss_info() acts on a channel switch announcement (CSA) carried in a received beacon or probe response before it verifies that the frame's BSSID matches our own IBSS; it only checks that the SSID matches. ieee80211_rx_mgmt_spectrum_mgmt() acts on a spectrum management (channel switch) action frame without checking the BSSID at all.

Quoted 10 lines

Because of this, any station in radio range that knows the IBSS SSID (which is broadcast in cleartext) can inject a beacon or action frame carrying a CSA element that points at an unsupported channel. The switch then fails in ieee80211_ibss_process_chanswitch(), which queues csa_connection_drop_work and tears the whole IBSS down. The members rejoin and the attacker repeats, resulting in a persistent, unauthenticated denial of service. Encrypted IBSS networks are equally affected because beacons are not protected. Since both of these CSA entry points are IBSS-specific, the impact is confined to IBSS (ad-hoc) mode; managed-mode CSA is handled separately in mlme.c and is unaffected.

Quoted 5 lines

Once you rewrite this to be more honest, you'll see that the whole Cc stable thing and all is fairly much pointless?

Or have you not realised yet that stations can also trivially fake their MAC address?

Also, since you don't have a track record in wifi, I'll point once again to https://docs.kernel.org/process/coding-assistants.html

johannes

#3 lore raw
Quoted 19 lines · Johannes Berg
Quoted 18 lines · Johannes Berg
Quoted 16 lines · Yingjie Cao

ieee80211_rx_bss_info() acts on a channel switch announcement (CSA) carried in a received beacon or probe response before it verifies that the frame's BSSID matches our own IBSS; it only checks that the SSID matches. ieee80211_rx_mgmt_spectrum_mgmt() acts on a spectrum management (channel switch) action frame without checking the BSSID at all.

Because of this, any station in radio range that knows the IBSS SSID (which is broadcast in cleartext) can inject a beacon or action frame carrying a CSA element that points at an unsupported channel. The switch then fails in ieee80211_ibss_process_chanswitch(), which queues csa_connection_drop_work and tears the whole IBSS down. The members rejoin and the attacker repeats, resulting in a persistent, unauthenticated denial of service. Encrypted IBSS networks are equally affected because beacons are not protected. Since both of these CSA entry points are IBSS-specific, the impact is confined to IBSS (ad-hoc) mode; managed-mode CSA is handled separately in mlme.c and is unaffected.

Quoted 9 lines
Quoted 5 lines

Once you rewrite this to be more honest, you'll see that the whole Cc stable thing and all is fairly much pointless?

Or have you not realised yet that stations can also trivially fake their MAC address?

Also, since you don't have a track record in wifi, I'll point once again to https://docs.kernel.org/process/coding-assistants.html

So, what's the litmus test? I've been watching this list for some time now. I've seen (what appears) to be an ushering of distrust brought on by llm's. This also seems to have come into prominence within the last 6 or so months. I understand the cautious approach, but what if one's been working diligently (and quietly), and has spent many hours studying and preparing a driver series (for oneself and submission to the kernel)? I've always done well by doing my homework the hard way. But now, submissions are met with skepticism... that the work must have been assisted-by if the person doesn't have a track record. How should one defend his work (I'd rather not share credit with a machine when my work is my own)? To be clear, my question is sourcing from what I've seen to be trending more recently whereby several submissions have been ?softly? tagged as assisted-by. Maybe they were, but my point still stands. Kindly provide guidance.

maintainer
#4 lore raw
Quoted 2 lines · Nathan Howard

So, what's the litmus test?

I don't know, tbh.

Quoted 5 lines

I've been watching this list for some time
now. I've seen (what appears) to be an ushering of distrust brought on by llm's. This also seems to have come into prominence within the last 6 or so months. I understand the cautious approach, but what if one's been working diligently (and quietly), and has spent many hours studying and

Quoted 8 lines

preparing a driver series (for oneself and submission to the kernel)? I've always done well by doing my homework the hard way. But now, submissions are met with skepticism... that the work must have been assisted-by if the person doesn't have a track record. How should one defend his work (I'd rather not share credit with a machine when my work is my own)? To be clear, my question is sourcing from what I've seen to be trending more recently whereby several submissions have been ?softly? tagged as assisted-by. Maybe they were, but my point still stands. Kindly provide guidance.

I'm convinced that if you've actually done the legwork you could defend the work you've done. If you're willing to go on the record saying you _didn't_ use an LLM I'm even going to believe it.

But if someone's sending "critical security fix that needs security@ involvement" across a wide spectrum of places then yes, I'm going to be highly sceptical they actually know what they're doing on any individual one of the issues.

Like here. OK, this one didn't go to security@, and it's not even a wrong fix, but doing "Cc stable", Cc'ing half the world and not following up *at all* are all bad signs.

johannes

#5 lore raw
Quoted 20 lines · Johannes Berg
Quoted 2 lines · Nathan Howard

So, what's the litmus test?

I don't know, tbh.

Quoted 5 lines

I've been watching this list for some time
now. I've seen (what appears) to be an ushering of distrust brought on by llm's. This also seems to have come into prominence within the last 6 or so months. I understand the cautious approach, but what if one's been working diligently (and quietly), and has spent many hours studying and

Quoted 8 lines

preparing a driver series (for oneself and submission to the kernel)? I've always done well by doing my homework the hard way. But now, submissions are met with skepticism... that the work must have been assisted-by if the person doesn't have a track record. How should one defend his work (I'd rather not share credit with a machine when my work is my own)? To be clear, my question is sourcing from what I've seen to be trending more recently whereby several submissions have been ?softly? tagged as assisted-by. Maybe they were, but my point still stands. Kindly provide guidance.

Quoted 3 lines

I'm convinced that if you've actually done the legwork you could defend the work you've done. If you're willing to go on the record saying you _didn't_ use an LLM I'm even going to believe it.

This sounds reasonable.

Quoted 9 lines

But if someone's sending "critical security fix that needs security@ involvement" across a wide spectrum of places then yes, I'm going to be highly sceptical they actually know what they're doing on any individual one of the issues.

Like here. OK, this one didn't go to security@, and it's not even a wrong fix, but doing "Cc stable", Cc'ing half the world and not following up *at all* are all bad signs.

As does this. Thank you for the guidance.

#6 lore raw
In reply to Johannes Berg

Hi Johannes,

Thank you for the feedback, and sorry for the delayed follow-up.

I did use AI assistance while preparing this patch, and I should have been more careful and responsible before submitting it. In particular, I agree that the commit message overstated the security impact, and that adding Cc: stable was not appropriate for this submission.

I am currently learning the kernel patch submission process and the IBSS code paths involved here. Going forward, I will make sure any future submissions are reviewed and verified by me personally before sending, and I will include the proper Assisted-by tag when AI tools materially contribute to the work.

For this patch, I will drop it until I have a fuller understanding of the code involved.

Thanks,
Yingjie