Shop OBEX P1 Docs P2 Docs Learn Events
Are there secure wifi methods? — Parallax Forums

Are there secure wifi methods?

T ChapT Chap Posts: 4,198
edited 2015-06-25 19:06 in Accessories
Is the Xbee wifi module able to be secure for remote control of appliances etc? I suppose everything is hackable these days, but I see remote control home automation including doors and lighting, so I am wondering if there is some method to remotely control a Propeller via wifi from a computer or iPhone app at any location that has internet access. I suppose the security has to be both local LAN/wifi and the network connection.

Comments

  • ElectrodudeElectrodude Posts: 1,621
    edited 2015-04-08 18:27
    I'm not sure if wifi with just wpa2 is secure, but you can add your own security fairly easily if you only care that your data is authentic and don't care if anyone steals it. First, you have to implement a cryptographic hash function like sha256 or whirlpool on the Propeller. This should be a matter of copy and paste if you're using C; I don't know if anyone's done it with Spin, but I'm sure it would be pretty easy to port it to spin. Then, each device has to have a shared secret - a number (at least 64 bits, if not way bigger) that only trusted devices have. Whenever something is sent, the data along with the secret are hashed together and the hash is sent along with the data. The recipient should calculate the hash itself and make sure it matches the one it received with the data. If they don't match, the message was compromised and should be ignored. If a hacker sends a modified message, he won't be able to come up with the correct hash because he doesn't have the secret. However, a hacker can still resend valid packets; including a timestamp with each message is probably enough to make this not a problem.

    If this secret is compromised, security is lost for the whole system. You could use an asymmetric system like RSA, keeping encryption keys private and decryption keys public, which would probably be more complicated but would mean that if one device's secret was compromised, only messages claiming to be from that device would become suspicious as opposed to all messages becoming suspect.

    I've been wanting to write a generic propeller telemetry system for a while now using these techniques, but then I realized how perfect a macro compiler would be for this and then I got bogged down by my compiler.

    EDIT: If you use RSA, you can guarantee secrecy as well as authenticity. You'll still suffer from repeatable messages, though, but, again, including a monotonically increasing message ID or timestamp should solve this.

    The XBee might know how to do all of this itself - this is probably what you want (and is probably what you're asking about). I know the normal non-wifi ones can do AES, although I've never used it.
  • xanaduxanadu Posts: 3,347
    edited 2015-04-08 18:46
    Secure on your WAN will be different than secure on your LAN. Security on your LAN would come in the form of WPAx encryption.

    Secure on the WAN means a VPN. A simple port forward on a router can get you in trouble even on an obscure port on a dynamic IP.

    So if you're looking for security over the internet, the best thing to do is put up a VPN. On the LAN (wifi) side, a strong password and WPA2 is tough to crack for most hackers.

    The iPhone can do L2TP, PPTP, and IPSec VPN, you'll just need an endpoint on the home network, such as a router with DD-WRT or a router that supports IPSEC using a non-static IP client. http://www.dd-wrt.com/site/index

    I use m0n0wall and IPSEC for everything over the web, 10 years no incidents... whew...
  • T ChapT Chap Posts: 4,198
    edited 2015-04-08 19:07
    Thanks for that great replies. This is an area I have been wanting to tackle on the Prop for a few years and I needed a good starting point. I have recently converted some C to Spin and it was not too much hassle, considering that it fit easily. I am assuming that if there were a need, you could send a command and a new secret that would be swapped out on the Prop. This way you are not stuck having to have the end user connect a computer to the Prop device to update the secret.
  • ElectrodudeElectrodude Posts: 1,621
    edited 2015-04-08 19:29
    But then how do you know the new secret is legitimate? What if a hacker sends a new secret that he knows to everyone?

    What if there are two secrets per device: one secret that's used that's shared between all devices, and another backup one that is unique to each device. All of the backup secrets are known by the master (a PC?). That way, if the master secret is compromised, a new master secret can be authenticated using the backup secrets. This still leaves the problem of how to encrypt the master key - XORing it with backup keys isn't good enough, because then discovering any one key would reveal all of them. This might not work - what if the compromised device claims to be not compromised and is sent the new secret by the master along with everyone else?
  • T ChapT Chap Posts: 4,198
    edited 2015-04-08 20:03
    To the point about updating the secrets remotely, what about not really updating the secrets remotely but rather switching from secret 1 to secret 2 remotely? This way, you load in maybe 5 secrets on the Prop device, and any of the 5 can be used and you select which is in use. Then if there is a concern that secret 1 has been compromised, you can toggle from secret 1 to any other of the stored secrets using a command. The point is, if you are not at the device you can still make some attempt to head off a hacking attempt.
  • xanaduxanadu Posts: 3,347
    edited 2015-04-08 20:44
    Plain text key exchange isn't secure, it doesn't matter what you do if the traffic is readable they will know everything they need to know and be able to spoof your clients. I doubt someone would invest the time into a man in the middle attack on something like this, but with all the automated scripts these days it's impossible to tell.

    The VPN will handle key exchange much better, as well as authentication and encryption.
  • T ChapT Chap Posts: 4,198
    edited 2015-04-09 05:48
    Thanks for the info guys. I have been reading up on the concepts posted. There is a lot to learn about this. I see a SHA256 in OBEX. Right now I don't need the ultimate security, just a starting point that can evolve over time. The first concept is an iPhone app that can be used anywhere to control devices in a house, as well as monitor sensors.


    http://obex.parallax.com/search/sha256
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2015-04-11 00:58
    If you really desire a full security suite for Wifi (not Bluetooth), you can hack small travel modems by installing OpenWRT Linux and have these connect with the Propeller's serial interface.

    We have already hacked the TP-LINK WR703 and MR3020 devices and Heater provided compiled binaries that allow for the compile and upload of Propeller binaries. So you have several powerful options.

    A. Serial Terminal control of a Propeller in Forth on the Propeller
    B. Serial Terminal control of a specific Propeller program written in any language available
    C. File transfer of Spin code to the mini-wifi modem to store, compile and load to the Propeller
    D. File transer of Propeller binaries to the mini-wifi modem to store and load to the Propeller

    The devices are relatively small - about 2.5 inches by 2.5 inches by 0.5 inches and low power from a USB power cable. Standby power is very minimal.

    These can be configured for three options.
    a. wifi only
    b. LAN only
    c. wifi and LAN

    And you have security as good as OpenWRT can provide in SSH.

    +++++++++
    Bluetooth is much simpler and easier to use, but security will never be as rugged as a Linux supported wifi solutions. The Linux supported solution requires more memory than a Propeller and Bluetooth can provide.

    From what little I know of XBee, it seems to be a branded Bluetooth solution.
  • Twinkling MelodyTwinkling Melody Banned Posts: 2
    edited 2015-06-25 19:06
    Hi, I just don't know if there are still secure methods for a wifi network connection. Hackers are around the globe and they can easily do something though how secure your wifi these days. But, you can at least do some precautionary measure, like setting it up the way that only people you choose can access it.

  • Hmm,  from reading briefly, Zigbee seems to still be secure.  At least didn't run across any posts in a quick google.  Assuming that is still true, your local LAN to Prop should be good.

    Now you remote device across internet to WAN/LAN, thats a real potential problem.
    To do this, I'm assuming you are going to  be running a webserver on the LAN/DMZ obviously.
    Since you will be logging into your webserver, is HTTPS not sufficiently secure?


Sign In or Register to comment.