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.
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
| Item | What to remember |
|---|---|
| Web ACL | The resource you attach. It has ordered rules plus a default action (allow or block) for unmatched requests |
| Rule evaluation | By priority, lowest number first. Allow and Block end evaluation. Count does not |
| Rule actions | Allow, Block, Count, CAPTCHA, Challenge. Block returns 403 by default, and the response can be customized |
| CAPTCHA and Challenge | Non-terminating when the client holds a valid token. Otherwise they block and send a puzzle or silent challenge. Need HTTPS. Extra fees apply |
| Count | Use to test a new rule before blocking. Labels set by a counted rule can feed later rules |
| Statement inspection | IP sets, geo match, headers, URI, query string, body, SQL injection, XSS, regex, size, labels. Combine with AND, OR, NOT |
| Rule groups | Your own, AWS Managed Rules, or AWS Marketplace sellers. AWS keeps managed groups updated |
| Scope | Regional web ACLs for ALB, API Gateway and others. A separate CloudFront (global) scope for distributions |
| Logging | CloudWatch Logs, S3 or Firehose |
| Body inspection | 8 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
| Need | Statement |
|---|---|
| Allow or block known addresses | IP set match (up to 10,000 CIDRs per set) |
| Country-level policy | Geo match, optionally on a forwarded IP header. It adds country and region labels |
| Specific strings, User-Agent, path | String match or regex pattern set, with text transformations (URL decode, lowercase) |
| Injection | SQLi and XSS match statements, or the managed groups |
| Too many requests | Rate-based rule (next section) |
| Header-order or TLS client identity | JA3 / JA4 fingerprint match on the TLS ClientHello |
| Reuse rules | Your 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.
| Setting | Value |
|---|---|
| Evaluation window | 60, 120, 300 (default) or 600 seconds |
| Lowest rate limit | 10 |
| Aggregation | Source 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 actions | Any except Allow |
| Cost in WCUs | 2 base, plus 30 per custom aggregation key |
| Per web ACL | Up 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 /loginrequests 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
| Group | Protects against | Extra fee |
|---|---|---|
| Core rule set (CRS) | Broad OWASP Top 10 web exploits | No |
| Known bad inputs, Admin protection | Log4j-style payloads, exposed admin paths | No |
| SQL database, Linux/POSIX/Windows OS, PHP, WordPress | Stack-specific exploits | No |
| Amazon IP reputation, Anonymous IP list | Known-bad sources, VPNs, Tor, hosting providers | No |
| Bot Control (common or targeted level) | Scrapers, crawlers, automation. Targeted adds browser interrogation, fingerprinting and ML | Yes |
| Fraud Control ATP (account takeover prevention) | Credential stuffing on the login endpoint, checks for stolen credentials | Yes |
| Fraud Control ACFP (account creation fraud prevention) | Fake sign-ups on the registration endpoint | Yes |
| Anti-DDoS | Layer 7 floods, with Challenge for suspect clients. Resource-level protection on ALBs, plus the AWSManagedRulesAntiDDoSRuleSet group for CloudFront and other resources | Yes (included with Shield Advanced) |
| AWS Marketplace groups | Vendor rules from firms such as F5, Fortinet, Imperva | Subscription |
- 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
| Item | Value |
|---|---|
| Web ACLs per account per Region | 100 |
| Capacity units per web ACL or rule group | 5,000 maximum. Fees rise above 1,500 WCUs per web ACL |
| IPs per IP set | 10,000 CIDR entries |
| Requests per second per web ACL | 100,000 default quota for non-CloudFront resources |
| Calls to AssociateWebACL | 1 per 2 seconds per account per Region |
AWS Firewall Manager
| Item | What to remember |
|---|---|
| Needs | AWS Organizations, a Firewall Manager administrator account, and AWS Config enabled in the accounts. Some policy types also need AWS RAM sharing |
| Policy types | WAF, Shield Advanced, security groups, network ACLs, Network Firewall, Route 53 Resolver DNS Firewall, third-party firewalls |
| Scope | All accounts or selected accounts and OUs, by resource type, and by tags |
| Auto remediation | Brings noncompliant resources into line and covers new accounts and new resources |
| Cost | You 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
Authorizationheader in the logging configuration.
Scenarios
ATP is built for credential stuffing: it inspects login requests, checks credentials against stolen-credential lists and tracks failed-login patterns per session and fingerprint, not just per IP. A global limit of 10 would block real users on every page. A network ACL on the ALB never sees the client addresses behind CloudFront and can't keep up with rotating residential IPs. Shield Advanced and the SRT target DDoS, not low-rate credential abuse.
Firewall Manager applies WAF policies across the organization, attaches them to new in-scope resources automatically, and keeps the security team's first rule groups ahead of each account's own rules. An SCP can't check whether a protection pack exists. Protection packs aren't shared through RAM. A one-time StackSet doesn't attach the rules to ALBs created later and lets account owners edit or detach them.
Related
Further reading
Edge Security with CloudFront, WAF and Shield
Layered edge protection. WAF rules, Shield DDoS, origin lockdown with OAC and secret headers, and central policy through Firewall Manager.
AWS Shield and DDoS Resilience
Shield Standard versus Shield Advanced, which resources each protects, and the architecture patterns that make an application resilient to DDoS.