Blog | G5 Cyber Security

Nuget Package Upload Security

TL;DR

Uploading packages to Nuget can be risky if not done correctly. This guide shows you how to check for common vulnerabilities and improve your security.

Checking for Nuget Package Upload Vulnerabilities

  1. Understand the Risks
  • Verify Package Source
  • Always confirm the package source before installing. Check the author and repository URL on the Nuget website.

  • Check for Package Signing
  • dotnet nuget list --allversions 
  • Review Package Dependencies
  • Implement NuGet Configuration Best Practices
  • <packageSources>
      <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
      <add key="MyInternalFeed" value="http://internalfeedurl" protocolVersion="3" />
    </packageSources>
  • Enable Two-Factor Authentication (2FA)
  • Protect your Nuget account with 2FA for an extra layer of security.

  • Regularly Audit Your Published Packages
  • Use Dependency Analysis Tools
  • Tools like Snyk or Sonatype Nexus Lifecycle can automatically scan your dependencies for known vulnerabilities.

  • Consider a Private Nuget Feed
  • For internal packages, using a private feed (e.g., Azure Artifacts, Artifactory) gives you more control and security.

    Exit mobile version