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

Merged
merged 3 commits into from
Nov 12, 2024

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
@arielkr256 arielkr256 added the rules Real-time log data detections label Nov 4, 2024
@arielkr256
Copy link
Contributor

@bcpenta looks like there's a minor linting issue. If you run make fmt it should auto-resolve those for you.

@arielkr256 arielkr256 merged commit 6224265 into panther-labs:develop Nov 12, 2024
8 checks passed
@arielkr256 arielkr256 added policies Real-time misconfiguration detections and removed rules Real-time log data detections labels Dec 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
policies Real-time misconfiguration detections
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants