HoloKat's avatar
HoloKat 1 year ago
Question: can nsec bunker custodian see your private keys? They store it to sign for you right? @PABLOF7z

Replies (52)

with the user's password right? cool. if someone wants to 'export' their private keys, or transfer them to another custodian, i'm assuming that's possible, right? (how's the security process for that like?).
HoloKat's avatar
HoloKat 1 year ago
I'm not making any statements, I just want to understand how it works.
HoloKat's avatar
HoloKat 1 year ago
Right, I get that, but if you (service provider) is able to see everyone's decrypted key, do we not agree that could be an issue?
I am not claiming that I know the code well en, so take my comments with a grain of salt. If signing is done at the client and key is never known to nsecbunker in its plain form, then only client has the access, if not, then server has the access. @PABLOF7z will be able to confirm one or the other way. 🐶🐾🫡
From the site: “Your nostr keys are stored encrypted with a passphrase you provide and must be decrypted by you before they can be used”
I don’t know but if the service has access to both (encrypted nsec and passphrase), then it is not hard to get a clear text nsec. It is clearly stored in mem since it’s in variable 🐶🐾🫡
Yes, it’s just not limited to the browser, i.e. you can put your key on any network attached device and have it sign remotely.
You have to trust the bunker But only the bunker (not every app you sign into) You can also run your own nsecbunker
Yup, it's true. Bunker has to be able to decrypt the key in order to sign with it. The user provides a password that is used to encrypt at rest but when the key is needed for signing the Bunker has to decrypt it (with the password you provide). The key is used and then re-encrypted. This is why it's important that the code for something like Nsecbunker is open and (ideally) it would be verifiable that a bunker service is running the exact same code so you know they haven't done anything fishy.
I think the major issue is that the service has access to both, the encrypted nsec and the key to decrypt it. Plus and service that is between the service and the client will have access to both, e.g., Cloudflare, TLS termination thingy. It’s just not a good approach to the storage of keys unless the organization hosts it in their own trusted infrastructure 🐶🐾🫡
i forget where i saw it implemented... maybe i even wrote an RPC recently that lets you do that unlock remotely so it never touches the disk... oh, no, it was my former sponsor... let me see... uses protobuf - you will see the proto and the generated pb.go code in there, that is an unlocker that stays off-disk a second best option is using an environment variable, you can protect that behind root privileges
This sounds super interesting. I’m not too familiar with go or gRPC but would love to understand the mechanics of this off disk unlock or remote signing. AFK right now but I’ll have a look later and might send a few questions.
How else could a remote signer sign on your behalf if the key is encrypted?
So, trust your bunker provider or run your own bunker. To me, this is a pretty easy model to understand. The bunker implementation can definitely be improved and become more paranoid but I think the trade-off for brand new users to get up and running super fast is worth it.
frphank's avatar
frphank 1 year ago
With certificates/"delegates" (nip-26) you can entrust the private key -- non-extractable -- to a hardware key store like Android Keystore, TPM, dunno what iShnitzels have. Everything else is nincompoop shenanigans.
Wut? End-to-end encryption; why would Cloudflare or any MITM have it? The nsec is encrypted at disk, user needs to talk to the bunker to provide pssphrase to decrypt it every time it reboots/forgets the nsec. Ofc there’s a trust element which is why open sourcing it is fundamental and reproducible builds and even better running in a secure enclave are ideal.
Because Cloudflare sees your traffic in clear, because they terminate your TLS connection. So are the other services or equipment that does that I think the point was that service that runs nsecbunker has access to the nsec as is, it doesn’t matter if it’s stored encrypted or not, it’s an easy fix to intercept the key if service wanted to. Enclave or HSM with the proper and standard encryption key exchange and zero exposure of unencrypted nsec or the key is the only way I see it being trustworthy. 🐶🐾🫡
over nostr, nip04 encrypted payloads it doesn't expose any direct APIs because the whole point was to be able to run it behind a firewall without doing any holepunching tricks (other than left-side-of-the-curve "just use nostr" holepunching)
Reading up on all these replies, it seems like nsecbunker (and OAuth) must be run self-custodially via personal home server (ex: Umbrel).