National Cyber Warfare Foundation (NCWF)login

aws-vault for keeping AWS credentials out of your plaintext config


0 user ratings
2026-11-01 17:24:21
milo
Red Team (CNA)
"aws-vault

aws-vault is a Go CLI that stores AWS IAM credentials in the OS secure keystore and issues short-lived STS tokens for shells and SDKs, built for developers and authorized cloud teams.








ToolByteNess/aws-vault — maintained fork of the 99designs classic that stores AWS credentials in OS keystores and brokers temporary STS credentials
Primary UseWrapping daily aws CLI and SDK workflows so long-term keys never sit in ~/.aws/credentials, with exec, login, and --server modes
Primary UseRunning aws-vault exec to expose short-lived GetSessionToken/AssumeRole credentials to shells, scripts, and SDKs during authorized cloud development and administration.
Safe UseIntended for developers and authorized security professionals managing their own AWS accounts, lab environments, and sanctioned assessments — it is a defensive hygiene tool, not an attack utility.
Telemetry NoteGenerates auditable STS GetSessionToken/AssumeRole calls visible in AWS CloudTrail, and sets AWS_VAULT= in child environments — defenders can correlate session activity to named vault profiles.

aws-vault in its ByteNess incarnation is the maintained continuation of the widely deployed 99designs/aws-vault project, which the README explicitly describes as abandoned. The premise is simple and remains one of the most practical pieces of credential hygiene available to anyone working with AWS: long-lived IAM access keys should never live in plaintext files like ~/.aws/credentials, and every process that touches AWS should instead receive short-lived, scoped credentials. The tool achieves this by storing your permanent keys inside the operating system's secure keystore and brokering temporary credentials from Amazon's STS service on demand. At roughly 448 stars and written in Go under an MIT license, it is a serious community continuation rather than a rewrite.


The architecture is worth understanding because it explains both the security benefit and the operational quirks. aws-vault is profile-aware: it parses your existing ~/.aws/config, understands source_profile and role_arn chains, and layers its own keystore on top. When you run aws-vault exec , the binary retrieves the master credentials from the backend keystore, optionally performs an MFA challenge against the mfa_serial you configured, calls either GetSessionToken or AssumeRole, and then injects the resulting temporary credentials into the child process environment. Your permanent keys never touch environment variables, process arguments, or disk-cached plaintext.


The vaulting backend layer is one of the more mature parts of the codebase, and the README documents the selection order in detail. By default the tool picks the first available backend per platform: wincred on Windows, keychain on macOS, and secret-service on Linux when a compatible service exists. Linux fallback proceeds through kwallet, keyctl, pass, passage, and finally file, which is the least-preferred option for obvious reasons — a file backend is only marginally better than plaintext. 1Password and Proton Pass backends are opt-in and must be selected explicitly with the --backend flag or the AWS_VAULT_BACKEND environment variable. This breadth matters operationally because it lets a security team standardize on whichever secrets store they already mandate.


Credential delivery to sub-processes happens in two modes, and the difference is meaningful. The default writes environment variables such as AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_SESSION_TOKEN, and AWS_CREDENTIAL_EXPIRATION into the child. If the profile's account can be inferred from role_arn, sso_account_id, or aws_account_id, AWS_ACCOUNT_ID is exposed too — a nice touch for audit tooling that wants to log which account it is touching. The alternative, enabled with aws-vault exec --server, starts a local metadata server and points the AWS SDKs at it via AWS_CONTAINER_CREDENTIALS_FULL_URI and AWS_CONTAINER_AUTHORIZATION_TOKEN, allowing automatic refresh and therefore much shorter session lifetimes.


The role-chaining and MFA behavior is documented with unusual honesty in a matrix near the end of the README, and it repays careful reading. A plain aws-vault exec yields a session-token with MFA, cached as a session-token. Adding --no-session skips the GetSessionToken layer and uses long-term credentials directly for the role assumption — faster, but trades away the MFA-enforced session cache for certain role configurations. The --duration=2h flag extends role sessions, and chained profiles like the example bar-role2 demonstrate session-token plus double-role assumptions. Understanding which layer is cached, and whether MFA was actually exercised, is essential when you're relying on this tool as part of a compliance posture.


Installation is unremarkable and well-distributed: brew install aws-vault on macOS, choco install aws-vault on Windows, nix-env -iA nixos.aws-vault on NixOS, or a prebuilt release binary from GitHub. The first-run workflow is aws-vault add , which interactively captures the access key, secret, and optionally the MFA device ARN before committing them to the keystore. From there, aws-vault exec -- runs any command with ephemeral credentials, aws-vault login federates into the AWS Console in a browser, aws-vault list inventories stored profiles, and a bare aws-vault exec spawns a fully credentialed subshell.


A newer convenience introduced since v7.3+ is auto-logout: the --auto-logout or -a flag on aws-vault login attempts to terminate any existing console session before issuing a new federated login. This closes a real gap — previously, repeated login invocations could stack browser sessions across profiles, which is precisely the kind of credential bleed the tool exists to prevent. Anyone administering multiple accounts in one browser should treat this flag as default behavior in their shell aliases.


From a defensive-analysis perspective, this is a tool you want to see on developer workstations, not one you hunt for. Its observable footprint in AWS is entirely legitimate: STS calls in CloudTrail from developer egress IPs, with session durations capped short. The AWS_VAULT= environment variable it injects makes attribution easier, not harder. Conversely, the presence of a long-lived access key in a plaintext ~/.aws/credentials file on a machine that also has aws-vault installed suggests someone bypassed the tool — a small but useful signal for endpoint hygiene reviews.


The Go implementation details revealed in the development section also merit a note: macOS release builds are code-signed specifically to avoid spurious Keychain access prompts, and you can verify that with codesign --verify --verbose $(which aws-vault). Anyone building from source can self-sign via Keychain Access's Certificate Assistant. This is the kind of supply-chain attentiveness you want in a tool whose entire job is guarding your root credentials.


For authorized security professionals, aws-vault fits naturally into cloud security assessments and internal hardening programs alike. Consultants working across many client AWS accounts get per-profile isolation with MFA enforcement rather than a folder of exported keys; internal teams get a way to enforce role-based access delegation consistent with AWS's own IAM best practices, which the README references directly. The obvious caveats are the ones the README itself implies: the file backend offers minimal protection, --no-session mode weakens the MFA story for some chains, and --duration=2h extends exposure windows. Used with the defaults, though, it converts the most commonly leaked secret in cloud environments — the static AWS key — into a short-lived artifact, which is exactly the kind of risk-reduction engineering this publication exists to highlight.



Official project repository for ByteNess/aws-vault.

Download Tool

Educational analysis for authorized security professionals. Use only in controlled, authorized environments.






Source: OffensiveSec
Source Link: https://www.offsecblog.com/2026/11/aws-vault-for-keeping-aws-credentials.html


Comments
new comment
Nobody has commented yet. Will you be the first?
 
Forum
Red Team (CNA)



Copyright 2012 through 2026 - National Cyber Warfare Foundation - All rights reserved worldwide.