python-broadlink icon indicating copy to clipboard operation
python-broadlink copied to clipboard

No encryption during provisioning?

Open Lull3n opened this issue 3 years ago • 15 comments

Was looking to implement the provisioning directly on android, and had a look at the setup method. Am i misunderstanding something here or are my wifi creds sent in unicode over open wifi?

Edit: typo

Lull3n avatar Jan 18 '22 22:01 Lull3n

It's not open Wi-Fi, you need to connect to the Wi-Fi network that your Broadlink device generates in AP setup mode.

felipediel avatar Jan 23 '22 21:01 felipediel

Hmm, might be that I've misunderstood wifi principles here, but aren't WiFi's with no password unencrypted?

Lull3n avatar Jan 25 '22 15:01 Lull3n

It is a private network to which you only connect a single time with a single device. It's not like broadcasting your credentials on your main network, that's what I mean.

felipediel avatar Jan 25 '22 15:01 felipediel

I feel I'm probably misunderstanding here? What I mean is if the wifi is not protected, it's not encrypted? And if there is no application layer encryption anyone sniffing the radio will then be able to read my wifi creds? I had a look at the JS in the "wifi login page" generated by my bulb, and it applies what appears to (to my untrained JS eyes) application layer encryption, which seems to support my suspections somewhat.

Lull3n avatar Jan 25 '22 16:01 Lull3n

It uses WPS, the communication is encrypted.

felipediel avatar Jan 25 '22 17:01 felipediel

I fear my broadlink "Smart Bulb" doesent. There are no buttons on the bulb, no PIN requests, and netsh reports: Network type : Infrastructure Radio type : 802.11n Authentication : Open Cipher : None

Lull3n avatar Jan 25 '22 18:01 Lull3n

Sometimes it's not a button, but a specific way you turn the power on and off to put it in AP setup mode. I don't have the bulb, I don't know how it works exactly, but the configuration is probably similar to the other devices with Broadlink DNA.

felipediel avatar Jan 25 '22 19:01 felipediel

Fair, i guess if there is WPS the device should only accept one concurrent connection? Otherwise the whole point of encrypting the data would be lost as anyone could just obtain the keys. I can connect multiple devices to the AP at the same time, and anyways as stated windows reports the connection as unencrypted. So, im getting fairly confident that the wifi creds are actually being broadcast unencrypted. Seing as broadlink has mitigated this with application level encryption i think you should look in to this, or at the very least disable the setup method for connections that have no encryption. I can take a swing at sniffing the packets if you need me to, and i can upload the JS encryption functions used by broadlink if you want to, but im afraid i can't make any PR's as my python is horrible.

Lull3n avatar Jan 25 '22 19:01 Lull3n

When we connect via WPS, the Broadlink device restricts the connection to the client and the Wi-Fi configuration is done with encryption. WPS is like connecting with passwords, but we press a button to grant permission to the first device that connects.

felipediel avatar Mar 19 '22 15:03 felipediel

I'm well aware what wps is, as stated there is no WPS in my lb2 (can get you the hex code if you want) the encryption is instead done in the application layer using a rabbit cipher that's run in JS on the the phone/tablet used for provisioning. As I've also already stated windows also reports the connection as unencrypted hence any credentials sent on the network without adding application layer encryption are subject to sniffing, and the only security granted here is by obscurity.

Lull3n avatar Mar 19 '22 17:03 Lull3n

Really cool project, and super greatful for all the work ofc, but you should at least inform your users that the credentials are sent in cleartext instead of just saying there's WPS (which there at least isn't on my device) and closing the issue.

Lull3n avatar Mar 19 '22 17:03 Lull3n

Okay, sorry, I'm short on time for the project so I end up having to make choices. I'll leave it open a little longer in case anyone wants to improve this with a PR. Thanks for reporting.

felipediel avatar Mar 19 '22 18:03 felipediel

If you could paste that Js here, it would be of great help.

felipediel avatar Mar 19 '22 20:03 felipediel

Thank you!

felipediel avatar Mar 21 '22 18:03 felipediel

I deleted the JS, as i realized there might be some stuff in it pointing to my device. Also I would like to apologize for my tone in the previous communications.

Lull3n avatar Jun 12 '24 15:06 Lull3n