Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Trail of Bits 17 min read Deep dive hardMaster

A few notes on AWS Nitro Enclaves: KMS integration

Integrating AWS Nitro Enclaves with KMS through PCR-based key policies and attestation-encrypted responses still leaves a range of passive and active attacks on the enclave-KMS channel. Passive attackers can swap data-key ciphertexts, substitute CMKs, abuse key aliases or IAM credentials, and replay attestations within KMS's five-minute window. The countermeasures are attacker-resistant encryption context, hardcoded full CMK ARNs checked against response keyId, an attested IAM role verified via sts:GetCallerIdentity, and validation of algorithm identifiers. Active attackers require enclave-initiated TLS with a pinned, attested Amazon CA plus VPC restrictions, and key policies should use PCR0/PCR8, avoid root-principal pitfalls, and require MFA for critical operations.

Assumes: AWS KMS and IAM policiesenvelope encryptionremote attestation and PCRsTLS basics

Related posts

  • How Bee implemented Zero Operator Access for personal AI on AWS

    AWS Architecture Blog hardMaster

    Bee, Amazon's wearable personal AI, enforces Zero Operator Access by having the user's device release short-lived decryption keys only to EC2 instances whose NitroTPM attestation matches software published in a public Sigstore Rekor transparency log. Attestable AMIs have no SSH/SSM/shell, read-only root filesystems and ephemeral encrypted storage, with OS measurements in PCR4/7/12. A custom measured-boot tool extends PCR14 with a hash of container ECR digests and model artifact checksums, and the attestation is embedded in AWS Private CA TLS certificates that clients verify offline. Network isolation with no egress, in-memory-only keys with data encrypted before reaching RDS, ElastiCache and S3, and SCP-backed separation of duties between independent teams close the gaps attestation cannot measure.

  • Upgrading 3 Million Variables to Envelope Encryption

    Railway mediumAdept

    Railway replaced direct per-variable calls to GCP KMS with envelope encryption: a locally generated AES-256-GCM data key per environment, encrypted once by KMS and serialized alongside each ciphertext. Storing the encrypted DEK next to the value enabled key rotation, decryption without passing environment context, and a gradual zero-downtime migration of over 3 million variables via fallback to legacy KMS decryption. KMS usage dropped 10x, worst-case batch decryption fell from ~10s to milliseconds, quota spikes disappeared, and per-environment keys limit the blast radius of a compromise.

  • Incident Report: October 21st Security Attack

    Railway mediumAdept

    An attacker partially escaped filesystem isolation in Railway's multi-tenant build infrastructure and stole a build credential. That credential was wrongly trusted by a self-hosted Temporal cluster, which exposed build histories and a copy of Railway's internal monorepo. Using the code, the attacker found a misconfigured OIDC binding in CI/CD, obtained cloud credentials, and SSHed into an orchestration machine. From there they read envelope-encrypted environment variables and decrypted them through the KMS, targeting AI provider keys for at most 1.85% (~100,000) of workspaces. Railway halted builds twice, revoked all credentials, rebuilt its PKI, reset 1,852 linked-account tokens, and coordinated key revocation with providers after an estimated ~$740,000 in unauthorized spend.

  • Our Journey Migrating to AWS IMDSv2

    Slack Engineering mediumAdept

    Slack enforced IMDSv2 across roughly 60,000 EC2 instances in hundreds of AWS accounts. IMDSv2's session tokens, obtained by PUT and sent as a header, blunt SSRF-based credential theft. The team found IMDSv1 callers with the MetadataNoToken CloudWatch metric, a Prometheus dashboard and ImdsPacketAnalyzer, then made shared Terraform modules require tokens via an exclusion-list module and denied IMDSv1 launches with SCPs. Because SCPs don't cover the root account or service-linked roles such as AutoScaling, they added EventBridge/CloudTrail alerts routed to Slack and an EKS-hosted "IMDSv1 Terminator" that continuously forces IMDSv2 on any instance still allowing v1.

  • Securing Model Context Protocol: Safer Agentic AI with Containers

    Docker easyNovice

    Running MCP servers via npx on the host with plaintext environment-variable secrets leaves agentic tooling exposed to supply-chain tampering, credential leakage, and attacks such as rug pulls, tool shadowing, and tool poisoning. Containers address part of this through isolation, reproducibility, and verifiable provenance. They should be paired with scoped secret injection, a single MCP Gateway that screens all server-to-client traffic, and separate policies for which servers are trusted versus which a given agent needs. Tool annotations like readOnlyHint and destructiveHint can be enforced at container runtime, and Docker's MCP Catalog and Toolkit package these ideas behind one socat-over-STDIO connection.

The quest for software engineering knowledge.

Look:
Layout: