1. 16
  1.  

  2. 4

    Unless I’m missing something, that sounds like it would be a firmware recompile away to spoof this using a sub-$20 teensy dev board. Am I missing something stronger than product id/vendor id/serial at play here? I think in many cases, grabbing the serial number to spoof would be relatively easy to automate by swapping someone’s charger out for a device that looks like a charger but also probes phones that are connected to it.

    1. 2

      Its just an example, one could use phone or other USB device with lock app that would ask for simpler 4 digit PIN instead of full password for example. One could use USB with filesystem and execute a script that would look for a particular content in the file on that USB device … or even your private SSH key … its just a matter of choice.

      You have to choose what is enough (and if its worth it) to unlock your laptop/workstation faster.

      1. 2

        Right, but your suggestions will make it a lot more difficult to set up.

        1. 1

          Not that difficult.

          Lets assume that we will put our public SSH key (id_rsa.pub) on the USB drive.

          Then, when we detect that this is the USB drive that we use to unlock, we mount it with filesystem that is available there, can be UFS on FreeBSD or ext4 on Linux for example, if it does not mount, then no unlock happens.

          If it mounts, then make this command to compare our public SSH key (id_rsa.pub) against our private SSH key (id_rsa) available in home ~/.ssh directory.

          # diff <( ssh-keygen -y -f ~/.ssh/id_rsa ) id_rsa.pub
          

          If it matches, then unlock the screen.

          Removal should be the same, after device removal just lock the screen.

          1. 2

            Interesting idea but now you have only compared the keys. I can also copy those if I have access to the drive. So this only works with something like a dedicated thumb drive which you never plug in anywhere else.

            1. 2

              You can generate new pair of keys for this purpose.

              Besides … if someone already has the access to your drive and files then he does not need to ‘hack’ your phone or USB drive because he already has that access, or am I missing something? :)

              1. 3

                What I mean is when you connect this drive to some other computer that computer can just copy the private key. You’re not really doing any crypto operation you just have a data file that needs to remain secret.

                1. -1

                  You can have encrypted file on the USB pendrive and a key to decrypt it on the laptop.

                  You can also have thousands of files and use just one - the least suspected one - to be used for unlock.

                  You can have encrypted file on that pendrive and a key to decrypt it on the laptop - but this does not change the general idea - if someone will get/copy that file and generate the same serial number for the pendrive then he will unlock your screen.

                  Its like with Yubi Key USB - if someone will get your Yubi Key he will be able to unlock things you lock with it - a general ‘physical’ security problem.

                  Hope that helps.

                  1. 7

                    The thing about a Yubi Key is that if I plug it into a malicious computer, they can’t just copy it. It’s not a filesystem. The secrets it hold cannot be copied out of it. It’s a device that outputs something based on some input and you can cryptologically verify that the data has been through the Yubi Key.

                    1. 3

                      Well, a) that’s not true. I can copy the entire drive and that will always work. So I can make a copy without the physical device being gone and b) a Yubikey is usually only a second factor it does not replace the password.

                      If this meets your security requirements that’s fine but I would not sign off on it. ;)

                      1. 1

                        The ‘iswrong’ user just gave me a good idea - to copy one time keys to the USB pendrive for example.

                        I will think about it for a while :)

                      2. 3

                        Its like with Yubi Key USB - if someone will get your Yubi Key he will be able to unlock things you lock with it

                        Ssh keys stored on a yubikey are pin-protected and the yubikey will reset itself after multiple failed attempts to unlock it.

                        1. 1

                          No matter how good the encryption is, there is always this case where encryption quality does not matter at all :)

                          https://www.xkcd.com/538/

                          1. 2

                            Well, at least with a YubiKey, there is not point torturing anyone anymore once they have given N fake pins (whatever you have set N to on your YubiKey).

                            Which actually sounds like a nice possible feature for YubiKeys: a special ‘poison pill’ PIN that you can give to immediately exhaust the counter. Then no one could ever decrypt the data.

                            1. 2

                              Experimenting with onlykey that is an especially interesting feature it has. You can enter a PIN that just wipes it. I’m still kicking the tires and can’t issue any kind of general recommendation to use it. But I really like that feature for some reason even though it’s vanishingly unlikely that I’d ever need it.

                              1. 1

                                It’s nice that it has that feature! However, I would be very worried by the security of OnlyKey. They do weird things like getting entropy from floating analog inputs, but due to some programming bug they actually use this entropy as a pointer to get the actual value, which ends up taking values from the vector table:

                                https://news.ycombinator.com/item?id=21889302

                                And their developers believing that passing dieharder is a good test for a hardware RNG for crypto:

                                https://news.ycombinator.com/item?id=21885109

                                The whole HN discussion is pretty cringeworthy.

                                1. 1

                                  I saw that discussion. FWIW, on most similar devices, I prefer to generate my keys on a normal but offline system and import them ever since the primality testing SNAFUs in some evaluated modules about 15 years ago.

                                  But I’m still looking at this as a fun development gadget so far. I have requested an unlocked device to explore in some more detail what could be done with it.

            2. 2

              I think I’d want to add some way to check that my phone was unlocked before letting it unlock my workstation. Did you try to do that at all?

              1. 1

                No, I did not tried that … but I have an idea how to implement that - by using MTP mount request on this phone’s storage. If you unlock the phone and then say AGREE to allow phone’s storage mounting then after successful MTP mount the computer can be unlocked.

          2. 2

            I think if my options are between plugging in a cable and typing my password I would prefer the latter.

            It would be nice if there was a PAM module for some of the phone authenticator apps, though.

            It would also be interesting if this would work with position detection. Afaik none of the existing systems even prevent relay attacks but if it’s good enough for cars some people might consider it good enough for their computer.

            1. 2

              I did not disabled password authentication, I just added automatic screen unlock when I attach my phone so I still can login using just password.

              1. 1

                The oath toolkit has such a module. I’ve only ever used it on a Linux server before, not on any kind of desktop and not on any kind of BSD. It looks like it’s been packaged for NetBSD at least though.

                You’ll want to use TOTP for most of the authenticator apps.

                1. 2

                  I was thinking more along the lines of those apps asking you “is this you signing in”. Something with a simple Yes/No prompt. If the goal is to make something that is more convenient than a password…

                  1. 1

                    I forgot about those and was just thinking of the OTP gadgets.

                    It would seem straightforward to modify a PAM module like that one such that it posts a request to an API that triggers a push notification, then when you say “that’s really me” has your phone post back the OTP for you. Might even be fun. That way the same scratch codes would work easily and everything…

              2. 1

                probable lack of drivers for a laptop builtin smart card reader

                I suspect they’re mostly USB devices supported by pcscd/pcsc-lite/opensc/whatever-else-in-this-mess.

                1. 1

                  Nice and practical approach. Though you probably want more than the device serial for this to be secure (depending on your threat assessment).

                  Compare with Apple Watch -> Mac proximity unlock:

                  When enabling an Apple Watch to unlock a Mac, a secure link using Auto Unlock Identities is established. The Mac creates a random one-time-use unlock secret and transmits it to the Apple Watch over the link. The secret is stored on Apple Watch and can only be accessed when Apple Watch is unlocked. The unlock token is not the user’s password.

                  During an unlock operation, the Mac uses BLE to create a connection to the Apple Watch. A secure link is then established between the two devices using the shared keys used when it was first enabled. The Mac and Apple Watch then use peer-to-peer Wi-Fi and a secure key derived from the secure link to determine the distance between the two devices. If the devices are within range, the secure link is then used to transfer the preshared secret to unlock the Mac. After successful unlock, the Mac replaces the current unlock secret with a new one-time use unlock secret and transmits the new unlock secret to the Apple Watch over the link.*

                  https://support.apple.com/guide/security/apple-watch-usage-sec947c4b977/web

                  1. 1

                    Good idea, to copy one time keys to the USB pendrive for example :)

                    1. 3

                      You are missing the point that “The secret is stored on Apple Watch and can only be accessed when Apple Watch is unlocked.”

                      1. 1

                        Indeed, an I bet that the secret can only be decrypted using the secure element, which can only be used by unlocking the watch.

                        1. 1

                          No matter how good the encryption is, there is always this case where encryption quality does not matter at all :)

                          https://www.xkcd.com/538/

                          1. 1

                            Sure. If I am target of the NSA or whatever, encryption does not matter. That does not mean that one should not use a cryptographically secure setup as a default. There are many other attack vectors that this protects very well against, including laptop theft, or being arrested by police that does not use wrenches to get a password (which is the most likely way to get arrested in my country).

                            Edit: not that I currently use this method for unlocking my Mac. I like Touch ID much more, but it was great before I had a Touch ID-capable Mac.

                  2. 1

                    I really do not like the smart card ecosystem – probably because it will be a big PITA to setup such subsystem on FreeBSD to make it lock/unlock my laptop with a smart card – not to mention of it will be even possible because of probable lack of drivers for a laptop builtin smart card reader.

                    Get a gnuk token, which will definitely work on FreeBSD. You have a wide range of options, anything from a 30 Euro NitroKey Start to a $2 Blue Pill board from AliExpress. You can do some proper challenge-response authentication (e.g. let the key sign some randomly generated data). And even though gnuk tokens do not have a secure element, they are better protected against copying than a USB pen drive or phone serial number. And if the read protection bit is enabled, you cannot read the private key out of firmware using ST-Link.

                    As a bonus, you have a hardware key that you can use to sign/encrypt files, SSH auth, etc.

                    (I would strongly recommend a device with a secure element, but if YubiKeys are too expensive for your taste or you want the key to run open source software, gnuk is a good alternative.)

                    Another angle would be to use the secure element of your phone for authentication (somewhat similar to what Krypton does).