diff --git a/checks/check_extra7166 b/checks/check_extra7166 index 3496238832..4a8430f5f8 100644 --- a/checks/check_extra7166 +++ b/checks/check_extra7166 @@ -15,9 +15,9 @@ CHECK_ID_extra7166="7.166" CHECK_TITLE_extra7166="[extra7166] Check if Elastic IP addresses with associations are protected by AWS Shield Advanced" CHECK_SCORED_extra7166="NOT_SCORED" CHECK_CIS_LEVEL_extra7166="EXTRA" -CHECK_SEVERITY_check="Medium" +CHECK_SEVERITY_extra7166="Medium" CHECK_ASFF_RESOURCE_TYPE_extra7166="AwsEc2Eip" -CHECK_ALTERNATE_extra7166="extra7166" +CHECK_ALTERNATE_check7166="extra7166" CHECK_SERVICENAME_extra7166="shield" CHECK_RISK_extra7166='AWS Shield Advanced provides expanded DDoS attack protection for your resources' CHECK_REMEDIATION_extra7166='Add as a protected resource in AWS Shield Advanced.' @@ -25,7 +25,7 @@ CHECK_DOC_extra7166='https://docs.aws.amazon.com/waf/latest/developerguide/confi CHECK_CAF_EPIC_extra7166='Infrastructure security' extra7166() { - if [[ "$($AWSCLI shield get-subscription-state --output text)" == "ACTIVE" ]]; then + if [[ "$($AWSCLI $PROFILE_OPT shield get-subscription-state --output text)" == "ACTIVE" ]]; then CALLER_IDENTITY=$($AWSCLI sts get-caller-identity $PROFILE_OPT --query Arn) PARTITION=$(echo $CALLER_IDENTITY | cut -d: -f2) ACCOUNT_ID=$(echo $CALLER_IDENTITY | cut -d: -f5) @@ -34,14 +34,14 @@ extra7166() { if [[ $LIST_OF_ELASTIC_IPS_WITH_ASSOCIATIONS ]]; then for elastic_ip in $LIST_OF_ELASTIC_IPS_WITH_ASSOCIATIONS; do EIP_ARN="arn:${PARTITION}:ec2:${regx}:${ACCOUNT_ID}:eip-allocation/${elastic_ip}" - if aws shield describe-protection --resource-arn $EIP_ARN >/dev/null 2>&1; then + if $AWSCLI $PROFILE_OPT shield describe-protection --resource-arn $EIP_ARN >/dev/null 2>&1; then textPass "$regx: EIP $elastic_ip is protected by AWS Shield Advanced" "$regx" "$elastic_ip" else textFail "$regx: EIP $elastic_ip is not protected by AWS Shield Advanced" "$regx" "$elastic_ip" fi done else - textPass "$regx: no elastic IP addresses with assocations found" "$regx" + textInfo "$regx: no elastic IP addresses with assocations found" "$regx" fi done else diff --git a/checks/check_extra7167 b/checks/check_extra7167 index 5bdcefed86..18ce62099f 100644 --- a/checks/check_extra7167 +++ b/checks/check_extra7167 @@ -12,12 +12,12 @@ # specific language governing permissions and limitations under the License. CHECK_ID_extra7167="7.167" -CHECK_TITLE_extra7167="[extra7167] Check if Cloudfront distributions are protected by AWS Shield" +CHECK_TITLE_extra7167="[extra7167] Check if Cloudfront distributions are protected by AWS Shield Advanced" CHECK_SCORED_extra7167="NOT_SCORED" CHECK_CIS_LEVEL_extra7167="EXTRA" -CHECK_SEVERITY_check="Medium" +CHECK_SEVERITY_extra7167="Medium" CHECK_ASFF_RESOURCE_TYPE_extra7167="AwsCloudFrontDistribution" -CHECK_ALTERNATE_extra7167="extra7167" +CHECK_ALTERNATE_check7167="extra7167" CHECK_SERVICENAME_extra7167="shield" CHECK_RISK_extra7167='AWS Shield Advanced provides expanded DDoS attack protection for your resources' CHECK_REMEDIATION_extra7167='Add as a protected resource in AWS Shield Advanced.' @@ -25,20 +25,20 @@ CHECK_DOC_extra7167='https://docs.aws.amazon.com/waf/latest/developerguide/confi CHECK_CAF_EPIC_extra7167='Infrastructure security' extra7167() { - if [[ "$($AWSCLI shield get-subscription-state --output text)" == "ACTIVE" ]]; then + if [[ "$($AWSCLI $PROFILE_OPT shield get-subscription-state --output text)" == "ACTIVE" ]]; then LIST_OF_CLOUDFRONT_DISTRIBUTIONS=$($AWSCLI cloudfront list-distributions $PROFILE_OPT --query 'DistributionList.Items[*].[Id,ARN]' --output text) if [[ $LIST_OF_CLOUDFRONT_DISTRIBUTIONS ]]; then while read -r distribution; do DISTRIBUTION_ID=$(echo $distribution | awk '{ print $1; }') DISTRIBUTION_ARN=$(echo $distribution | awk '{ print $2; }') - if aws shield describe-protection --resource-arn $DISTRIBUTION_ARN >/dev/null 2>&1; then + if $AWSCLI $PROFILE_OPT shield describe-protection --resource-arn $DISTRIBUTION_ARN >/dev/null 2>&1; then textPass "$REGION: Cloudfront distribution $DISTRIBUTION_ID is protected by AWS Shield Advanced" "$REGION" "$DISTRIBUTION_ID" else textFail "$REGION: Cloudfront distribution $DISTRIBUTION_ID is not protected by AWS Shield Advanced" "$REGION" "$DISTRIBUTION_ID" fi done <<<"$LIST_OF_CLOUDFRONT_DISTRIBUTIONS" else - textPass "$REGION: no Cloudfront distributions found" "$REGION" + textInfo "$REGION: no Cloudfront distributions found" "$REGION" fi else textInfo "No AWS Shield Advanced subscription found. Skipping check." diff --git a/checks/check_extra7168 b/checks/check_extra7168 index 67f9901235..e2f2514d1a 100644 --- a/checks/check_extra7168 +++ b/checks/check_extra7168 @@ -12,12 +12,12 @@ # specific language governing permissions and limitations under the License. CHECK_ID_extra7168="7.168" -CHECK_TITLE_extra7168="[extra7168] Check if Route53 hosted zones are protected by AWS Shield" +CHECK_TITLE_extra7168="[extra7168] Check if Route53 hosted zones are protected by AWS Shield Advanced" CHECK_SCORED_extra7168="NOT_SCORED" CHECK_CIS_LEVEL_extra7168="EXTRA" -CHECK_SEVERITY_check="Medium" +CHECK_SEVERITY_extra7168="Medium" CHECK_ASFF_RESOURCE_TYPE_extra7168="AwsRoute53Domain" -CHECK_ALTERNATE_extra7168="extra7168" +CHECK_ALTERNATE_check7168="extra7168" CHECK_SERVICENAME_extra7168="shield" CHECK_RISK_extra7168='AWS Shield Advanced provides expanded DDoS attack protection for your resources' CHECK_REMEDIATION_extra7168='Add as a protected resource in AWS Shield Advanced.' @@ -25,7 +25,7 @@ CHECK_DOC_extra7168='https://docs.aws.amazon.com/waf/latest/developerguide/confi CHECK_CAF_EPIC_extra7168='Infrastructure security' extra7168() { - if [[ "$($AWSCLI shield get-subscription-state --output text)" == "ACTIVE" ]]; then + if [[ "$($AWSCLI $PROFILE_OPT shield get-subscription-state --output text)" == "ACTIVE" ]]; then CALLER_IDENTITY=$($AWSCLI sts get-caller-identity $PROFILE_OPT --query Arn) PARTITION=$(echo $CALLER_IDENTITY | cut -d: -f2) LIST_OF_ROUTE53_HOSTED_ZONES=$($AWSCLI route53 list-hosted-zones $PROFILE_OPT --query 'HostedZones[*].[Id,Name]' --output text) @@ -34,14 +34,14 @@ extra7168() { HOSTED_ZONE_ID=$(echo $hosted_zone | awk '{ print $1; }') HOSTED_ZONE_NAME=$(echo $hosted_zone | awk '{ print $2; }') HOSTED_ZONE_ARN="arn:${PARTITION}:route53:::${HOSTED_ZONE_ID:1}" - if aws shield describe-protection --resource-arn $HOSTED_ZONE_ARN >/dev/null 2>&1; then + if $AWSCLI $PROFILE_OPT shield describe-protection --resource-arn $HOSTED_ZONE_ARN >/dev/null 2>&1; then textPass "$REGION: Route53 Hosted Zone $HOSTED_ZONE_NAME is protected by AWS Shield Advanced" "$REGION" "$HOSTED_ZONE_NAME" else textFail "$REGION: Route53 Hosted Zone $HOSTED_ZONE_NAME is not protected by AWS Shield Advanced" "$REGION" "$HOSTED_ZONE_NAME" fi done <<<"$LIST_OF_ROUTE53_HOSTED_ZONES" else - textPass "$REGION: no Route53 hosted zones found" "$REGION" + textInfo "$REGION: no Route53 hosted zones found" "$REGION" fi else textInfo "No AWS Shield Advanced subscription found. Skipping check." diff --git a/checks/check_extra7169 b/checks/check_extra7169 index 728244ac6d..573c0415ee 100644 --- a/checks/check_extra7169 +++ b/checks/check_extra7169 @@ -12,12 +12,12 @@ # specific language governing permissions and limitations under the License. CHECK_ID_extra7169="7.169" -CHECK_TITLE_extra7169="[extra7169] Check if global accelerators are protected by AWS Shield" +CHECK_TITLE_extra7169="[extra7169] Check if global accelerators are protected by AWS Shield Advanced" CHECK_SCORED_extra7169="NOT_SCORED" CHECK_CIS_LEVEL_extra7169="EXTRA" -CHECK_SEVERITY_check="Medium" +CHECK_SEVERITY_extra7169="Medium" CHECK_ASFF_RESOURCE_TYPE_extra7169="AwsGlobalAccelerator" -CHECK_ALTERNATE_extra7169="extra7169" +CHECK_ALTERNATE_check7169="extra7169" CHECK_SERVICENAME_extra7169="shield" CHECK_RISK_extra7169='AWS Shield Advanced provides expanded DDoS attack protection for your resources' CHECK_REMEDIATION_extra7169='Add as a protected resource in AWS Shield Advanced.' @@ -25,20 +25,20 @@ CHECK_DOC_extra7169='https://docs.aws.amazon.com/waf/latest/developerguide/confi CHECK_CAF_EPIC_extra7169='Infrastructure security' extra7169() { - if [[ "$($AWSCLI shield get-subscription-state --output text)" == "ACTIVE" ]]; then + if [[ "$($AWSCLI $PROFILE_OPT shield get-subscription-state --output text)" == "ACTIVE" ]]; then LIST_OF_GLOBAL_ACCELERATORS=$($AWSCLI globalaccelerator list-accelerators --region us-west-2 $PROFILE_OPT --query 'Accelerators[?Enabled].[Name,AcceleratorArn]' --output text) if [[ $LIST_OF_GLOBAL_ACCELERATORS ]]; then while read -r accelerator; do ACCELERATOR_NAME=$(echo $accelerator | awk '{ print $1; }') ACCELERATOR_ARN=$(echo $accelerator | awk '{ print $2; }') - if aws shield describe-protection --resource-arn $ACCELERATOR_ARN >/dev/null 2>&1; then + if $AWSCLI $PROFILE_OPT shield describe-protection --resource-arn $ACCELERATOR_ARN >/dev/null 2>&1; then textPass "$REGION: Global Accelerator $ACCELERATOR_NAME is protected by AWS Shield Advanced" "$REGION" "$ACCELERATOR_NAME" else textFail "$REGION: Global Accelerator $ACCELERATOR_NAME is not protected by AWS Shield Advanced" "$REGION" "$ACCELERATOR_NAME" fi done <<<"$LIST_OF_GLOBAL_ACCELERATORS" else - textPass "$REGION: no global accelerators found" "$REGION" + textInfo "$REGION: no global accelerators found" "$REGION" fi else textInfo "No AWS Shield Advanced subscription found. Skipping check." diff --git a/checks/check_extra7170 b/checks/check_extra7170 index 190604ddd7..f8675a5c37 100644 --- a/checks/check_extra7170 +++ b/checks/check_extra7170 @@ -12,12 +12,12 @@ # specific language governing permissions and limitations under the License. CHECK_ID_extra7170="7.170" -CHECK_TITLE_extra7170="[extra7170] Check if internet-facing application load balancers are protected by AWS Shield" +CHECK_TITLE_extra7170="[extra7170] Check if internet-facing application load balancers are protected by AWS Shield Advanced" CHECK_SCORED_extra7170="NOT_SCORED" CHECK_CIS_LEVEL_extra7170="EXTRA" -CHECK_SEVERITY_check="Medium" +CHECK_SEVERITY_extra7170="Medium" CHECK_ASFF_RESOURCE_TYPE_extra7170="AwsElasticLoadBalancingV2LoadBalancer" -CHECK_ALTERNATE_extra7170="extra7170" +CHECK_ALTERNATE_check7170="extra7170" CHECK_SERVICENAME_extra7170="shield" CHECK_RISK_extra7170='AWS Shield Advanced provides expanded DDoS attack protection for your resources' CHECK_REMEDIATION_extra7170='Add as a protected resource in AWS Shield Advanced.' @@ -25,21 +25,21 @@ CHECK_DOC_extra7170='https://docs.aws.amazon.com/waf/latest/developerguide/confi CHECK_CAF_EPIC_extra7170='Infrastructure security' extra7170() { - if [[ "$($AWSCLI shield get-subscription-state --output text)" == "ACTIVE" ]]; then + if [[ "$($AWSCLI $PROFILE_OPT shield get-subscription-state --output text)" == "ACTIVE" ]]; then for regx in $REGIONS; do LIST_OF_APPLICATION_LOAD_BALANCERS=$($AWSCLI elbv2 describe-load-balancers $PROFILE_OPT --region $regx --query 'LoadBalancers[?Type == `application` && Scheme == `internet-facing`].[LoadBalancerName,LoadBalancerArn]' --output text) if [[ $LIST_OF_APPLICATION_LOAD_BALANCERS ]]; then while read -r alb; do ALB_NAME=$(echo $alb | awk '{ print $1; }') ALB_ARN=$(echo $alb | awk '{ print $2; }') - if aws shield describe-protection --resource-arn $ALB_ARN >/dev/null 2>&1; then + if $AWSCLI $PROFILE_OPT shield describe-protection --resource-arn $ALB_ARN >/dev/null 2>&1; then textPass "$regx: ALB $ALB_NAME is protected by AWS Shield Advanced" "$regx" "$ALB_NAME" else textFail "$regx: ALB $ALB_NAME is not protected by AWS Shield Advanced" "$regx" "$ALB_NAME" fi done <<<"$LIST_OF_APPLICATION_LOAD_BALANCERS" else - textPass "$regx: no application load balancers found" "$regx" + textInfo "$regx: no application load balancers found" "$regx" fi done else diff --git a/checks/check_extra7171 b/checks/check_extra7171 index 87db38b355..61834e58fc 100644 --- a/checks/check_extra7171 +++ b/checks/check_extra7171 @@ -12,12 +12,12 @@ # specific language governing permissions and limitations under the License. CHECK_ID_extra7171="7.171" -CHECK_TITLE_extra7171="[extra7171] Check if classic load balancers are protected by AWS Shield" +CHECK_TITLE_extra7171="[extra7171] Check if classic load balancers are protected by AWS Shield Advanced" CHECK_SCORED_extra7171="NOT_SCORED" CHECK_CIS_LEVEL_extra7171="EXTRA" -CHECK_SEVERITY_check="Medium" +CHECK_SEVERITY_extra7171="Medium" CHECK_ASFF_RESOURCE_TYPE_extra7171="AwsElasticLoadBalancingLoadBalancer" -CHECK_ALTERNATE_extra7171="extra7171" +CHECK_ALTERNATE_check7171="extra7171" CHECK_SERVICENAME_extra7171="shield" CHECK_RISK_extra7171='AWS Shield Advanced provides expanded DDoS attack protection for your resources' CHECK_REMEDIATION_extra7171='Add as a protected resource in AWS Shield Advanced.' @@ -25,7 +25,7 @@ CHECK_DOC_extra7171='https://docs.aws.amazon.com/waf/latest/developerguide/confi CHECK_CAF_EPIC_extra7171='Infrastructure security' extra7171() { - if [[ "$($AWSCLI shield get-subscription-state --output text)" == "ACTIVE" ]]; then + if [[ "$($AWSCLI $PROFILE_OPT shield get-subscription-state --output text)" == "ACTIVE" ]]; then CALLER_IDENTITY=$($AWSCLI sts get-caller-identity $PROFILE_OPT --query Arn) PARTITION=$(echo $CALLER_IDENTITY | cut -d: -f2) ACCOUNT_ID=$(echo $CALLER_IDENTITY | cut -d: -f5) @@ -34,14 +34,14 @@ extra7171() { if [[ $LIST_OF_CLASSIC_LOAD_BALANCERS ]]; then for elb in $LIST_OF_CLASSIC_LOAD_BALANCERS; do ELB_ARN="arn:${PARTITION}:elasticloadbalancing:${regx}:${ACCOUNT_ID}:loadbalancer/${elb}" - if aws shield describe-protection --resource-arn $ELB_ARN >/dev/null 2>&1; then + if $AWSCLI $PROFILE_OPT shield describe-protection --resource-arn $ELB_ARN >/dev/null 2>&1; then textPass "$regx: ELB $elb is protected by AWS Shield Advanced" "$regx" "$elb" else textFail "$regx: ELB $elb is not protected by AWS Shield Advanced" "$regx" "$elb" fi done else - textPass "$regx: no classic load balancers found" "$regx" + textInfo "$regx: no classic load balancers found" "$regx" fi done else diff --git a/checks/check_sample b/checks/check_sample index 873aa2ba83..1ec39a35b0 100644 --- a/checks/check_sample +++ b/checks/check_sample @@ -27,7 +27,7 @@ # CHECK_TITLE_checkN="[checkN] Description " # CHECK_SCORED_checkN="NOT_SCORED" # CHECK_CIS_LEVEL_checkN="EXTRA" -# CHECK_SEVERITY_check="Medium" +# CHECK_SEVERITY_checkNN="Medium" # CHECK_ASFF_RESOURCE_TYPE_checkN="AwsAccount" # Choose appropriate value from https://docs.aws.amazon.com/securityhub/latest/userguide/securityhub-findings-format.html#asff-resources # CHECK_ALTERNATE_checkN="extraN" # CHECK_SERVICENAME_checkN="service" # get service short name from `curl -s https://api.regional-table.region-services.aws.a2z.com/index.json | jq -r '.prices[] | .id' | awk -F: '{ print $1 }' | sort -u` diff --git a/groups/group7_extras b/groups/group7_extras index 9d95d88730..eeb1d031d7 100644 --- a/groups/group7_extras +++ b/groups/group7_extras @@ -15,7 +15,7 @@ GROUP_ID[7]='extras' GROUP_NUMBER[7]='7.0' GROUP_TITLE[7]='Extras - all non CIS specific checks - [extras] ****************' GROUP_RUN_BY_DEFAULT[7]='Y' # run it when execute_all is called -GROUP_CHECKS[7]='extra71,extra72,extra73,extra74,extra75,extra76,extra77,extra78,extra79,extra710,extra711,extra712,extra713,extra714,extra715,extra716,extra717,extra718,extra719,extra720,extra721,extra722,extra723,extra724,extra725,extra726,extra727,extra728,extra729,extra730,extra731,extra732,extra733,extra734,extra735,extra736,extra738,extra739,extra740,extra741,extra742,extra743,extra744,extra745,extra746,extra747,extra748,extra749,extra750,extra751,extra752,extra753,extra754,extra755,extra757,extra758,extra761,extra762,extra763,extra764,extra765,extra767,extra768,extra769,extra770,extra771,extra772,extra773,extra774,extra775,extra776,extra777,extra778,extra779,extra780,extra781,extra782,extra783,extra784,extra785,extra786,extra787,extra788,extra791,extra792,extra793,extra794,extra795,extra796,extra797,extra798,extra799,extra7100,extra7101,extra7102,extra7103,extra7104,extra7105,extra7106,extra7107,extra7108,extra7109,extra7110,extra7111,extra7112,extra7113,extra7114,extra7115,extra7116,extra7117,extra7118,extra7119,extra7120,extra7121,extra7122,extra7123,extra7124,extra7125,extra7126,extra7127,extra7128,extra7129,extra7130,extra7131,extra7132,extra7133,extra7134,extra7135,extra7136,extra7137,extra7138,extra7139,extra7140,extra7141,extra7142,extra7143,extra7144,extra7145,extra7146,extra7147,extra7148,extra7149,extra7150,extra7151,extra7152,extra7153,extra7154,extra7155,extra7156,extra7157,extra7158,extra7159,extra7160,extra7161,extra7162,extra7163,extra7164,extra7165' +GROUP_CHECKS[7]='extra71,extra72,extra73,extra74,extra75,extra76,extra77,extra78,extra79,extra710,extra711,extra712,extra713,extra714,extra715,extra716,extra717,extra718,extra719,extra720,extra721,extra722,extra723,extra724,extra725,extra726,extra727,extra728,extra729,extra730,extra731,extra732,extra733,extra734,extra735,extra736,extra738,extra739,extra740,extra741,extra742,extra743,extra744,extra745,extra746,extra747,extra748,extra749,extra750,extra751,extra752,extra753,extra754,extra755,extra757,extra758,extra761,extra762,extra763,extra764,extra765,extra767,extra768,extra769,extra770,extra771,extra772,extra773,extra774,extra775,extra776,extra777,extra778,extra779,extra780,extra781,extra782,extra783,extra784,extra785,extra786,extra787,extra788,extra791,extra792,extra793,extra794,extra795,extra796,extra797,extra798,extra799,extra7100,extra7101,extra7102,extra7103,extra7104,extra7105,extra7106,extra7107,extra7108,extra7109,extra7110,extra7111,extra7112,extra7113,extra7114,extra7115,extra7116,extra7117,extra7118,extra7119,extra7120,extra7121,extra7122,extra7123,extra7124,extra7125,extra7126,extra7127,extra7128,extra7129,extra7130,extra7131,extra7132,extra7133,extra7134,extra7135,extra7136,extra7137,extra7138,extra7139,extra7140,extra7141,extra7142,extra7143,extra7144,extra7145,extra7146,extra7147,extra7148,extra7149,extra7150,extra7151,extra7152,extra7153,extra7154,extra7155,extra7156,extra7157,extra7158,extra7159,extra7160,extra7161,extra7162,extra7163,extra7164,extra7165,extra7166,extra7167,extra7168,extra7169,extra7170,extra7171' # Extras 759 and 760 (lambda variables and code secrets finder are not included) # to run detect-secrets use `./prowler -g secrets`