Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Feature Requests
  3. Better security without the need of a cryptoprocessor: out-of-band authentication

Better security without the need of a cryptoprocessor: out-of-band authentication

Scheduled Pinned Locked Moved Feature Requests
54 Posts 5 Posters 11.1k Views 7 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Sergio RiusS Sergio Rius

    @Anticimex I didn't mean it to be in the controller. I just talked about a key generator (and perhaps storage) node, that could be on the network and recognized by the gateway or/and the repeaters.
    That should be a way of only implementing one time the most expensive components and decoupling for compatibility.

    Of course all of this are ideas and all need time to studying.

    AnticimexA Offline
    AnticimexA Offline
    Anticimex
    Contest Winner
    wrote on last edited by Anticimex
    #14

    @Sergio-Rius Oh, I just read your "selectively implemented by controllers" and thought that it should be up to the controller to use that.
    Well, a dedicated key storage node is a thought, although as things are with and without security currently, the use of atmega328p based GW:s is coming to an end.
    So we should not base future security functionality on basis that the GW is performance limited.
    Me and @d00616 have been discussing a scheme where the GW generates a root key and distribute node specific keys. But there are many aspects to cover still, one such is handling of repeater nodes, and we are also constrained in time for how much time and effort we can spend on this at the moment. There is already a security scheme in place and although it is not perfect, it is adequate from a security point of view.
    And personally, I currently simply don't have the time to spare to design and implement something newer right now. Suggestions and PR:s are always welcome. That's how I started out, others are welcome to do the same ;)
    Although since then I have been elevated to some form of security responsible, so I will for that sake, place some pointers to what a new security scheme need to cover:

    • Authentication
    • Obfuscation
    • Handle node-jumping (repeater nodes)
    • Support resource limited nodes (not necessarily GW:s)
    • Not transmit sensitive data OTA
    • Be simple to use
    • Be well documented
    • Either support key protection or simple key revocation (preferably on a per-node basis)

    That's all I can think of right now :)

    Do you feel secure today? No? Start requiring some signatures and feel better tomorrow ;)

    d00616D 1 Reply Last reply
    2
    • AnticimexA Anticimex

      @Sergio-Rius Oh, I just read your "selectively implemented by controllers" and thought that it should be up to the controller to use that.
      Well, a dedicated key storage node is a thought, although as things are with and without security currently, the use of atmega328p based GW:s is coming to an end.
      So we should not base future security functionality on basis that the GW is performance limited.
      Me and @d00616 have been discussing a scheme where the GW generates a root key and distribute node specific keys. But there are many aspects to cover still, one such is handling of repeater nodes, and we are also constrained in time for how much time and effort we can spend on this at the moment. There is already a security scheme in place and although it is not perfect, it is adequate from a security point of view.
      And personally, I currently simply don't have the time to spare to design and implement something newer right now. Suggestions and PR:s are always welcome. That's how I started out, others are welcome to do the same ;)
      Although since then I have been elevated to some form of security responsible, so I will for that sake, place some pointers to what a new security scheme need to cover:

      • Authentication
      • Obfuscation
      • Handle node-jumping (repeater nodes)
      • Support resource limited nodes (not necessarily GW:s)
      • Not transmit sensitive data OTA
      • Be simple to use
      • Be well documented
      • Either support key protection or simple key revocation (preferably on a per-node basis)

      That's all I can think of right now :)

      d00616D Offline
      d00616D Offline
      d00616
      Contest Winner
      wrote on last edited by
      #15

      @Anticimex said in Better security without the need of a cryptoprocessor: out-of-band authentication:

      That's all I can think of right now

      That's most complete.

      Looking at the most modern MCU's (nRF51, nRF52, CC1350, EFR32BG13P733) with integrated radio mostly AES-CCM is available as hardware component. With AES-CCM encryption and authentication is available. AES-CCM is part of the BLE specification. I think this type of MCU's are the future and the time of 8 Bit MCUs with external radio modules are mostly over. The nRF5 MCU's are compatible with MySensors starting with release 2.2.

      In my personal opinion AES-CCM is a good choice for battery powered nodes, but I think it's no problem to accept other security schemes.

      AnticimexA 1 Reply Last reply
      1
      • d00616D d00616

        @Anticimex said in Better security without the need of a cryptoprocessor: out-of-band authentication:

        That's all I can think of right now

        That's most complete.

        Looking at the most modern MCU's (nRF51, nRF52, CC1350, EFR32BG13P733) with integrated radio mostly AES-CCM is available as hardware component. With AES-CCM encryption and authentication is available. AES-CCM is part of the BLE specification. I think this type of MCU's are the future and the time of 8 Bit MCUs with external radio modules are mostly over. The nRF5 MCU's are compatible with MySensors starting with release 2.2.

        In my personal opinion AES-CCM is a good choice for battery powered nodes, but I think it's no problem to accept other security schemes.

        AnticimexA Offline
        AnticimexA Offline
        Anticimex
        Contest Winner
        wrote on last edited by
        #16

        @d00616 I agree. It is good to base any scheme of something that at least some HW can provide already. As such, I don't think the actual algorithms is the key issue though. It is the routing I mostly worry about. If we do full encryption and expect the mesh network to be working, key needs to be shared at least with the repeaters and the endpoint.
        But it could be that we settle for leaving the message header unencrypted, but then we need to also handle padding of the payload (algorithm specific). Not a huge issue but something to consider.
        Also, the payload sizes do have an effect on how to do this. But there are huge changes planned for version 3 of the library when it comes to protocol and payloads, so we also need to decide if the security layer sits close to the transport (RF specific) or higher up in the stack.
        I for one, feel that what we primarily want to protect is the payload. But perhaps also certain parts of the header (like sensor type, etc). We should probably align this with other core team members looking into protocol changes, so that we separate routing parts in the header from "semi-payload" data (sensor type, etc).

        Do you feel secure today? No? Start requiring some signatures and feel better tomorrow ;)

        Sergio RiusS 1 Reply Last reply
        0
        • AnticimexA Anticimex

          @d00616 I agree. It is good to base any scheme of something that at least some HW can provide already. As such, I don't think the actual algorithms is the key issue though. It is the routing I mostly worry about. If we do full encryption and expect the mesh network to be working, key needs to be shared at least with the repeaters and the endpoint.
          But it could be that we settle for leaving the message header unencrypted, but then we need to also handle padding of the payload (algorithm specific). Not a huge issue but something to consider.
          Also, the payload sizes do have an effect on how to do this. But there are huge changes planned for version 3 of the library when it comes to protocol and payloads, so we also need to decide if the security layer sits close to the transport (RF specific) or higher up in the stack.
          I for one, feel that what we primarily want to protect is the payload. But perhaps also certain parts of the header (like sensor type, etc). We should probably align this with other core team members looking into protocol changes, so that we separate routing parts in the header from "semi-payload" data (sensor type, etc).

          Sergio RiusS Offline
          Sergio RiusS Offline
          Sergio Rius
          wrote on last edited by
          #17

          @Anticimex With that scheme, what happens when the GW fails?
          Once keys are generated should they be saved on nodes and locked like now?
          Could it be possible for a malicious user to hang the GW and supplant it, or take control of a far part of the network?

          I really like the idea of those new platforms. But I wonder what problems would arise if they're tired to an specific radio. I almost can't use the 2.4ghz band, for example.

          AnticimexA 2 Replies Last reply
          0
          • Sergio RiusS Sergio Rius

            @Anticimex With that scheme, what happens when the GW fails?
            Once keys are generated should they be saved on nodes and locked like now?
            Could it be possible for a malicious user to hang the GW and supplant it, or take control of a far part of the network?

            I really like the idea of those new platforms. But I wonder what problems would arise if they're tired to an specific radio. I almost can't use the 2.4ghz band, for example.

            AnticimexA Offline
            AnticimexA Offline
            Anticimex
            Contest Winner
            wrote on last edited by
            #18

            @Sergio-Rius if the GW fails your hub is out and your controller isolated from the sensor network.
            If you have a different use case, just present a proposal and ideally a PR. Just leave the controller out of the equation.
            What would be different in this situation from your key storage node failing?

            Do you feel secure today? No? Start requiring some signatures and feel better tomorrow ;)

            1 Reply Last reply
            0
            • Sergio RiusS Sergio Rius

              @Anticimex With that scheme, what happens when the GW fails?
              Once keys are generated should they be saved on nodes and locked like now?
              Could it be possible for a malicious user to hang the GW and supplant it, or take control of a far part of the network?

              I really like the idea of those new platforms. But I wonder what problems would arise if they're tired to an specific radio. I almost can't use the 2.4ghz band, for example.

              AnticimexA Offline
              AnticimexA Offline
              Anticimex
              Contest Winner
              wrote on last edited by
              #19

              @Sergio-Rius regarding tied to a specific radio, I don't think I have ever suggested such a thing?
              When it talk transport, it is still in the library context. Not the physical layer which I consider the radio to be.

              Do you feel secure today? No? Start requiring some signatures and feel better tomorrow ;)

              1 Reply Last reply
              0
              • Sergio RiusS Offline
                Sergio RiusS Offline
                Sergio Rius
                wrote on last edited by Sergio Rius
                #20

                I was only presenting possible situations for discussing.
                I'm analyst (processes, reliability and security). Perhaps I'm too anal with my profession. Also I'm not too good expressing myself in English.
                I'm so sorry if I'm a hassle.
                I'm on holidays, I should better come back to work ;)

                AnticimexA 1 Reply Last reply
                0
                • Sergio RiusS Sergio Rius

                  I was only presenting possible situations for discussing.
                  I'm analyst (processes, reliability and security). Perhaps I'm too anal with my profession. Also I'm not too good expressing myself in English.
                  I'm so sorry if I'm a hassle.
                  I'm on holidays, I should better come back to work ;)

                  AnticimexA Offline
                  AnticimexA Offline
                  Anticimex
                  Contest Winner
                  wrote on last edited by
                  #21

                  @Sergio-Rius you are not a hassle. And I am sure as a analyst you appreciate challenging and be challenged :)
                  I suggest if we should be a bit mot concrete, that you if you would like, describe your proposal or thoughts in the context of the bullet list I presented above.
                  For sure those bullets can all be addressed on various ways, but any security solution should adresse them all (and no, the proposal does not have to be fully documented from the start :))

                  Do you feel secure today? No? Start requiring some signatures and feel better tomorrow ;)

                  E 1 Reply Last reply
                  0
                  • AnticimexA Anticimex

                    @Eurbaix regarding asymmetric encryption, do you have something special in mind?
                    And I also have a few questions on your original proposal;

                    GW generate random PSK for every new node? How? What prevents the GW from accepting "rogue" nodes and adding them? Inclusion mode?

                    After the node has authenticated with the GW and received a communication token, is it not possible for a different node to use that token (since the PSK can be assumed to be known as it is distributed OTA from the GW, right?) during the time window he token is valid?

                    Your proposal is interesting but let's discuss it some more :)

                    Edit: I also find the term PSK a bit misleading if the GW calculate and distribute them (or I misunderstood you). PSK suggests it is pre-shared and hence not distributed OTA (and therefore not subject to eavesdropping).

                    E Offline
                    E Offline
                    Eurbaix
                    wrote on last edited by
                    #22

                    @Anticimex There are, in fact, three different keys in my proposal:

                    • A initialization PSK which should be stored in EEPROM, not the firmware, so it can be erased after the sensor registration. This PSK is common to all new sensors but only used once.
                    • A sensor PSK, which is sent over the air during the registration, encrypted with the initialization PSK.
                    • The sensor PSK is used to encrypt the token request and answer so another sensor cannot "read" the token since it doesn't have the same sensor PSK.
                    • The token is then used as an authentication and encryption key during the rest of the communication.

                    So here's a few more details about how it would work:

                    • When firmware is initially loaded on a new sensor, the initialization PSK is also loaded in the sensor EEPROM.
                    • The GW needs a "WPS" button (as modern routers have)
                    • Just before powering-up a sensor for the first time, press the GW's "WPS" button, the sensor will accept a connection with the initialization PSK for a few seconds (10-15s) and, along the normal sensor "registration", also send a new key to the sensor. The sensor will then erase the original PSK and replace it with this "sensor PSK", which is specific to this sensor. Since this original PSK is only used during the initial registration then deleted, it will only exist in the sensor memory while the sensor is in a secure location. In case this PSK is compromised, you only need to create a new key in the gateway, that will then be used when you load new sensors.
                    • This sensor PSK is then used to encrypt the token request since the GW knows each sensor key. The token is sent encrypted with this sensor PSK so another sensor cannot "read" this token. If the token is requested for a sensor-to-sensor communication, the GW will also send the token to the second sensor, encrypted with the second sensor PSK.
                    • For the rest of the communication (sensor to sensor, or sensor to GW), this token becomes the encryption key and authentication key.

                    This way, a common PSK is only used during the initialization and can only be used for initialization. This PSK is not accepted for regular communication with the GW (or other sensors). Also, a rogue sensor who have this initialization PSK can only request a "sensor PSK" when the WPS button is pressed. The chance of a rogue sensor sending a initialization request just after the WPS button has been pressed is minimal (except if you routinely initialized dozens of sensors everyday). If fact, the chances are low enough that the initialization PSK is even optional, in my opinion. After all, router use WPS without initialization PSK and this approach is considered reasonnably secure.

                    Last, if a "sensor PSK" is compromised, you only have to erase this entry in the sensor PSK table on the GW and the rest of your sensor network will be secure. If we are not using a cryptoprocessor to store the sensor PSK, the risk of the sensor PSK to be read in a stolen sensor exist, but the fact that sensor PSK are individuals make this risk easier to mitigate (as long as you notice that a sensor has been stolen of course).

                    AnticimexA Sergio RiusS 2 Replies Last reply
                    0
                    • E Eurbaix

                      @Anticimex There are, in fact, three different keys in my proposal:

                      • A initialization PSK which should be stored in EEPROM, not the firmware, so it can be erased after the sensor registration. This PSK is common to all new sensors but only used once.
                      • A sensor PSK, which is sent over the air during the registration, encrypted with the initialization PSK.
                      • The sensor PSK is used to encrypt the token request and answer so another sensor cannot "read" the token since it doesn't have the same sensor PSK.
                      • The token is then used as an authentication and encryption key during the rest of the communication.

                      So here's a few more details about how it would work:

                      • When firmware is initially loaded on a new sensor, the initialization PSK is also loaded in the sensor EEPROM.
                      • The GW needs a "WPS" button (as modern routers have)
                      • Just before powering-up a sensor for the first time, press the GW's "WPS" button, the sensor will accept a connection with the initialization PSK for a few seconds (10-15s) and, along the normal sensor "registration", also send a new key to the sensor. The sensor will then erase the original PSK and replace it with this "sensor PSK", which is specific to this sensor. Since this original PSK is only used during the initial registration then deleted, it will only exist in the sensor memory while the sensor is in a secure location. In case this PSK is compromised, you only need to create a new key in the gateway, that will then be used when you load new sensors.
                      • This sensor PSK is then used to encrypt the token request since the GW knows each sensor key. The token is sent encrypted with this sensor PSK so another sensor cannot "read" this token. If the token is requested for a sensor-to-sensor communication, the GW will also send the token to the second sensor, encrypted with the second sensor PSK.
                      • For the rest of the communication (sensor to sensor, or sensor to GW), this token becomes the encryption key and authentication key.

                      This way, a common PSK is only used during the initialization and can only be used for initialization. This PSK is not accepted for regular communication with the GW (or other sensors). Also, a rogue sensor who have this initialization PSK can only request a "sensor PSK" when the WPS button is pressed. The chance of a rogue sensor sending a initialization request just after the WPS button has been pressed is minimal (except if you routinely initialized dozens of sensors everyday). If fact, the chances are low enough that the initialization PSK is even optional, in my opinion. After all, router use WPS without initialization PSK and this approach is considered reasonnably secure.

                      Last, if a "sensor PSK" is compromised, you only have to erase this entry in the sensor PSK table on the GW and the rest of your sensor network will be secure. If we are not using a cryptoprocessor to store the sensor PSK, the risk of the sensor PSK to be read in a stolen sensor exist, but the fact that sensor PSK are individuals make this risk easier to mitigate (as long as you notice that a sensor has been stolen of course).

                      AnticimexA Offline
                      AnticimexA Offline
                      Anticimex
                      Contest Winner
                      wrote on last edited by
                      #23

                      @Eurbaix sounds good. Just a few comments.

                      • WPS is considered broken (but I have not read up on the details, I am not sure it is due to the theory of operation as you outlined)
                      • if all communications are encrypted, is it the full payload or partial? Which algorithm do you suggest? Currently, we are limited to a full payload length of 32 bytes. Some bytes of these are for routing info so that repeater nodes can relay the message. I suppose these repeaters will be unable to decrypt messages not ment for them so at least the routing bytes need to be sent in plain text. And the algorithm block size might then be an issue given the current limitations of the payload size.

                      All in all I think the suggestion is sound and much in line with what we have already been theorizing around in the core team.

                      Do you feel secure today? No? Start requiring some signatures and feel better tomorrow ;)

                      1 Reply Last reply
                      0
                      • AnticimexA Anticimex

                        @Sergio-Rius you are not a hassle. And I am sure as a analyst you appreciate challenging and be challenged :)
                        I suggest if we should be a bit mot concrete, that you if you would like, describe your proposal or thoughts in the context of the bullet list I presented above.
                        For sure those bullets can all be addressed on various ways, but any security solution should adresse them all (and no, the proposal does not have to be fully documented from the start :))

                        E Offline
                        E Offline
                        Eurbaix
                        wrote on last edited by
                        #24

                        @Anticimex A few additional points to address the rest of the conversation:

                        • Since we are in a mesh network, I believe encrypting the routing information is not really an option as it would mean decrypting and reencrypting at each hop. Beside, if not using a common PSK, managing key exchange would become a nightmare. So, the security would only be end-to-end, with the intermediate node seeing the routing information (sensor IDs) but not the payload (sensor type and data).
                        • I agree that security should be handled entirely by the gateway and sensors, as it is the only nodes we fully control the firmware. Involving any external component like the controller would be this a nightmare to maintain since we do not have full control on the firmware evolution of anything outside the GW and sensors.
                        • Although new sensors will probably not be based on 8bits Atmegas, there are plenty of existing sensors that use 8bits Atmegas so I believe we should aim to implement a fully software solution, light enough to run on an 8bit Atmega. In my proposal, the only modification required would be to add a button on the gateway so it can still be easily implemented in an existing network. HW support (encryption or key generation) would be optional but I would keep the option to simply generate a key from an floating analog input.
                        • As for the encryption, I would simply choose one that is supported by most hardware platforms but light enough to be able to implement software encryption in existing 8bits sensors, although I'm not sure there is still enough flash available to add software encryption on legacy sensors.

                        Also note that my proposal does not aim at absolute perfect security, simply something that would allow to easily revoke a node so we don't need a cryptoprocessor to store authentication/encryption keys.

                        AnticimexA 1 Reply Last reply
                        0
                        • E Eurbaix

                          @Anticimex A few additional points to address the rest of the conversation:

                          • Since we are in a mesh network, I believe encrypting the routing information is not really an option as it would mean decrypting and reencrypting at each hop. Beside, if not using a common PSK, managing key exchange would become a nightmare. So, the security would only be end-to-end, with the intermediate node seeing the routing information (sensor IDs) but not the payload (sensor type and data).
                          • I agree that security should be handled entirely by the gateway and sensors, as it is the only nodes we fully control the firmware. Involving any external component like the controller would be this a nightmare to maintain since we do not have full control on the firmware evolution of anything outside the GW and sensors.
                          • Although new sensors will probably not be based on 8bits Atmegas, there are plenty of existing sensors that use 8bits Atmegas so I believe we should aim to implement a fully software solution, light enough to run on an 8bit Atmega. In my proposal, the only modification required would be to add a button on the gateway so it can still be easily implemented in an existing network. HW support (encryption or key generation) would be optional but I would keep the option to simply generate a key from an floating analog input.
                          • As for the encryption, I would simply choose one that is supported by most hardware platforms but light enough to be able to implement software encryption in existing 8bits sensors, although I'm not sure there is still enough flash available to add software encryption on legacy sensors.

                          Also note that my proposal does not aim at absolute perfect security, simply something that would allow to easily revoke a node so we don't need a cryptoprocessor to store authentication/encryption keys.

                          AnticimexA Offline
                          AnticimexA Offline
                          Anticimex
                          Contest Winner
                          wrote on last edited by
                          #25

                          @Eurbaix your proposal is in my opinion fully adequate from a security point of view.
                          As for encryption on "legacy" hardware we already have a sw AES crypto driver (although weak).
                          The button on the GW actually already exist for "inclusion mode". And we also already have a software equivalent that is triggered from the controller for those who don't have or don't want a button on the GW.
                          A lightweight security personalizer should be enough to store the initial PSK in the nodes. For those who have used the current signing solution, that should not be a deterrent. Some new users might be annoyed by it but I don't see a good alternative. Sending it OTA is a big nono. And having it as an optional FW defined static is bad practice in case the FW leaks (even though we have inclusion mode).
                          If you want we can set up some shared document to flesh out the implementation details for this?
                          @d00616 do you have any additional input?

                          Do you feel secure today? No? Start requiring some signatures and feel better tomorrow ;)

                          E 1 Reply Last reply
                          0
                          • AnticimexA Anticimex

                            @Eurbaix your proposal is in my opinion fully adequate from a security point of view.
                            As for encryption on "legacy" hardware we already have a sw AES crypto driver (although weak).
                            The button on the GW actually already exist for "inclusion mode". And we also already have a software equivalent that is triggered from the controller for those who don't have or don't want a button on the GW.
                            A lightweight security personalizer should be enough to store the initial PSK in the nodes. For those who have used the current signing solution, that should not be a deterrent. Some new users might be annoyed by it but I don't see a good alternative. Sending it OTA is a big nono. And having it as an optional FW defined static is bad practice in case the FW leaks (even though we have inclusion mode).
                            If you want we can set up some shared document to flesh out the implementation details for this?
                            @d00616 do you have any additional input?

                            E Offline
                            E Offline
                            Eurbaix
                            wrote on last edited by
                            #26

                            @Anticimex I believe the difficulty is not in making "out-of-band" secure, as it has been used and reviewed many times from a security point of view. My concern was more: can we keep it simple enough so it could be deployed on existing 8 bit platforms.

                            As for OTA, the initialization I proposed never send a clear key OTA. The initialization PSK is written on the sensor when you flash it (so, wired comms) and not part of the firmware. I was thinking something along the line of:

                            • Flash and run a small firmware (which has the initialization PSK hardcoded) that will just store the initialization PSK in the EEPROM.
                            • Flash and run the full MySensor firmware (which doesn't have the PSK hardcoded), then run the initialization using the PSK in the EEPROM.
                              This way, the full MySensor firmware, that will be updated OTA, never have to include a PSK so it can be sent in clear. Also, since comms are now encrypted, OTA updates could be encrypted although I don't see a need to encrypt firmware updates since they do not contain sensitive information.

                            As for packet size limitation, that's one of the reason I went with short TTL tokens that also act as nounce. The tokens are sent in a separate packet from the gateway so there is no need to exchange nounce for the rest of the communication as long as the token TTL is short enough. I would guess 5 or 10 packets using the same token should not be enough for a brute force attack. This leaves the entire packet free for payload (minus routing information), the usable payload is in fact the same as in non-secured comms.

                            Last: Yes, a shared document would be a good idea so we don't have go through all the posts to remember what we already discussed. I have Google Docs and One Drive accounts, but can also register on another collaboration platform.

                            AnticimexA Sergio RiusS 2 Replies Last reply
                            0
                            • E Eurbaix

                              @Anticimex I believe the difficulty is not in making "out-of-band" secure, as it has been used and reviewed many times from a security point of view. My concern was more: can we keep it simple enough so it could be deployed on existing 8 bit platforms.

                              As for OTA, the initialization I proposed never send a clear key OTA. The initialization PSK is written on the sensor when you flash it (so, wired comms) and not part of the firmware. I was thinking something along the line of:

                              • Flash and run a small firmware (which has the initialization PSK hardcoded) that will just store the initialization PSK in the EEPROM.
                              • Flash and run the full MySensor firmware (which doesn't have the PSK hardcoded), then run the initialization using the PSK in the EEPROM.
                                This way, the full MySensor firmware, that will be updated OTA, never have to include a PSK so it can be sent in clear. Also, since comms are now encrypted, OTA updates could be encrypted although I don't see a need to encrypt firmware updates since they do not contain sensitive information.

                              As for packet size limitation, that's one of the reason I went with short TTL tokens that also act as nounce. The tokens are sent in a separate packet from the gateway so there is no need to exchange nounce for the rest of the communication as long as the token TTL is short enough. I would guess 5 or 10 packets using the same token should not be enough for a brute force attack. This leaves the entire packet free for payload (minus routing information), the usable payload is in fact the same as in non-secured comms.

                              Last: Yes, a shared document would be a good idea so we don't have go through all the posts to remember what we already discussed. I have Google Docs and One Drive accounts, but can also register on another collaboration platform.

                              AnticimexA Offline
                              AnticimexA Offline
                              Anticimex
                              Contest Winner
                              wrote on last edited by
                              #27

                              @Eurbaix I know. Hence my connection to the existing security personalizer which does the exact same thing.
                              The packet size concern is more about that certain crypto algorithms produce a ciphertext of a specific size, which had to fit in the message frame. So if parts of the buffer is in plain text, some limitation is put in the allowed size of the ciphertext (and the original plaintext which could produce a ciphertext spanning multiple crypto blocks which then would not fit the message buffer). But this is specific to the chosen algorithm.

                              I'll look into facilitating some document sharing later. A bit busy right now and out of computers reach.

                              Do you feel secure today? No? Start requiring some signatures and feel better tomorrow ;)

                              E 1 Reply Last reply
                              0
                              • AnticimexA Anticimex

                                @Eurbaix I know. Hence my connection to the existing security personalizer which does the exact same thing.
                                The packet size concern is more about that certain crypto algorithms produce a ciphertext of a specific size, which had to fit in the message frame. So if parts of the buffer is in plain text, some limitation is put in the allowed size of the ciphertext (and the original plaintext which could produce a ciphertext spanning multiple crypto blocks which then would not fit the message buffer). But this is specific to the chosen algorithm.

                                I'll look into facilitating some document sharing later. A bit busy right now and out of computers reach.

                                E Offline
                                E Offline
                                Eurbaix
                                wrote on last edited by
                                #28

                                @Anticimex You raise a good point regarding cyphertext size. I was thinking initially AES 128 would be a good choice but, if routing is in clear, the encrypted part of the packet is now reduced to 16 bytes. Something to look at... or may be 16 bytes is acceptable in the use case scenario of MySensors since not all information is necessarily sensitive.

                                Also, what are you referring to when you say "security personalizer"? I don't remember something with this name in the current security in MySensors?

                                P.S.: No rush for the document sharing. It will take a while anyway to come up with something that covers all the basics so a few days more or less won't make a real difference.

                                I

                                AnticimexA 1 Reply Last reply
                                0
                                • E Eurbaix

                                  @Anticimex You raise a good point regarding cyphertext size. I was thinking initially AES 128 would be a good choice but, if routing is in clear, the encrypted part of the packet is now reduced to 16 bytes. Something to look at... or may be 16 bytes is acceptable in the use case scenario of MySensors since not all information is necessarily sensitive.

                                  Also, what are you referring to when you say "security personalizer"? I don't remember something with this name in the current security in MySensors?

                                  P.S.: No rush for the document sharing. It will take a while anyway to come up with something that covers all the basics so a few days more or less won't make a real difference.

                                  I

                                  AnticimexA Offline
                                  AnticimexA Offline
                                  Anticimex
                                  Contest Winner
                                  wrote on last edited by
                                  #29

                                  @Eurbaix security personalization is the corner stone of the current signing solution :) you can't use it without personalization (except for the simplified security flag on the development branch).

                                  Do you feel secure today? No? Start requiring some signatures and feel better tomorrow ;)

                                  E 1 Reply Last reply
                                  0
                                  • AnticimexA Anticimex

                                    @Eurbaix security personalization is the corner stone of the current signing solution :) you can't use it without personalization (except for the simplified security flag on the development branch).

                                    E Offline
                                    E Offline
                                    Eurbaix
                                    wrote on last edited by
                                    #30

                                    @Anticimex Well, it seems I missed something important in the current signing implementation. I'll have a second look.

                                    1 Reply Last reply
                                    0
                                    • d00616D Offline
                                      d00616D Offline
                                      d00616
                                      Contest Winner
                                      wrote on last edited by
                                      #31

                                      I had similar ideas with two firmwares. One for initialization and one running MySensors.

                                      If asymetric encryption is used, there is no need for an PSK for encryption. A key is calculated on both sides this can be used as a node key. A library supporting 8 bit and 32 bit MCU is micro-ecc. The problem is, the key must be compared on both sides to detect man in the middle attacks. This could be by synchronous LED blinking the hash of the calculated key and accepting the key on the gateway. This allows to integrate sensors without the need of the SecurityPersonalizer.

                                      The 32 byte package size can be extended by an nRF24/ECB protocol extension. First packet is send without ACK and when a second packet is received the ACK payload reports if the first packet is received. Then we have 64 byte packages, compatible with classic hardware.

                                      I'm unsure if routing encrypted packages is a good idea. An attacker can force the relay to route invalid packages. On the other side the attacker can block the complete channel by sending invalid data.

                                      When the motivation of the new security scheme is to reduce the cost. There are nRF51822 boards starting at less than 2.50€ and nRF52832 boards for less than 4.50€.

                                      Compared the Arduino Pro Mini + nRF24 solution with the nRF51 you get ~100 times more performance without the 2k RAM limit and a lot of Flash for 0.50€ more costs. The nRF51 has an better range compared with the nrf24, allows to implement better radio protocols or switching to BLE (actually without MySensors) and it's possible to connect RFM modules. I think in six month the pricing is eqal.

                                      With an bootloader like mcuboot, which needs porting to MySensors the key can be protected by disallowing flashing unsigned firmware and disable debugging.

                                      I think we shouldn't do compromises to support 8 bit MCUs.

                                      E KoreshK 2 Replies Last reply
                                      0
                                      • E Eurbaix

                                        @Anticimex There are, in fact, three different keys in my proposal:

                                        • A initialization PSK which should be stored in EEPROM, not the firmware, so it can be erased after the sensor registration. This PSK is common to all new sensors but only used once.
                                        • A sensor PSK, which is sent over the air during the registration, encrypted with the initialization PSK.
                                        • The sensor PSK is used to encrypt the token request and answer so another sensor cannot "read" the token since it doesn't have the same sensor PSK.
                                        • The token is then used as an authentication and encryption key during the rest of the communication.

                                        So here's a few more details about how it would work:

                                        • When firmware is initially loaded on a new sensor, the initialization PSK is also loaded in the sensor EEPROM.
                                        • The GW needs a "WPS" button (as modern routers have)
                                        • Just before powering-up a sensor for the first time, press the GW's "WPS" button, the sensor will accept a connection with the initialization PSK for a few seconds (10-15s) and, along the normal sensor "registration", also send a new key to the sensor. The sensor will then erase the original PSK and replace it with this "sensor PSK", which is specific to this sensor. Since this original PSK is only used during the initial registration then deleted, it will only exist in the sensor memory while the sensor is in a secure location. In case this PSK is compromised, you only need to create a new key in the gateway, that will then be used when you load new sensors.
                                        • This sensor PSK is then used to encrypt the token request since the GW knows each sensor key. The token is sent encrypted with this sensor PSK so another sensor cannot "read" this token. If the token is requested for a sensor-to-sensor communication, the GW will also send the token to the second sensor, encrypted with the second sensor PSK.
                                        • For the rest of the communication (sensor to sensor, or sensor to GW), this token becomes the encryption key and authentication key.

                                        This way, a common PSK is only used during the initialization and can only be used for initialization. This PSK is not accepted for regular communication with the GW (or other sensors). Also, a rogue sensor who have this initialization PSK can only request a "sensor PSK" when the WPS button is pressed. The chance of a rogue sensor sending a initialization request just after the WPS button has been pressed is minimal (except if you routinely initialized dozens of sensors everyday). If fact, the chances are low enough that the initialization PSK is even optional, in my opinion. After all, router use WPS without initialization PSK and this approach is considered reasonnably secure.

                                        Last, if a "sensor PSK" is compromised, you only have to erase this entry in the sensor PSK table on the GW and the rest of your sensor network will be secure. If we are not using a cryptoprocessor to store the sensor PSK, the risk of the sensor PSK to be read in a stolen sensor exist, but the fact that sensor PSK are individuals make this risk easier to mitigate (as long as you notice that a sensor has been stolen of course).

                                        Sergio RiusS Offline
                                        Sergio RiusS Offline
                                        Sergio Rius
                                        wrote on last edited by
                                        #32

                                        @Eurbaix said in Better security without the need of a cryptoprocessor: out-of-band authentication:

                                        There are, in fact, three different keys in my proposal

                                        Here you're basically proposing a handshake system, but, what you talk about in the first section of points, are you referring to the GW or nodes?
                                        I don't see the need of this first key. Anything that identifies the sensor, like it's name would serve the same purpose. Or I understand it wrong?

                                        I think that if you have two networks/channels, as I have, sensors from the two networks would have different keys. Then if we wanted to add a new sensor to one of the networks, what prevents the GW1 to see a sensor from the second network (that may have connectivity issues, alias it may be asking for reconnection) as a new sensor?

                                        1 Reply Last reply
                                        0
                                        • d00616D Offline
                                          d00616D Offline
                                          d00616
                                          Contest Winner
                                          wrote on last edited by
                                          #33

                                          For an mixed network with classic hardware and new hardware we can work with two address ranges. This is possible for nRF networks.

                                          1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          14

                                          Online

                                          11.7k

                                          Users

                                          11.2k

                                          Topics

                                          113.1k

                                          Posts


                                          Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • MySensors
                                          • OpenHardware.io
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular