BreachHunter
Pricing Blog Log inSign up
● thermal huntscan engines onlineassessment only — no exploits
  1. Home
  2. Blog
  3. Exposed AWS Credentials File: The /.aws/credentials Finding, Explained

Guides · ← All guides

Exposed AWS Credentials File: The /.aws/credentials Finding, Explained

Published: November 14, 2026 · Last reviewed: November 14, 2026 · 7 min read

By the Ingenious AI team

The short answer: The file at ~/.aws/credentials holds AWS access keys — the master keys to a cloud account's storage, compute and billing. If your web server serves that file at /.aws/credentials, BreachHunter rates it CRITICAL (10 points, the table maximum), with the table's own words: “AWS credential files should never sit under a web root. A 200 here is a cloud-account takeover risk.” The remediation is not a config tweak: remove the file, and rotate — deactivate — the exposed keys in the AWS console, because a copied key works from anywhere on earth until it is switched off.

Run a free BreachHunter assessment on your site →

Most rows in the sensitive-paths table are about the website. This one is about everything behind the website: the storage buckets with the backups, the compute that can be spun up for mining at your expense, the whole account the keys command. Cloud keys are bearer instruments — whoever presents them is, to AWS, you.

This guide explains how a credentials file ends up under a document root (home-directory deployments, container images copied wholesale, archive uploads), what an attacker does in the first hour with working keys, and the prevention pattern — instance roles and environment-scoped keys — that means the file never needs to exist on the server at all.

How does an AWS credentials file get under a web root?

The common story is a deployment whose “project” boundary is drawn wrong: an application deployed from a home directory or a user account whose home the web server can reach; a sync that copies the developer's working folder — .aws included — to the server; a whole-disk backup or archive restored into the web tree. The file's normal home (a user's ~/.aws) and the web root were never supposed to intersect; misconfigured document roots and wholesale copies are how they do.

The probe costs an attacker nothing and runs constantly — /.aws/credentials sits in the standard sensitive-path lists alongside /.env and /.git/HEAD, which are precisely the rows the scanner checks as a set (the full family is in the assessment phases guide). Where .env offers the website's secrets, this file offers the account's: a different and larger incident, which the equal CRITICAL rating quietly understates.

The first hour with your keys, and the architecture that prevents it

With working keys, an attacker's playbook is automated: enumerate permissions, read storage buckets (backups, assets, data exports), and — if compute is allowed — launch mining capacity that bills to you until noticed. The defender's first hour mirrors it: deactivate the exposed key in IAM (deactivate first, delete after confirming nothing breaks), review the account's CloudTrail for the key's usage, then hunt for the persistence a careful intruder leaves behind — new users, new keys, new roles.

Prevention is architectural: servers should not hold long-lived keys at all. On AWS compute, an instance/task role gives the application temporary credentials minted by the platform; nothing sits in a file to leak. Where a key is unavoidable, scope it to the one service and bucket it needs, so a leak is a bucket incident rather than an account incident. The scanner's fix text is the floor — “remove the file and rotate the keys” — roles are the ceiling that makes the row un-reproducible.

Worked example: solsticetravel.example

Solstice Travel's site had been migrated from a developer's workstation backup two years earlier — a faithful copy of a home directory, restored under the web server's reach. The sensitive-path probe returned the table's gravest line:

GET /.aws/credentials -> 200
  [default]  aws_access_key_id = AKIA…  aws_secret_access_key = …
Finding: Exposed AWS credentials file — CRITICAL (-10)

The response ran as a cloud incident: the key deactivated in IAM within the hour, CloudTrail reviewed for the key's history (usage appeared to be only the agency's own migration scripts), the restored-home-directory tree purged from the server, and the application moved to an instance role so no key file exists to expose. The retest's clean 404 was the smallest part of the outcome; the real change is that Solstice's servers now hold no long-lived cloud keys at all.

The five actions to take

Answering a /.aws/credentials finding:

  1. Deactivate the exposed key in IAM immediately (deactivate, verify the app still runs on its replacement path, then delete).
  2. Review CloudTrail for the key's full usage history; hunt for created users, keys or roles you do not recognize.
  3. Remove the file and the whole misplaced tree from the server; find how it got there (sync, restore, home-dir deployment) and close that route.
  4. Move the application to an instance/task role or tightly scoped keys delivered via the environment — no credential files on disk.
  5. Re-scan the full sensitive-path set, and add cloud-key paths to your own deployment exclusion list.

Run a free BreachHunter assessment on your site →

Frequently asked questions

The keys were “read-only”. Is it still CRITICAL?

Read-only keys still read: buckets, backups, customer exports, the data whose exposure is the breach. The scanner cannot see your key's policy from outside — it reports the file class at its standard rating and the incident review establishes what the key could actually do.

How do we know if the keys were used by someone else?

CloudTrail records API calls per key: review the exposed key's activity for unfamiliar source IPs, regions and actions (especially IAM writes and large launches). Absence of strange activity is good news to verify, not to assume — which is why rotation happens regardless of what the log shows.

Why did our deploy include a home directory?

Usually a workstation backup used as the deployment source, or a sync tool pointed one directory too high. The fix is an allow-listed deploy artifact (only the app files, built by the pipeline) rather than a mirror of anyone's working folder — the same rule that keeps .env and .git out of the tree.

Are other clouds' credential files also probed?

The class generalizes — GCP service-account JSON, Azure publish profiles, SSH keys (see the .env guide for the rotation order and the sensitive-path family). The AWS file is the table's named row; treat any credential material under the web root as the same emergency.

Can a WAF rule blocking /.aws/ count as fixed?

It can be tonight's bandage, never the fix: the file remains one rule-edit away from exposure, and direct-to-origin requests may bypass the WAF entirely. Removal plus rotation plus roles is the fix; the rule is optional extra noise reduction.

Sources

The primary sources behind this guide — the documents we check our own work against:

  • AWS IAM best practices (2025) — least privilege, credential rotation and never embedding keys in code.
  • OWASP Web Security Testing Guide (2021) — configuration and deployment management testing.
Share this: X · Facebook · LinkedIn · WhatsApp

Related guides

  • Website Security Test: What It Checks, What It Misses, and How to Read Yours · 9 min read
  • Website Security Cheat Sheet: Headers, TLS, Cookies and Exposed Files · 7 min read
  • What a Website Security Assessment Actually Tests · 10 min read
  • TLS/SSL Basics: What Your Certificate Says About Your Site · 8 min read
  • Common Website Misconfigurations (and How to Fix Them) · 11 min read
  • Reading Your First Pentest Report: From Score to Action · 9 min read
  • Deleted ≠ Gone: What the Wayback Machine Keeps After You Delete Your Secrets · 9 min read
  • SQL Injection in Plain English: How One Login Box Can Read Your Database · 9 min read
  • What Does a Website Security Scan Check? · 8 min read
  • Exposed .git Directory: What It Leaks and How to Check · 7 min read
  • Security Headers Missing? What Each Header Stops · 7 min read
  • How Much Does a Penetration Test Cost in 2026? · 7 min read
  • Website Security Checklist for Small Teams (60-second self-check) · 6 min read
  • Reading Your Scan Results: Which Findings Fix First? · 7 min read
  • Content-Security-Policy Missing: What CSP Does and How to Add It Safely · 8 min read
  • HSTS Missing: What Strict-Transport-Security Prevents · 7 min read
  • Clickjacking and X-Frame-Options: How Framing Attacks Work · 7 min read
  • Cookie Flags Explained: Secure, HttpOnly and SameSite · 8 min read
  • Exposed .env File: What Leaks, What Attackers Do Next, What You Do First · 8 min read
  • Directory Listing Enabled: What It Shows Attackers and How to Disable It · 7 min read
  • Mixed Content: Why Your HTTPS Page Still Loads Insecure Resources · 7 min read
  • Expired SSL Certificate: What Breaks, Why Renewal Fails, and How to Catch It Early · 7 min read
  • TLS 1.0 and 1.1 Still Enabled: Why Old Protocols Show Up as a Finding · 7 min read
  • Open Ports on a Web Server: Which Ones Should Never Face the Internet · 8 min read
  • No SPF or DMARC Record: How Missing Email Auth Exposes Your Website · 7 min read
  • Subdomain Takeover: How a Dangling DNS Record Lets Attackers Claim Your Name · 7 min read
  • Forgotten Subdomains: The Staging Site You Forgot Is Still Public · 7 min read
  • WordPress Security Scan: The Exposures an Assessment Finds on WordPress Sites · 8 min read
  • Exposed Backup Files: .bak, .old and .zip Files Sitting in Your Web Root · 7 min read
  • phpinfo() in Production: The Diagnostic Page That Maps Your Server for Attackers · 7 min read
  • Server Version Banners: Why Your Headers Point Attackers to the Right Exploit · 7 min read
  • End-of-Life Software: Running a Server Stack Nobody Patches Anymore · 7 min read
  • CORS Misconfiguration: When Cross-Origin Sharing Opens Your Data to Any Site · 7 min read
  • Open Redirect Vulnerability: How Your Own Domain Sends Visitors to a Phishing Page · 7 min read
  • Dangerous HTTP Methods: What TRACE, PUT and DELETE Should Never Answer · 7 min read
  • Host Header Injection: Poisoned Reset Links and Cache Attacks Explained · 7 min read
  • What Is security.txt? The Small File That Lets Researchers Reach You · 6 min read
  • Admin Panel Exposed to the Internet: What an Assessment Flags and Why · 7 min read
  • phpMyAdmin Exposed: Why This Database Door Is a Prime Brute-Force Target · 7 min read
  • Spring Boot Actuator Exposed: Environment Dumps, Heap Leaks and Shutdown Endpoints · 7 min read
  • Debug Console in Production: The Finding That Can Become Code Execution · 7 min read
  • Referrer-Policy and Permissions-Policy: The Two Quiet Headers You Are Probably Missing · 6 min read
  • Exposed package.json: Your Dependency List Is a Recon Gift · 6 min read
  • DNS Zone Transfer Open (AXFR): Handing Out Your Entire DNS Map · 6 min read
  • Certificate Name Mismatch: Why the Cert Does Not Match Your Domain · 6 min read
  • Website Security Assessments for Agencies: Checking Every Client Site Without a Security Team · 8 min read
  • SaaS Security Questionnaires: What Buyers Check About Your Website First · 8 min read
  • Ecommerce Website Security: The Exposures That Put Your Checkout at Risk · 8 min read
  • Small Business Website Security: The Checks That Matter at Your Size · 7 min read
  • How to Prepare for a Website Security Assessment (and Read the Report Calmly) · 7 min read
  • Vulnerability Severity Explained: What Critical, High, Medium and Low Actually Mean · 7 min read
  • Retest After Fixes: How to Prove a Security Finding Is Actually Closed · 7 min read
  • Security Assessment vs Vulnerability Scan vs Pentest: What Is the Difference? · 7 min read
  • How Long Does a Website Security Scan Take? · 6 min read
  • Website Security Drift: Why Last Month's Clean Scan Is Already Out of Date · 7 min read
  • WordPress Site Keeps Getting Hacked After Cleanup · 8 min read
  • Google Blacklist Removal: Getting the Red Warning Off Your Site · 8 min read
  • VirusTotal Flagged My Site: How to Clear a False Positive · 8 min read

Related from the Ingenious AI suite

  • Ingenious AI — the full suite of security and compliance tools
  • DomainGuard — domain impersonation and typosquat defense
  • See BreachHunter pricing →
BreachHunter · by Ingenious AI · read-only security assessment — scan only targets you own or are authorized to test
About · Contact · Blog · vs Intruder · Privacy · Terms · Security · Threats · Nextcloud Check · Verify Evidence · Help · Redeem
More from Ingenious AI:
DisclosureGuard — AI disclosure compliance · Vibe-Code Audit — AI code security scanner · Rogue-Agent Defense — AI agent firewall · ChatBreaker — AI chatbot red-teaming · ModelMinder — AI model deprecation radar · TermsWatch — AI vendor terms monitor · Agent Flight Recorder — tamper-evident agent audit trails · Agent Auth Gateway — agent credentials & kill switch · DomainGuard — domain impersonation defense · Agent Passport — Know-Your-Agent registry · AgentGate — agent policy publisher · AgentBlock — AI agent & crawler access control · BoundaryVault — agent log forensics · Agentic Receipts — verifiable agent payment receipts · EvalEgress — eval-to-production exposure scan · HomeShield MCP — home AI server exposure check · WireWatch — payment verification ceremony · ADMT Notice Kit — AI decision notice compliance · DueLadder — human-approved invoice chasing · Agent-Ready Store Audit — can AI agents buy from your store · ContentCraft AI — content operations · AgentReady — agent-readiness checks · AI Audit Exchange — AI audit exchange · CallbackShield — callback & webhook protection · CompanionGuard — AI companion safety guardrails · CRAClock — EU Cyber Resilience Act deadline clock · EInvoice Translator — e-invoice format translator · GEOFixer — geo & local listing fixes · MandateGuard — agent spending mandates · OutcomeMeter — AI outcome measurement · ProvenanceGuard — content provenance checks · ReviewDesk — review response desk · ReviewProof — verified review evidence · TakedownCoop — coordinated phishing takedowns · TrustGate — trust & safety gating · BreachHunter — website penetration testing · All 36 platforms — the Ingenious AI portfolio

We use cookies. Necessary cookies keep the site working. With your permission we also use analytics cookies (to understand usage) and marketing cookies (for ads). Read our privacy policy.

NecessaryRequired for login, security and core features. Always on.
AnalyticsHelps us understand which pages are useful.
MarketingUsed for advertising and measuring ad performance.

    No match. Try “pricing”, “php2shell” or “contact” — or press Esc to close.

    ↑↓ navigate · Enter open · Esc close