Skip to content

Agent-mode NuGet apply leaves stale dll copies in bin/ and publish output unreported, and gives no advisory when a patched assembly is strong-named or Authenticode-signed #2198

Open

Description

Summary

Agent mode patches a NuGet package where NuGet restored it: the packages.config folder, the packageFolders of obj/project.assets.json, and the global packages folder (crates/socket-patch-core/src/crawlers/nuget_crawler.rs, get_nuget_package_paths). The dlls a project actually runs are the COPIES in its build output (bin/<configuration>/<tfm>/) and in publish directories. Those are not found or reported, so after apply an already-built project still loads the unpatched dll until it is rebuilt.

There is also no advisory about signing: changing a strong-named assembly invalidates its strong-name signature, and an Authenticode signature if present. I found no mention of either in the crawler or in patch/sidecars/nuget.rs (which handles .nupkg.metadata and warns about .nupkg.sha512).

Why this matters

For .NET a patch always changes a compiled dll. A user who applies and then runs without rebuilding is still vulnerable, with no signal. Strong names are common: all 32 dlls in five releases of four widely used packages I inspected (Newtonsoft.Json, Serilog, Humanizer.Core, Polly) were strong-named.

Suggested direction

  1. After patching a NuGet package, look for copies of the patched dlls under the project's output directories and report them (an advisory such as "rebuild required: N stale copies"), and withhold a VEX attestation while stale copies exist, the way stale copies are treated for other ecosystems.
  2. An advisory when a patched assembly is strong-named or Authenticode-signed, saying the signature no longer verifies and on which runtimes that matters.
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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions