Skip to contentSkip to conversation

wifi: cfg80211: Fix out-of-bounds in cfg80211_wext_siwscan

PATCH In review Jeongjun Park 2 participants 2 messages Jun 23, 2024 – Jun 25, 2024

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

PATCH 1/1 wifi: cfg80211: Fix out-of-bounds in cfg80211_wext_siwscan

In the process of searching for matching hardware channels, wreq and wreq->num_channels are checked to see if they are NULL. However, if the value of wreq->num_channels is greater than IW_MAX_FREQUENCIES, an out-of-bounds vulnerability occurs.

Therefore, you must also add code to check whether the value of wreq->num_channels is within the range.

Reguards.

Signed-by-off: Jeongjun Park <[email protected]>

---
 net/wireless/scan.c | 4 ++++
 1 file changed, 4 insertions(+)
net/wireless/scan.c +4 -0
index 0222ede0feb6..f253dee041d1 100644
@@ -3460,6 +3460,10 @@ int cfg80211_wext_siwscan(struct net_device *dev,
 			if (wreq && wreq->num_channels) {
 				int k;
 				int wiphy_freq = wiphy->bands[band]->channels[j].center_freq;
+
+				if (wreq->num_channels > IW_MAX_FREQUENCIES)
+					wreq->num_channels = IW_MAX_FREQUENCIES;
+
 				for (k = 0; k < wreq->num_channels; k++) {
 					struct iw_freq *freq =
 						&wreq->channel_list[k];
Signature · 1 line
2.34.1
maintainer
#1 lore raw
Quoted 8 lines · Jeongjun Park

In the process of searching for matching hardware channels, wreq and wreq->num_channels are checked to see if they are NULL. However, if the value of wreq->num_channels is greater than IW_MAX_FREQUENCIES, an out-of-bounds vulnerability occurs.

Therefore, you must also add code to check whether the value of wreq->num_channels is within the range.

This is the same more or less as

https://msgid.link/[email protected]

no?

johannes