Skip to content
Code & CI · Secret guide

Leaked NuGet Feed Password: what to do in the first hour

Medium severityDetected onlyLast verified · 5 min read

A NuGet feed password is the credential saved in a NuGet.Config file so that the .NET tooling can sign in to a private package feed. It is not a NuGet.org secret: the feed can be hosted by Azure DevOps, GitHub Packages, JFrog Artifactory, ProGet, MyGet or another server, and the password is issued by that host. Whoever holds it can usually restore your private packages and, if the account may publish, push new versions that your builds will then install. Rotate the credential at the feed host first, then check what was downloaded or published.

Check your GitHub account for leaked secrets — free

Provider
NuGet
Severity
Medium
Impact
SaaS account access and billing
Checked live by LeakWatch
No

What a NuGet Feed Password looks like

There is no fixed token format here. The secret sits in the credentials block of a NuGet configuration file, under the name of the feed, as a key and value pair:

<packageSourceCredentials>
  <MyFeed>
    <add key="Username" value="XXXX" />
    <add key="ClearTextPassword" value="…" />
  </MyFeed>
</packageSourceCredentials>

The key is called ClearTextPassword when the value is stored as plain text, or Password when NuGet encrypted it. The encryption is tied to the machine and user account on Windows, and it does not protect a file copied elsewhere in a way you can rely on. The password itself may be a personal access token from the host, an API key or a real account password, so its look depends on the feed. The same files appear as NuGet.Config, nuget.config or NuGet.config in a repository root, a solution folder or the user profile. Do not mix it up with a NuGet.org API key used to push packages, which is a separate secret that is not configured here.

How NuGet Feed Passwords get leaked

  • A committed config file. A NuGet.Config in the repository root that holds the credentials block, added so that colleagues and CI can restore packages.
  • Docker build context. A config file copied into an image build, and left in a layer or a public image.
  • CI templates. A pipeline that writes the credentials into the file with a command and then archives the working folder as a build artifact.
  • Copied home folders. A backup or dotfiles repository containing the user-level configuration from the profile folder.
  • Shared samples. A config pasted into an issue, a forum post or a question about a restore failure, with the real values left in.

What to do in the first hour

  1. Find the feed host. Read the source URL in the config and identify who issues the credential. The place to revoke it is the host, not NuGet.
  2. Rotate the credential. Sign in to the feed host (see the link below), open the page where tokens or passwords are managed, and revoke or regenerate the one that leaked. If it was a real account password, change it and review sign-in sessions.
  3. Deploy the new value through your CI secret store or an environment variable, not inside the file. Test a restore.
  4. Check activity. Use the feed’s audit or download history for the period since the exposure. Look for restores from addresses you do not know, and for new versions of packages you publish.
  5. Check packages. If the account could publish, compare recent versions with your build records. Remove or deprecate anything you did not push, and rebuild from clean sources.
  6. Review permissions. Make sure the account used by CI can only read, and that publishing uses a separate, narrower credential.
  7. Clean up the code. Remove the credentials block, and refer to feed credentials by environment variable. See I accidentally pushed an API key to GitHub.

Not sure what else leaked from the same repository? Run a free scan.

Not sure what else leaked? Run a free scan.

Revoke it at NuGet

Because the password belongs to your feed host, revoking it means opening the credentials or tokens page of that host’s account settings and revoking the one used in the config. This guide cannot name a single page for every host, and no console link has been confirmed for it. A person has not confirmed the exact menu wording for any host, and the interface can change, so look for the section where personal access tokens, API keys or feed credentials are listed, and follow your feed host’s documentation. The public NuGet gallery has no part in it unless that is your feed.

How LeakWatch detects it

The rule is called NuGet Config Password. It looks for an XML element of the form add with a key attribute named Password or ClearTextPassword (in any letter case), followed by a value attribute of at least eight characters in double quotes, and a closing />. The text <add key= is needed for the file to be considered at all. A value shorter than eight characters, single-quoted attributes, or a username entry is not reported, and neither is a value split over several lines. Encrypted passwords are reported too, as the rule cannot tell them from plain text. The severity is medium. This type is not checked live: LeakWatch does not send any request to a feed with the value it found.

LeakWatch detects this format but does not check it live: it can tell you the key is exposed, not whether it still works. Assume it does until you have revoked it.

FAQ

Is an encrypted Password value safe to leave in the repository?

No. The encryption is tied to a machine and a user, which is no guarantee for a copied file. Treat it as exposed and rotate the credential.

Does this give access to NuGet.org?

Not by itself. The credentials block belongs to the feed named in the source URL. A NuGet.org push key is a different secret and is not stored there.

How should the file be set up instead?

Keep the feed address in the file, and supply the credential from an environment variable or a secret store in CI, so that no password is ever committed.

Get alerted next time a secret leaks — create a free account

LeakWatch is not affiliated with NuGet.