Trying Out Token Protection for aws login with AWS Credential Daemon

Trying Out Token Protection for aws login with AWS Credential Daemon

I stored the aws login token in a tpm backend using EC2 NitroTPM and confirmed the AWS CLI can receive short-lived credentials via credential_process. No credential strings turned up in ~/.aws, and local audit logs were verifiable.
2026.12.02

This page has been translated by machine translation. View original

Introduction

On December 1, 2026, the preview version of AWS Credential Daemon (credsd) was released.

https://aws.amazon.com/jp/about-aws/whats-new/2026/12/aws-credential-daemon/

According to the announcement, credsd is a daemon that stores AWS credentials and third-party secrets. The stored secrets are protected by hardware such as a TPM, and are never written to disk as plaintext files.

In this article, I confirmed that an aws login token can be stored in credsd and used from the AWS CLI via credential_process.

Test environment

  • Region: Tokyo (ap-northeast-1)
  • Instance: EC2 t4g.small
    • Boot mode: UEFI
    • TPM: NitroTPM (TpmSupport=v2.0)
  • OS: Amazon Linux 2023 (kernel 6.18.62-127.181.amzn2023.aarch64)
  • AMI: Re-registered from the official AL2023 arm64 AMI (al2023-ami-2023.12.20261127.0-kernel-6.18-arm64)
  • credsd, creds: 0.3.0 (credsd-linux-aarch64-tpm.tar.gz)
  • tpm2-tss: 4.0.2-1.amzn2023.0.1
  • AWS CLI: aws-cli/2.38.0
  • Storage backend: tpm
  • Execution user: root for installation, ec2-user from sign-in onward

TPM-enabled AMI

The official AL2023 AMI does not support TPM. To use NitroTPM, I copied its snapshot to my own account and used an AMI registered with --boot-mode uefi --tpm-support v2.0.

aws ec2 copy-snapshot \
  --source-region ap-northeast-1 \
  --source-snapshot-id <SNAPSHOT_ID>

aws ec2 register-image \
  --name <AMI_NAME> \
  --architecture arm64 \
  --virtualization-type hvm \
  --boot-mode uefi \
  --tpm-support v2.0 \
  --ena-support \
  --imds-support v2.0 \
  --root-device-name /dev/xvda \
  --block-device-mappings DeviceName=/dev/xvda,Ebs={SnapshotId=<COPIED_SNAPSHOT_ID>,VolumeSize=8,VolumeType=gp3,DeleteOnTermination=true}

I launched a t4g.small from this AMI and checked it with describe-instances; TpmSupport was v2.0.

aws ec2 describe-instances \
  --instance-ids <INSTANCE_ID> \
  --query 'Reservations[0].Instances[0].{Type:InstanceType,Boot:BootMode,Tpm:TpmSupport,State:State.Name,Imds:MetadataOptions.HttpTokens}' \
  --output json
{
    "Type": "t4g.small",
    "Boot": "uefi",
    "Tpm": "v2.0",
    "State": "running",
    "Imds": "required"
}

Installation

The tpm version of credsd uses the tpm2-tss library to access the TPM. On AL2023, install it with dnf.

dnf install -y tpm2-tss

I obtained the credsd archive from the v0.3.0 release on GitHub.

base=https://github.com/aws/credential-daemon/releases/download/v0.3.0
archive=credsd-linux-aarch64-tpm.tar.gz
curl -fsSLO "$base/$archive"

I also obtained the .sig file and verified the signature by following the Linux procedure in the official documentation.

https://docs.aws.amazon.com/cli/latest/userguide/getting-started-credsd-install.html

The standard gnupg2-minimal on AL2023 does not include gpg-agent, so I replaced it with gnupg2 and then verified with gpg --batch --verify.

dnf install -y --allowerasing gnupg2

After verification, I extracted the archive and placed credsd and creds in /usr/local/bin/.

tar xzf credsd-linux-aarch64-tpm.tar.gz
cd credsd-linux-aarch64-tpm
install -m 0755 credsd creds /usr/local/bin/

I ran credsd install and credsd status.

$ credsd install
credsd installed as a system service. It will start on demand.
$ credsd status
installed: true
running:   false
binary:    /usr/local/bin/credsd
args:      --storage-backend tpm serve --system
backend:   tpm
data dir:  /var/lib/credsd
socket:    /run/credsd/credsd.sock

Because credsd starts on the first connection to the socket, it shows running: false right after installation.

I installed tpm2-tss on an already-running instance, so I re-applied the udev rules to set /dev/tpmrm0 to root:tss with mode 0660, and restarted the socket.

I used this owner and mode because credsd.service runs as the user credsd with the supplementary group tss. Before re-applying, it was crw-------. root root, and afterward it was crw-rw----. root tss.

udevadm trigger --action=add --subsystem-match=tpmrm
udevadm settle
systemctl reset-failed credsd.service credsd.socket
systemctl restart credsd.socket

After running creds list as ec2-user to connect to the socket, I checked credsd status as root, and the daemon was running.

$ creds list
No credentials configured. Run 'creds bootstrap' to get started.
$ credsd status
running:   true

/var/log/credsd/credsd.log recorded a line showing that the key was loaded from the tpm backend.

2026-12-02T09:06:38.468261Z  INFO encryption key loaded backend="tpm"

Storing credentials

I obtain the aws login token with creds bootstrap and store it. If the browser is not on the same machine (for example, over SSH), add --remote. I ran the following command as ec2-user.

creds bootstrap --credential verify aws-login --region ap-northeast-1 --remote

A URL and a prompt for entering a code were displayed.

Open this URL in a browser on any machine to complete login:
https://ap-northeast-1.signin.aws.amazon.com/v1/authorize?…
Paste the code Sign-In displayed:

I opened the URL in a browser on another machine and signed in, then pasted the displayed code into the prompt, and the credentials were stored under the name verify.

$ creds list
CREDENTIAL      KIND                STATUS TAGS
verify          session_credentials active
Daemon log after sign-in
2026-12-02T09:09:08.063326Z  INFO aws login signed in; not yet saved credential=verify
2026-12-02T09:09:08.070423Z  INFO aws login saved credential=verify arn=arn:aws:sts::<ACCOUNT>:assumed-role/<ROLE>/<ROLE>
2026-12-02T09:09:08.085315Z  INFO bootstrap complete credential=verify provider="aws-login (region ap-northeast-1)" expires_at="-"

Using it with the AWS CLI

I added a profile that uses credential_process to ~/.aws/config.

[profile credsd]
credential_process = creds get --credential verify --format credential-process
region = ap-northeast-1

When I ran aws sts get-caller-identity with this profile, the session of the role I signed in with via aws-login was returned.

$ aws sts get-caller-identity --profile credsd
{
    "UserId": "<ROLEID>:<ROLE>",
    "Account": "<ACCOUNT>",
    "Arn": "arn:aws:sts::<ACCOUNT>:assumed-role/<ROLE>/<ROLE>"
}

The JSON that the AWS CLI receives from credential_process can be checked with creds get --format credential-process. In the following example, secret values are masked with jq.

$ creds get --credential verify --format credential-process | jq '{Version, Expiration, AccessKeyId: (.AccessKeyId[0:4] + "…"), SecretAccessKey: "<masked>", SessionToken: "<masked>"}'
{
  "Version": 1,
  "Expiration": "2026-12-02T09:24:08Z",
  "AccessKeyId": "ASIA…",
  "SecretAccessKey": "<masked>",
  "SessionToken": "<masked>"
}

In this test, Expiration was 15 minutes after sign-in completed.

What remains on disk

Credentials protected by the TPM

Credentials are encrypted with a TPM-protected key and placed under /var/lib/credsd as *.enc. There is no command to extract the key, and *.enc alone cannot be decrypted. Running ls -laR /var/lib/credsd as root showed the following three files for the verify credential.

/var/lib/credsd/callers/1000/credentials/verify:
-rw-------. 1 credsd credsd 4180 Dec  2 09:09 aws_login_token.enc
-rw-------. 1 credsd credsd  252 Dec  2 09:09 dpop_key.enc
-rw-------. 1 credsd credsd  408 Dec  2 09:09 identity.enc

Investigating credentials

What was in ~/.aws was config and cli/cache/session.db, and no environment variables starting with AWS_ were set.

$ find /home/ec2-user/.aws -type f -exec ls -l {} \;
-rw-r--r--. 1 ec2-user ec2-user 120 Dec  2 09:09 /home/ec2-user/.aws/config
-rw-r--r--. 1 ec2-user ec2-user 20480 Dec  2 09:09 /home/ec2-user/.aws/cli/cache/session.db

I searched these and the shell configuration files (~/.bash*, ~/.profile), but found no credential strings.

$ grep -rIlE "AKIA|ASIA|aws_secret_access_key|aws_session_token|SessionToken" /home/ec2-user/.aws /home/ec2-user/.bash* /home/ec2-user/.profile
$ cd /home/ec2-user/.aws/cli/cache
$ grep -caE "ASIA|AKIA|SessionToken|SecretAccessKey|aws_secret" session.db

Audit log

When installed as a system service on Linux, the audit log is written to /var/log/credsd/credsd.log by default. The owner is credsd and the mode is 0600, so read it as root. Since I did not create config.toml, the format is the default, text.

The command to read the end of the log is as follows. Because each line is long, cut truncates each line to its first 600 characters.

tail -n 25 /var/log/credsd/credsd.log | cut -c1-600

Each time creds was called, a caller assessment line was recorded.

2026-12-02T09:09:33.507803Z  INFO caller assessment pid=26903 uid=1000 transport="uds" credential="verify" signal="undetermined" claimed=Unstated observed="opaque_ancestor" caller="creds" agentic=false evidence=…

Summary

I confirmed that with AWS Credential Daemon (credsd), an aws login token can be used while remaining protected by a TPM.

With aws login, the token is written to a local file, so there is a risk of leakage. Using credsd can reduce this risk.

credsd is currently a preview version, but if you have TPM-capable hardware and an OS, and need countermeasures against leakage of tokens such as those from aws login, I recommend giving it a try.


セキュリティ対策もお任せください

セキュリティ相談会では、御社の環境に合わせて、どこを確認し、どの対策から進めるかを一緒に考えます。「今の設定で大丈夫か、少し気になる」くらいの段階から、喫緊の課題までオンラインで無料でご相談いただけます。ぜひご活用ください。

セキュリティ相談会

セキュリティ相談会の詳細を見る

Share this article

AWSのお困り事はクラスメソッドへ