Inline IAM policy does not allow 'aws-marketplace:Subscribe' on all resources
IAM inline policies are analyzed to identify statements that grant aws-marketplace:Subscribe on all resources (*). This action controls the ability to subscribe to AWS Marketplace products, including Amazon Bedrock foundation models, and should be scoped to specific product ARNs to enforce least privilege.
Risk
Granting aws-marketplace:Subscribe on all resources via inline policies allows subscribing to any Marketplace product, including expensive Bedrock foundation models, leading to uncontrolled costs, shadow AI usage, and compliance violations.
Run this check with Prowler
Run in Prowler Cloudprowler aws --checks iam_inline_policy_no_wildcard_marketplace_subscribeRecommendation
Replace Resource: "*" with specific, approved AWS Marketplace product ARNs. Prefer managed policies over inline and apply the principle of least privilege to aws-marketplace:Subscribe permissions to prevent unauthorized subscriptions to costly Bedrock models and other Marketplace products.
Remediation
Terraform
resource "aws_iam_role_policy" "scoped_marketplace_subscribe" {
name = "scoped-marketplace-subscribe"
role = aws_iam_role.example.id
policy = jsonencode({
Version = "2012-10-17"
Statement = [{
Effect = "Allow"
Action = ["aws-marketplace:Subscribe"]
Resource = ["arn:aws:aws-marketplace::123456789012:product/approved-product-id"] # FIX: scope to specific products
}]
})
}NativeIaC
Resources:
ExampleRole:
Type: AWS::IAM::Role
Properties:
Policies:
- PolicyName: scoped-marketplace-subscribe
PolicyDocument:
Version: '2012-10-17'
Statement:
- Effect: Allow
Action:
- aws-marketplace:Subscribe # FIX: scope to specific product ARNs
Resource:
- arn:aws:aws-marketplace::123456789012:product/approved-product-idOther
Check Code
from prowler.lib.check.models import Check, Check_Report_AWS
from prowler.providers.aws.services.iam.iam_client import iam_client
from prowler.providers.aws.services.iam.lib.policy import (
policy_allows_marketplace_subscribe_on_all_resources,
)
class iam_inline_policy_no_wildcard_marketplace_subscribe(Check):
def execute(self) -> list[Check_Report_AWS]:
findings = []
for policy in iam_client.policies.values():
if policy.type == "Inline":
report = Check_Report_AWS(metadata=self.metadata(), resource=policy)
report.region = iam_client.region
report.resource_id = f"{policy.entity}/{policy.name}"
report.status = "PASS"
resource_type_str = report.resource_arn.split(":")[-1].split("/")[0]
resource_attached = report.resource_arn.split("/")[-1]
report.status_extended = f"Inline policy {policy.name}{' attached to ' + resource_type_str + ' ' + resource_attached if policy.attached else ''} does not allow 'aws-marketplace:Subscribe' on all resources."
if (
policy.document
and policy_allows_marketplace_subscribe_on_all_resources(
policy.document
)
):
report.status = "FAIL"
report.status_extended = f"Inline policy {policy.name}{' attached to ' + resource_type_str + ' ' + resource_attached if policy.attached else ''} allows 'aws-marketplace:Subscribe' on all resources."
findings.append(report)
return findings