Can't connect to Wi-Fi due to unsupported character in SSID

Hi there, after refreshing my Pi3 emonBase to emonSD-24Jul20 and emoncms then updating to 10.6.9 via ethernet, I want to switch back to Wi-Fi. However, when I select my SSID and enter the password, I am getting an error referring to a neighbours SSID which appears in the list of 4 SSIDā€™s, even though I am not trying to use it:

EmonCMS Error

Message: Error: Syntax error, unrecognized expression: .psk[ssid=ā€˜Rhysā€™. Get offā€™]
Route: Lib/jquery-1.11.3.min.js
Line: 2
Column: 12748

I assume it is because the neighbours SSID has a single apostrophe in its name, as visible in this screenshot
image

This error is preventing me from selecting my own Wi-Fi SSID.

Apart from trying to shield the Pi so it cannot see the offending SSID long enough to get select my SSID, any other suggestions on dealing with this?

Thanks

Ian

This looks like one for @TrystanLea - if nothing else, Iā€™d be worried that it points to a weakness thatā€™s inviting a buffer overflow/cross-site scripting attack.

If you can get into the Pi via SSH, or you can take the SD card out and edit the file elsewhere, then this might help:

(where youā€™re adding to the wpa_supplicant.conf file).

I donā€™t know much about SSID syntax so I did some searches and it appears [1] that an SSID can contain an arbitrary value up to 32 octets long. It can also choose to restrict itself to a UTF-8 encoded value also limited to 32 octets. But a single quote would be legal in either case, so it sounds like the issue might be a bug in the software that reports the error?

If the software is jquery-1.11.3 then it seems that is rather old, so a first step might be updating to a [near] current version?

It does seem to me that a developer will be needed to fix the problem.

[1] Service set (802.11 network) - Wikipedia

That was exactly my thinking when I wrote

who is the developer. But it seems he hasnā€™t seen this yet.

This is a long standing ā€˜featureā€™ IIRC.

Your memory is better than mine :sob:

and

where it appears that @glyn.hudson is still working on a fix, if the final post is to be believed:

I can see whatā€™s causing this, we fixed one issue with special characters but obviously not this one. Looking at this now and testing here it looks like Iā€™m going to need to change the implementation of the WiFi interface quite a bit to get it to workā€¦ will update further soon.

Hi Robert, Thanks for this suggestion, it worked. I should have thought of this myself, so thanks for pointing me in the right direction.
Regards
Ian

1 Like

I raised this PR a while ago to fix an issue with unsupported characters in WiFi passwords: Use fwrite instead of exec to ensure single quotes can be handled in PSK by lachiemurray Ā· Pull Request #36 Ā· emoncms/wifi Ā· GitHub. Iā€™ve not tested but itā€™s possible it solves the problem for SSIDs as well

Hello @lachie sorry to miss your pull request on the WiFi module, it looks good, will test and merge assuming all goes well.

@TrystanLea no worries, thank you!