2.20 Ensure access to AWSCloudShellFullAccess is restricted

Information

AWS CloudShell is a convenient way of running CLI commands against AWS services. The managed IAM policy AWSCloudShellFullAccess provides full access to CloudShell, including file upload and download capability between a user's local system and the CloudShell environment. Within the CloudShell environment, a user has sudo permissions and can access the internet. It is therefore possible to install software and transfer data to external systems.

Access to this policy should be restricted, as it presents a potential channel for data exfiltration by privileged users. AWS documentation provides guidance on creating more restrictive policies that limit file transfer capabilities.

NOTE: Nessus has not performed this check. Please review the benchmark to ensure target compliance.

Solution

From Console

- Open the IAM console at https://console.aws.amazon.com/iam/
- In the left pane, select Policies
- Search for and select AWSCloudShellFullAccess
- Select the Entities attached tab
- For each attached entity:

- Select the entity
- Choose Detach

From Command Line (optional automation):

POLICY_ARN="arn:aws:iam::aws:policy/AWSCloudShellFullAccess"

# Detach from users
for u in $(aws iam list-entities-for-policy --policy-arn "$POLICY_ARN" --query "PolicyUsers[].UserName" --output text); do
echo "Detaching from user: $u"
aws iam detach-user-policy --user-name "$u" --policy-arn "$POLICY_ARN"
done

# Detach from roles
for r in $(aws iam list-entities-for-policy --policy-arn "$POLICY_ARN" --query "PolicyRoles[].RoleName" --output text); do
echo "Detaching from role: $r"
aws iam detach-role-policy --role-name "$r" --policy-arn "$POLICY_ARN"
done

# Detach from groups
for g in $(aws iam list-entities-for-policy --policy-arn "$POLICY_ARN" --query "PolicyGroups[].GroupName" --output text); do
echo "Detaching from group: $g"
aws iam detach-group-policy --group-name "$g" --policy-arn "$POLICY_ARN"
done

Impact:

Unrestricted access to CloudShell may allow users to transfer data outside the AWS environment, increasing the risk of data exfiltration and loss of sensitive information.

See Also

https://workbench.cisecurity.org/benchmarks/24575

Item Details

Category: ACCESS CONTROL, IDENTIFICATION AND AUTHENTICATION

References: 800-53|AC-1, 800-53|AC-2, 800-53|IA-4, 800-53|IA-5, CSCv7|14.1

Plugin: amazon_aws

Control ID: a32e27369ef6f95d8c8735128e32d882e099083462abcb099735d95e601259c8