Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

s3 bucket confused deputy attack #1416

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

bcpenta
Copy link
Contributor

@bcpenta bcpenta commented Oct 31, 2024

Background

This policy ensures that S3 bucket policies with service principals contain conditions to prevent cross-service confused deputy issues. Without these conditions (such as aws:SourceArn, aws:SourceAccount, aws:SourceOrgID, or aws:SourceOrgPaths), attackers may be able to exploit the bucket and upload malicious data or exfiltrate sensitive data from the bucket.
https://docs.aws.amazon.com/IAM/latest/UserGuide/confused-deputy.html

Changes

  • Added a new policy AWS.S3.Bucket.PolicyConfusedDeputyProtection to check that S3 bucket policies containing service principals also include at least one condition to limit cross-service permissions.

  • This policy examines the conditions associated with service principals to ensure appropriate resource constraints.

Testing

Added test cases to validate the policy:

  • S3 bucket policy with a service principal and a compliant condition (expected to pass).
    
  • S3 bucket policy with a service principal but without a condition (expected to fail).
    
  • S3 bucket policy without a service principal (expected to pass).
    

@bcpenta bcpenta requested a review from a team as a code owner October 31, 2024 02:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant