Skip to content

Commit

Permalink
Desync mitigation check on ELBv1 (#807)
Browse files Browse the repository at this point in the history
  • Loading branch information
cbeltranbird authored Dec 3, 2020
1 parent 5cd0480 commit 7bc830c
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 0 deletions.
6 changes: 6 additions & 0 deletions audit_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -388,3 +388,9 @@ REQUEST_SMUGGLING:
description: "HTTP request smuggling is possible against ALBs, as described here: https://portswigger.net/web-security/request-smuggling"
severity: Low
group: ELB

ELBV1_DESYNC_MITIGATION:
title: Desync mitigation mode not configured
description: "Desync mitigation mode protects your application from issues due to HTTP Desync and should be set to 'Strictest'. https://docs.aws.amazon.com/elasticloadbalancing/latest/classic/config-desync-mitigation-mode.html"
severity: Low
group: ELB
5 changes: 5 additions & 0 deletions collect_commands.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,11 @@
Value: rds-describe-db-instances.json|.DBInstances[]?|.DBInstanceArn
- Service: elb
Request: describe-load-balancers
- Service: elb
Request: describe-load-balancer-attributes
Parameters:
- Name: LoadBalancerName
Value: elb-describe-load-balancers.json|.LoadBalancerDescriptions[].LoadBalancerName
- Service: elb
Request: describe-load-balancer-policies
- Service: elb
Expand Down
20 changes: 20 additions & 0 deletions shared/audit.py
Original file line number Diff line number Diff line change
Expand Up @@ -837,6 +837,25 @@ def audit_ec2(findings, region):
)


def audit_elbv1(findings, region):
json_blob = query_aws(region.account, "elb-describe-load-balancers", region)

for load_balancer in json_blob.get("LoadBalancerDescriptions", []):
lb_name = load_balancer["LoadBalancerName"]

# Check attributes
attributes_json = get_parameter_file(
region, "elb", "describe-load-balancer-attributes", lb_name
)

for attribute in attributes_json.get("LoadBalancerAttributes", [])['AdditionalAttributes']:
if (
attribute["Key"] == "elb.http.desyncmitigationmode"
and attribute["Value"] != "strictest"
):
findings.add(Finding(region, "ELBV1_DESYNC_MITIGATION", lb_name))


def audit_elbv2(findings, region):
json_blob = query_aws(region.account, "elbv2-describe-load-balancers", region)

Expand Down Expand Up @@ -1172,6 +1191,7 @@ def audit(accounts):
audit_redshift(findings, region)
audit_es(findings, region)
audit_ec2(findings, region)
audit_elbv1(findings, region)
audit_elbv2(findings, region)
audit_sg(findings, region)
audit_lambda(findings, region)
Expand Down

0 comments on commit 7bc830c

Please sign in to comment.