No IAM users, groups, or roles have the AWSCloudShellFullAccess policy attached
IAM identities with the AWS managed policy AWSCloudShellFullAccess attached are identified across users, groups, and roles.
This indicates principals are granted cloudshell:* on *, enabling full CloudShell features, including environment startup and file transfer.
Risk
Granting cloudshell:* enables an interactive shell with Internet egress and file upload/download, degrading confidentiality and integrity.
Compromised principals can exfiltrate data, stage tooling with sudo, persist artifacts in CloudShell, and operate from AWS IP space to bypass endpoint controls.
Run this check with Prowler
Run in Prowler Cloudprowler aws --checks iam_policy_cloudshell_admin_not_attachedRecommendation
Detach AWSCloudShellFullAccess from identities.
Apply least privilege: permit CloudShell only when necessary via narrowly scoped permissions, restricted roles, short-lived sessions, and approvals. Prefer controlled alternatives (local CLI, bastion, or Session Manager). Enforce separation of duties and monitor usage.
Remediation
Terraform
# Terraform: ensure AWSCloudShellFullAccess is NOT attached
resource "aws_iam_user_policy_attachment" "<example_resource_name>" {
count = 0 # Critical: prevents creation, ensuring the policy is detached/not attached
user = "<example_resource_name>"
policy_arn = "arn:aws:iam::aws:policy/AWSCloudShellFullAccess" # Denied policy
}NativeIaC
# CloudFormation: ensure AWSCloudShellFullAccess is NOT attached to the IAM user
Resources:
<example_resource_name>:
Type: AWS::IAM::User
Properties:
ManagedPolicyArns: [] # Critical: empty list ensures AWSCloudShellFullAccess is not attachedOther
Check Code
from prowler.lib.check.models import Check, Check_Report_AWS
from prowler.providers.aws.services.iam.iam_client import iam_client
class iam_policy_cloudshell_admin_not_attached(Check):
def execute(self) -> Check_Report_AWS:
findings = []
if iam_client.entities_attached_to_cloudshell_policy:
report = Check_Report_AWS(
metadata=self.metadata(),
resource=iam_client.entities_attached_to_cloudshell_policy,
)
report.region = iam_client.region
report.resource_id = iam_client.audited_account
report.resource_arn = f"arn:{iam_client.audited_partition}:iam::aws:policy/AWSCloudShellFullAccess"
entities = iam_client.entities_attached_to_cloudshell_policy
if entities["Users"] or entities["Groups"] or entities["Roles"]:
report.status = "FAIL"
attached_entities = [
(key, ", ".join(entities[key]))
for key in ["Users", "Groups", "Roles"]
if entities[key]
]
entity_strings = [
f"{entity[0]}: {entity[1]}" for entity in attached_entities
]
report.status_extended = f"AWS CloudShellFullAccess policy attached to IAM {', '.join(entity_strings)}."
else:
report.status = "PASS"
report.status_extended = (
"AWS CloudShellFullAccess policy is not attached to any IAM entity."
)
findings.append(report)
return findingsReferences
- https://docs.aws.amazon.com/securityhub/latest/userguide/iam-controls.html#iam-27
- https://www.trendmicro.com/trendaivisiononecloudriskmanagement/knowledge-base/aws/IAM/unapproved-iam-policy-in-use.html
- https://docs.aws.amazon.com/config/latest/developerguide/iam-policy-blacklisted-check.html
- https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_manage-attach-detach.html
- https://icompaas.freshdesk.com/support/solutions/articles/62000233099-1-22-restrict-access-to-awscloudshellfullaccess-manual-