-
Notifications
You must be signed in to change notification settings - Fork 17.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
x/crypto/ssh: misuse of ServerConfig.PublicKeyCallback may cause authorization bypass #70779
x/crypto/ssh: misuse of ServerConfig.PublicKeyCallback may cause authorization bypass #70779
Comments
This comment was marked as outdated.
This comment was marked as outdated.
Change https://go.dev/cl/635315 mentions this issue: |
Related: #20094 |
It looks like this was reported in 2017 in #20094 but that issue was frozen due to no real world examples of misuse of the API being found at the time. I actually think the write up and discussion on the older issue is a little clearer. |
When we first made Tailscale SSH, we assumed people would want public key support soon after. Turns out that hasn't been the case; people love the Tailscale identity authentication and check mode. In light of CVE-2024-45337, just remove all our public key code to not distract people, and to make the code smaller. We can always get it back from git if needed. Updates tailscale/corp#25131 Updates golang/go#70779 Co-authored-by: Percy Wegmann <percy@tailscale.com> Change-Id: I87a6e79c2215158766a81942227a18b247333c22 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
When we first made Tailscale SSH, we assumed people would want public key support soon after. Turns out that hasn't been the case; people love the Tailscale identity authentication and check mode. In light of CVE-2024-45337, just remove all our public key code to not distract people, and to make the code smaller. We can always get it back from git if needed. Updates tailscale/corp#25131 Updates golang/go#70779 Co-authored-by: Percy Wegmann <percy@tailscale.com> Change-Id: I87a6e79c2215158766a81942227a18b247333c22 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
When we first made Tailscale SSH, we assumed people would want public key support soon after. Turns out that hasn't been the case; people love the Tailscale identity authentication and check mode. In light of CVE-2024-45337, just remove all our public key code to not distract people, and to make the code smaller. We can always get it back from git if needed. Updates tailscale/corp#25131 Updates golang/go#70779 Co-authored-by: Percy Wegmann <percy@tailscale.com> Change-Id: I87a6e79c2215158766a81942227a18b247333c22 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
When we first made Tailscale SSH, we assumed people would want public key support soon after. Turns out that hasn't been the case; people love the Tailscale identity authentication and check mode. In light of CVE-2024-45337, just remove all our public key code to not distract people, and to make the code smaller. We can always get it back from git if needed. Updates tailscale/corp#25131 Updates golang/go#70779 Co-authored-by: Percy Wegmann <percy@tailscale.com> Change-Id: I87a6e79c2215158766a81942227a18b247333c22 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
I'm sorry but how on earth has this been assigned a CVSS score of 9.1? |
CVSS scores for widely used libraries are more or less meaningless. Most security vulnerabilities (and many bugs) can be inconsequential or critical depending on the application. More concretely, I don't think the Go project is involved in the CVSS scoring process. @rolandshoemaker? |
As per the discussion at #20094 - this is NOT a vulnerability in this library. It is just a poorly documented callback API that has a POTENTIAL for misuse by users who do not understand how SSH key exchange works. Now everyone that uses x/crypto has a nice 9.1 CVE that they have to "patch", even if they're not using x/crypto/ssh, or use the callback properly. |
I invite you to take the opportunity to ask your vendor scanner why they report such obvious false positives, when the public vulnerability database includes package and symbol information. govulncheck is an example of a scanner that won't report that false positive. |
Yes, unfortunately the GitHub Advisory Database and dependabot don't seem to be capable of using that information yet so they're going around opening alerts across hundreds of projects. |
We explicitly don't assign CVSS scores for our CVEs, as we do not believe they can be accurately calculated for libraries. MITRE et al fills those in when we omit them, despite our objections, and there is not much we can do about that. |
According to the README of https://github.com/community/community, the feedback channel to report this limitation is https://github.com/orgs/community/discussions/categories/code-security. |
Fair point, I appreciate the info! I mistakenly was under the impression the team submitting the CVE passed along a score, my bad! |
In the hypothetical scenario that someone is misusing this API, will patching up past 9.1 give them false confidence? What are the implications of API misuse after https://go.dev/cl/635315? |
The most common misuse, recording the last seen PublicKey, is mitigated as long as there are no other authentication methods (PasswordCallback, KeyboardInteractiveCallback, or NoClientAuth).
|
Reference: golang/go#70779
Backport of influxdata#16297. Fixes CVE-2024-45337. See golang/go#70779. (cherry picked from commit 36553ae)
The change will fix CVE-2023-45288 Vulnerability details: https://nvd.nist.gov/vuln/detail/CVE-2023-45288 Fix: golang/go#70779
The change will fix CVE-2023-45288 Vulnerability details: https://nvd.nist.gov/vuln/detail/CVE-2024-45337 Fix: golang/go#70779 Signed-off-by: Kamlesh Verma <kamlesh.a.verma@hotmail.com>
Applications and libraries which misuse the ServerConfig.PublicKeyCallback callback may be susceptible to an authorization bypass.
The documentation for ServerConfig.PublicKeyCallback says that "A call to this function does not guarantee that the key offered is in fact used to authenticate." Specifically, the SSH protocol allows clients to inquire about whether a public key is acceptable before proving control of the corresponding private key. PublicKeyCallback may be called with multiple keys, and the order in which the keys were provided cannot be used to infer which key the client successfully authenticated with, if any. Some applications, which store the key(s) passed to PublicKeyCallback (or derived information) and make security relevant determinations based on it once the connection is established, may make incorrect assumptions.
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.
Since this API is widely misused, as a partial mitigation golang.org/x/crypto@v0.31.0 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. PublicKeyCallback will now be called multiple times with the same key, if necessary. Note that the client may still not control the last key passed to PublicKeyCallback if the connection is then authenticated with a different method, such as PasswordCallback, KeyboardInteractiveCallback, or NoClientAuth.
Users should be using the Extensions field of the Permissions return value from the various authentication callbacks to record data associated with the authentication attempt instead of referencing external state. Once the connection is established the state corresponding to the successful authentication attempt can be retrieved via the ServerConn.Permissions field. Note that some third-party libraries misuse the Permissions type by sharing it across authentication attempts; users of third-party libraries should refer to the relevant projects for guidance.
Thanks to Damien Tournoud, Patrick Dawkins, Vince Parker, and Jules Duvivier from the Platform.sh / Upsun engineering team for reporting this issue.
The text was updated successfully, but these errors were encountered: