Skip to content
Info disclosure Write-up Intermediate

A Subtle Audit Log Consideration In Aws

The author found that when an S3 request is denied by a bucket policy, CloudTrail logs an AwsApiCall event that includes caller-controlled metadata such as the userAgent string, and this event is sent to both the caller's and resource owner's accounts. An attacker could therefore exfiltrate data by embedding it in the userAgent of denied requests, but if the deny is enforced at a VPC endpoint instead, CloudTrail logs a metadata-stripped AwsVpceEvent only to the VPC owner's account.

Suresh Gururajan Follow

Published on systemweakness.com

tldr; A denied API call isn’t just a security failure; it’s a telemetry trail. If you rely solely on Bucket Policies, a denied request still generates an AwsApiCall log in both the caller and resource accounts—preserving caller-controlled metadata (like userAgent) that can be used for data exfiltration.

Suresh Gururajan, on systemweakness.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the placement of the deny decision determines the CloudTrail event type: resource-based policy denials produce AwsApiCall events that preserve caller-controlled request context, while VPC endpoint policy denials produce AwsVpceEvent network events that omit that context and are routed only to the VPC owner.

Impact

An attacker in an untrusted account could exfiltrate data by embedding it in the userAgent of denied requests, because the resulting AwsApiCall log is sent to both the caller and resource accounts; enforcing the deny at the VPC endpoint instead produces a metadata-stripped AwsVpceEvent that is only sent to the VPC owner, preventing this log-based exfiltration.

What the attacker needed

Multi-account AWS environment; VPC with S3 endpoint; CloudTrail logging enabled

The fix

The author recommends enforcing deny at the VPC endpoint using a policy that restricts access to the organisation's PrincipalOrgID, which prevents foreign identities from reaching the logs with caller-controlled metadata.

How it was found

  1. Set up three AWS accounts: one for credentials, one owning a VPC with a Lambda function and an S3 VPC endpoint, and one owning an S3 bucket.
  2. Run a Lambda function in the VPC using credentials from the first account to call s3:GetObject on the bucket.
  3. In the first experiment, configure the bucket policy to deny access while the VPC endpoint policy allows it, then observe the CloudTrail event.
  4. In the second experiment, configure the VPC endpoint policy to deny access while the bucket policy allows it, then observe the CloudTrail event.
  5. Compare the two CloudTrail events to see which fields are present or absent.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

When you try to access something in the cloud and are blocked, the system still writes a log entry. This article shows that if the block happens at the storage bucket, the log includes extra details the requester supplied, such as a user-agent string, and both the requester and the bucket owner can see that log. If the block happens earlier at the network gateway (VPC endpoint), the log is different: it leaves out those details and only the network owner sees it.

What is Info disclosure?

Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.

Similar reports

View all

Same bug class and techniques, clearest first.

Information disclosure

The lesson behind this report.

Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.