mirror of
https://github.com/ghndrx/prowler.git
synced 2026-02-10 14:55:00 +00:00
Add conditions check for extra771
(cherry picked from commit 805b276578d5afda60b38cffa28fe09b16380799)
This commit is contained in:
@@ -24,7 +24,7 @@ extra771(){
|
|||||||
if [[ $BUCKET_POLICY_STATEMENTS == *GetBucketPolicy* ]]; then
|
if [[ $BUCKET_POLICY_STATEMENTS == *GetBucketPolicy* ]]; then
|
||||||
textInfo "Bucket policy does not exist for bucket $bucket"
|
textInfo "Bucket policy does not exist for bucket $bucket"
|
||||||
else
|
else
|
||||||
BUCKET_POLICY_BAD_STATEMENTS=$(echo $BUCKET_POLICY_STATEMENTS | jq --arg arn "arn:aws:s3:::$bucket" 'fromjson | .Statement[]|select(.Effect=="Allow" and (((.Principal|type == "object") and .Principal.AWS == "*") or ((.Principal|type == "string") and .Principal == "*")) and (.Action|startswith("s3:Put") or startswith("s3:*")))')
|
BUCKET_POLICY_BAD_STATEMENTS=$(echo $BUCKET_POLICY_STATEMENTS | jq --arg arn "arn:aws:s3:::$bucket" 'fromjson | .Statement[]|select(.Effect=="Allow" and (((.Principal|type == "object") and .Principal.AWS == "*") or ((.Principal|type == "string") and .Principal == "*")) and (.Action|startswith("s3:Put") or startswith("s3:*")) and .Condition == null)')
|
||||||
if [[ $BUCKET_POLICY_BAD_STATEMENTS != "" ]]; then
|
if [[ $BUCKET_POLICY_BAD_STATEMENTS != "" ]]; then
|
||||||
textFail "Bucket $bucket allows public write: $BUCKET_POLICY_BAD_STATEMENTS"
|
textFail "Bucket $bucket allows public write: $BUCKET_POLICY_BAD_STATEMENTS"
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user