Skip to content

ssh: reject source-address critical option on host certificates - #367

Open
waterWang wants to merge 1 commit into
golang:masterfrom
waterWang:fix/ssh-host-cert-source-address
Open

ssh: reject source-address critical option on host certificates#367
waterWang wants to merge 1 commit into
golang:masterfrom
waterWang:fix/ssh-host-cert-source-address

Conversation

@waterWang

Copy link
Copy Markdown

Fixes golang/go#80872

Problem

x/crypto/ssh clients will accept a host certificate containing a source-address critical option, which OpenSSH rejects. The source-address option should only apply to user certificates, not host certificates.

Root cause

In certs.go, CheckCert() unconditionally skips the source-address critical option with the comment "sourceAddressCriticalOption will be enforced by serverAuthenticate", regardless of whether the certificate is a user or host certificate.

For user certificates this is correct — the server-side authentication dispatch loop enforces the source-address restriction. But for host certificates, source-address is an unsupported critical option that should be rejected.

Fix

Check cert.CertType in the critical options loop: if source-address appears on a HostCert, return an error instead of skipping it. User certificates continue to skip it as before, preserving the existing server-side enforcement path.

Changes

  • ssh/certs.go: add HostCert type check for source-address critical option

@google-cla

google-cla Bot commented Aug 13, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

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.

x/crypto/ssh: client-side CheckHostKey accepts unsupported source-address critical option

1 participant