Skip to content

Go call analysis marks called vulnerabilities as uncalled when an uncalled finding comes last (last-wins aggregation) #3161

Closed

Description

@VIRUSBABAA

Summary

matchAnalysisWithPackageVulns aggregates govulncheck findings per (vulnerability, module) with a plain map assignment, so the last finding wins instead of OR-ing. govulncheck emits one finding per vulnerable symbol, and multi-symbol advisories routinely mix called findings (trace frame with a function name) and uncalled findings (single frame, empty function). If the uncalled finding comes last, a vulnerability whose code IS executed is marked Called=false.

Location: internal/sourceanalysis/go.go, in matchAnalysisWithPackageVulns (the idToModuleToCalled assignment loop).

Expected behavior

A vulnerability with ANY called finding must be reported as called, regardless of finding order. This matches the in-repo semantics elsewhere: internal/sourceanalysis/rust.go ("Once one advisory marks this vuln as called, always mark as called", OR-ing), and internal/scalibrenricher/govulncheck/source/govulncheck.go where reachability is ANY finding with a function frame. The Go path is the odd one out.

Actual behavior (order-dependent verdict)

Same finding set, different outcome depending only on order:

  • order [called, uncalled] -> Called=false (wrong: the false negative)
  • order [uncalled, called] -> Called=true

Impact

A misclassified vulnerability goes to the hidden (uncalled) bucket in output (internal/output/output_result.go), and determineReturnErr (pkg/osvscanner/osvscanner.go) returns no error (exit 0) when only uncalled vulnerabilities are found with --show-all-vulns off. Go call analysis is ON by default. Net effect: a Go project calling a vulnerable symbol can get a clean scan purely because of finding order. (Exit 0 for genuinely uncalled vulnerabilities is by design; the defect is the misclassification feeding it.)

Minimal reproduction

Call matchAnalysisWithPackageVulns with package github.com/gogo/protobuf v1.3.1, vulnerability GO-2021-0053 (with an imports field), and two findings for the same OSV and module: one with Trace[0].Function set (called) and one with Trace[0].Function empty (uncalled). In order [called, uncalled] the resulting ExperimentalAnalysis["GO-2021-0053"].Called is false; in the reversed order it is true. Verified against the real function with a unit test in both orders.

Suggested fix shape (not applied)

OR instead of overwrite in the aggregation loop:
idToModuleToCalled[f.OSV][modulePath] = idToModuleToCalled[f.OSV][modulePath] || called

Dup-screen note

Searched existing issues and the web for this aggregation flaw and found no existing issue describing it. No repo TODO or comment acknowledges last-wins behavior here.

Activity

  1. VIRUSBABAA commented on Oct 23, 2026

    @VIRUSBABAA
    Author

    Closing this — re-filing the same report from the correct account (Subhan1794).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions