Description
From [security] Vulnerability in golang.org/x/crypto:
For example, an attacker may send public keys A and B, and then authenticate with A. PublicKeyCallback would be called only twice, first with A and then with B. A vulnerable application may then make authorization decisions based on key B for which the attacker does not actually control the private key.
golang.org/x/[email protected] enforces the property that, when successfully authenticating via public key, the last key passed to ServerConfig.PublicKeyCallback will be the key used to authenticate the connection.
I'm worried that this fix isn't sufficient given this package's use of PublicKeyCallback, because applyConnMetadata
only ever sets context values on its first call:
Lines 114 to 116 in adec695
I.e., the fact that v0.31.0 makes additional calls to PublicKeyCallback won't actually help here, because only the values from the first call get stored in the ctx.
Does that seem correct? If so, should applyConnMetadata
be patched so that we used the values from the last call? Or would some other patch be appropriate?