VPC Endpoint Policies Without Explicit Deny Bypass S3 Bucket ACLs
S3 VPC endpoint policies default to full access when administrators configure resource-based restrictions without corresponding endpoint denials. This architectural gap lets applications reach restricted buckets through the VPC gateway whilst direct internet access correctly blocks the same requests. Standard bucket policies and IAM controls appear functional during testing but fail to contain internal traffic routed through the endpoint.
At a glance
- Unsafe setting
- Default VPC endpoint policy allows all S3 actions without explicit deny statements.
- Failure trigger
- Applications access restricted S3 buckets through VPC endpoints whilst internet access correctly blocks.
- Blast radius
- Internal applications bypass bucket policies and reach restricted S3 data through VPC endpoints.
- Recommended control
- Deploy explicit Deny statements in VPC endpoint policies matching bucket policy restrictions.
The Trap
VPC endpoint policies for S3 that rely on implicit restrictions without explicit Deny statements, leaving bucket policies enforceable only against internet-routed traffic whilst VPC-routed requests bypass the same controls entirely.
The Default State
AWS creates VPC endpoints with a default policy allowing all S3 actions to all resources: {"Version":"2012-10-17","Statement":[{"Effect":"Allow","Principal":"*","Action":"s3:*","Resource":"*"}]}. Infrastructure engineers typically focus on bucket policies and IAM roles, assuming the VPC endpoint inherits the same restrictions. When teams do customise endpoint policies, they often write Allow statements for legitimate access patterns without adding corresponding Deny rules for prohibited actions. The endpoint policy evaluation happens before bucket policies in the AWS authorisation chain, so an overly permissive endpoint policy can grant access that bucket-level controls intended to block.
The Blast Radius
Applications running inside the VPC can access S3 buckets that should be restricted by bucket policies, IAM conditions, or resource-based controls. The breach appears inconsistent because the same requests fail when routed through internet gateways or NAT instances, making the policy bypass difficult to detect during standard testing. Compliance audits discover that sensitive data buckets marked as “internal access only” or “production environment restricted” are actually reachable from development or shared service VPCs. Data exfiltration, cross-environment contamination, and regulatory violations occur through the VPC endpoint whilst perimeter monitoring tools focused on internet egress miss the internal traffic flow entirely.
The Lead Mechanic Fix
Replace the default endpoint policy with explicit Deny statements that mirror your bucket policy restrictions. Use aws ec2 modify-vpc-endpoint --vpc-endpoint-id vpce-12345678 --policy-document to deploy a policy containing both Allow and Deny statements. Structure the policy with explicit "Effect":"Deny" conditions for prohibited source IPs, invalid VPCs, or restricted principals before any Allow rules. For production S3 buckets restricted to specific environments, add a Deny statement like {"Effect":"Deny","Principal":"*","Action":"s3:*","Resource":"arn:aws:s3:::production-data/*","Condition":{"StringNotEquals":{"aws:PrincipalTag/Environment":"production"}}}. Test both VPC-routed and internet-routed access paths to ensure consistent policy enforcement across all traffic flows.
Apply the safer control
Before you change production
Confirm the affected scope, export the current configuration, and test the replacement control in a non-production environment first.
Fix commands and configuration
aws ec2 modify-vpc-endpoint --vpc-endpoint-id vpce-12345678 --policy-document"Effect":"Deny"{"Effect":"Deny","Principal":"*","Action":"s3:*","Resource":"arn:aws:s3:::production-data/*","Condition":{"StringNotEquals":{"aws:PrincipalTag/Environment":"production"}}}Verify, roll back or escalate
Verify
Re-run the detection test and a controlled negative-path test. Confirm the unsafe behaviour is blocked while approved traffic still succeeds.
Rollback
Restore the exported configuration if the new control blocks required production traffic, then narrow the policy before redeployment.
Escalate
Escalate when the blast radius is uncertain, the control cannot be tested safely, or remediation requires an outage or security exception.