Merge branch 'bugfix/dpp_stray_auth_confirm' into 'master'

fix(esp_wifi): Harden dpp Auth confirm and drop mismatched auth confirms

Closes WIFIBUG-2032 and WIFIBUG-2075

See merge request espressif/esp-idf!51554
This commit is contained in:
Jiang Jiang Jian
2026-08-19 17:15:35 +08:00
2 changed files with 23 additions and 6 deletions

View File

@@ -368,7 +368,12 @@ static int esp_dpp_rx_auth_conf(struct action_rx_param *rx_param, uint8_t *dpp_d
if (os_memcmp(rx_param->sa, auth->peer_mac_addr, ETH_ALEN) != 0) {
wpa_printf(MSG_DEBUG, "DPP: MAC address mismatch (expected "
MACSTR ") - drop", MAC2STR(auth->peer_mac_addr));
return ESP_ERR_DPP_FAILURE;
return ESP_OK;
}
if (auth->auth_success || !auth->waiting_auth_conf) {
wpa_printf(MSG_DEBUG, "DPP: Not waiting for Auth Confirm - drop");
return ESP_OK;
}
eloop_cancel_timeout(esp_dpp_auth_conf_wait_timeout, NULL, NULL);
@@ -401,7 +406,8 @@ static esp_err_t esp_dpp_rx_peer_disc_resp(struct action_rx_param *rx_param)
uint8_t *buf;
if (!dc) {
return ESP_ERR_DPP_FAILURE;
wpa_printf(MSG_DEBUG, "DPP: No config store for Peer Discovery Response - drop");
return ESP_OK;
}
const uint8_t *trans_id;
uint16_t trans_id_len;
@@ -414,6 +420,11 @@ static esp_err_t esp_dpp_rx_peer_disc_resp(struct action_rx_param *rx_param)
return ESP_OK;
}
if (s_dpp_ctx.peer_disc_resp_received) {
wpa_printf(MSG_DEBUG, "DPP: Peer Discovery Response already processed - drop");
return ESP_OK;
}
wpa_printf(MSG_DEBUG, "DPP: Peer Discovery from " MACSTR, MAC2STR(rx_param->sa));
trans_id = dpp_get_attr(&buf[2], len, DPP_ATTR_TRANSACTION_ID, &trans_id_len);
@@ -426,6 +437,10 @@ static esp_err_t esp_dpp_rx_peer_disc_resp(struct action_rx_param *rx_param)
return ESP_OK;
}
eloop_cancel_timeout(peer_disc_timeout, ELOOP_ALL_CTX, ELOOP_ALL_CTX);
eloop_cancel_timeout(esp_dpp_peer_disc_retry, NULL, NULL);
s_dpp_ctx.peer_disc_resp_received = true;
const uint8_t *status_val;
uint16_t status_len;
const uint8_t *peer_connector;
@@ -461,10 +476,6 @@ static esp_err_t esp_dpp_rx_peer_disc_resp(struct action_rx_param *rx_param)
goto out;
}
/* peer_disc_timeout handles timeout in Enrollee role */
eloop_cancel_timeout(peer_disc_timeout, NULL, s_dpp_ctx.dpp_auth);
s_dpp_ctx.peer_disc_resp_received = true;
if (!conf->connector || !conf->net_access_key || !conf->c_sign_key) {
wpa_printf(MSG_ERROR, "DPP: Incomplete config for network introduction");
ret = ESP_ERR_DPP_FAILURE;

View File

@@ -2793,6 +2793,12 @@ int dpp_auth_conf_rx(struct dpp_authentication *auth, const u8 *hdr,
return -1;
}
if (!auth->waiting_auth_conf) {
wpa_printf(MSG_DEBUG,
"DPP: Not waiting for Auth Confirm - drop");
return -1;
}
auth->waiting_auth_conf = 0;
wrapped_data = dpp_get_attr(attr_start, attr_len, DPP_ATTR_WRAPPED_DATA,