Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added workaround for CVE-2020-12638. See https://lbsfilm.at/blog/wpa2… #2107

Merged
merged 1 commit into from
Sep 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions Sming/Arch/Esp32/Platform/WifiEventsImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
*/

#include "WifiEventsImpl.h"
#include <Platform/Station.h>
#include <esp_wifi.h>
#include <esp_event.h>

Expand Down Expand Up @@ -66,6 +67,16 @@ void WifiEventsImpl::WifiEventHandler(void* arg, esp_event_base_t base, int32_t
auto oldMode = WifiAuthMode(event->old_mode);
auto newMode = WifiAuthMode(event->new_mode);
debugf("mode: %d -> %d\n", oldMode, newMode);

if((oldMode != AUTH_OPEN) && (newMode == AUTH_OPEN)) {
// CVE-2020-12638 workaround.
// TODO: Remove this workaround once ESP-IDF has the proper fix.
debugf("Potential downgrade attack. Reconnecting WiFi. See CVE-2020-12638 for more details\n");
WifiStation.disconnect();
WifiStation.connect();
break;
}

if(onSTAAuthModeChange) {
onSTAAuthModeChange(oldMode, newMode);
}
Expand Down
11 changes: 11 additions & 0 deletions Sming/Arch/Esp8266/Platform/WifiEventsImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
*/

#include "WifiEventsImpl.h"
#include <Platform/Station.h>
#include <esp_wifi.h>

static WifiEventsImpl events;
Expand Down Expand Up @@ -48,6 +49,16 @@ void WifiEventsImpl::WifiEventHandler(System_Event_t* evt)
auto oldMode = WifiAuthMode(evt->event_info.auth_change.old_mode);
auto newMode = WifiAuthMode(evt->event_info.auth_change.new_mode);
debugf("mode: %d -> %d\n", oldMode, newMode);

if((oldMode != AUTH_OPEN) && (newMode == AUTH_OPEN)) {
// CVE-2020-12638 workaround.
// TODO: Remove this workaround once NON-OS SDK 3.0.x plays nicely with Sming
debugf("Potential downgrade attack. Reconnecting WiFi. See CVE-2020-12638 for more details\n");
WifiStation.disconnect();
WifiStation.connect();
break;
}

if(onSTAAuthModeChange) {
onSTAAuthModeChange(oldMode, newMode);
}
Expand Down