Skip to content

x/vuln/cmd/govulncheck: type propagation can produce confusing results #47121

@rolandshoemaker

Description

@rolandshoemaker

Type propagation appears to taint some functions in the call graph, causing them to be reported as vulnerable, sometimes shadowing the actual results.

The example below is a quite basic example of this. Because VulnerableImplementation flows from EntryB through EntryA, the latter is reported as vulnerable, shadowing EntryB, since we try to only show a single finding per vulnerability. Removing EntryB causes nothing to be reported.

I suspect this will also lead to more confusing results, where it is less obvious how the type is being propagated, tainting a function.

cc @zpavlinovic

package example

import "vuln"

type OrdinaryInterface interface {
	F()
}

func EntryA(oi OrdinaryInterface) {
	oi.F()
}

func EntryB() {
	var oi OrdinaryInterface
	oi = &vuln.VulnerableImplementation{}
	EntryA(oi)
}
package vuln

type VulnerableImplementation struct {}

func (vi *VulnerableImplementation) F() {}
[
    {
        "id": "GO-EXAMPLE",
        "package": {
            "name": "vuln",
            "ecosystem": "Go"
        },
        "ecosystem_specific": {
            "symbols": [
                "VulnerableImplementation.F"
            ]
        }
    }
]
Trace:
vuln.VulnerableImplementation.F (/Users/roland/vulncheck-permissive/main.go:10:6)
example.OrdinaryInterface.F(...) [approx. resolved to (*vuln.VulnerableImplementation).F] (/Users/roland/vulncheck-permissive/main.go:10:6)
example.EntryA(...) (/Users/roland/vulncheck-permissive/main.go:9:6)

Vulnerabilities:
vuln ()

Metadata

Metadata

Assignees

No one assigned

    Labels

    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.vulncheck or vulndbIssues for the x/vuln or x/vulndb repo

    Type

    No type

    Projects

    Status

    No status

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions