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

iam_role_cross_service_confused_deputy_prevention remediation broke specific process #4714

Open
migs017 opened this issue Aug 9, 2024 · 5 comments
Assignees
Labels
bug provider/aws Issues/PRs related with the AWS provider severity/medium Results in some unexpected or undesired behavior.

Comments

@migs017
Copy link

migs017 commented Aug 9, 2024

Steps to Reproduce

  1. It isn't a command but a setup where cloudtrail will send logs to cloudwatch
  2. AWS environment
  3. Single account
  4. Error
    iam role last activity date

Expected behavior

Prowler recommends to remediate/prevent confused deputy its either use aws:SourceArn or aws:SourceAccount or both. If the specfici resource has been added in the condition nothing should break our process.

Actual Result with Screenshots or Logs

iam role last activity date
Prowlers solution works on some roles but for cloudtrail to cloudwatch process that a role will handle it breaks. We also encounter in IAM role that's assumed by aws transcoder when we add either aws:SourceArn or aws:SourceAccount or both. Our process will stop working.

The exact trust relationship policy for the transcoder role:
{
"Version": "2008-10-17",
"Statement": [
{
"Sid": "1",
"Effect": "Allow",
"Principal": {
"Service": [
"elastictranscoder.amazonaws.com",
"transcribe.amazonaws.com"
]
},
"Action": "sts:AssumeRole",
"Condition": {
"StringEquals": {
"aws:SourceAccount": "<account_id>"
},
"ArnLike": {
"aws:SourceArn": [
"arn:aws:elastictranscoder::<account_id>:pipeline/example_pipeline",
"arn:aws:elastictranscoder::<account_id>:job/",
"arn:aws:elastictranscoder::<account_id>:preset/
"
]
}
}
}
]
}

How did you install Prowler?

From pip package (pip install prowler)

Environment Resource

Workstation

OS used

Windows

Prowler version

4.2.4

Pip version

pip 23.2.1

Context

We consulted the cloudtrail to cloudwatch process role to AWS Support and they mention "no documentation around which services do or do not support the aws:SourceArn or aws:SourceAccount condition keys because they're global condition keys and technically available to all services. The keys are supported in any situation where a service tries to access another service's resource with a call from their service principal. If it's not from a service principal, we don't expect those condition keys to be set."

@migs017 migs017 added bug status/needs-triage Issue pending triage labels Aug 9, 2024
@sergargar sergargar self-assigned this Aug 12, 2024
@sergargar sergargar added severity/medium Results in some unexpected or undesired behavior. provider/aws Issues/PRs related with the AWS provider and removed status/needs-triage Issue pending triage labels Aug 12, 2024
@sergargar
Copy link
Member

Hi @migs017, thanks for reaching us out!
This Prowler check was done regarding this official documentation , from what I understood is that both roles that are either assumed by CloudTrail or Transcoder break when the aws:SourceAccount or aws:SourceArn are set?

@migs017
Copy link
Author

migs017 commented Aug 12, 2024

Hey @sergargar, Yup that's right

@sergargar
Copy link
Member

sergargar commented Aug 12, 2024

"The keys are supported in any situation where a service tries to access another service's resource with a call from their service principal."

Is that your situation @migs017 ?

@migs017
Copy link
Author

migs017 commented Aug 12, 2024

Hmm I don't think so, example in cloudtrail role the condition are aws:SourceArn : <arn_of_a_trail>. That means its the same service resource from the service principal that I'm trying to allow assuming the role right?

@sergargar
Copy link
Member

Hmm I don't think so, example in cloudtrail role the condition are aws:SourceArn : <arn_of_a_trail>. That means its the same service resource from the service principal that I'm trying to allow assuming the role right?

Yes, but in that case the condition aws:SourceAccount should be use so only the cloudtrail of your account can assume it.

Can you try it again in the branch PRWLR-4858-check-policy-conditions-for-aws-lambda-public-checks? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug provider/aws Issues/PRs related with the AWS provider severity/medium Results in some unexpected or undesired behavior.
Projects
None yet
Development

No branches or pull requests

2 participants