mirror of
https://github.com/ghndrx/prowler.git
synced 2026-02-11 07:15:15 +00:00
50 lines
2.7 KiB
Bash
50 lines
2.7 KiB
Bash
#!/usr/bin/env bash
|
|
|
|
# Prowler - the handy cloud security tool (copyright 2019) by Toni de la Fuente
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
|
# use this file except in compliance with the License. You may obtain a copy
|
|
# of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software distributed
|
|
# under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
|
# CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
|
# specific language governing permissions and limitations under the License.
|
|
CHECK_ID_extra744="7.44"
|
|
CHECK_TITLE_extra744="[extra744] Check if API Gateway has a WAF ACL attached (Not Scored) (Not part of CIS benchmark)"
|
|
CHECK_SCORED_extra744="NOT_SCORED"
|
|
CHECK_TYPE_extra744="EXTRA"
|
|
CHECK_SEVERITY_extra744="Medium"
|
|
CHECK_ASFF_RESOURCE_TYPE_extra744="AwsApiGatewayRestApi"
|
|
CHECK_ALTERNATE_check744="extra744"
|
|
CHECK_ASFF_COMPLIANCE_TYPE_extra744="ens-mp.s.2.aws.waf.2"
|
|
CHECK_SERVICENAME_extra744="apigateway"
|
|
CHECK_RISK_extra744='Potential attacks and / or abuse of service; more even for even for internet reachable services.'
|
|
CHECK_REMEDIATION_extra744='Use AWS WAF to protect your API Gateway API from common web exploits; such as SQL injection and cross-site scripting (XSS) attacks. These could affect API availability and performance; compromise security; or consume excessive resources.'
|
|
CHECK_DOC_extra744='https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-control-access-aws-waf.html'
|
|
CHECK_CAF_EPIC_extra744='Infrastructure Security'
|
|
|
|
extra744(){
|
|
for regx in $REGIONS; do
|
|
LIST_OF_REST_APIS=$($AWSCLI $PROFILE_OPT --region $regx apigateway get-rest-apis --query 'items[*].id' --output text)
|
|
if [[ $LIST_OF_REST_APIS ]];then
|
|
for api in $LIST_OF_REST_APIS; do
|
|
API_GW_NAME=$($AWSCLI apigateway get-rest-apis $PROFILE_OPT --region $regx --query "items[?id==\`$api\`].name" --output text)
|
|
LIST_OF_STAGES=$($AWSCLI $PROFILE_OPT --region $regx apigateway get-stages --rest-api-id $api --query 'item[*].stageName' --output text)
|
|
if [[ $LIST_OF_STAGES ]]; then
|
|
for stage in $LIST_OF_STAGES; do
|
|
CHECK_WAFACL=$($AWSCLI $PROFILE_OPT --region $regx apigateway get-stages --rest-api-id $api --query "item[?stageName==\`$stage\`].webAclArn" --output text)
|
|
if [[ $CHECK_WAFACL ]]; then
|
|
textPass "$regx: API Gateway $API_GW_NAME ID $api in $stage has $CHECK_WAFACL WAF ACL attached" "$regx"
|
|
else
|
|
textFail "$regx: API Gateway $API_GW_NAME ID $api in $stage has not WAF ACL attached" "$regx"
|
|
fi
|
|
done
|
|
fi
|
|
done
|
|
else
|
|
textInfo "$regx: No API Gateways found" "$regx"
|
|
fi
|
|
done
|
|
}
|