News for hackers. Stuff that matters.
Re:How to SSH Properly by ddevault on Wednesday April 01, 2020 @05:33PM (#22753752)
This article can be boiled down to one common sense idea and one less obvious idea:

1. Don't put secret information on a machine where someone you don't trust has root.

2. Don't use agent forwarding unless you know you can trust the machine on the other end.

Since agent forwarding is not enabled by default, both of these seem pretty obvious to me.

Re:How to SSH Properly by dx87 on Wednesday April 01, 2020 @06:08PM (#22754026)
It's still good info, I don't think it's obvious to most people. I was doing a pentest for a Fortune 500 company, and a key component of us compromising their entire network was a bastion host that controlled access to sensitive parts of their network. Turns out whoever controlled the machine made the rookie mistake of running a cron job as root that ran a non root-owned script, which enabled us to elevate and copy the ssh keys of a lot of IT staff.
Re:How to SSH Properly by ddevault on Wednesday April 01, 2020 @06:12PM (#22754051)
Good insight. You should definitely be careful with forwarding.
Re:How to SSH Properly by jlgaddis on Wednesday April 01, 2020 @10:14PM (#22755637)
Yes, be careful when using ForwardAgent and, more importantly, avoid using it altogether unless you absolutely need to!

Most "use cases" I've come across could have been solved "better" by simply using ProxyCommand instead. That was apparently too hard, though, so use of agent forwarding continued.

Since the introduction of ProxyJump a while back, however, it's now even easier to avoid using agent forwarding in most -- but not all -- cases.

So yes, be careful when using agent forwarding but, more importantly, as much as possible, just avoid using it entirely unless you absolutely must!

Re:How to SSH Properly by manuel_w on Saturday April 04, 2020 @06:59AM (#22777544)
Sometimes I log into a machine and would like to ssh-clone a git repository there using the private key I've got on my local machine. Is there a way around forwarding my ssh-agent in this case?
Re:How to SSH Properly by kitotik on Wednesday April 01, 2020 @09:52PM (#22755528)
IIRC this is how the matrix.org infrastructure compromise happened.
Re:How to SSH Properly by shandor on Thursday April 02, 2020 @07:36AM (#22757962)
> 2. Don't use agent forwarding unless you know you can trust the machine on the other end.

This gets said a lot, but doesn't forcing a prompt every time the forwarded key gets used mitigate this? SSH is not like surfing on the web with traffic flowing everywhere all the time. If you did not just now run any commands that are expected to invoke SSH, you probably don't want to answer yes to that prompt.

Re:How to SSH Properly by staticassertion on Wednesday April 01, 2020 @07:38PM (#22754707)
> Don't use agent forwarding unless you know you can trust the machine on the other end.

On both ends. Agent hijacking can happen on client or server, with an attacker present. And is there any machine you can 'trust' ? That's a big ask, and I think the modern 'zero trust' is fundamentally averse to the concept.