News for hackers. Stuff that matters.
Re:Tofu: Do You Check? by tedunangst on Friday September 22, 2023 @01:59PM (#37615369)
Nobody ever mentions that TOFU requires the attacker to commit to the attack before they know whether you know the fingerprint. Somebody could set up on that public wifi and intercept ssh, but they'd be detected as soon as anybody with a previously known key tries to connect. They can't wait for you to connect to an unknown server, because they don't know what you don't know. If you're not sure about the network, you can connect to a known host first to check for funny business.

Or turn on the option for ascii art keys.

Re:Tofu: Do You Check? by SoftTalker on Friday September 22, 2023 @02:40PM (#37615944)
> they'd be detected as soon as anybody with a previously known key tries to connect

Would they? Or would the person just delete the old key from their ~/.ssh/known_hosts and accept the new one?

Re:Tofu: Do You Check? by tedunangst on Friday September 22, 2023 @02:54PM (#37616137)
If you're deleting keys from known_hosts, you're not trusting on first use.
Re:Tofu: Do You Check? by mjochim on Friday September 22, 2023 @05:26PM (#37618013)
That is correct. And still, many, many devs and admins would do exactly that. Which is why in many, many cases, Tofu really isn't Tofu but "trust whatever."

When designing or evaluating security, one should not ignore that this is a part of reality.

Re:Tofu: Do You Check? by arp242 on Friday September 22, 2023 @10:15PM (#37620062)
That's a bit of a different issue from the "Let’s say you’re on a fresh machine" that this article is about.

I agree that "automatic trust on first use" is "good enough" for most cases and people (especially with sshfp records), and to be honest I think the warning you get once that fails is strong enough:

  % git clone [email protected]:madmurphy/libconfini.git
  Cloning into 'libconfini'...
  @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  @    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
  @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
  Someone could be eavesdropping on you right now (man-in-the-middle attack)!
  It is also possible that a host key has just been changed.
  The fingerprint for the ED25519 key sent by the remote host is
  SHA256:+DiY3wvvV6TuJJhbpZisF/zLDA0zPMSvHdkr4UvCOqU.
  Please contact your system administrator.
  Add correct host key in /home/martin/.ssh/known_hosts to get rid of this message.
  Offending ED25519 key in /home/martin/.ssh/known_hosts:118
  Host key for github.com has changed and you have requested strict checking.
  Host key verification failed.
  fatal: Could not read from remote repository.
  
  Please make sure you have the correct access rights
  and the repository exists.
It's a strong warning, with a manual fix that's more than "just press ok" (probably intentionally), and if you choose to ignore that then that's your problem.

I'm not really sure what could be done better? A centralized https-like system comes with its own downsides.

(The only complaint is that last "Please make sure you have the correct access rights and the repository exists" line, which is from git and not ssh, and a tad confusing; maybe it's possible for git to do better here?)

Re:Tofu: Do You Check? by SoftTalker on Saturday September 23, 2023 @12:32PM (#37624762)
That warning IMO is over the top and too long. All that noise with key fingerprints and filenames makes the eyes glaze over. Any user who knows what a "key fingerprint" is will be able to find and compare them if they are interested. The message should just say something like:

  WARNING: Remote host identification has changed.
  If you did not expect this, verify this change with the remote system administrator before proceeding.
Ideally the message should be able to be customized so that organizations who provision computers for their employees could include e.g. the phone number or email address for the internal help desk.
Re:Tofu: Do You Check? by patrakov on Sunday September 24, 2023 @05:22AM (#37631431)
Note that Ubuntu patches the message and recommends `ssh-keygen -R github.com`, thus making it much closer to "just press ok".

https://salsa.debian.org/ssh-team/openssh/-/blob/master/debi...

Re:Tofu: Do You Check? by foobiekr on Friday September 22, 2023 @05:51PM (#37618263)
This. Hell, in almost every org I've worked there's a guy who has helper scripts to do this automatically.
Re:Tofu: Do You Check? by c7DJTLrn on Friday September 22, 2023 @02:05PM (#37615443)
Good point. If we're being imaginative, there's various side channels an attacker could use to carefully target their attack, such as seeing a new MAC or DHCP lease on the local network.
Re:Tofu: Do You Check? by xg15 on Friday September 22, 2023 @03:26PM (#37616548)
True. Also depends on what the target is. I.e., if the attacker wants to impersonate machines that are only avaliable on the local network, then it's probably reasonable to conclude that a machine which was never seen on that LAN before also hasn't yet connected to the impersonated host.

However, that isn't true for "public" SSH endpoints, such as github, gitlab etc - e.g. if the attacker is impersonating the wifi if the nearest Starbucks to snoop on all the hipster solo-devs there, he'll probably be unable to impersonate github, because even people who use that wifi for the first time have probably connected to github before, on a different network.