-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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/vuln: false negative for GO-2024-3321 #71449
Comments
If I understand correctly from what you are saying, |
I think it is called? The code doesn't misuse the callback arguments, but govulncheck wouldn't know about that, it should just flag the use of |
Then I got confused with the opening message. Actually, is it possible to get a smaller reproducer? If there is an issue, I suspect the example can be shortened. |
Pending above comment resolution, I think I know where the problem might be: I will try to confirm this, which seems to be a db issue. |
Shortened as requested |
If govulncheck can’t handle functions as fields, then NewServerConn has to be flagged instead, which in turn will lead to more false positives (e.g. running a SSH server that does not use pubkey auth). Catch 22… that said, would rather a false positive than false negative. |
I think a minimal example would look like: package main
import (
"fmt"
"net"
"golang.org/x/crypto/ssh"
)
func main() {
config := &ssh.ServerConfig{
PublicKeyCallback: func(c ssh.ConnMetadata, pubKey ssh.PublicKey) (*ssh.Permissions, error) {
return nil, fmt.Errorf("unknown public key for %q", c.User())
},
}
var conn net.Conn
ssh.NewServerConn(conn, config)
} The callback is in the called from NewServerConn here: https://go.googlesource.com/crypto/+/refs/heads/master/ssh/server.go#659 |
Go version
go1.23.5
Output of
go env
in your module/workspace:What did you do?
Ran govulncheck on the sample code below (https://pkg.go.dev/golang.org/x/crypto/ssh#ServerConn example, with a
fmt.Println
added):What did you see happen?
Program output (when connected to using the Linux SSH client):
govulncheck output:
What did you expect to see?
The sample code is vulnerable to GO-2024-3321, as far as I can tell:
Whilst the sample program does not misuse the callback, it potentially could. Based on the OSV record, the govulncheck seeks to determine whether ServerConfig.PublickeyCallback is executed (or reachable from main via call graph analysis). It clearly is but the report states otherwise.
The text was updated successfully, but these errors were encountered: