While in theory, this adds at least some small layer of protection, I have doubts that it adds anything meaningful to stop a smart attacker.
The problem here is that everything is running as your user, so it's all the same security sphere.
You may be thinking, "But Bitwarden requires me to approve each key request". Problem is that if the attacker is already running as your user, which I'm assuming here because to steal your bare keys, they'd already need to be. This means they can also hit the approve button for you.
Ok, now you say "But it requires touchID!". Maybe that gets you just a little bit of protection, but...
The next idea is to just steal the decrypted key out of RAM. This requires a little bit of effort, because you generally can't attach to a sibling process without root on Linux with default configs. This will only delay things slightly. Attaching to your child is allowed, so all an attacker needs to do is replace your launch shortcut/service for Bitwarden with a thin wrapper that makes the attacker the parent process, and then they can just ptrace it and steal the decrypted key next startup. On Mac, where the ptrace path isn't viable due to disallowing ptrace of signed binaries by default, you could just replicate the Bitwarden GUI as a wrapper and steal the master password at startup.
If you really want to protect your keys from attacks like this, you need a real hardware device with OOB signaling.
A lot of your caveats here assume some level of sophisticated attacker that has persistent access to the machine and is motivated to investigate when something doesn't work, rather than the extremely common case of a smash-and-grab credential stealer script that quickly scans through the system and tries to grab anything it can before being removed.
Even things that will not stand up to a motivated attacker still add value towards reducing the likelihood of a breach, by increasing friction for attackers that are simply grabbing at low-hanging fruit. A setup with a bit more friction is a locked door in a long hallway of unlocked doors. Yeah someone can get through it, but it's not going to be their highest priority. This is the case for almost anything security related: layers of imperfect protection are good in combination.
I agree 100% here, and I had this argument running through my head as I wrote this comment. The problem is I think these assumptions only hold up for a very short time in today's world. Even unsophisticated attackers will have access to the sorts of methods involved here soon, if they don't already. I'm not up to date on the latest malware practices, but I would be surprised if they weren't already targeting popular credential managers like Bitwarden.
What is the intersection of unsophisticated attacker and enabling tools? That is, what is today's script kiddie? Is there a community around abliterated models that people run to h4ck?
While I have no direct knowledge here, surely there must be. It takes approximately 20 min or less to set up a very capable ablated model on a local consumer-gaming-class GPU. It's not frontier levels right now, but it's still very capable, and with the pace things are going, current frontier power will probably be available in no more than 1-2 years locally.
I'm all aboard the Yubikey train[0] for securing SSH keys, but I'd imagine most SSH keys aren't being exfiltrated by smart attackers putting in the work to steal decrypted keys from RAM. Most SSH keys are being exfiltrated by scripts being run via curl | bash (or agents...) that quickly gather up every potentially useful user file they can find and upload it to a remote endpoint somewhere.
[0] I also use an SSH key in Bitwarden for lower priority concerns, but my main SSH keys that get automatically installed on remote systems and used for signing commits are stored via FIDO on Yubis.
More niche situations where you can't use the agent. You need to use it from somewhere you can't forward the agent, or you need to make too many calls (eg ssh to 10,000 machines).
Just to note, it is not a given that "running as same user" implies "has control over all other user processes". Wayland for instance (famously) blocks that kind of attack.
It is certainly possible to enable authentication methods whereby two processes at the same privilege level cannot grab each other's secrets or tokens. Credential guard is one example, I am sure there are analogous implementations on Linux but I believe namespacing and SELinux attack this from different angles.
The next idea is to just steal the decrypted key out of RAM.
It is also not a given that a userland process can do this.
All of this is true, but would you notice if a malware swapped in a shim into the place where your Bitwarden startup is (user systemd, WM startup, etc), and all that shim did was spawn Bitwarden as a child process? You can generally ptrace a child process.
> While in theory, this adds at least some small layer of protection, I have doubts that it adds anything meaningful to stop a smart attacker.
You’re not wrong, but for most of us the threat of a simple credential stealer is a million times more likely than being targeted by a dedicated, intelligent hacker.
In the most common compromise scenario, the attack comes along with some widely distributed software and is going for quantity of keys compromised via automated scripts, not precision extraction of one person’s keys through interactive exploration of their computer.
Adjust your security model if you’re in an important position at a big company or some other high value target.
For most of us, though, anything that defeats a common credential stealer is highly valuable.
If you want secure the key, generate one on YK directly and use it. The entire point of hardware key storage is for key itself to never touch anything else
Yubikey or another removable security key is the way to go in my opinion. I've been doing this since I think 2018. There are few ways you can do it, I've always used the GPG key option - you have the GPG key irretrievably on the Yubikey, you set up SSH to talk to gpg-agent and you have to provide a PIN every time you plug the USB back in. When I walk away, the Yubikey goes with me. I've never had a problem getting it working with anything on Linux or any external service. You can either let existing sessions continue or there are ways you can break existing sessions when the key is unplugged. Works on Windows and macOS too, from memory, macOS was almost as easy as Linux and Windows is more fiddly.
By having it as a GPG key, you get signing and encryption on top of SSH. You can pair it with gopass as a password vault.
I haven't had to make a new key for years, they're very hard-wearing, mine lives on my key ring with my house keys. But I wrote this script to automate setting up a new key, I haven't tested it with recent Yubikeys or a recent version of GPG, but might be a useful starting point: https://github.com/Method-B-Ltd/auto-gpg-card - PRs welcome if it's broken.
You still need to be really careful about what can run as your user, but being able to take the key away physically remove a load of risk.
There's real ergonomic gain here if you ever forward your ssh agent to another machine. With default SSH, you need to use the clunky askpass setup to be able to approve each access of your keys from the remote machine, but with Bitwarden, you can easily attach it to TouchID or similar.
ssh-add -c + ssh-askpass might be clunky, but - hitting TouchID is notably worse security wise since you'll get into a pattern of hitting it relatively often, making it much easier to smuggle an illegitimate request into that, no? It diminishes the value of TouchID.
Absolutely, but what's the better option? If you're forwarding to a remote and that remote isn't fully trusted with your key, you need a manual approval step of some sort whether that's askpass, Bitwarden, or a yubikey.
Just to clarify your point for others; SSH private key files can already be encrypted with a passphrase. SSH will then prompt for the passphrase whenever the key is used. The standard SSH agent can optionally keep keys unlocked for a time period.
There's no need to reveal your unencrypted keys to Bitwarden or any other cloud service.
> The standard SSH agent can optionally keep keys unlocked for a time period.
The default for keys added to ssh-agent without further config/options is to keep them unlocked indefinitely (as long as the ssh-agent process keeps running anyway).
If your threat model includes rogue LLM agents on your system then your passphrase can be compromised by a logger or just getting it from memory
I use yubikey Fido keys so I need to touch the key to unlock it
It’s quite wild to be working and see my yubikey flash waiting for input because I have an agent running a task and it’s trying things like GitHub auth without asking me. Not hard to imagine it taking the next step and just grabbing tokens it needs to do whatever it needs to complete its task
If you want the agent to look at logs, create PRs, run tests that need network access (grade, Basel, etc) then you are going to have to give it enough access that there is probably very little functional difference from you running those commands yourself
I can tell you at my work, a large enterprise, people have pretty much just given Claude auto-mode free rein to do everything. Incidents in production are honestly people just sharing the output of their Claude’s investigations colored by whatever skills, memory and tokens available to it
Why does it need to create PR's? It can work in a local branch that you pull from your user and push to whatever upstream you want. Sure, it's slightly slower, but you're not handing Anthropic keys to your kingdom.
Would you give a contractor developer your private key, just because it's somewhat lower friction?
> If you want the agent to look at logs, create PRs, run tests that need network access (grade, Basel, etc) then you are going to have to give it enough access that there is probably very little functional difference from you running those commands yourself
The difference is that one situation is logged in the logs as you doing a thing, and the other is logged as the agent doing the thing. That's why you should really run your agents as their own separate user account and give that account whatever (minimal required) permissions it needs to do the job. For auditability purposes when tracing down a problem (to implement a solution, or to lay blame), you probably want to know when the "bot" screwed up so that it can be fixed (and so you don't have to take the blame for something you had absolutely no control over). The problem with that whole plan is this; I double-dog dare you to try to get the "bosses" to implement anything that improves security and auditability if it's going to cost even just ten seconds of extra time, or ten cents of extra money. Ain't gonna happen.
I think the answer is more plainly and reasonably given in the article TFA cites as inspiration, "I deleted all my SSH keys":
> First – Isn’t using a passphrase enough? Probably. I don’t intend to imply that this post is the only way that anyone should be doing SSH keys. [...] So yes, the ’traditional’ method is probably fine for most threat models.
Typing a reasonably strong SSH key passphrase many times a day is deeply annoying, and the alternative to that is running ssh-add once a session and then anything else running as your user being able to use it with impunity.
Agents like Bitwarden and 1Password are more granular in their authorisation, in 1Password’s case I tap the fingerprint reader on my laptop when a process in a specific terminal first requests SSH key access to authorise that, after which it can use it as much as it likes until the session times out. Doing so however doesn’t mean that some other process spawned by some malware can also use it, that’s going to pop a prompt up again.
I’m currently trying to get to a point where I don’t keep long lived credentials on disk, and as much as possible keep them out of environment variables as well. I don’t want random processes running as my user account to be able to go sniff out my GitHub, AWS, and so on API tokens. Unfortunately It’s a massive pain to get right at the moment. I particularly don’t want long lived credentials where if a process sends them to a server somewhere they’re valid for ages afterwards.
SSH keys are pretty much solved, I’m using 1Password’s SSH agent similar to what OP is doing with Bitwarden. It works wonderfully.
Various API keys are a pain in the backside. 1Password has some features which kind of maybe help by allowing you to keep credentials in 1Password and then exposing them either as a named pipe that requires auth to read, or via CLI wrappers that inject the credentials at runtime. Both of those still require long lived credentials though.
At some point I’ll probably snap and build something analogous to what 1Password are doing but using OAuth or similar to request short lived, scoped, credentials as needed. I assume there’s approximately six hundred things like this which are targeted at agent use but I’d like something that doesn’t require me to run everything in a sandbox.
Everyone is updating their threat models to include locally operating LLM agents. Here's a random thought: Don't let LLM agents act on your local system as you? They should be operating in a constrained way with their own account and privileges, rather than acting directly on your behalf with your privileges and access. Treat the agent as if its another user.
> They should be operating in a constrained way with their own account and privileges, rather than acting directly on your behalf with your privileges and access.
That's effective when possible, but it's not quite the correct level of permission. Separation of users usually involves disjoint working spaces/sets, and that defeats many typical 'assistant' roles. For example, "look through my e-mail for the past month and remind me if anybody needs something from me" is a very useful task for an assistant (LLM or human), but it necessarily involves access to one's own information -- even on a read-only basis.
IMO we're missing a robust task-level permission system, and this is difficult because a 'task' does not have a 1:1 mapping to a path, user, or application.
Right, but I don't need an LLM to do something as basic as read my email... in fact, having an LLM read my email actually makes email less valuable. The "assistant role" is of no actual value or usefulness to most people. On the other hand, LLM assisted coding can be highly useful and does not need to access anything that's uniquely tied to my identity/account/privileges.
I always scoff when I see people zoom into HN and say hey check out what I am working on, but I agree with you and I made a 2 computer system -- one that is the core with everything on it and another that is a sandbox. They are both their own physical machines and the sandbox is not attached to a network at all, just directly to the core machine which allows you to modify firewall rules at egress
It's a nice thought and probably the right way to be thinking about things. I take the view it's where we'll end up eventually.
The tooling is all DIY however and most people aren't used to operating multi-user environments, nor do they have filesystem permissions set up correctly, nor do they have a good way of handling secrets management, development environment credentials, etc etc etc.
Essentially, I feel like there's a lot of hand waving going on. Are you operating in this style of environment already? Are you using Claude Code or similar operating as another user on your local machine?
A modern Mac is already a multi-user environment. Any Linux device is already a multi-user environment. Is there some particular reason why you can't set up a user account specifically for using coding agents? That's effectively what I've done on my system. It's not as if I'm using the computer for other tasks when I'm running coding agents as they are monopolizing my computer (with local LLMs) anyway, so clearly separating these tasks into a dedicated user account with appropriate permissions is not a huge barrier and significantly improves your security posture against various issues.
I stopped fighting this war because the Cat version sort of follows the Subject-Verb-Object order in English, depending on how you think about the subject.
Tailscale SSH solves a lot of this. You use your Tailscale identity to authenticate, you can force SSO w/ MFA for every login, and Tailscale keys can be locked behind a TPM.
The problem here is that everything is running as your user, so it's all the same security sphere.
You may be thinking, "But Bitwarden requires me to approve each key request". Problem is that if the attacker is already running as your user, which I'm assuming here because to steal your bare keys, they'd already need to be. This means they can also hit the approve button for you.
Ok, now you say "But it requires touchID!". Maybe that gets you just a little bit of protection, but...
The next idea is to just steal the decrypted key out of RAM. This requires a little bit of effort, because you generally can't attach to a sibling process without root on Linux with default configs. This will only delay things slightly. Attaching to your child is allowed, so all an attacker needs to do is replace your launch shortcut/service for Bitwarden with a thin wrapper that makes the attacker the parent process, and then they can just ptrace it and steal the decrypted key next startup. On Mac, where the ptrace path isn't viable due to disallowing ptrace of signed binaries by default, you could just replicate the Bitwarden GUI as a wrapper and steal the master password at startup.
If you really want to protect your keys from attacks like this, you need a real hardware device with OOB signaling.
Even things that will not stand up to a motivated attacker still add value towards reducing the likelihood of a breach, by increasing friction for attackers that are simply grabbing at low-hanging fruit. A setup with a bit more friction is a locked door in a long hallway of unlocked doors. Yeah someone can get through it, but it's not going to be their highest priority. This is the case for almost anything security related: layers of imperfect protection are good in combination.
[0] I also use an SSH key in Bitwarden for lower priority concerns, but my main SSH keys that get automatically installed on remote systems and used for signing commits are stored via FIDO on Yubis.
Also, pretty sure you can’t use the CA for GitHub without enterprise.
It is certainly possible to enable authentication methods whereby two processes at the same privilege level cannot grab each other's secrets or tokens. Credential guard is one example, I am sure there are analogous implementations on Linux but I believe namespacing and SELinux attack this from different angles.
It is also not a given that a userland process can do this.You’re not wrong, but for most of us the threat of a simple credential stealer is a million times more likely than being targeted by a dedicated, intelligent hacker.
In the most common compromise scenario, the attack comes along with some widely distributed software and is going for quantity of keys compromised via automated scripts, not precision extraction of one person’s keys through interactive exploration of their computer.
Adjust your security model if you’re in an important position at a big company or some other high value target.
For most of us, though, anything that defeats a common credential stealer is highly valuable.
You can enroll your ssh keys into a yubikey, and have it securely stored in the hardware until you plug it in to ssh.
If you want secure the key, generate one on YK directly and use it. The entire point of hardware key storage is for key itself to never touch anything else
By having it as a GPG key, you get signing and encryption on top of SSH. You can pair it with gopass as a password vault.
I haven't had to make a new key for years, they're very hard-wearing, mine lives on my key ring with my house keys. But I wrote this script to automate setting up a new key, I haven't tested it with recent Yubikeys or a recent version of GPG, but might be a useful starting point: https://github.com/Method-B-Ltd/auto-gpg-card - PRs welcome if it's broken.
You still need to be really careful about what can run as your user, but being able to take the key away physically remove a load of risk.
- Good ergonomics
- No private key sitting unencrypted on disk
Hell, isn't it even the default when using `ssh-keygen`? As in, it prompts you for a passphrase if you don't explicitly tell it not to?
There's no need to reveal your unencrypted keys to Bitwarden or any other cloud service.
The default for keys added to ssh-agent without further config/options is to keep them unlocked indefinitely (as long as the ssh-agent process keeps running anyway).
I use yubikey Fido keys so I need to touch the key to unlock it
It’s quite wild to be working and see my yubikey flash waiting for input because I have an agent running a task and it’s trying things like GitHub auth without asking me. Not hard to imagine it taking the next step and just grabbing tokens it needs to do whatever it needs to complete its task
I can tell you at my work, a large enterprise, people have pretty much just given Claude auto-mode free rein to do everything. Incidents in production are honestly people just sharing the output of their Claude’s investigations colored by whatever skills, memory and tokens available to it
Would you give a contractor developer your private key, just because it's somewhat lower friction?
The difference is that one situation is logged in the logs as you doing a thing, and the other is logged as the agent doing the thing. That's why you should really run your agents as their own separate user account and give that account whatever (minimal required) permissions it needs to do the job. For auditability purposes when tracing down a problem (to implement a solution, or to lay blame), you probably want to know when the "bot" screwed up so that it can be fixed (and so you don't have to take the blame for something you had absolutely no control over). The problem with that whole plan is this; I double-dog dare you to try to get the "bosses" to implement anything that improves security and auditability if it's going to cost even just ten seconds of extra time, or ten cents of extra money. Ain't gonna happen.
If you grant an LLM agent full system access, it’ll have full system access.
> First – Isn’t using a passphrase enough? Probably. I don’t intend to imply that this post is the only way that anyone should be doing SSH keys. [...] So yes, the ’traditional’ method is probably fine for most threat models.
https://blog.infected.systems/posts/2026-11-03-i-deleted-all...
Agents like Bitwarden and 1Password are more granular in their authorisation, in 1Password’s case I tap the fingerprint reader on my laptop when a process in a specific terminal first requests SSH key access to authorise that, after which it can use it as much as it likes until the session times out. Doing so however doesn’t mean that some other process spawned by some malware can also use it, that’s going to pop a prompt up again.
SSH keys are pretty much solved, I’m using 1Password’s SSH agent similar to what OP is doing with Bitwarden. It works wonderfully.
Various API keys are a pain in the backside. 1Password has some features which kind of maybe help by allowing you to keep credentials in 1Password and then exposing them either as a named pipe that requires auth to read, or via CLI wrappers that inject the credentials at runtime. Both of those still require long lived credentials though.
At some point I’ll probably snap and build something analogous to what 1Password are doing but using OAuth or similar to request short lived, scoped, credentials as needed. I assume there’s approximately six hundred things like this which are targeted at agent use but I’d like something that doesn’t require me to run everything in a sandbox.
https://venya.ai/#/security
working on SIEM now (for beta4, now testing against fluentd, logstash, splunk, rsyslog)
That's effective when possible, but it's not quite the correct level of permission. Separation of users usually involves disjoint working spaces/sets, and that defeats many typical 'assistant' roles. For example, "look through my e-mail for the past month and remind me if anybody needs something from me" is a very useful task for an assistant (LLM or human), but it necessarily involves access to one's own information -- even on a read-only basis.
IMO we're missing a robust task-level permission system, and this is difficult because a 'task' does not have a 1:1 mapping to a path, user, or application.
https://github.com/RALaBarge/enclave
The tooling is all DIY however and most people aren't used to operating multi-user environments, nor do they have filesystem permissions set up correctly, nor do they have a good way of handling secrets management, development environment credentials, etc etc etc.
Essentially, I feel like there's a lot of hand waving going on. Are you operating in this style of environment already? Are you using Claude Code or similar operating as another user on your local machine?
feels wrong. Unnecessary uses of cat.
`pbcopy < ~/.ssh/id_rsa`
`<~/.ssh/id_rsa pbcopy`
is this a view of recent attacks everywhere? is this everyone just handling the keys to remote-chatbots with exec permission? is that just illiteracy?
i think that's the best angle of this discussion.
(also, extra funny they are worried about keys on disc stolen by local priviledged attakers, but use an ssh agent)
https://github.com/roddhjav/apparmor.d
(I'm the contributor)
Still, validation without extraction (FIDO2), instead of read to validate is the best solution in OP's situation.