[GTALUG] SSH Agent Forwarding

Giles Orr gilesorr at gmail.com
Thu Dec 17 17:29:27 UTC 2015


A couple days ago I discovered the joys of SSH agent forwarding.  But
with that, I discovered this warning in the man page: "Agent
forwarding should be enabled with caution.  Users with the ability to
bypass file permissions on the remote host (for the agent's
UNIX-domain socket) can access the local agent through the forwarded
connection.  An attacker cannot obtain key material from the agent,
however they can perform operations on the keys that enable them to
authenticate using the identities loaded into the agent."  I've read
this about five times because as far as I can tell, all it's actually
saying is "you need to trust your remote system."  So please correct
me if I'm wrong: it's saying that IF someone on the remote system has
a privilege escalation (or is root), then they can authenticate using
any keys in your agent (but not get the keys).  Is that correct?

And today I found this:

https://heipei.github.io/2015/02/26/SSH-Agent-Forwarding-considered-harmful/

He attacks with "It is meant as an easy way to connect to a host A
with your SSH key and from there connect to another host B with that
same key. This obviously is only needed if you cannot connect to host
B directly from your workstation."

I was immediately scratching my head, because my use-case is to load
my keys on my workstation, then SSH to a remote host where I do git
and/or ansible stuff that needs a key.  I can connect to "host B" (the
git host) from "my workstation," but the work is better done on "host
A."  With agent forwarding, I don't have to store the private key on
the remote machine, or (re)load an SSH key.

So I see that agent forwarding might be unwise if you don't trust the
administrator or the machine is compromised (and yes, you can never be
sure a machine is secure), but if you're worried about the security of
the remote host, storing private keys on it and reauthenticating seems
worse.  Am I missing something?

-- 
Giles
http://www.gilesorr.com/
gilesorr at gmail.com


More information about the talk mailing list