Skip to content

fix(ci): only trust Launchpad's pinned RSA host key - #115

Merged
rvagg merged 1 commit into
nodejs:mainfrom
NopeCharon:pin-launchpad-rsa-host-key
Nov 16, 2026
Merged

rvagg merged 1 commit into
nodejs:mainfrom
NopeCharon:pin-launchpad-rsa-host-key

Conversation

@NopeCharon

Copy link
Copy Markdown
Contributor

Fixes #114

The cron job pins Launchpad's SSH host key by checking that the RSA fingerprint from https://help.launchpad.net/SSHFingerprints is among the ssh-keyscan results. Without -t, ssh-keyscan adds every key type the server offers to known_hosts, and the check only verifies the RSA one. If someone intercepts the connection, they can return the real RSA public key alongside their own Ed25519 key. The check passes and git push launchpad then accepts the unverified Ed25519 key.

Launchpad only serves the RSA key, so this change requests only that type with ssh-keyscan -t rsa. known_hosts then contains only the key the check verifies.

Testing

  • In an Ubuntu 24.04 container, I ran a local sshd that only has an Ed25519 key, impersonating git.launchpad.net:
    • Current workflow (its Ed25519 key plus the real RSA line): fingerprint check: PASSED, and ssh accepts the host key (Permission denied (publickey,password).).
    • With -t rsa: the fingerprint check fails. If known_hosts holds only the real RSA key, ssh reports Host key verification failed.
  • I ran the updated ssh-keyscan/ssh-keygen lines from the workflow in a clean container against the real git.launchpad.net. The check passes, and ssh [email protected] accepts the host key and reaches authentication (Permission denied (publickey).).
  • actionlint .github/workflows/cron.yml passes.

The cron job pins git.launchpad.net's host key by running ssh-keyscan
and checking that the expected RSA fingerprint from
https://help.launchpad.net/SSHFingerprints is among the results. Without
-t, ssh-keyscan writes every key type the server offers to known_hosts.
The check only looks at the RSA line, so any ECDSA or Ed25519 key
in the scan is trusted without being verified.

An attacker who can intercept the runner's connection can return the
real RSA public key next to their own Ed25519 key. ssh-keyscan records
host keys before it checks the server's signature, so this does not need
Launchpad's private key. The fingerprint check passes, and
`git push launchpad` then prefers the Ed25519 entry from known_hosts and
connects to the attacker using the LAUNCHPAD_RSA key.

Launchpad only serves the RSA key, so request just that type with
`ssh-keyscan -t rsa`. known_hosts then contains only the key that the
check verifies, and ssh rejects a server that offers any other key with
"Host key verification failed".

Fixes: nodejs#114
Signed-off-by: NopeCharon <[email protected]>

@rvagg rvagg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok .. not exactly a plausible attack vector but this isn't unreasonable

@rvagg
rvagg merged commit 3e3f931 into nodejs:main Nov 16, 2026
rvagg pushed a commit that referenced this pull request Nov 16, 2026
rvagg pushed a commit that referenced this pull request Nov 16, 2026
rvagg pushed a commit that referenced this pull request Nov 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cron trusts unverified Launchpad SSH host keys of other types

2 participants