Malhar Ujawane

Notes

Note·

TIL: find a bad SSH key by fingerprint with ssh-keygen -lf

ssh-keygen -lf reads a whole authorized_keys file, handles option prefixes and prints one SHA256 fingerprint per key. Match bad keys on that.

ssh-keygen -lf takes a whole authorized_keys file and prints one fingerprint per key. That’s the right way to look for a known bad key, because the comment at the end of each line is free text and anyone can change it.

I needed this for today’s post on the Claude Code extension backdoor, where the planted key has the comment svc-telemetry and the published fingerprint SHA256:0Z6R+DF64Do2nwQic8a7kkfDLNNk4IiK+2U2Rci4htk. My test file has a normal key, the attacker’s key with its comment changed to deploy@ci, the same key again with authorized_keys options in front and no comment, and a comment line:

$ ssh-keygen -lf authorized_keys
256 SHA256:LGBrqDwGtZB6RdQ5PaMsgaA8gGQn+h1xGdCCb7hLNyA me@laptop (ED25519)
256 SHA256:0Z6R+DF64Do2nwQic8a7kkfDLNNk4IiK+2U2Rci4htk deploy@ci (ED25519)
256 SHA256:0Z6R+DF64Do2nwQic8a7kkfDLNNk4IiK+2U2Rci4htk from="10.0.0.0/8",no-pty (ED25519)
$ ssh-keygen -lf authorized_keys | grep -F SHA256:0Z6R+DF64Do2nwQic8a7kkfDLNNk4IiK+2U2Rci4htk
256 SHA256:0Z6R+DF64Do2nwQic8a7kkfDLNNk4IiK+2U2Rci4htk deploy@ci (ED25519)
256 SHA256:0Z6R+DF64Do2nwQic8a7kkfDLNNk4IiK+2U2Rci4htk from="10.0.0.0/8",no-pty (ED25519)
$ grep -c svc-telemetry authorized_keys
0

Three things I didn’t expect:

  • It parses the options prefix (from="...", no-pty) and skips # lines, so you can point it at the real file.
  • When a key has no comment, the options string shows up where the comment would be. Don’t read that column as a name.
  • It reads from stdin with -, so echo "<key line>" | ssh-keygen -lf - checks one line, which is handy for confirming that a key published in an advisory matches its published fingerprint.

Run on OpenSSH 10.0p2 (Debian 13), October 31, 2026. SHA256 has been the default fingerprint format since OpenSSH 6.8 in 2015, so any current machine prints the same format the advisories use.

Get new posts in your inbox

© 2026 Malhar Ujawane. Built with Astro.