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

Bug Softap without encryption #182

Open
Rotzbua opened this issue Apr 16, 2021 · 15 comments
Open

Bug Softap without encryption #182

Rotzbua opened this issue Apr 16, 2021 · 15 comments
Labels

Comments

@Rotzbua
Copy link
Contributor

Rotzbua commented Apr 16, 2021

Edit: seems to be an error in the esp32 arduino framework, see below

Environment

Chipset: eps32
Board: heltec_wifi_kit_32
Iotwebconf: 3.0.1
Compiler: PlatformIO 5.1.1
Partition: min_spiffs

Problem

Softap is unencrypted.

Reproduce

I do not know how this exactly could happen.
I use custom configuration.

  1. configured wifi & saved settings
  2. configured custom fields & saved

Maybe I changed layout without updating the version number for eeprom storage.

edit: after a second test: after restart or no configured wifi the device starts an unencrypted ap.

Expected behavior

If no valid password is available from config -> fallback to initial compiled password instead of open ap.

@prampec
Copy link
Owner

prampec commented Apr 16, 2021

If you are right, this MUST be fixed ASAP.

@prampec prampec added the bug label Apr 16, 2021
@prampec
Copy link
Owner

prampec commented Apr 16, 2021

I cannot reproduce this. Please check the console:
Ready.
AP password was not set in configuration
State changing from: 0 to 1
Setting up AP: testThing

@Rotzbua
Copy link
Contributor Author

Rotzbua commented Apr 16, 2021

I took some code from the mqtt example.
After I configured and reset the esp, there is an encrypted AP.
After another restart there is an open AP is started for the configured 30 seconds.
If there is no wifi where the esp could connect, it fallback again back to the unencrypted AP.
Really strange behavior 😕 .

I erased the complete flash of the esp32 and compiler cache and build the application again to avoid interference with old config.

The output is:

Config version: mqt2
Config size: 549
Loading configurations
[iwcAll]
|-- [iwcSys]
|   |-- 'iwcThingName' with value: 'testThing'
|   |-- 'iwcApPassword' with value: <hidden>
|   |-- [iwcWifi0]
|   |   |-- 'iwcWifiSsid' with value: '1-ABCD-IOT'
|   |   \-- 'iwcWifiPassword' with value: <hidden>
|   \-- 'iwcApTimeout' with value: '30'
|-- [iwcCustom]
|   \-- [MQTT configuration]
|       |-- 'mqttServer' with value: ''
|       |-- 'mqttUser' with value: ''
|       \-- 'mqttPass' with value: <hidden>
\-- [hidden]
Ready.
State changing from: 0 to 2
Setting up AP: testThing
Use password: <hidden>
AP IP address: 192.168.4.1
AP timeout (ms): 30000
State changed from: 0 to 2
Connection to AP.
[E][WebServer.cpp:633] _handleRequest(): request handler not found
Request for connectivitycheck.gstatic.com redirected to 192.168.4.1

@prampec
Copy link
Owner

prampec commented Apr 16, 2021

Do you provide any password for the AP?
After "Apply" button you should see:

iwcThingName: testThing
iwcApPassword: <was not changed>
iwcWifiSsid: someSsid
iwcWifiPassword: <updated>

@Rotzbua
Copy link
Contributor Author

Rotzbua commented Apr 16, 2021

Do you provide any password for the AP?
After "Apply" button you should see:

Yes, I compiled my project with IOTWEBCONF_DEBUG_PWD_TO_SERIAL and it shows the correct password.

Did you test it with an esp32 or an eps8266?

@Rotzbua
Copy link
Contributor Author

Rotzbua commented Apr 16, 2021

Ok, I found an issue, seems to be an framework bug: espressif/arduino-esp32#5038
May keep this issue open as information for others until it is fixed in the framework.

@prampec
Copy link
Owner

prampec commented Apr 16, 2021

Thank you for pointing this out!

@prampec prampec added wontfix and removed bug labels Apr 16, 2021
@societyofrobots
Copy link

Confirming. I'm also seeing this serious security issue.

Unfortunately when I revert back to 1.0.4, I run into incompatibilities with other libraries I'm using.

Is there any quick fix that can be done via IotWebConf? How can we get the attention of the core developers?

@Rotzbua
Copy link
Contributor Author

Rotzbua commented Apr 19, 2021

Is there any quick fix that can be done via IotWebConf?

Force HTTP Auth like on lan access would be an solution. This would be vulnerable to sniffing but better than an non auth access to the conf.

@prampec
Copy link
Owner

prampec commented Apr 19, 2021

Can we somehow detect from the software whether we have an unprotected AP set up?

@societyofrobots
Copy link

Force HTTP Auth like on lan access would be an solution.

How could I do this? The sniffing vulnerability isn't an issue for me in the short term.

Can we somehow detect from the software whether we have an unprotected AP set up?

I set to verbose and this is all it gave me when connecting by AP unsecured:

[D][WiFiGeneric.cpp:374] _eventCallback(): Event: 16 - AP_STACONNECTED
[D][WiFiGeneric.cpp:374] _eventCallback(): Event: 18 - AP_STAIPASSIGNED

I'd assume it had to be one of these changes in the last few months that broke it?
https://github.com/espressif/arduino-esp32/commits/master/libraries/WiFi/src

@Rotzbua
Copy link
Contributor Author

Rotzbua commented Apr 19, 2021

Unfortunately when I revert back to 1.0.4, I run into incompatibilities with other libraries I'm using.

@societyofrobots You are using Arduino IDE right? Then you can try the development version 2.0.0-alpha1. Just add the development url to the board manager:
https://github.com/espressif/arduino-esp32/blob/master/docs/arduino-ide/boards_manager.md

@societyofrobots
Copy link

You are using Arduino IDE right? Then you can try the development version 2.0.0-alpha1. Just add the development url to the board manager:

Just tried using an IotWebConf demo example. This security bug does not exist in 2.0.0-alpha1. Yay!

I'm getting some unrelated conflicts in my own core software, but maybe I'll be able to work around them.

@Rotzbua
Copy link
Contributor Author

Rotzbua commented Apr 27, 2021

Can we somehow detect from the software whether we have an unprotected AP set up?

Just with basic esp framework functions.

// required include
extern "C"
{
#include <esp_wifi.h>
}

// in code
wifi_config_t conf_current;
esp_wifi_get_config(WIFI_IF_AP, &conf_current);

if(conf_current.ap.authmode==WIFI_AUTH_OPEN){
// unprotected
}

@Rotzbua
Copy link
Contributor Author

Rotzbua commented Sep 23, 2021

The problems should be fixed with Arduino IDE ESP32 board framework 2.0.0. Seems that older 1.0.x wont get a fix espressif/arduino-esp32#5351 (comment) .

Platformio is pending: platformio/platform-espressif32#619

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants