[GH-ISSUE #804] Problem with special character in password #671

Closed
opened 2026-02-28 01:26:29 +03:00 by kerem · 22 comments
Owner

Originally created by @giulianetti on GitHub (Jan 10, 2019).
Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/804

Description

I am have problem when I use special characters in the passwords.
Exemple: "32<@werpW&uqyW=dmk0FSD"
Could anybody help me?

Basic Infos

Hardware

WiFimanager Branch/Release:

  • Master
  • Development

Esp8266/Esp32:

  • ESP8266
  • ESP32

Hardware: ESP-12e, esp01, esp25

  • ESP01
  • ESP12 E/F/S (nodemcu, wemos, feather)
  • Other

ESP Core Version: 2.4.0, staging

  • 2.3.0
  • 2.4.0
  • staging (master/dev)

Debug Messages

*WM: [2] ESP32 event handler enabled
*WM: [2] Connecting as wifi client...
*WM: [2] setSTAConfig static ip not set
*WM: [3] WIFI station disconnect
*WM: [1] Connecting to saved AP: Leonardo
*WM: [3] WiFi station enable
*WM: [2] 30000 ms connectTimeout set
*WM: [2] 30000 ms timeout, waiting for connect...
*WM: [2] Connection result: WL_DISCONNECTED
*WM: [3] lastconxresulttmp: WL_IDLE_STATUS
*WM: [3] lastconxresult: WL_DISCONNECTED
*WM: [1] AutoConnect: FAILED
*WM: [2] AccessPoint set password is VALID
*WM: [1] password
*WM: [3] WIFI station disconnect
*WM: [3] WiFi station enable
*WM: [2] Disabling STA
*WM: [2] Enabling AP
*WM: [1] StartAP with SSID: AutoConnectAP
*WM: [1] AP IP address: 192.168.4.1
*WM: [3] setupConfigPortal
*WM: [1] Starting Web Portal
*WM: [3] dns server started with ip: 192.168.4.1
*WM: [2] HTTP server started
*WM: [2] WiFi Scan ASYNC started
*WM: [2] Config Portal Running, blocking, waiting for clients...
*WM: [2] NUM CLIENTS: 0

Originally created by @giulianetti on GitHub (Jan 10, 2019). Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/804 ### Description I am have problem when I use special characters in the passwords. Exemple: "32<@werpW&uqyW=dmk0FSD" Could anybody help me? ### Basic Infos #### Hardware **WiFimanager Branch/Release:** - [ ] Master - [x] Development **Esp8266/Esp32:** - [ ] ESP8266 - [x] ESP32 **Hardware: ESP-12e, esp01, esp25** - [ ] ESP01 - [ ] ESP12 E/F/S (nodemcu, wemos, feather) - [ ] Other **ESP Core Version: 2.4.0, staging** - [ ] 2.3.0 - [ ] 2.4.0 - [ ] staging (master/dev) ### Debug Messages *WM: [2] ESP32 event handler enabled *WM: [2] Connecting as wifi client... *WM: [2] setSTAConfig static ip not set *WM: [3] WIFI station disconnect *WM: [1] Connecting to saved AP: Leonardo *WM: [3] WiFi station enable *WM: [2] 30000 ms connectTimeout set *WM: [2] 30000 ms timeout, waiting for connect... *WM: [2] Connection result: WL_DISCONNECTED *WM: [3] lastconxresulttmp: WL_IDLE_STATUS *WM: [3] lastconxresult: WL_DISCONNECTED *WM: [1] AutoConnect: FAILED *WM: [2] AccessPoint set password is VALID *WM: [1] password *WM: [3] WIFI station disconnect *WM: [3] WiFi station enable *WM: [2] Disabling STA *WM: [2] Enabling AP *WM: [1] StartAP with SSID: AutoConnectAP *WM: [1] AP IP address: 192.168.4.1 *WM: [3] setupConfigPortal *WM: [1] Starting Web Portal *WM: [3] dns server started with ip: 192.168.4.1 *WM: [2] HTTP server started *WM: [2] WiFi Scan ASYNC started *WM: [2] Config Portal Running, blocking, waiting for clients... *WM: [2] NUM CLIENTS: 0
kerem 2026-02-28 01:26:30 +03:00
Author
Owner

@tablatronix commented on GitHub (Jan 10, 2019):

in what password?

<!-- gh-comment-id:453170688 --> @tablatronix commented on GitHub (Jan 10, 2019): in what password?
Author
Owner

@giulianetti commented on GitHub (Jan 10, 2019):

I'm trying to connect to an AP with SSID name = Leonardo and Password = "32 <@ werpW & uqyW = dmk0FSD". So, I understand that WIFIManager is not able to connect because it does not understand the special characters <@ = + ...
When I change the password and I remove the special characters, it works.

<!-- gh-comment-id:453182917 --> @giulianetti commented on GitHub (Jan 10, 2019): I'm trying to connect to an AP with SSID name = Leonardo and Password = "32 <@ werpW & uqyW = dmk0FSD". So, I understand that WIFIManager is not able to connect because it does not understand the special characters <@ = + ... When I change the password and I remove the special characters, it works.
Author
Owner

@tablatronix commented on GitHub (Jan 10, 2019):

ok, let me check it out, must be an encoding issue in the form submission

<!-- gh-comment-id:453195302 --> @tablatronix commented on GitHub (Jan 10, 2019): ok, let me check it out, must be an encoding issue in the form submission
Author
Owner

@tablatronix commented on GitHub (Jan 10, 2019):

I dont know that this is a wm problem
*WM: [1] using password: 32<@werpW&uqyW=dmk0FSD

are you sure esp supports this password, can you connect manually?

<!-- gh-comment-id:453219108 --> @tablatronix commented on GitHub (Jan 10, 2019): I dont know that this is a wm problem `*WM: [1] using password: 32<@werpW&uqyW=dmk0FSD` are you sure esp supports this password, can you connect manually?
Author
Owner

@giulianetti commented on GitHub (Jan 10, 2019):

Yes, I can.

See the example bellow:

Code:

`/*

  • This sketch sends data via HTTP GET requests to data.sparkfun.com service.
  • You need to get streamId and privateKey at data.sparkfun.com and paste them
  • below. Or just customize this script to talk to other HTTP servers.

*/

#include <WiFi.h>

const char* ssid = "Leonardo";
const char* password = "32<@werpW&uqyW=dmk0FSD";

const char* host = "data.sparkfun.com";
const char* streamId = "....................";
const char* privateKey = "....................";

void setup()
{
Serial.begin(115200);
delay(10);

// We start by connecting to a WiFi `

Debug

'Connecting to Leonardo
.......................................
WiFi connected
IP address:
192.168.43.154
connecting to data.sparkfun.com
Requesting URL: /input/....................?private_key=....................&value=1
HTTP/1.1 302 Found
Cache-Control: no-cache
Content-length: 0
Location: https://data.sparkfun.com/input/....................?private_key=....................&value=1
Connection: close'

<!-- gh-comment-id:453233025 --> @giulianetti commented on GitHub (Jan 10, 2019): Yes, I can. See the example bellow: Code: `/* * This sketch sends data via HTTP GET requests to data.sparkfun.com service. * * You need to get streamId and privateKey at data.sparkfun.com and paste them * below. Or just customize this script to talk to other HTTP servers. * */ #include <WiFi.h> const char* ssid = "Leonardo"; const char* password = "32<@werpW&uqyW=dmk0FSD"; const char* host = "data.sparkfun.com"; const char* streamId = "...................."; const char* privateKey = "...................."; void setup() { Serial.begin(115200); delay(10); // We start by connecting to a WiFi ` Debug 'Connecting to Leonardo ....................................... WiFi connected IP address: 192.168.43.154 connecting to data.sparkfun.com Requesting URL: /input/....................?private_key=....................&value=1 HTTP/1.1 302 Found Cache-Control: no-cache Content-length: 0 Location: https://data.sparkfun.com/input/....................?private_key=....................&value=1 Connection: close'
Author
Owner

@giulianetti commented on GitHub (Jan 10, 2019):

I am trying to debug the password that the program is reading, however I am having difficulty finding the password variable.
Can you tell me what it is?

bool WiFiManager::wifiConnectDefault(){
bool ret = false;
DEBUG_WM(F("Connecting to saved AP:"),WiFi_SSID());
DEBUG_WM(F("Password:"), ??????);
ret = WiFi_enableSTA(true,storeSTAmode);
if(!ret) DEBUG_WM(DEBUG_ERROR,"[ERROR] wifi enableSta failed");
ret = WiFi.begin();
if(!ret) DEBUG_WM(DEBUG_ERROR,"[ERROR] wifi begin failed");
return ret;
}

<!-- gh-comment-id:453235403 --> @giulianetti commented on GitHub (Jan 10, 2019): I am trying to debug the password that the program is reading, however I am having difficulty finding the password variable. Can you tell me what it is? bool WiFiManager::wifiConnectDefault(){ bool ret = false; DEBUG_WM(F("Connecting to saved AP:"),WiFi_SSID()); DEBUG_WM(F("Password:"), **??????**); ret = WiFi_enableSTA(true,storeSTAmode); if(!ret) DEBUG_WM(DEBUG_ERROR,"[ERROR] wifi enableSta failed"); ret = WiFi.begin(); if(!ret) DEBUG_WM(DEBUG_ERROR,"[ERROR] wifi begin failed"); return ret; }
Author
Owner

@tablatronix commented on GitHub (Jan 10, 2019):

so you did begin(ssid,password);

It just sends it to the esp lib

<!-- gh-comment-id:453261601 --> @tablatronix commented on GitHub (Jan 10, 2019): so you did `begin(ssid,password);` It just sends it to the esp lib
Author
Owner

@tablatronix commented on GitHub (Jan 10, 2019):

3717e323b9

<!-- gh-comment-id:453263391 --> @tablatronix commented on GitHub (Jan 10, 2019): 3717e323b9f524c4018cc883350db8072b5d3ff3
Author
Owner

@giulianetti commented on GitHub (Jan 11, 2019):

Hi tablatronix,

As you can see bellow, the problem is in the character "=", per some reason it is scaping.
I belive that the problem happen when we are saving the new ap (form web).

Debbug

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:952
load:0x40078000,len:6084
load:0x40080000,len:7936
entry 0x40080310
*WM: [1] AutoConnect
*WM: [2] ESP32 event handler enabled
*WM: [2] Connecting as wifi client...
*WM: [2] setSTAConfig static ip not set
*WM: [3] WIFI station disconnect
*WM: [1] Connecting to saved AP: Leonardo
*WM: [3] Using Password: 32<@werpW&uqyW
*WM: [3] WiFi station enable
*WM: [2] 60000 ms connectTimeout set
*WM: [2] 60000 ms timeout, waiting for connect...
*WM: [2] Connection result: WL_DISCONNECTED
*WM: [3] lastconxresulttmp: WL_IDLE_STATUS
*WM: [3] lastconxresult: WL_DISCONNECTED
*WM: [1] AutoConnect: FAILED
*WM: [2] AccessPoint set password is VALID
*WM: [1] password
*WM: [3] WIFI station disconnect
*WM: [3] WiFi station enable
*WM: [2] Disabling STA
*WM: [2] Enabling AP
*WM: [1] StartAP with SSID: AutoConnectAP
*WM: [1] AP IP address: 192.168.4.1
*WM: [3] setupConfigPortal
*WM: [1] Starting Web Portal
*WM: [3] dns server started with ip: 192.168.4.1
*WM: [2] HTTP server started
*WM: [2] WiFi Scan ASYNC started
*WM: [2] Config Portal Running, blocking, waiting for clients...
*WM: [2] NUM CLIENTS: 0

<!-- gh-comment-id:453497452 --> @giulianetti commented on GitHub (Jan 11, 2019): Hi tablatronix, As you can see bellow, the problem is in the character "=", per some reason it is scaping. I belive that the problem happen when we are saving the new ap (form web). Debbug rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT) configsip: 0, SPIWP:0xee clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00 mode:DIO, clock div:1 load:0x3fff0018,len:4 load:0x3fff001c,len:952 load:0x40078000,len:6084 load:0x40080000,len:7936 entry 0x40080310 *WM: [1] AutoConnect *WM: [2] ESP32 event handler enabled *WM: [2] Connecting as wifi client... *WM: [2] setSTAConfig static ip not set *WM: [3] WIFI station disconnect *WM: [1] Connecting to saved AP: Leonardo `*WM: [3] Using Password: 32<@werpW&uqyW` *WM: [3] WiFi station enable *WM: [2] 60000 ms connectTimeout set *WM: [2] 60000 ms timeout, waiting for connect... *WM: [2] Connection result: WL_DISCONNECTED *WM: [3] lastconxresulttmp: WL_IDLE_STATUS *WM: [3] lastconxresult: WL_DISCONNECTED *WM: [1] AutoConnect: FAILED *WM: [2] AccessPoint set password is VALID *WM: [1] password *WM: [3] WIFI station disconnect *WM: [3] WiFi station enable *WM: [2] Disabling STA *WM: [2] Enabling AP *WM: [1] StartAP with SSID: AutoConnectAP *WM: [1] AP IP address: 192.168.4.1 *WM: [3] setupConfigPortal *WM: [1] Starting Web Portal *WM: [3] dns server started with ip: 192.168.4.1 *WM: [2] HTTP server started *WM: [2] WiFi Scan ASYNC started *WM: [2] Config Portal Running, blocking, waiting for clients... *WM: [2] NUM CLIENTS: 0
Author
Owner

@mindforger commented on GitHub (Jan 11, 2019):

probably because it is a

form method='get'

i did not look into the parser deep enough but this may be misread as an additional key/value pair from the webserver

also transmitting a password by get in plain text is maybe not the very best option as a side thought

<!-- gh-comment-id:453499232 --> @mindforger commented on GitHub (Jan 11, 2019): probably because it is a >form method='get' i did not look into the parser deep enough but this may be misread as an additional key/value pair from the webserver also transmitting a password by get in plain text is maybe not the very best option as a side thought
Author
Owner

@giulianetti commented on GitHub (Jan 11, 2019):

I solved this problem changing the file strings_en.h, as bellow:

Before:
const char HTTP_FORM_START[] PROGMEM = "<form method='POST' action='{v}'>";

After:
const char HTTP_FORM_START[] PROGMEM = "<form method='POST' enctype=\"multipart/form-data\" action='{v}'>";

<!-- gh-comment-id:453546791 --> @giulianetti commented on GitHub (Jan 11, 2019): I solved this problem changing the file strings_en.h, as bellow: Before: `const char HTTP_FORM_START[] PROGMEM = "<form method='POST' action='{v}'>";` After: `const char HTTP_FORM_START[] PROGMEM = "<form method='POST' enctype=\"multipart/form-data\" action='{v}'>";`
Author
Owner

@mindforger commented on GitHub (Jan 11, 2019):

Huh? What file was i reading then?

<!-- gh-comment-id:453548468 --> @mindforger commented on GitHub (Jan 11, 2019): Huh? What file was i reading then?
Author
Owner

@tablatronix commented on GitHub (Jan 11, 2019):

must have not pulled branch in a very long time

<!-- gh-comment-id:453553858 --> @tablatronix commented on GitHub (Jan 11, 2019): must have not pulled branch in a very long time
Author
Owner

@tablatronix commented on GitHub (Jan 11, 2019):

hmm interesting, I guess some browsers automatically handle the enctype
or maybe you dont have the newest branch updates with the <meta charset='UTF-8'> ?

<!-- gh-comment-id:453554652 --> @tablatronix commented on GitHub (Jan 11, 2019): hmm interesting, I guess some browsers automatically handle the enctype or maybe you dont have the newest branch updates with the `<meta charset='UTF-8'>` ?
Author
Owner

@acidobinario commented on GitHub (Mar 5, 2019):

seems like a base64 conversion of the password (maybe with js? ) would help (but you'll have to decode it just before this lines:

void WiFiManager::handleWifiSave() {
  DEBUG_WM(F("WiFi save"));

  //SAVE/connect here
  _ssid = server->arg("s").c_str();
  _pass = server->arg("p").c_str();
...

)

<!-- gh-comment-id:469853116 --> @acidobinario commented on GitHub (Mar 5, 2019): seems like a base64 conversion of the password (maybe with js? ) would help (but you'll have to decode it just before this lines: ``` void WiFiManager::handleWifiSave() { DEBUG_WM(F("WiFi save")); //SAVE/connect here _ssid = server->arg("s").c_str(); _pass = server->arg("p").c_str(); ... ``` )
Author
Owner

@amites commented on GitHub (Mar 22, 2019):

tried added encoding -- still failing for me

about to tie in the base64 encode/decode -- my current guess is that the strings are being url encoded and not url decoded before being implemented though I've yet to really crawl through to verify that...

<!-- gh-comment-id:475789114 --> @amites commented on GitHub (Mar 22, 2019): tried added encoding -- still failing for me about to tie in the base64 encode/decode -- my current guess is that the strings are being url encoded and not url decoded before being implemented though I've yet to really crawl through to verify that...
Author
Owner

@acidobinario commented on GitHub (Mar 23, 2019):

@amites where's the code that you've used? i'll like to see it.

<!-- gh-comment-id:475865921 --> @acidobinario commented on GitHub (Mar 23, 2019): @amites where's the code that you've used? i'll like to see it.
Author
Owner

@tablatronix commented on GitHub (Mar 23, 2019):

your still having issues with this?

I added debugging, what do you logs say ?

<!-- gh-comment-id:475868178 --> @tablatronix commented on GitHub (Mar 23, 2019): your still having issues with this? I added debugging, what do you logs say ?
Author
Owner

@amites commented on GitHub (Mar 23, 2019):

I forked the repo at https://github.com/amites/WiFiManager/tree/cmidgley
the last 4 commits are me tweaking the form output

All I committed so far was added enc-type coding to the different forms, and monitored the serial output
it seems to freeze when trying to connect until about 10 minutes of trying at which point it seems to memory dump and reset itself trying to autoconnect with the previously saved creds

I'm pretty green to C++ so wasn't sure how to add the base64 decode referred to in the above issue
link -- have code ready to push that adds base64 encoding to the form before submitting that I'd be happy to share

I can see that special characters are URL encoded as part of the GET request and I suspect they aren't being decoded before being used as credentials to login to wifi

<!-- gh-comment-id:475878339 --> @amites commented on GitHub (Mar 23, 2019): I forked the repo at https://github.com/amites/WiFiManager/tree/cmidgley the last 4 commits are me tweaking the form output All I committed so far was added enc-type coding to the different forms, and monitored the serial output it seems to freeze when trying to connect until about 10 minutes of trying at which point it seems to memory dump and reset itself trying to autoconnect with the previously saved creds I'm pretty green to C++ so wasn't sure how to add the base64 decode referred to in the above issue link -- have code ready to push that adds base64 encoding to the form before submitting that I'd be happy to share I can see that special characters are URL encoded as part of the `GET` request and I suspect they aren't being decoded before being used as credentials to login to wifi
Author
Owner

@tablatronix commented on GitHub (Mar 23, 2019):

I posted above that I could not reproduce so it must be a browser dependant issue. I also added debugging to clearly show what was received.

Not sure what else can be done, charaet encoding should work on all browsers

<!-- gh-comment-id:475908991 --> @tablatronix commented on GitHub (Mar 23, 2019): I posted above that I could not reproduce so it must be a browser dependant issue. I also added debugging to clearly show what was received. Not sure what else can be done, charaet encoding should work on all browsers
Author
Owner

@tablatronix commented on GitHub (Mar 23, 2019):

Ok are you not using development , this issue is for development and fixes are applied there only atm

<!-- gh-comment-id:475909273 --> @tablatronix commented on GitHub (Mar 23, 2019): Ok are you not using development , this issue is for development and fixes are applied there only atm
Author
Owner

@tablatronix commented on GitHub (May 11, 2020):

I will close this if it is not reproducible. let me know if it needs to be tested more.

<!-- gh-comment-id:626852244 --> @tablatronix commented on GitHub (May 11, 2020): I will close this if it is not reproducible. let me know if it needs to be tested more.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/WiFiManager#671
No description provided.