mirror of
https://github.com/ghndrx/prowler.git
synced 2026-02-11 15:25:10 +00:00
30 lines
1.5 KiB
Plaintext
30 lines
1.5 KiB
Plaintext
CHECK_ID_check124="1.24"
|
|
CHECK_TITLE_check124="Ensure IAM policies that allow full \"*:*\" administrative privileges are not created (Scored)"
|
|
CHECK_SCORED_check124="SCORED"
|
|
CHECK_ALTERNATE_check124="check124"
|
|
|
|
check124(){
|
|
# "Ensure IAM policies that allow full \"*:*\" administrative privileges are not created (Scored)"
|
|
LIST_CUSTOM_POLICIES=$($AWSCLI iam list-policies --output text $PROFILE_OPT --region $REGION|grep 'arn:aws:iam::[0-9]\{12\}:'|awk '{ print $2 }')
|
|
if [[ $LIST_CUSTOM_POLICIES ]]; then
|
|
textInfo "Looking for custom policies: (skipping default policies - it may take few seconds...)"
|
|
for policy in $LIST_CUSTOM_POLICIES; do
|
|
POLICY_VERSION=$($AWSCLI iam list-policies $PROFILE_OPT --region $REGION --query 'Policies[*].[Arn,DefaultVersionId]' --output text |awk "\$1 == \"$policy\" { print \$2 }")
|
|
POLICY_WITH_FULL=$($AWSCLI iam get-policy-version --output text --policy-arn $policy --version-id $POLICY_VERSION --query "PolicyVersion.Document.Statement[?Effect == 'Allow' && contains(Resource, '*') && contains (Action, '*')]" $PROFILE_OPT --region $REGION)
|
|
if [[ $POLICY_WITH_FULL ]]; then
|
|
POLICIES_ALLOW_LIST="$POLICIES_ALLOW_LIST $policy"
|
|
fi
|
|
done
|
|
if [[ $POLICIES_ALLOW_LIST ]]; then
|
|
textInfo "List of custom policies: "
|
|
for policy in $POLICIES_ALLOW_LIST; do
|
|
textInfo "Policy $policy allows \"*:*\""
|
|
done
|
|
else
|
|
textPass "No custom policy found that allow full \"*:*\" administrative privileges"
|
|
fi
|
|
else
|
|
textPass "No custom policies found"
|
|
fi
|
|
}
|