Join our Newsletter — 33% off our NHI Course
Home› Guides› How to Find Plaintext Credential Files on Developer…
Guide Secrets Management

How to Find Plaintext Credential Files on Developer Laptops: Locations, Audit Method and Safer Storage

PDF for newsletter subscribers · free to read online

← All guides
By NHI Mgmt Group, edited by Lalit Choda Updated 13 November 2026 14 min read
On this page

Developer laptops hold long-lived cloud keys, registry tokens and cluster credentials in well-known plaintext files, and infostealers read those paths first. The command line tools that engineers use every day (AWS CLI, npm, Docker, kubectl, gcloud, Azure CLI, Git, GitHub CLI, Twine) each have a default place where they keep a credential, and several of those places are plain files protected only by file permissions. This guide is an audit how-to: where each file lives, what a finding looks like, how to scan a fleet without collecting secret values, how to move each tool to a safer store, and how to detect unexpected reads. It is written for endpoint, platform and security engineering teams. For what to do once a laptop is known to be compromised, use the response playbook linked below; this page is about finding and removing the exposure before that happens.

Key takeaways

  • The paths are documented and predictable. ~/.aws/credentials, ~/.npmrc, ~/.docker/config.json, ~/.kube/config, ~/.git-credentials and ~/.pypirc are named in the tools' own documentation, which is why credential-stealing malware targets them.
  • Several vendors say plainly that the file is plaintext. AWS calls its shared files "plaintext files", Git warns its store helper keeps passwords "unencrypted on disk", the PyPA warns that .pypirc "stores your password in plain text", and Microsoft states the Azure CLI token cache is plaintext on Linux and macOS.
  • Audit for presence and type, never collect values. A fleet scan should report which files exist, which credential types they contain and their age, so the scan itself does not become a new secret store.
  • Every tool has a safer mode. OS keychains through credential helpers, short-lived federated sessions (IAM Identity Center, OIDC cluster sign-in), and environment references replace most long-lived file secrets.
  • Measure the trend, not one scan. Track hosts with long-lived cloud keys, unscoped or plaintext registry tokens and static kubeconfig tokens over time, and alert on reads of these paths by unexpected processes.

Why these files matter

A developer laptop is where human identity and machine identity meet. The engineer signs in with phishing-resistant MFA, then a CLI writes a token that works without MFA until it expires or is revoked. ATT&CK tracks this as T1552.001 Unsecured Credentials: Credentials In Files and T1552.004 Private Keys, and the related T1555 Credentials from Password Stores covers theft from keychains and credential managers. Infostealer families and malicious packages harvest exactly these locations: the ChainDrop npm worm collected npm tokens, GitHub tokens, AWS, Google Cloud and Azure credentials, Kubernetes tokens, Docker configuration and SSH keys from developer machines and CI runners, along with credential files for AI coding tools.

The exposure is also about what the token can reach. In the LastPass 2022 breach a senior DevOps engineer's home computer was compromised and the attacker used AWS access keys and backup decryption keys reached from that engineer's access to copy cloud backups. One endpoint, one set of machine credentials, a large blast radius. See the Developer endpoints as NHI stores guide for the wider argument, and the Infostealer Threat Guide for how stealer malware operates.

Where each tool stores credentials

The table lists default locations from each tool's own documentation. Environment variables can move a file, so an audit should also check them.

ToolDefault locationWhat can be in itOverride
AWS CLI and SDKs~/.aws/credentials and ~/.aws/config (Windows: %UserProfile%\.aws\); SSO tokens in ~/.aws/sso/cache; assumed-role credentials in ~/.aws/cli/cacheaws_access_key_id, aws_secret_access_key, aws_session_token, or a credential_process commandAWS_SHARED_CREDENTIALS_FILE, AWS_CONFIG_FILE
npmPer-user ~/.npmrc; per-project .npmrc in the repository root; global $PREFIX/etc/npmrc_authToken, _auth, username and _password, client certfile and keyfileuserconfig and globalconfig parameters
Docker CLI$HOME/.docker/config.json (Windows: %USERPROFILE%/.docker/config.json)Base64-encoded registry credentials when no credential store is configured; otherwise credsStore or credHelpers entries naming a helperDocker config directory settings
kubectl$HOME/.kube/configBearer tokens, embedded client certificates and keys, or exec plugin commands that fetch a tokenKUBECONFIG variable, --kubeconfig flag
Google Cloud ADC$HOME/.config/gcloud/application_default_credentials.json (Windows: %APPDATA%\gcloud\)User refresh credentials from gcloud auth application-default login; elsewhere, service account key filesGOOGLE_APPLICATION_CREDENTIALS points to a key or federation config file
Azure CLIFiles under ~/.azureMSAL token cache and service principal entries: encrypted on Windows, plaintext on Linux and macOS according to MicrosoftAZURE_CONFIG_DIR
Git~/.git-credentials or $XDG_CONFIG_HOME/git/credentials (default ~/.config/git/credentials) when the store helper is usedOne URL per line with user name and password or token--file option of the helper
GitHub CLISystem credential store by default; a plain text file if no store is available or --insecure-storage is used (gh auth status shows where)OAuth token or personal access tokenGH_TOKEN environment variable
Python packaging (Twine)$HOME/.pypircusername = __token__ and a PyPI API token as passwordKeyring or environment variables
Terraform CLICLI configuration (.terraformrc in the home directory, terraform.rc in %APPDATA% on Windows) and the file terraform login writesAPI tokens in credentials blocksTF_TOKEN_ variables, credentials_helper

Beyond the table, an audit usually also covers SSH private keys in ~/.ssh (see the SSH Key Management Guide), .env files in working copies, shell history files that captured a token typed on the command line, and the credential files of AI coding assistants, which the ChainDrop write-up shows are now on stealer target lists.

What a finding looks like, and how serious it is

Not every file is equally risky. A file that holds a pointer to a keychain helper is fine; a file that holds a permanent key to production is not. Grade findings so the remediation queue starts with the worst.

FindingSeverityWhy
~/.aws/credentials with an access key ID starting AKIA (long-term IAM user key)CriticalWorks from anywhere until rotated; no MFA on use. AWS recommends federation such as IAM Identity Center instead.
Service account key JSON on disk, or GOOGLE_APPLICATION_CREDENTIALS pointing to oneCriticalGoogle states service account keys "create a security risk and are not recommended".
Unscoped _authToken in .npmrc, or a publish-capable tokenHighnpm documents an unscoped token as a "bad config"; publish rights enable a supply chain attack.
kubeconfig with a static token or client-key-data for a production clusterHighStatic cluster credentials outlive the user's IdP session and bypass its policies.
~/.git-credentials or .pypirc with a tokenHighPlaintext by design, as the Git and PyPA docs state.
auths entries with an auth value in ~/.docker/config.jsonMedium to highBase64 is encoding, not encryption; severity depends on registry push rights.
Azure CLI token cache on Linux or macOSMediumTokens expire, but refresh tokens extend the window; treat as session theft risk.
AWS SSO cache, credential_process, Docker credsStore, kubeconfig exec pluginLow (expected)Short-lived or keychain-backed. Still check file permissions and session length.

How to audit a fleet safely

