Skip to content

Commit 59499c7

Browse files
committed
backport #7486
1 parent 59bbfc7 commit 59499c7

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

libraries/ESP8266WiFi/src/ESP8266WiFiGeneric.cpp

+10
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,16 @@ void ESP8266WiFiGenericClass::_eventCallback(void* arg)
233233
WiFiClient::stopAll();
234234
}
235235

236+
if (event->event == EVENT_STAMODE_AUTHMODE_CHANGE) {
237+
auto& src = event->event_info.auth_change;
238+
if ((src.old_mode != AUTH_OPEN) && (src.new_mode == AUTH_OPEN)) {
239+
// CVE-2020-12638 workaround. When we get a change to AUTH_OPEN from any other mode, drop the WiFi link because it's a downgrade attack
240+
// TODO - When upgrading to 3.x.x with fix, remove this code
241+
DEBUG_WIFI("WIFI_EVENT_STAMODE_AUTHMODE_CHANGE from encrypted(%d) to AUTH_OPEN, potential downgrade attack. Reconnecting WiFi. See CVE-2020-12638 for more details\n", src.old_mode);
242+
WiFi.reconnect(); // Disconnects from STA and then reconnects
243+
}
244+
}
245+
236246
for(auto it = std::begin(sCbEventList); it != std::end(sCbEventList); ) {
237247
WiFiEventHandler &handler = *it;
238248
if (handler->canExpire() && handler.unique()) {

0 commit comments

Comments
 (0)