Skip to Content
Asterrr's Handbook
3 · Infrastructure security

AWS WAF and Firewall Manager

Layer 7 filtering with web ACLs, rate-based rules and managed rule groups, and org-wide enforcement with Firewall Manager.

Exam tasks: 3.1 (WAF, OWASP Top 10, rules for geography, rate limiting and client fingerprinting)

The decision: which WAF rule type or managed group stops this request pattern, and where do you attach it and manage it centrally?

AWS WAF inspects HTTP and HTTPS requests at layer 7 and allows, blocks, counts or challenges them. It attaches to a web ACL on a supported resource. AWS Firewall Manager deploys and audits WAF and other firewall policies across an AWS Organizations organization. WAF does not stop network layer floods. That is Shield.

Firewall Manager administrator accountMember accountdeploysHTTPSinspectallowedlogFirewall ManagerpolicyWeb ACLCloudFrontLoad balancerWAF logsClients
A Firewall Manager policy pushes a web ACL into each member account. WAF filters requests before they reach the protected resource and writes logs.
us-east-1
Region for protection packs attached to CloudFront (and for ACM certificates used by CloudFront).
60–600 s
Rate-based evaluation window choices: 60, 120, 300 (default) or 600 seconds.
10
Lowest request limit a rate-based rule accepts.
1,500 WCU
Capacity included per protection pack before extra charges.
8 KB / 16 KB
Default body inspection limit for ALB and AppSync / for CloudFront and API Gateway.

To match a threat to an edge control first, see Which one to use.

What WAF protects

CloudFront distributions, API Gateway REST APIs, Application Load Balancers, AppSync GraphQL APIs, Cognito user pools, App Runner services, Verified Access instances, Amplify, and Bedrock AgentCore Gateway. It does not attach to Network Load Balancers or EC2 directly. ECS tasks are covered through an ALB.

Core facts

ItemWhat to remember
Web ACLThe resource you attach. It has ordered rules plus a default action (allow or block) for unmatched requests
Rule evaluationBy priority, lowest number first. Allow and Block end evaluation. Count does not
Rule actionsAllow, Block, Count, CAPTCHA, Challenge. Block returns 403 by default, and the response can be customized
CAPTCHA and ChallengeNon-terminating when the client holds a valid token. Otherwise they block and send a puzzle or silent challenge. Need HTTPS. Extra fees apply
CountUse to test a new rule before blocking. Labels set by a counted rule can feed later rules
Statement inspectionIP sets, geo match, headers, URI, query string, body, SQL injection, XSS, regex, size, labels. Combine with AND, OR, NOT
Rule groupsYour own, AWS Managed Rules, or AWS Marketplace sellers. AWS keeps managed groups updated
ScopeRegional web ACLs for ALB, API Gateway and others. A separate CloudFront (global) scope for distributions
LoggingCloudWatch Logs, S3 or Firehose
Body inspection8 KB for ALB and AppSync. Default 16 KB for CloudFront, API Gateway, Cognito, App Runner and Verified Access, adjustable up to 64 KB

Rule statements worth knowing

NeedStatement
Allow or block known addressesIP set match (up to 10,000 CIDRs per set)
Country-level policyGeo match, optionally on a forwarded IP header. It adds country and region labels
Specific strings, User-Agent, pathString match or regex pattern set, with text transformations (URL decode, lowercase)
InjectionSQLi and XSS match statements, or the managed groups
Too many requestsRate-based rule (next section)
Header-order or TLS client identityJA3 / JA4 fingerprint match on the TLS ClientHello
Reuse rulesYour own rule group, or managed groups from AWS or AWS Marketplace

Exam signal

"The same client keeps rotating IP addresses" means IP-based blocking won't hold. Match or rate limit on a JA3/JA4 fingerprint, a header, a cookie or a session token instead. The TLS fingerprint stays the same while the address changes.

Also worth knowing.

  • CloudFront protection packs are global and must be created in us-east-1. Every other resource uses a regional pack in its own Region.
  • Allow-by-default with block rules is normal for public sites. Block-by-default suits an API used only by known partners.
  • Set the oversize handling to Match or Block for APIs that must not accept uninspected payloads.

Rate-based rules

A rate-based rule counts requests per aggregation key over an evaluation window and applies its action to the key once it passes the limit.

SettingValue
Evaluation window60, 120, 300 (default) or 600 seconds
Lowest rate limit10
AggregationSource IP (default), IP from a header such as X-Forwarded-For, or custom keys such as a header or query argument. Or count all requests, which needs a scope-down statement
Allowed actionsAny except Allow
Cost in WCUs2 base, plus 30 per custom aggregation key
Per web ACLUp to 10 rate-based rules. Up to 4 per rule group

To rate limit only requests with a particular User-Agent, nest a string match statement as the scope-down statement of the rate-based rule. Requests that do not match are not counted. Requests from the same IP with other agents are untouched.

Exam signal

"Block an IP that sends too many requests", "login brute force" or "throttle a scraper": rate-based rule, optionally with a scope-down on URI or header. "Block known bad inputs, SQL injection, XSS": managed rule groups.

More on rate-based rules

  • Custom keys can combine headers, cookies, query arguments, URI path, HTTP method, labels and a JA3 or JA4 fingerprint.
  • Count all with a scope-down statement rate limits a whole class of traffic, for example all POST /login requests from one country.
  • The limit is approximate, not exact.

Rate limiting behind a proxy

Behind CloudFront or another proxy, every request to an ALB's protection pack comes from a proxy address. A rate-based rule keyed on source IP then throttles the proxy, not the attacker. Put the protection pack on CloudFront, or key on the forwarded IP header and accept that clients can spoof it.

Managed rule groups

GroupProtects againstExtra fee
Core rule set (CRS)Broad OWASP Top 10 web exploitsNo
Known bad inputs, Admin protectionLog4j-style payloads, exposed admin pathsNo
SQL database, Linux/POSIX/Windows OS, PHP, WordPressStack-specific exploitsNo
Amazon IP reputation, Anonymous IP listKnown-bad sources, VPNs, Tor, hosting providersNo
Bot Control (common or targeted level)Scrapers, crawlers, automation. Targeted adds browser interrogation, fingerprinting and MLYes
Fraud Control ATP (account takeover prevention)Credential stuffing on the login endpoint, checks for stolen credentialsYes
Fraud Control ACFP (account creation fraud prevention)Fake sign-ups on the registration endpointYes
Anti-DDoSLayer 7 floods, with Challenge for suspect clients. Resource-level protection on ALBs, plus the AWSManagedRulesAntiDDoSRuleSet group for CloudFront and other resourcesYes (included with Shield Advanced)
AWS Marketplace groupsVendor rules from firms such as F5, Fortinet, ImpervaSubscription
  • ATP and ACFP need you to tell WAF the login or registration path and where the username and password sit in the request. Add the application integration SDK (JavaScript or mobile) so clients get tokens, which makes Challenge and silent verification work.
  • Deploy a new managed group in Count first, read the labels in the logs, then switch to its default actions. Override one rule to Count if it blocks good traffic.
  • Pin a version of a managed group if you need change control. Otherwise AWS updates it automatically.

Legacy: use AWS WAF (v2) instead

AWS WAF Classic (conditions, separate regional and global APIs, rate-based rules fixed at 5 minutes) no longer accepts new configurations. Older material that talks about "conditions" and "rules with predicates" describes Classic.

Limits and defaults

ItemValue
Web ACLs per account per Region100
Capacity units per web ACL or rule group5,000 maximum. Fees rise above 1,500 WCUs per web ACL
IPs per IP set10,000 CIDR entries
Requests per second per web ACL100,000 default quota for non-CloudFront resources
Calls to AssociateWebACL1 per 2 seconds per account per Region

AWS Firewall Manager

ItemWhat to remember
NeedsAWS Organizations, a Firewall Manager administrator account, and AWS Config enabled in the accounts. Some policy types also need AWS RAM sharing
Policy typesWAF, Shield Advanced, security groups, network ACLs, Network Firewall, Route 53 Resolver DNS Firewall, third-party firewalls
ScopeAll accounts or selected accounts and OUs, by resource type, and by tags
Auto remediationBrings noncompliant resources into line and covers new accounts and new resources
CostYou pay for the underlying services such as WAF and Config

Setup flow in the console. Designate the administrator account, choose Create policy, pick the policy type and Region, add rule groups, choose scope and tags, then review compliance under Security policies.

Exam trap

Firewall Manager does not replace the services it manages. It deploys WAF web ACLs, Shield protections or firewalls. A question about enforcing the same WAF rules in every account is a Firewall Manager answer. A question about one application is a plain web ACL answer.

More on Firewall Manager

  • A WAF policy puts a first and last rule group around each account's own rules. The security team owns the baseline, and application teams can still add rules in between.
  • Third-party firewall policies cover Palo Alto Networks Cloud NGFW and Fortinet FortiGate CNF.
  • Auto remediation applies the policy to new resources that match tags or resource types as they appear.

Logging

  • WAF logs go to CloudWatch Logs, S3 or Data Firehose, and the destination name must start with aws-waf-logs-.
  • Redact fields such as the Authorization header in the logging configuration.

Scenarios

Scenario
A ticketing company serves its site through CloudFront with an ALB origin. When sales open, a botnet sends login requests at about 400 per minute per address, rotating through thousands of residential IP addresses. Legitimate users are rarely blocked by the current IP-based rate-based rule because each bot IP stays under the limit. The company wants to stop the credential stuffing with the least custom code. What should the security engineer do?
Scenario
A holding company runs 60 AWS accounts in AWS Organizations. Each business unit owns its web applications on ALBs and API Gateway. The security team must guarantee that every current and future internet-facing ALB and API has the Core rule set and the Amazon IP reputation list evaluated before any business-unit rules, while business units keep adding their own rules. What should the team do?

Further reading

On this page