The audit must not create a new honeypot. Design it so that no secret value ever leaves the endpoint.

  • Collect metadata only: path, owner, permission bits, size, modification time, and a classification label (for example "AWS long-term key present", "npm token unscoped"). Classify on the endpoint with pattern checks, then discard the matched text.
  • Use the tooling you already trust: an EDR live query, an MDM script with read-only rights, or an osquery-style file table. Avoid ad hoc scripts that upload file contents to a share.
  • Cover every user profile: laptops often hold old profiles, WSL distributions and dev containers with their own home directories. Include /home/*, /Users/*, C:\Users\* and WSL file systems in scope.
  • Check environment and shell configuration: exported AWS_ACCESS_KEY_ID, GH_TOKEN, NPM_TOKEN or TF_TOKEN_* lines in .zshrc, .bashrc or PowerShell profiles are the same exposure in a different file.
  • Check permissions as a secondary finding: a credential file readable by group or others (anything looser than 600 on Unix) is worse; the PyPA guidance explicitly recommends chmod 600 ~/.pypirc.
  • Record the owner and team: remediation is a conversation with an engineer, so the finding must route to a person, not just a hostname.
  • Handle the data as sensitive: even metadata reveals which hosts hold production access. Restrict the results to the security team and set a retention period.

Pair the endpoint scan with repository and pipeline scanning, because the same tokens leak into commits and CI logs. See the Developer Secret Scanning Triage guide.

Moving each tool to a safer store

For each finding there is a documented safer configuration. The aim is short-lived credentials obtained from the identity provider, or long-lived ones held in an OS keychain behind the user's login.

ToolReplaceWith
AWS CLILong-term keys in ~/.aws/credentialsIAM Identity Center profiles with aws sso login (temporary role credentials), or credential_process calling a vault or keychain. See the AWS Access Keys Security Guide.
npmPlaintext _authToken in ~/.npmrcA registry-scoped entry using ${VARIABLE} substitution filled from a secrets tool at run time, read-only tokens for installs, and trusted publishing from CI instead of laptop publishing. See the npm Tokens Security Guide.
DockerBase64 auths in config.jsoncredsStore set to osxkeychain, wincred, pass or secretservice, or per-registry credHelpers. See the Docker Desktop Security guide.
kubectlStatic tokens and client keysAn exec credential plugin that obtains short-lived tokens through the IdP or cloud provider sign-in. Only accept kubeconfig files from trusted sources, as the Kubernetes docs warn a crafted file can run code.
Google CloudService account key filesUser ADC from gcloud auth application-default login for local development and service account impersonation where a service identity is needed.
Gitcredential.helper storeAn OS-integrated helper (macOS Keychain, Windows Credential Manager, libsecret) or git-credential-cache, as the Git docs suggest, and SSH or signed commits with hardware-backed keys.
GitHub CLIPlain text token fileDefault system credential store; remove --insecure-storage from onboarding scripts.
Twine and PyPIToken in .pypircKeyring storage, and trusted publishing from CI. See the PyPI API Tokens and Trusted Publishing Security Guide.
TerraformTokens in CLI configurationA credentials_helper, or TF_TOKEN_ variables injected for the session.

Choosing between options

  • Federated short-lived session vs keychain: prefer federation whenever the platform supports it, because a stolen token expires and access follows the IdP's conditional access. Use a keychain where only a static token exists (many package registries), since the keychain at least ties access to the logged-in user.
  • Keychain vs environment injection: environment variables are visible to every child process and often end up in shell history or crash dumps. Inject per command (a secrets tool that wraps the command) rather than exporting in shell profiles.
  • Small organisations: start with AWS federation, Docker and Git credential helpers, and a ban on publish tokens on laptops. That removes most critical findings with little tooling.
  • Large organisations: manage developer CLI configuration centrally (MDM-delivered config, golden dev container images), and make the endpoint scan part of device compliance so a laptop with a long-lived production key fails posture. See the Device Trust and Posture Guide.

Implementation: a phased rollout

  1. Baseline (weeks 1 to 2): run the metadata-only scan on a pilot ring of volunteer engineers across macOS, Windows and Linux. Validate classifiers against known test files so the counts are trustworthy.
  2. Fix the criticals (weeks 2 to 4): for each long-lived cloud key or service account key, the owner rotates and deletes it, and switches to federation. Revoke at the provider; deleting the local file alone leaves the key valid.
  3. Change defaults (weeks 3 to 6): ship managed configuration: Docker credsStore, Git OS helper, AWS SSO profiles, kubeconfig exec plugins. Update onboarding documentation and scripts so new laptops start clean.
  4. Widen to the fleet (weeks 6 to 10): extend the scan to all engineering endpoints, then to everyone with CLI access to production (data, SRE, support).
  5. Enforce (after 10 weeks): add "no long-lived production credential files" as a device compliance condition in report-only mode first, then block access from non-compliant devices to sensitive applications.
  6. Roll back safely: keep the previous credential path documented for each tool during the switch, and do not revoke a team's old key until its federated profile has been used successfully. If a helper breaks builds, revert the managed configuration for that ring, not the whole fleet.

Detection and measurement

What to watch

  • Unexpected readers: EDR file-access telemetry on the paths in the first table, alerting when a process other than the owning tool (for example anything other than aws, kubectl, docker, an IDE or the shell) opens them, especially processes started from download or temp folders, package install scripts and browser child processes.
  • Bulk access: one process touching several credential paths within seconds is a stealer pattern, regardless of the binary name.
  • Use from unusual locations: on the provider side, alert when a key or token tied to a laptop user is used from an IP, ASN or country outside the norm (CloudTrail, Google Cloud audit logs, Entra sign-in logs, npm and GitHub audit logs).
  • Stealer intelligence: monitor for your domains and tokens in infostealer log feeds. See the Infostealer Logs Monitoring and Response Guide.

Metrics

MetricTarget direction
Endpoints with long-lived cloud keys or service account key filesDown to zero for production accounts
Endpoints with plaintext or unscoped registry tokens (npm, PyPI, Docker auths)Down quarter on quarter
kubeconfig contexts using static tokens or client keys for production clustersZero
Median age of credential files foundDown; old files signal abandoned keys
Time from finding to revocation at the provider for critical findingsUnder 5 working days
Share of engineering endpoints covered by the scan in the last 30 daysAbove 95 percent

Common failure patterns

  • Deleting the file, not the credential: a key copied by a stealer last month still works. Rotation and revocation happen at the provider, then the file is removed.
  • A scan that uploads secrets: collecting file contents "for triage" builds a central store of every engineer's keys. Classify on the device and ship labels only.
  • Ignoring per-project files: scanning only home directories misses .npmrc and .env files committed or left in working copies, which also leak through repositories and container builds.
  • Forgetting secondary environments: WSL, dev containers, virtual machines and old user profiles each have their own ~/.aws and ~/.kube.
  • Publishing from laptops: a publish-capable registry token on an engineer's laptop turns one infostealer infection into a supply chain incident, as the npm worm cases show. Publish from CI with trusted publishing instead. See the Shai-Hulud npm Worm Guide.
  • Treating encoding as protection: base64 in Docker config.json and file permissions on Linux and macOS stop casual browsing, not malware running as the user.

Framework mapping

FrameworkReferenceHow it applies
MITRE ATT&CKT1552.001 Credentials In Files; T1552.004 Private Keys; T1555 Credentials from Password StoresThe techniques this audit reduces and the detection rules target
NIST SP 800-53 Rev 5IA-5(7) No Embedded Unencrypted Static Authenticators; IA-5 Authenticator Management; CM-6 Configuration SettingsRemoving plaintext authenticators and enforcing managed tool configuration
NIST CSF 2.0PR.AA-01; PR.DS-01; DE.CM-09Managed credentials for users and services, protecting data at rest, and monitoring endpoints
CIS Controls v8.1Control 3 Data Protection; Control 5 Account Management; Control 6 Access Control ManagementInventory and protection of sensitive data and credentials

Practitioner checklist

  • Build a metadata-only scan for the credential paths in this guide, including WSL, dev containers and every user profile.
  • Grade findings by credential type and reach, and route each one to its owner.
  • Revoke at the provider every long-lived cloud key and service account key found, then remove the file.
  • Move AWS to IAM Identity Center profiles and kubectl to exec plugin sign-in.
  • Ship managed Docker credsStore and Git OS credential helper configuration.
  • Remove publish-capable npm and PyPI tokens from laptops and publish from CI with trusted publishing.
  • Strip exported tokens from shell profiles and onboarding scripts, including --insecure-storage.
  • Alert on credential file reads by unexpected processes and on bulk access to several paths.
  • Report the six metrics monthly and add the condition to device compliance once the baseline is low.

Standards and references

Related NHI Mgmt Group resources: Compromised Developer Workstation Playbook · Developer endpoints as NHI stores · Developer Workstation and IDE Security Guide · Infostealer Threat Guide

PDF for subscribers

Take this guide with you

Every section, table and checklist in one PDF, with links to the sources and related guides. Subscribe to our weekly NHI & AI Identity Journal and we’ll email you a download link.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

NHIMG Editorial Note
Researched and written by the NHI Mgmt Group editorial team using AI tools, under the editorial direction of Lalit Choda. Facts are drawn from the sources listed on this page and checked by our automated quality process. Last updated 13 November 2026. Spotted an error? Use our contact page.
NHI Mgmt Group, the independent authority on Non-Human Identity, IAM and Agentic AI security. nhimg.org

PDF Downloads for Newsletter Subscribers

Get the guide

Enter your details and we’ll email you a download link.

The full guide is free to read online. The PDF is a thank you for subscribing.

Fill in all fields marked * and tick the PDF box to continue.