id
stringlengths 8
78
| source
stringclasses 743
values | chunk_id
int64 1
5.05k
| text
stringlengths 593
49.7k
|
---|---|---|---|
waf-dg-094 | waf-dg.pdf | 94 | Description Date AWS WAF Bot Control rule group Released static version 3.1 of this rule group. 2024-11-07 New bot name label in Added the New York Times the Bot Control labels: label to the list of bot name awswaf:managed:aws labels. :bot-control:bot:: name:nytimes Core rule set (CRS) managed rule group Released static version 1.16 of this rule group. 2024-10-16 • CrossSiteScripting Improved detection signature _BODY s for the cross site scripting • CrossSiteScripting rules. _COOKIE • CrossSiteScripting _QUERYARGUMENTS • CrossSiteScripting _URIPATH Using managed rule groups 274 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Rule group and rules Description Date AWS WAF Bot Control rule group Released static versions 2.0 and 3.0 of this rule group. 2024-09-13 New rules: • TGT_TokenAbsent • TGT_VolumetricSess ionMaximum • TGT_SignalBrowserA utomationExtension • TGT_ML_Coordinated ActivityLow , TGT_ML_Coordinated ActivityMedium , and TGT_ML_Coordinated ActivityHigh • TGT_TokenReuseIpLo w , TGT_Token ReuseIpMedium , and TGT_TokenReuseIpHi gh Version 2.0 is the same as version 3.0, but with rule actions for all new rules set to Count. This guide documents the latest version of each rule group. Added the listed new rules. Updated labeling so that all rules apply a label with the pattern awswaf:ma naged:aws:bot-cont rol: <RuleName> . Added cloud service provider labels to the Bot Control signal labels. Added new bot name labels that are inspected for by bot • TGT_TokenReuseAsnL category rules. ow , TGT_Token ReuseAsnMedium , and TGT_TokenReuseAsnH igh • TGT_TokenReuseCoun tryLow , TGT_Token ReuseCountryMedium , and TGT_Token ReuseCountryHigh Deleted rules: Using managed rule groups 275 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Rule group and rules Description Date • TGT_TokenReuseIp . Replaced with the corresponding new low, medium, and high rules. New labels: • HTTP Library bots: • awswaf:ma naged:aws:bot- control:bot:n ame:fasthttp • AI bots: • awswaf:ma naged:aws:bot- control:bot:n ame:bedrockbot • awswaf:ma naged:aws:bot- control:bot:n ame:claudebot • awswaf:ma naged:aws:bot- control:bot:n ame:anthropic • awswaf:ma naged:aws:bot- control:bot:n ame:metae xternalagent • awswaf:ma naged:aws:bot- Using managed rule groups 276 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Rule group and rules Description Date control:bot:n ame:bytespider • awswaf:ma naged:aws:bot- control:bot:n ame:omgili • awswaf:ma naged:aws:bot- control:bot:n ame:diffbot • awswaf:ma naged:aws:bot- control:bot:n ame:perplexitybot • awswaf:ma naged:aws:bot- control:bot:n ame:timpibot • awswaf:ma naged:aws:bot- control:bot:n ame:cohere • Search engine bots: • awswaf:ma naged:aws:bot- control:bot:n ame:naver • Advertising bots: • awswaf:ma naged:aws:bot- control:bot:n ame:naver_ads Using managed rule groups 277 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Rule group and rules Description Date • Social media bots: • awswaf:ma naged:aws:bot- control:bot:n ame:snapchat • Content fetcher bots: • awswaf:ma naged:aws:bot- control:bot:n ame:naver_preview • awswaf:ma naged:aws:bot- control:bot:n ame:censys • awswaf:ma naged:aws:bot- control:bot:n ame:imess age_preview • awswaf:ma naged:aws:bot- control:bot:n ame:imagesift • Cloud service provider signals: • awswaf:ma naged:aws:bot- control:signa l:cloud_s ervice_pr ovider:aws • awswaf:ma naged:aws:bot- Using managed rule groups 278 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Rule group and rules Description Date control:signa l:cloud_s ervice_pr ovider:azure • awswaf:ma naged:aws:bot- control:signa l:cloud_s ervice_pr ovider:gcp • awswaf:ma naged:aws:bot- control:signa l:cloud_s ervice_pr ovider:oracle • awswaf:ma naged:aws:bot- control:signa l:cloud_s ervice_pr ovider:di gital_ocean • awswaf:ma naged:aws:bot- control:signa l:cloud_s ervice_pr ovider:akamai • awswaf:ma naged:aws:bot- control:signa l:cloud_s Using managed rule groups 279 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Rule group and rules Description Date ervice_pr ovider:cloudflare • awswaf:ma naged:aws:bot- control:signa l:cloud_s ervice_pr ovider:ibm_cloud Additional labeling in existing rules. AWS WAF Fraud Control account takeover prevention Released static version 1.1 of this rule group. 2024-09-13 (ATP) rule group All rules Updated labeling so that all rules apply a label with the pattern awswaf:managed:aws :atp: <RuleName> . AWS WAF Fraud Control account creation fraud Released static version 1.1 of this rule group. 2024-09-13 prevention (ACFP) rule group All rules Updated labeling so that all rules apply a label with the pattern awswaf:managed:aws :acfp: <RuleName> . Linux operating system managed rule group Released static version 2.5 of this rule group. 2024-09-02 All rules Added signatures to improve detection. Using managed rule groups 280 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Rule group and rules Description Date Core rule set (CRS) managed rule group Released static version 1.15 of this rule group. 2024-08-30 • GenericLFI_QUERYAR Improved detection signature GUMENTS s for the generic LFI rules. • GenericLFI_URIPATH • GenericLFI_BODY Windows operating system managed rule group Released static version 2.3 of this rule group. 2024-08-28 Adjusted detection signature s in the listed rules to reduce false positives. • • • WindowsShellComman ds_QUERYARGUMENTS WindowsShellComman ds_BODY WindowsShellComman ds_COOKIE WordPress application managed rule group Released static version 1.3 of this rule group. 2024-07-15 • WordPressExploitab leCommands_QUERYST RING Added the JS_DECODE text transformation to the listed rule. Linux operating system managed rule group Released static version 2.4 of this rule group. 2024-07-12 • LFI_QUERYSTRING Added the JS_DECODE text transformation to the listed rule. Using managed rule groups 281 AWS WAF, AWS |
waf-dg-095 | waf-dg.pdf | 95 | GenericLFI_URIPATH • GenericLFI_BODY Windows operating system managed rule group Released static version 2.3 of this rule group. 2024-08-28 Adjusted detection signature s in the listed rules to reduce false positives. • • • WindowsShellComman ds_QUERYARGUMENTS WindowsShellComman ds_BODY WindowsShellComman ds_COOKIE WordPress application managed rule group Released static version 1.3 of this rule group. 2024-07-15 • WordPressExploitab leCommands_QUERYST RING Added the JS_DECODE text transformation to the listed rule. Linux operating system managed rule group Released static version 2.4 of this rule group. 2024-07-12 • LFI_QUERYSTRING Added the JS_DECODE text transformation to the listed rule. Using managed rule groups 281 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Rule group and rules Description Date Core rule set (CRS) managed rule group Released static version 1.14 of this rule group. 2024-07-09 • EC2MetaDataSSRF_BO Added the JS_DECODE text DY transformation to the listed • EC2MetaDataSSRF_QU rules. ERYARGUMENTS • GenericLFI_QUERYAR GUMENTS • GenericLFI_BODY • RestrictedExtensio ns_QUERYARGUMENTS • GenericRFI_QUERYAR GUMENTS • GenericRFI_BODY • CrossSiteScripting _QUERYARGUMENTS • CrossSiteScripting _BODY • CrossSiteScripting _COOKIE • CrossSiteScripting _URIPATH Using managed rule groups 282 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Rule group and rules Description Date PHP application managed rule group Released static version 2.1 of this rule group. 2024-07-03 Added the JS_DECODE text transformation to the listed rules. • • PHPHighRiskMethods Variables_BODY PHPHighRiskMethods Variables_QUERYSTR ING Windows operating system managed rule group Released static version 2.2 of this rule group. 2024-07-03 Added the JS_DECODE text transformation to the listed rules. • • • • WindowsShellComman ds_QUERYARGUMENTS WindowsShellComman ds_BODY PowerShellCommands _QUERYARGUMENTS PowerShellCommands _BODY Linux operating system managed rule group Released static version 2.3 of this rule group. 2024-06-06 All rules Added signatures to improve detection. Using managed rule groups 283 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Rule group and rules Description Date AWS WAF Bot Control rule group The bot and fraud rule groups are now versioned. If you're 2024-05-29 AWS WAF Fraud Control account takeover prevention (ATP) rule group AWS WAF Fraud Control account creation fraud prevention (ACFP) rule group using any of these rule groups, this update doesn't change how they handle your web traffic. This update sets the current rule group version to static version 1.0 and sets the default version to point to it. For more information about versioned managed rules, see the following: • Using versioned managed rule groups in AWS WAF • Deployments for versioned AWS Managed Rules rule groups • Getting notified of new versions and updates to a managed rule group Using managed rule groups 284 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Rule group and rules Description Date POSIX operating system managed rule group Released static version 3.0 of this rule group. 2024-05-28 • • • • UNIXShellCommandsV ariables_QUERYARGU MENTS UNIXShellCommandsV ariables_QUERYSTRI NG UNIXShellCommandsV ariables_HEADER UNIXShellCommandsV ariables_BODY Removed UNIXShell CommandsVariables_ QUERYARGUMENTS and replaced it with UNIXShell CommandsVariables_ QUERYSTRING . If you have rules that match on the label for UNIXShellCommandsV ariables_QUERYARGU MENTS , when you use this version, switch them to match on the label for UNIXShell CommandsVariables_ QUERYSTRING . The new label is awswaf:ma naged:aws:posix-os :UNIXShellCommands Variables_QueryStr ing . Added the rule UNIXShell CommandsVariables_ HEADER , which matches on all headers. Updated all the rules in the managed rule group with improved detection logic. Corrected the documente d capitalization of the label Using managed rule groups 285 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Rule group and rules Description Date for UNIXShellCommandsV ariables_BODY . Core rule set (CRS) managed rule group Released static version 1.12 of this rule group. 2024-05-21 • CrossSiteScripting* Added signatures to all of the cross site scripting rules to improve detection and reduce false positives. SQL database managed rule group Released static version 1.2 of this rule group. 2024-05-14 • SQLi_BODY • SQLi_QUERYARGUMENTS • SQLiExtendedPatter ns_QUERYARGUMENTS Added the JS_DECODE text transformation to the listed rules. Known bad inputs managed rule group Released static version 1.22 of this rule group. 2024-05-08 • JavaDeserializatio nRCE_BODY Added the JS_DECODE text transformation to the listed rules. • JavaDeserializatio nRCE_QUERYSTRING • Log4JRCE_QUERYSTRI NG • Log4JRCE_BODY • Log4JRCE_HEADER POSIX operating system managed rule group Released static version 2.2 of this rule group. 2024-05-08 Added the JS_DECODE text transformation to both rules. Using managed rule groups 286 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Rule group and rules Description Date Windows operating system managed rule group Released static version 2.1 of this rule group. 2024-05-03 • PowerShellCommands _BODY Added signatures to PowerShellCommands _BODY to improve detection. Amazon IP reputation list managed rule group Updated the sources of the IP reputation list, to improve 2024-03-13 • AWSManagedIPReputa tionList identification of addresses that are actively engaging in malicious activities and to reduce false positives. This update doesn't involve a new version because this |
waf-dg-096 | waf-dg.pdf | 96 | the JS_DECODE text transformation to both rules. Using managed rule groups 286 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Rule group and rules Description Date Windows operating system managed rule group Released static version 2.1 of this rule group. 2024-05-03 • PowerShellCommands _BODY Added signatures to PowerShellCommands _BODY to improve detection. Amazon IP reputation list managed rule group Updated the sources of the IP reputation list, to improve 2024-03-13 • AWSManagedIPReputa tionList identification of addresses that are actively engaging in malicious activities and to reduce false positives. This update doesn't involve a new version because this rule group isn't versioned. Known bad inputs managed rule group Released static version 1.21 of this rule group. 2023-12-16 Added signatures to improve detection and reduce false positives. Using managed rule groups 287 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Rule group and rules Description Date Known bad inputs managed rule group Released static version 1.20 of this rule group. 2023-12-14 • ExploitablePaths_U RIPATH Updated the Exploitab lePaths_URIPATH to add detection for requests rule that match the Atlassian Confluence CVE-2023-22518 Improper Authorization vulnerability. This vulnerabi lity affects all versions of Confluence Data Center and Server. For more information, see NIST: National Vulnerabi lity Database: CVE-2023- 22518 Detail. Core rule set (CRS) managed rule group Released static version 1.11 of this rule group. 2023-12-06 • CrossSiteScripting* AWS WAF Bot Control rule group • New label: awswaf:ma naged:aws:bot-cont rol:targeted:aggre gate:coordinated_a ctivity:low Added signatures to all of the cross site scripting rules to improve detection and reduce false positives. Added the coordinated activity low label to the rule group's targeted protection level labels. This label isn't associated with any rule. This labeling is in addition to the medium and high level rules and labels. 2023-12-05 Using managed rule groups 288 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Rule group and rules Description Date Bot Control labels • Label: awswaf:ma naged:aws:bot-cont rol:targeted:signa l:browser_automati on_extension Added a signal label to the rule group that indicates the detection of a browser extension that assists in automation. This label isn't specific to an individual rule. 2023-11-14 Core rule set (CRS) managed rule group Released static version 1.10 of this rule group. 2023-11-02 • EC2MetaDataSSRF_QU ERYARGUMENTS Updated one rule to improve detection and reduce false positives. Core rule set (CRS) managed rule group Released static version 1.9 of this rule group. 2023-10-30 Updated rules to improve detection and reduce false positives. • • • • EC2MetaDataSSRF_BO DY EC2MetaDataSSRF_CO OKIE EC2MetaDataSSRF_UR IPATH EC2MetaDataSSRF_QU ERYARGUMENTS Using managed rule groups 289 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Rule group and rules Description Date POSIX operating system managed rule group Released static version 2.1 of this rule group. 2023-10-12 • UNIXShellCommandsV ariables_QUERYARGU MENTS Updated the query arguments rule to improve detection. Core rule set (CRS) managed rule group Released static version 1.8 of this rule group. 2023-10-11 • • • • GenericLFI_QUERYAR detection. GUMENTS Updated rules to improve GenericLFI_URIPATH RestrictedExtensio ns_URIPATH RestrictedExtensio ns_QUERYARGUMENTS Using managed rule groups 290 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Rule group and rules Description Date Known bad inputs managed rule group Exception deployment: released static version 1.19 of 2023-10-04 • ExploitablePaths_U RIPATH this rule group. Updated the default version to use version 1.19. Updated the Exploitab lePaths_URIPATH to add detection for requests rule matching the Atlassian Confluence CVE-2023- 22515 Privilege Escalation Vulnerability. This vulnerabi lity affects some versions of Atlassian Confluence. For more information, see NIST: National Vulnerability Database: CVE-2023-22515 Detail and Atlassian Support: FAQ for CVE-2023-22515. For information about this deployment type, see Exception deployments for AWS Managed Rules. Using managed rule groups 291 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Rule group and rules Description Date Known bad inputs managed rule group Exception deployment: released static version 1.18 of 2023-10-04 • • • Host_localhost_HEA DER Log4J* JavaDeserializatio n* this rule group. This is a quick rollout of this static version to accommodate the creation and rollout of version 1.19. Updated the Host_loca lhost_HEADER all Log4J and Java deseriali rule and zation rules for improved detection. For information about this deployment type, see Exception deployments for AWS Managed Rules. Using managed rule groups 292 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Rule group and rules Description Date AWS WAF Bot Control rule group Added rules to the rule group with Count action. 2023-09-06 • • • TGT_TokenReuseIp TGT_ML_Coordinated ActivityMedium TGT_ML_Coordinated ActivityHigh The token reuse IP rule detects and counts token sharing across IP addresses. The coordinated activity rules use automated, machine- learning (ML) analysis of website traffic to detect bot- related activity. In your rule group configuration, you can opt out of the use of ML. With this release, customers |
waf-dg-097 | waf-dg.pdf | 97 | deployments for AWS Managed Rules. Using managed rule groups 292 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Rule group and rules Description Date AWS WAF Bot Control rule group Added rules to the rule group with Count action. 2023-09-06 • • • TGT_TokenReuseIp TGT_ML_Coordinated ActivityMedium TGT_ML_Coordinated ActivityHigh The token reuse IP rule detects and counts token sharing across IP addresses. The coordinated activity rules use automated, machine- learning (ML) analysis of website traffic to detect bot- related activity. In your rule group configuration, you can opt out of the use of ML. With this release, customers who are currently using the targeted protection level are opted in to the use of ML. Opting out disables the coordinated activity rules. AWS WAF Bot Control rule group Added the rule CategoryAI to the rule group. 2023-08-30 • CategoryAI Using managed rule groups 293 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Rule group and rules Description Date Core rule set (CRS) managed rule group Released static version 1.7 of this rule group. 2023-07-26 • • • • • • RestrictedExtensio ns_URIPATH RestrictedExtensio ns_QUERYARGUMENTS EC2MetaDataSSRF_CO OKIE EC2MetaDataSSRF_QU ERYARGUMENTS EC2MetaDataSSRF_BO DY EC2MetaDataSSRF_UR IPATH AWS WAF Fraud Control account creation fraud prevention (ACFP) rule group All rules in new rule group Updated restricted extensions and EC2 metadata SSRF rules to improve detection and reduce false positives. Added the rule group 2023-06-13 AWSManagedRulesACF PRuleSet . Linux operating system managed rule group Released static version 2.2 of this rule group. 2023-05-22 Added signatures to improve detection. LFI_HEADER LFI_URIPATH • • • LFI_QUERYSTRING Using managed rule groups 294 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Rule group and rules Description Date Core rule set (CRS) managed rule group Released static version 1.6 of this rule group. 2023-04-28 Updated cross-site scripting (XSS) and restricted extension rules to improve detection and reduce false positives. • • • • • • RestrictedExtensio ns_URIPATH RestrictedExtensio ns_QUERYARGUMENTS CrossSiteScripting _COOKIE CrossSiteScripting _QUERYARGUMENTS CrossSiteScripting _BODY CrossSiteScripting _URIPATH Using managed rule groups 295 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Rule group and rules Description Date PHP application managed rule group Released static version 2.0 of this rule group. 2023-02-27 • • • • Updated PHPHighRi skMethodsVariables Added signatures to improve detection in all rules. _BODY Replaced the rule PHPHighRi Removed PHPHighRi skMethodsVariables _QUERYARGUMENTS Added PHPHighRi skMethodsVariables _QUERYSTRING Added PHPHighRi skMethodsVariables _HEADER skMethodsVariables _QUERYARGUMENTS with PHPHighRiskMethods Variables_QUERYSTR ING , which inspects the entire query string instead of just the query arguments. Added the rule PHPHighRi skMethodsVariables _HEADER , to expand coverage to include all headers. Updated the following labels to align with standard AWS Managed Rules labeling: • Old name: PHPHighRi skMethodsVariables _BODY New name: PHPHighRiskMethods Variables_Body • Old name: PHPHighRi skMethodsVariables _QUERYARGUMENTS New name: PHPHighRi Using managed rule groups 296 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Rule group and rules Description Date skMethodsVariables _QueryString AWS WAF Fraud Control account takeover prevention Added login response inspection rules for use with 2023-02-15 (ATP) rule group protected Amazon CloudFron • • VolumetricIpFailed LoginResponseHigh VolumetricSessionF ailedLoginResponse High t distributions. These rules can block new login attempts from IP addresses and client sessions that have recently been the source of too many failed login attempts. Core rule set (CRS) managed rule group Released static version 1.5 of this rule group. 2023-01-25 Updated Cross Site Scripting (XSS) filters to improve detection. • • • • • NoUserAgent_HEADER CrossSiteScripting _COOKIE CrossSiteScripting _QUERYARGUMENTS CrossSiteScripting _BODY CrossSiteScripting _URIPATH Using managed rule groups 297 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Rule group and rules Description Date Linux operating system managed rule group Released static version 2.1 of this rule group. 2022-12-15 • • • • LFI_COOKIE - removed LFI_HEADER - added LFI_URIPATH LFI_QUERYSTRING Removed the rule LFI_COOKI E and its label awswaf:ma naged:aws:linux- os:LFI_Cookie replaced them with the , and new rule LFI_HEADER and its label awswaf:ma naged:aws:linux- os:LFI_Header change expands inspection to . This multiple headers. Added text transformations and signatures to all rules to improve detection. Core rule set (CRS) managed rule group Released static version 1.4 of this rule group. 2022-12-05 Added a text transformation to NoUserAgent_HEADER to remove all null bytes. Updated the filters in the cross-site scripting rules to improve detection. • • • • • NoUserAgent_HEADER CrossSiteScripting _COOKIE CrossSiteScripting _QUERYARGUMENTS CrossSiteScripting _BODY CrossSiteScripting _URIPATH Using managed rule groups 298 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Rule group and rules Description Date Known bad inputs managed rule group Released static version 1.17 of this rule group. 2022-10-20 • • • • • JavaDeserializatio nRCE_BODY JavaDeserializatio nRCE_URIPATH JavaDeserializatio nRCE_HEADER JavaDeserializatio nRCE_QUERYSTRING Host_localhost_HEA DER Updated the Java deseriali zation rules to add detection for requests matching Apache CVE-2022-42889, a remote code execution |
waf-dg-098 | waf-dg.pdf | 98 | to remove all null bytes. Updated the filters in the cross-site scripting rules to improve detection. • • • • • NoUserAgent_HEADER CrossSiteScripting _COOKIE CrossSiteScripting _QUERYARGUMENTS CrossSiteScripting _BODY CrossSiteScripting _URIPATH Using managed rule groups 298 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Rule group and rules Description Date Known bad inputs managed rule group Released static version 1.17 of this rule group. 2022-10-20 • • • • • JavaDeserializatio nRCE_BODY JavaDeserializatio nRCE_URIPATH JavaDeserializatio nRCE_HEADER JavaDeserializatio nRCE_QUERYSTRING Host_localhost_HEA DER Updated the Java deseriali zation rules to add detection for requests matching Apache CVE-2022-42889, a remote code execution (RCE) vulnerability in Apache Commons Text versions prior to 1.10.0. For more informati on, see NIST: National Vulnerability Database: CVE-2022-42889 Detail and CVE-2022-42889: Apache Commons Text prior to 1.10.0 allows RCE when applied to untrusted input due to insecure interpolation defaults. Improved detection in Host_localhost_HEA DER . Using managed rule groups 299 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Rule group and rules Description Date Known bad inputs managed rule group Released static version 1.16 of this rule group. 2022-10-05 Removed false positives that AWS identified in version 1.15. • • • • Log4JRCE_HEADER Log4JRCE_QUERYSTRI NG Log4JRCE_URIPATH Log4JRCE_BODY POSIX operating system managed rule group Corrected the documented label names. 2022-09-19 PHP application managed rule group WordPress application managed rule group IP reputation rule groups This change doesn't alter how the rule group handles web 2022-08-30 • AWSManagedIPDDoSLi traffic. st Added a new rule with Count action to inspect for IP addresses that are actively engaging in DDoS activities, according to Amazon threat intelligence. Using managed rule groups 300 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Rule group and rules Description Date Known bad inputs managed rule group Released static version 1.15 of this rule group. 2022-08-22 • • • • • • • • • • • Log4JRCE Log4JRCE_HEADER Log4JRCE_QUERYSTRI NG Log4JRCE_URIPATH Log4JRCE_BODY JavaDeserializatio nRCE_HEADER JavaDeserializatio nRCE_BODY JavaDeserializatio nRCE_URIPATH JavaDeserializatio nRCE_QUERYSTRING Host_localhost_HEA DER PROPFIND_METHOD Removed Log4JRCE and replaced it with Log4JRCE_HEADER , Log4JRCE_QUERYSTRI NG , Log4JRCE_URI , and Log4JRCE_BODY , for more granular monitoring and management of false positives. Added signatures for improved detection and blocking to PROPFIND_ METHOD and to all JavaDeserializatio nRCE* and Log4JRCE* rules. Updated labels to correct capitalization in Host_loca and in lhost_HEADER all JavaDeserializatio nRCE* rules. Corrected the description of JavaDeserializatio nRCE_HEADER . Using managed rule groups 301 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Rule group and rules Description Date AWS WAF Fraud Control account takeover prevention Added a rule to prevent the use of the account takeover 2022-08-11 (ATP) rule group • UnsupportedCognito IDP Core rule set (CRS) managed rule group prevention managed rule group for Amazon Cognito user pool web traffic. AWS has scheduled expiratio 2022-06-09 n for versions Version_1 .2 and Version_2.0 of the rule group. The versions will expire on September 9, 2022. For information about version expiration, see Using versioned managed rule groups in AWS WAF. Core rule set (CRS) managed rule group Released version 1.3 of this rule group. This 2022-05-24 • GenericLFI_URIPATH GenericRFI_URIPATH AWS WAF Bot Control rule group • CategoryEmailClient release updates the match signatures in the rules GenericLFI_URIPATH and GenericRFI_URIPATH , to improve detection. Added the rule CategoryE to the rule mailClient group. 2022-04-06 Using managed rule groups 302 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Rule group and rules Description Date Known bad inputs managed rule group Released version 1.14 of this rule group. The four 2022-03-31 JavaDeserializtion RCE rules are moved to Block mode. • • • • JavaDeserializatio nRCE_HEADER JavaDeserializatio nRCE_BODY JavaDeserializatio nRCE_URI JavaDeserializatio nRCE_QUERYSTRING Known bad inputs managed rule group Released version 1.13 of this rule group. Updated the text 2022-03-31 transformation for Spring Core and Cloud Function RCE vulnerabilities. These rules are in count mode to gather metrics and evaluate matched patterns. The label can be used to block requests in a custom rule. A subsequent version will be deployed with these rules in block mode. • • • • JavaDeserializatio nRCE_HEADER_RC_COU NT JavaDeserializatio nRCE_BODY_RC_COUNT JavaDeserializatio nRCE_URI_RC_COUNT JavaDeserializatio nRCE_QUERYSTRING_R C_COUNT Using managed rule groups 303 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Rule group and rules Description Date Known bad inputs managed rule group Released version 1.12 of this rule group. Added signature 2022-03-30 • • • • • • • • • JavaDeserializatio nRCE_HEADER_RC_COU NT JavaDeserializatio nRCE_BODY_RC_COUNT JavaDeserializatio nRCE_URI_RC_COUNT JavaDeserializatio nRCE_QUERYSTRING_R C_COUNT Log4JRCE_HEADER s for Spring Core and Cloud Function RCE vulnerabilities. These rules are in count mode to gather metrics and evaluate matched patterns. The label can be used to block requests in a custom rule. A subsequent version will be deployed with these rules in block mode. Removed the rules Log4JRCE_HEADER , Log4JRCE_QUERYSTRI NG , Log4JRCE_URI , |
waf-dg-099 | waf-dg.pdf | 99 | Developer Guide Rule group and rules Description Date Known bad inputs managed rule group Released version 1.12 of this rule group. Added signature 2022-03-30 • • • • • • • • • JavaDeserializatio nRCE_HEADER_RC_COU NT JavaDeserializatio nRCE_BODY_RC_COUNT JavaDeserializatio nRCE_URI_RC_COUNT JavaDeserializatio nRCE_QUERYSTRING_R C_COUNT Log4JRCE_HEADER s for Spring Core and Cloud Function RCE vulnerabilities. These rules are in count mode to gather metrics and evaluate matched patterns. The label can be used to block requests in a custom rule. A subsequent version will be deployed with these rules in block mode. Removed the rules Log4JRCE_HEADER , Log4JRCE_QUERYSTRI NG , Log4JRCE_URI , and Log4JRCE_BODY and replaced them with the rule Log4JRCE_QUERYSTRI Log4JRCE. NG Log4JRCE_URI Log4JRCE_BODY Log4JRCE IP reputation rule groups Updated the AWSManage 2022-02-15 • AWSManagedReconnai ssanceList dReconnaissanceLis t rule to change the action from count to block. Using managed rule groups 304 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Rule group and rules Description Date AWS WAF Fraud Control account takeover prevention (ATP) rule group All rules in new rule group Added the rule group 2022-02-11 AWSManagedRulesATP RuleSet . Known bad inputs managed rule group Released version 1.9 of this rule group. Removed 2022-01-28 • • • • • Log4JRCE Log4JRCE_HEADER Log4JRCE_QUERYSTRI NG Log4JRCE_URI Log4JRCE_BODY the rule Log4JRCE and replaced it with the rules Log4JRCE_HEADER , Log4JRCE_QUERYSTRI NG , Log4JRCE_URI , and Log4JRCE_BODY , for flexibility in the use of this functionality. Added signature s to improve detection and blocking. Core rule set (CRS) 2022-01-10 • CrossSiteScripting _URIPATH • CrossSiteScripting _BODY • CrossSiteScripting _QUERYARGUMENTS • CrossSiteScripting _COOKIE Released version 2.0 of this rule group. For these rules, tuned detection signature s to reduce false positives. Replaced the URL_DECODE text transformation with the double URL_DECODE_UNI text transformation. Added the HTML_ENTITY_DECODE text transformation. Using managed rule groups 305 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Rule group and rules Description Date Core rule set (CRS) 2022-01-10 • RestrictedExtensio ns_URIPATH • RestrictedExtensio ns_QUERYARGUMENTS SQL database • SQLi_BODY • SQLi_QUERYARGUMENTS • SQLi_COOKIE • SQLi_URIPATH • SQLiExtendedPatter ns_BODY • SQLiExtendedPatter ns_QUERYARGUMENTS 2022-01-10 As part of the release of version 2.0 of this rule group, added the URL_DECOD E_UNI text transformation. Removed the URL_DECOD E text transformation from RestrictedExtensio ns_URIPATH . Released version 2.0 of this rule group. Replaced the URL_DECODE text transform ation with the double URL_DECODE_UNI text tran sformation and added the COMPRESS_WHITE_SPACE text transformation. Added more detection signatures to SQLiExten dedPatterns_QUERYA RGUMENTS . Added JSON inspection to SQLi_BODY . Added the rule SQLiExten dedPatterns_BODY . Removed the rule SQLi_URIP ATH . Using managed rule groups 306 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Rule group and rules Description Date Known bad inputs Released version 1.8 of the 2021-12-17 • Log4JRCE rule Log4JRCE to improve header inspection and matching criteria. Known bad inputs Released version 1.4 of the 2021-12-11 • Log4JRCE rule Log4JRCE to tune the matching criteria and to inspect additional headers. Released version 1.5 to tune the matching criteria. Known bad inputs • Log4JRCE Added the rule Log4JRCE version 1.2 in response to the recently disclosed security 2021-12-10 • BadAuthToken_COOKI issue within Log4j. For E_AUTHORIZATION information see CVE-2021- 44228. This rule inspects common URI paths, query strings, the first 8KB of the request body, and common headers. The rule uses double URL_DECODE_UNI text transformations. Released version 1.3 of Log4JRCE to tune the matching criteria and to inspect additional headers. Removed the rule BadAuthTo ken_COOKIE_AUTHORI ZATION . The following table lists changes prior to December, 2021. Using managed rule groups 307 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Rule group and rules Description Date Amazon IP reputation list AWSManage dReconnai ssanceList 2021-11-23 Added the AWSManage dReconnai ssanceList rule in monitoring/ count mode. This rule contains IP addresses that are performing reconnais sance against AWS resources. Windows operating system WindowsSh ellCommands Added three new rules for WindowsSh 2021-11-23 PowerShel lCommands ell commands: WindowsSh ellComman ds_COOKIE , WindowsSh ellComman ds_QUERYA RGUMENTS , and WindowsSh ellComman ds_BODY . Added a new PowerShell rule: PowerShel lCommands _COOKIE . Restructured the PowerShel lComands rules Using managed rule groups 308 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Rule group and rules Description Date naming by removing the string _Set1 and _Set2. Added more comprehensive detection signature s to PowerShel lRules . Added URL_DECOD E_UNI text transformation to all Windows operating system rules. Linux operating system LFI_URIPATH Replaced double 2021-11-23 LFI_QUERYSTRING LFI_BODY LFI_COOKIE URL_DECODE text transformation with double URL_DECOD E_UNI . Added NORMALIZE _PATH_WIN as a second text transformation. Replaced the LFI_BODY rule with the LFI_COOKIE rule. Added more comprehensive detection signatures for all LFI rules. Using managed rule groups 309 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Rule group and rules Description Date 2021-10-27 2021-10-27 Reduced |
waf-dg-100 | waf-dg.pdf | 100 | rules Description Date naming by removing the string _Set1 and _Set2. Added more comprehensive detection signature s to PowerShel lRules . Added URL_DECOD E_UNI text transformation to all Windows operating system rules. Linux operating system LFI_URIPATH Replaced double 2021-11-23 LFI_QUERYSTRING LFI_BODY LFI_COOKIE URL_DECODE text transformation with double URL_DECOD E_UNI . Added NORMALIZE _PATH_WIN as a second text transformation. Replaced the LFI_BODY rule with the LFI_COOKIE rule. Added more comprehensive detection signatures for all LFI rules. Using managed rule groups 309 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Rule group and rules Description Date 2021-10-27 2021-10-27 Reduced the size limit to block web requests with body payloads larger than 8 KB. Previously, the limit was 10 KB. Added more detection signature s. Added double unicode URL decode to improve blocking. Added double unicode URL decode to improve blocking. 2021-10-27 Core rule set (CRS) SizeRestr ictions_BODY Core rule set (CRS) EC2MetaDa Core rule set (CRS) taSSRF_BODY EC2MetaDa taSSRF_COOKIE EC2MetaDa taSSRF_URIPATH EC2MetaDa taSSRF_QU ERYARGUMENTS GenericLF I_QUERYAR GUMENTS GenericLF I_URIPATH Restricte dExtensio ns_URIPATH Restricte dExtensio ns_QUERYA RGUMENTS Using managed rule groups 310 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Rule group and rules Description Date Core rule set (CRS) GenericRF I_QUERYAR GUMENTS GenericRFI_BODY GenericRF I_URIPATH All All rules Amazon IP reputation list AWSManage dIPReputa tionList_xxxx 2021-10-27 2021-10-25 2021-05-04 Updated the rule signatures to reduce false positives, based on customer feedback. Added double unicode URL decode to improve blocking. Added support for AWS WAF labels to all rules that didn't already support labeling. Restructured the IP reputation list, removed suffixes from rule name, and added support for AWS WAF labels. Anonymous IP list AnonymousIPList Added support for AWS WAF labels. 2021-05-04 HostingPr oviderList Bot Control All Core rule set (CRS) GenericRF I_QUERYAR GUMENTS Added the Bot Control rule set. 2021-04-01 Added double URL decode. 2021-03-03 Using managed rule groups 311 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Rule group and rules Description Date Core rule set (CRS) Restricte dExtensio ns_URIPATH Admin protection AdminProt Known bad inputs ection_URIPATH Exploitab lePaths_U RIPATH Linux operating system LFI_QUERY ARGUMENTS Windows operating system All PHP application PHPHighRi skMethods Variables _QUERYARG UMENTS PHPHighRi skMethods Variables_BODY 2021-03-03 Improved the configuration of the rules and added an extra URL decode. Added double URL decode. 2021-03-03 2021-03-03 2021-03-03 2020-09-23 2020-09-16 Improved the configuration of the rules and added an extra URL decode. Improved the configuration of the rules and added an extra URL decode. Improved the configuration of the rules. Changed the text transformation from HTML decode to URL decode, to improve blocking. Using managed rule groups 312 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Rule group and rules Description Date POSIX operating system UNIXShell CommandsV ariables_ Changed the text transformation from HTML decode to URL 2020-09-16 QUERYARGUMENTS decode, to improve blocking. Core rule set Linux operating system UNIXShell CommandsV ariables_BODY GenericLF I_QUERYAR GUMENTS GenericLF I_URIPATH GenericLFI_BODY LFI_URIPATH LFI_QUERY ARGUMENTS LFI_BODY Anonymous IP List All 2020-08-07 Changed the text transformation from HTML decode to URL decode, to improve blocking. 2020-05-19 2020-03-06 Changed the text transformation from HTML entity decode to URL decode, to improve detection and blocking. New rule group in IP reputation rule groups to block requests from services that permit the obfuscation of viewer identity, to help mitigate bots and evasion of geographic restric tions. Using managed rule groups 313 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Rule group and rules Description Date WordPress applicati on WordPress Exploitab leCommand New rule that checks for exploitable commands in the s_QUERYSTRING query string. 2020-03-03 Adjusted the size value constraints for improved accuracy. 2020-03-03 Core rule set (CRS) SizeRestr ictions_Q UERYSTRING SizeRestr ictions_C ookie_HEADER SizeRestr ictions_BODY SizeRestr ictions_U RIPATH SQL database SQLi_URIPATH SQL database SQLi_BODY The rules now check the message URI. 2020-01-23 Updated text transformations. 2019-12-20 SQLi_QUER YARGUMENTS SQLi_COOKIE Using managed rule groups 314 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Rule group and rules Description Date Updated text transformations. 2019-12-20 Core rule set (CRS) CrossSite Scripting _URIPATH CrossSite Scripting_BODY CrossSite Scripting _QUERYARG UMENTS CrossSite Scripting _COOKIE Managing your own rule groups You can create your own rule group to reuse collections of rules that you either don't find in the managed rule group offerings or that you prefer to handle on your own. Rule groups that you create hold rules just like a web ACL does, and you add rules to a rule group in the same way as you do to a web ACL. When you create your own rule group, you must set an immutable maximum capacity for it. Topics • Creating a rule group • Editing a rule group • Using your rule group in a web ACL • Deleting a rule group • Sharing a |
waf-dg-101 | waf-dg.pdf | 101 | reuse collections of rules that you either don't find in the managed rule group offerings or that you prefer to handle on your own. Rule groups that you create hold rules just like a web ACL does, and you add rules to a rule group in the same way as you do to a web ACL. When you create your own rule group, you must set an immutable maximum capacity for it. Topics • Creating a rule group • Editing a rule group • Using your rule group in a web ACL • Deleting a rule group • Sharing a rule group Creating a rule group To create a new rule group, follow the procedure on this page. Managing your own rule groups 315 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide To create a rule group 1. Sign in to the AWS Management Console and open the AWS WAF console at https:// console.aws.amazon.com/wafv2/. 2. 3. In the navigation pane, choose Rule groups, and then Create rule group. Enter a name and description for the rule group. You'll use these to identify the rule set to manage it and use it. Don't use names that start with AWS, Shield, PreFM, or PostFM. These strings are either reserved or could cause confusion with rule groups that are managed for you by other services. See Recognizing rule groups provided by other services. Note You can't change the name after you create the rule group. 4. For Region, choose the Region where you want to store the rule group. To use a rule group in web ACLs that protect Amazon CloudFront distributions, you must use the global setting. You can use the global setting for regional applications, too. 5. Choose Next. 6. Add rules to the rule group using the Rule builder wizard, the same as you do in web ACL management. The only difference is that you can't add a rule group to another rule group. 7. For Capacity, set the maximum for the rule group's use of web ACL capacity units (WCUs). This is an immutable setting. For information about WCUs, see Web ACL capacity units (WCUs) in AWS WAF. As you add rules to the rule group, the Add rules and set capacity pane displays the minimum required capacity, which is based on the rules that you've already added. You can use this and your future plans for the rule group to help estimate the capacity that the rule group will require. 8. Review the settings for the rule group, and choose Create. Editing a rule group To add or remove rules from a rule group or change configuration settings, access the rule group using the procedure on this page. Managing your own rule groups 316 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Production traffic risk If you change a rule group that you're currently using in a web ACL, those changes will affect your web ACL behavior wherever it's being used. Be sure to test and tune all changes in a staging or testing environment until you are comfortable with the potential impact to your traffic. Then test and tune your updated rules in count mode with your production traffic before enabling them. For guidance, see Testing and tuning your AWS WAF protections. To edit a rule group 1. Sign in to the AWS Management Console and open the AWS WAF console at https:// console.aws.amazon.com/wafv2/. 2. In the navigation pane, choose Rule groups. 3. Choose the name of the rule group that you want to edit. The console takes you to the rule group's page. Note If you don't see the rule group that you want to edit, check the Region selection inside the Rule groups section. For rule groups used to protect Amazon CloudFront distributions, use the Global (CloudFront) setting. 4. Edit the rule group as needed. You can edit the rule group's mutable properties, similar to how you did during creation. The console saves your changes as you go. Note If you change the name of a rule and you want the rule's metric name to reflect the change, you must update the metric name as well. AWS WAF doesn't automatically update the metric name for a rule when you change the rule name. You can change the metric name when you edit the rule in the console, by using the rule JSON editor. You can also change both names through the APIs and in any JSON listing that you use to define your web ACL or rule group. Managing your own rule groups 317 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Temporary inconsistencies during updates When you create or change a web ACL or other AWS WAF resources, the changes take a small amount of |
waf-dg-102 | waf-dg.pdf | 102 | automatically update the metric name for a rule when you change the rule name. You can change the metric name when you edit the rule in the console, by using the rule JSON editor. You can also change both names through the APIs and in any JSON listing that you use to define your web ACL or rule group. Managing your own rule groups 317 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Temporary inconsistencies during updates When you create or change a web ACL or other AWS WAF resources, the changes take a small amount of time to propagate to all areas where the resources are stored. The propagation time can be from a few seconds to a number of minutes. The following are examples of the temporary inconsistencies that you might notice during change propagation: • After you create a web ACL, if you try to associate it with a resource, you might get an exception indicating that the web ACL is unavailable. • After you add a rule group to a web ACL, the new rule group rules might be in effect in one area where the web ACL is used and not in another. • After you change a rule action setting, you might see the old action in some places and the new action in others. • After you add an IP address to an IP set that is in use in a blocking rule, the new address might be blocked in one area while still allowed in another. Using your rule group in a web ACL To use a rule group in a web ACL, you add it to the web ACL in a rule group reference statement. Production traffic risk Before you deploy changes in your web ACL for production traffic, test and tune them in a staging or testing environment until you are comfortable with the potential impact to your traffic. Then test and tune your updated rules in count mode with your production traffic before enabling them. For guidance, see Testing and tuning your AWS WAF protections. Note Using more than 1,500 WCUs in a web ACL incurs costs beyond the basic web ACL price. For more information, see Web ACL capacity units (WCUs) in AWS WAF and AWS WAF Pricing. Managing your own rule groups 318 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide To use a rule group 1. Sign in to the AWS Management Console and open the AWS WAF console at https:// console.aws.amazon.com/wafv2/. 2. In the navigation pane, choose Rule groups. 3. Choose the name of the rule group that you want to use. 4. Choose Add rules, and then choose Add my own rules and rule groups. 5. Choose Rule group and select your rule group from the list. In your web ACL, you can alter the behavior of a rule group and its rules by setting the individual rule actions to Count or any other action. This can help you do things like test a rule group, identify false positives from rules in a rule group, and customize how a managed rule group handles your requests. For more information, see Overriding rule group actions in AWS WAF. If your rule group contains a rate-based statement, each web ACL where you use the rule group has its own separate rate tracking and management for the rate-based rule, independent of any other web ACL where you use the rule group. For more information, see Using rate-based rule statements in AWS WAF. Temporary inconsistencies during updates When you create or change a web ACL or other AWS WAF resources, the changes take a small amount of time to propagate to all areas where the resources are stored. The propagation time can be from a few seconds to a number of minutes. The following are examples of the temporary inconsistencies that you might notice during change propagation: • After you create a web ACL, if you try to associate it with a resource, you might get an exception indicating that the web ACL is unavailable. • After you add a rule group to a web ACL, the new rule group rules might be in effect in one area where the web ACL is used and not in another. • After you change a rule action setting, you might see the old action in some places and the new action in others. • After you add an IP address to an IP set that is in use in a blocking rule, the new address might be blocked in one area while still allowed in another. Managing your own rule groups 319 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Deleting a rule group Follow the guidance in this section to delete |
waf-dg-103 | waf-dg.pdf | 103 | in effect in one area where the web ACL is used and not in another. • After you change a rule action setting, you might see the old action in some places and the new action in others. • After you add an IP address to an IP set that is in use in a blocking rule, the new address might be blocked in one area while still allowed in another. Managing your own rule groups 319 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Deleting a rule group Follow the guidance in this section to delete a rule group. Deleting referenced sets and rule groups When you delete an entity that you can use in a web ACL, like an IP set, regex pattern set, or rule group, AWS WAF checks to see if the entity is currently being used in a web ACL. If it finds that it is in use, AWS WAF warns you. AWS WAF is almost always able to determine if an entity is being referenced by a web ACL. However, in rare cases it might not be able to do so. If you need to be sure that nothing is currently using the entity, check for it in your web ACLs before deleting it. If the entity is a referenced set, also check that no rule groups are using it. To delete a rule group 1. Sign in to the AWS Management Console and open the AWS WAF console at https:// console.aws.amazon.com/wafv2/. 2. In the navigation pane, choose Rule groups. 3. Choose the rule group that you want to delete, and then choose Delete. Note If you don't see the rule group that you want to delete, check the Region selection inside the Rule groups section. For rule groups used to protect Amazon CloudFront distributions, use the Global (CloudFront) setting. Sharing a rule group You can share a rule group with other acccounts, for use by those accounts. Sharing a rule group You can share with one or more specific accounts, and you can share with all accounts in an organization. To share a rule group, you use the AWS WAF API to create a policy for the rule group sharing that you want. For more information, see PutPermissionPolicy in the AWS WAF API Reference. Using a rule group that's been shared with you Managing your own rule groups 320 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide If a rule group has been shared with your account, you can access it through the API and you can reference it when you create or update your web ACLs through the API. For more information, see GetRuleGroup, CreateWebACL, and UpdateWebACL in the AWS WAF API Reference. Rule groups that are shared with you don't appear in your AWS WAF console rule groups listing. AWS Marketplace rule groups This section explains how to use AWS Marketplace rule groups. AWS Marketplace rule groups are available by subscription through the AWS Marketplace console at AWS Marketplace. After you subscribe to an AWS Marketplace rule group, you can use it in AWS WAF. To use an AWS Marketplace rule group in an AWS Firewall Manager AWS WAF policy, each account in your organization must subscribe to it. You can subscribe to different types of rule groups through AWS Marketplace: • AWS WAF partner-managed rule groups • Client-side protections Test and tune any changes to your AWS WAF protections before you use them for production traffic. For information, see Testing and tuning your AWS WAF protections. AWS Marketplace Rule Group Pricing AWS Marketplace rule groups are available with no long-term contracts, and no minimum commitments. When you subscribe to a rule group, you are charged a monthly fee (prorated hourly) and ongoing request fees based on volume. For more information, see AWS WAF Pricing and the description for each AWS Marketplace rule group at AWS Marketplace. Have questions about an AWS Marketplace rule group? For questions about a rule group that's managed by an AWS Marketplace seller and to request changes in functionality, contact the provider's customer support team. To find contact information, see the provider's listing at AWS Marketplace. The AWS Marketplace rule group provider determines how to manage the rule group, for example how to update the rule group and whether the rule group is versioned. The provider also determines the details of the rule group, including the rules, rule actions, and any labels that the rules add to matching web requests. AWS Marketplace rule groups 321 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Subscribing to AWS Marketplace rule groups You can subscribe to and unsubscribe from AWS Marketplace rule groups on the AWS WAF console. Important To use an AWS Marketplace rule group in an AWS Firewall |
waf-dg-104 | waf-dg.pdf | 104 | group provider determines how to manage the rule group, for example how to update the rule group and whether the rule group is versioned. The provider also determines the details of the rule group, including the rules, rule actions, and any labels that the rules add to matching web requests. AWS Marketplace rule groups 321 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Subscribing to AWS Marketplace rule groups You can subscribe to and unsubscribe from AWS Marketplace rule groups on the AWS WAF console. Important To use an AWS Marketplace rule group in an AWS Firewall Manager policy, each account in your organization must first subscribe to that rule group. To subscribe to an AWS Marketplace rule group 1. Sign in to the AWS Management Console and open the AWS WAF console at https:// 2. 3. console.aws.amazon.com/wafv2/. In the navigation pane, choose Add-on protections. In the AWS Marketplace section, choose the name of a rule group to view the details and pricing information. Tip Use the filters to quickly sort for the rules you're most interested in. For example, you can use the Category filter to view client-side protections only. 4. To subscribe to an AWS Marketplace rule group: a. Navigate to a rule group, then choose Subscribe via Marketplace. b. In the Marketplace page that opens, choose View purchase options, then choose Subscribe. Note If you decide not to subscribe to the rule group, simply close the pop-up. After you're subscribed to an AWS Marketplace rule group, you use it in your web ACLs as you do other managed rule groups. For information, see Creating a web ACL in AWS WAF. AWS Marketplace rule groups 322 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide When adding a rule group to a web ACL, you can override the actions of rules in the rule group and of the rule group result. For more information, see Overriding rule group actions in AWS WAF. Unsubscribing from AWS Marketplace rule groups You can unsubscribe from AWS Marketplace rule groups on the AWS Marketplace console. Important To stop the subscription charges for an AWS Marketplace rule group, you must remove it from all web ACLs in AWS WAF and in any Firewall Manager AWS WAF policies, in addition to unsubscribing from it. If you unsubscribe from an AWS Marketplace rule group but don't remove it from your web ACLs, you will continue to be charged for the subscription. To unsubscribe from an AWS Marketplace rule group 1. Remove the rule group from all web ACLs. For more information, see Editing a web ACL in AWS WAF. 2. Open the AWS console at https://console.aws.amazon.com/marketplace. The Manage subscriptions page appears. 3. Open the Delivery method list and choose SaaS. 4. Under Agreement, open the Actions list and choose Cancel subscription next to the name of the rule group that you want to unsubscribe from. 5. In the Cancel subscription dialog box, enter confirm, then choose Yes, cancel subscription. Troubleshooting AWS Marketplace rule groups If you find that an AWS Marketplace rule group is blocking legitimate traffic, you can troubleshoot the problem by performing the following steps. To troubleshoot an AWS Marketplace rule group 1. Override the actions to count for the rules that are blocking legitimate traffic. You can identify which rules are blocking specific requests using either the AWS WAF sampled requests or AWS WAF logs. You can identify the rules by looking at the ruleGroupId field in the log or the AWS Marketplace rule groups 323 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide RuleWithinRuleGroup in the sampled request. You can identify the rule in the pattern <Seller Name>#<RuleGroup Name>#<Rule Name>. 2. If setting specific rules to only count requests doesn't solve the problem, you can override all of the rule actions or change the action for the AWS Marketplace rule group itself from No override to Override to count. This allows the web request to pass through, regardless of the individual rule actions within the rule group. 3. After overriding either the individual rule action or the entire AWS Marketplace rule group action, contact the rule group provider‘s customer support team to further troubleshoot the issue. For contact information, see the rule group listing on the product listing pages on AWS Marketplace. Contacting AWS support For problems with AWS WAF or a rule group that is managed by AWS, contact AWS Support. For problems with a rule group that is managed by an AWS Marketplace seller, contact the provider's customer support team. To find contact information, see the provider's listing on AWS Marketplace. Recognizing rule groups provided by other services If you or an administrator in your organization uses AWS Firewall Manager or AWS Shield Advanced to manage resource protections using AWS WAF, |
waf-dg-105 | waf-dg.pdf | 105 | troubleshoot the issue. For contact information, see the rule group listing on the product listing pages on AWS Marketplace. Contacting AWS support For problems with AWS WAF or a rule group that is managed by AWS, contact AWS Support. For problems with a rule group that is managed by an AWS Marketplace seller, contact the provider's customer support team. To find contact information, see the provider's listing on AWS Marketplace. Recognizing rule groups provided by other services If you or an administrator in your organization uses AWS Firewall Manager or AWS Shield Advanced to manage resource protections using AWS WAF, you might see rule group reference statements added to web ACLs in your account. The names of these rule groups begin with the following strings: • ShieldMitigationRuleGroup – These rule groups are managed by AWS Shield Advanced and used to provide automatic application layer DDoS mitigation to protected application layer (layer 7) resources. When you enable automatic application layer DDoS mitigation for a protected resource, Shield Advanced adds one of these rule groups to the web ACL that you have associated with the resource. Shield Advanced assigns the rule group reference statement a priority setting of 10,000,000, so that it runs after the rules that you have configured in the web ACL. For more information about these rule groups, see Automating application layer DDoS mitigation with Shield Advanced . Recognizing rule groups from other services 324 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Warning Don't try to manually manage this rule group in your web ACL. In particular, don't manually delete the ShieldMitigationRuleGroup rule group reference statement from your web ACL. Doing this could have unintended consequences for all resources that are associated with the web ACL. Instead, use Shield Advanced to disable automatic mitigation for the resources that are associated with the web ACL. Shield Advanced will remove the rule group for you when it's not needed for automatic mitigation. • PREFMManaged and POSTFMManaged – These rule groups are managed by AWS Firewall Manager based on Firewall Manager AWS WAF policy configurations. Firewall Manager provides these rule groups inside web ACLs that Firewall Manager manages. Firewall Manager creates web ACLs for you with names that begin with FMManagedWebACLV2. You can configure Firewall Manager to retrofit your existing web ACLs as well. For these, the web ACL name is the one that you specified when you created it. In either case, Firewall Manager will add these rule groups to the web ACL. For more information, see Using AWS WAF policies with Firewall Manager. Web ACL capacity units (WCUs) in AWS WAF This section explains what web ACL capacity units (WCUs) are and how they work. AWS WAF uses WCUs to calculate and control the operating resources that are required to run your rules, rule groups, and web ACLs. AWS WAF enforces WCU limits when you configure your rule groups and web ACLs. WCUs don't affect how AWS WAF inspects web traffic. AWS WAF manages capacity for rules, rule groups, and web ACLs. Rule WCUs AWS WAF calculates rule capacity when you create or update a rule. AWS WAF calculates capacity differently for each rule type, to reflect each rule's relative cost. Simple rules that cost little to run use fewer WCUs than more complex rules that use more processing power. For example, a size constraint rule statement uses fewer WCUs than a statement that inspects requests using a regex pattern set. Web ACL capacity units (WCUs) 325 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Rule capacity requirements generally start at a base cost for the rule type and increase with complexity, for example, when you add text transformations before inspection or if you inspect the JSON body. For information about rule capacity requirements, see the listings for the rule statements at Using rule statements in AWS WAF. Rule group WCUs The WCU requirements for a rule group are determined by the rules that you define inside the rule group. The maximum capacity for a rule group is 5,000 WCUs. Each rule group has an immutable capacity setting, which the owner assigns at creation. This is true for managed rule groups and rule groups that you create through AWS WAF. When you modify a rule group, your changes must keep the rule group's WCUs within its capacity. This ensures that web ACLs that are using the rule group remain within their capacity requirements. The WCUs that are in use in a rule group is the sum of the WCUs for the rules minus any processing optimizations that AWS WAF is able to obtain by combining the behavior of the rules. For example, if you define two rules to examine the same web request component, and the rules each apply a particular transformation to |
waf-dg-106 | waf-dg.pdf | 106 | groups that you create through AWS WAF. When you modify a rule group, your changes must keep the rule group's WCUs within its capacity. This ensures that web ACLs that are using the rule group remain within their capacity requirements. The WCUs that are in use in a rule group is the sum of the WCUs for the rules minus any processing optimizations that AWS WAF is able to obtain by combining the behavior of the rules. For example, if you define two rules to examine the same web request component, and the rules each apply a particular transformation to the component before inspecting it, AWS WAF might be able to charge you just once for applying the transformation. The WCU cost to use a rule group in a web ACL is always the fixed WCU setting that you defined at the rule group creation. When you create a rule group, take care to set the capacity high enough to accommodate the rules that you'll want to use throughout the rule group's lifetime. Web ACL WCUs The WCU requirements for a web ACL are determined by the rules and rule groups that you use inside the web ACL. • The cost of using a rule group in a web ACL is the rule group's capacity setting. • The cost of using a rule is the rule's calculated WCUs minus any processing optimizations that AWS WAF is able to obtain from the web ACL's combination of rules. For example, if you define two rules to examine the same web request component, and the rules each apply a particular transformation to the component before inspecting it, AWS WAF might be able to charge you just once for applying the transformation. The basic price for a web ACL includes up to 1,500 WCUs. Using more than 1,500 WCUs incurs additional fees, according to a tiered pricing model. AWS WAF automatically adjusts your web ACL pricing as your web ACL WCU usage changes. For pricing details, see AWS WAF Pricing. Web ACL capacity units (WCUs) 326 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide The maximum capacity for a web ACL is 5,000 WCUs. Determining the WCUs for a rule group or web ACL As noted in prior sections, the total WCUs used in a rule group or web ACL will be equal to or less than the sum of the WCUs for all of the rules that are defined in the rule group or web ACL. In the AWS WAF console, you can see the capacity consumed when you add rules to your web ACL or rule group. The console displays the current capacity units used as you add the rules. Through the API, you can check the maximum capacity requirements for the rules that you want to use in a web ACL or rule group. To do this, provide the JSON listing of the rules to the check capacity call. For more information, see CheckCapacity in the AWS WAFV2 API Reference. Oversize web request components in AWS WAF This section explains how to manage the size limits on inspecting the web request body, headers, and cookies in AWS WAF. AWS WAF doesn't support inspecting very large contents for the web request components body, headers, or cookies. The underlying host service has count and size limits on what it forwards to AWS WAF for inspection. For example, the host service doesn't send more than 200 headers to AWS WAF, so for a web request with 205 headers, AWS WAF can't inspect the last 5 headers. When AWS WAF allows a web request to proceed to your protected resource, the entire web request is sent, including any contents that are outside of the count and size limits that AWS WAF was able to inspect. Component inspection size limits The component inspection size limits are as follows: • Body and JSON Body – For Application Load Balancer and AWS AppSync, AWS WAF can inspect the first 8 KB of the body of a request. For CloudFront, API Gateway, Amazon Cognito, App Runner, and Verified Access, by default, AWS WAF can inspect the first 16 KB, and you can increase the limit up to 64 KB in your web ACL configuration. For more information, see Managing body inspection size limits for AWS WAF. • Headers – AWS WAF can inspect at most the first 8 KB (8,192 bytes) of the request headers and at most the first 200 headers. The content is available for inspection by AWS WAF up to the first limit reached. Determining the WCUs for a rule group or web ACL 327 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide • Cookies – AWS WAF can inspect at most the first 8 KB (8,192 bytes) of the |
waf-dg-107 | waf-dg.pdf | 107 | to 64 KB in your web ACL configuration. For more information, see Managing body inspection size limits for AWS WAF. • Headers – AWS WAF can inspect at most the first 8 KB (8,192 bytes) of the request headers and at most the first 200 headers. The content is available for inspection by AWS WAF up to the first limit reached. Determining the WCUs for a rule group or web ACL 327 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide • Cookies – AWS WAF can inspect at most the first 8 KB (8,192 bytes) of the request cookies and at most the first 200 cookies. The content is available for inspection by AWS WAF up to the first limit reached. Oversize handling options for your rule statements When you write a rule statement that inspects one of these request component types, you specify how to handle oversize components. Oversize handling tells AWS WAF what to do with a web request when the request component that the rule inspects is over the size limits. The options for handling oversize components are as follows: • Continue – Inspect the request component normally according to the rule inspection criteria. AWS WAF will inspect the request component contents that are within the size limits. • Match – Treat the web request as matching the rule statement. AWS WAF applies the rule action to the request without evaluating it against the rule's inspection criteria. • No match – Treat the web request as not matching the rule statement without evaluating it against the rule's inspection criteria. AWS WAF continues its inspection of the web request using the rest of the rules in the web ACL like it would do for any non-matching rule. In the AWS WAF console, you're required to choose one of these handling options. Outside the console, the default option is Continue. If you use the Match option in a rule that has its action set to Block, the rule will block a request whose inspected component is oversize. With any other configuration, the final disposition of the request depends on various factors, such as the configuration of the other rules in your web ACL and the web ACL's default action setting. Oversize handling in rule groups that you don't own Component size and count limitations apply to all rules that you use in your web ACL. This includes any rules that you use but don't manage, in managed rule groups and in rule groups that are shared with you by another account. When you use a rule group that you don't manage, the rule group might have a rule that inspects a limited request component but that doesn't handle oversized contents the way you need them to be handled. For information about how AWS Managed Rules manage oversize components, see AWS Managed Rules rule groups list. For information about other rule groups, ask your rule group provider. Oversize web request components 328 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Guidelines for managing oversize components in your web ACL The way you handle oversize components in your web ACL can depend on a number of factors such as the expected size of your request component contents, your web ACL's default request handling, and how other rules in your web ACL match and handle requests. The general guidelines for managing oversized web request components are as follows: • If you need to allow some requests with oversize component contents, if possible, add rules to explicitly allow only those requests. Prioritize those rules so that they run before any other rules in the web ACL that inspect the same component types. With this approach, you won't be able to use AWS WAF to inspect the entire contents of the oversize components that you allow to pass to your protected resource. • For all other requests, you can prevent any additional bytes from passing through by blocking requests that go over the limit: • Your rules and rule groups – In your rules that inspect components with size limits, configure oversize handling so that you block requests that go over the limit. For example, if your rule blocks requests with specific header contents, set the oversize handling to match on requests that have oversize header content. Alternately, if your web ACL blocks requests by default and your rule allows specific header contents, then configure your rule's oversize handling to not match on any request that has oversize header content. • Rule groups that you don't manage – To prevent rule groups that you don't manage from allowing oversize request components, you can add a separate rule that inspects the request component type and blocks requests that go over the limits. Prioritize the rule in your web ACL |
waf-dg-108 | waf-dg.pdf | 108 | blocks requests with specific header contents, set the oversize handling to match on requests that have oversize header content. Alternately, if your web ACL blocks requests by default and your rule allows specific header contents, then configure your rule's oversize handling to not match on any request that has oversize header content. • Rule groups that you don't manage – To prevent rule groups that you don't manage from allowing oversize request components, you can add a separate rule that inspects the request component type and blocks requests that go over the limits. Prioritize the rule in your web ACL so that it runs before the rule groups. For example, you can block requests with oversize body content before any of your body inspection rules run in the web ACL. The following procedure describes how to add this type of rule. Blocking oversized web request components You can add a rule in your web ACL that blocks requests with oversized components. To add a rule that blocks oversized contents 1. When you create or edit your web ACL, in the rules settings, choose Add rules, Add my own rules and rule groups, Rule builder, then Rule visual editor. For guidance on creating or editing a web ACL, see Viewing web traffic metrics in AWS WAF. Blocking oversized components 329 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide 2. Enter a name for your rule, and leave the Type setting at Regular rule. 3. Change the following match settings from their defaults: a. On Statement, for Inspect, open the dropdown and choose the web request component b. c. that you need, either Body, Headers, or Cookies. For Match type, choose Size greater than. For Size, type a number that's at least the minimum size for the component type. For headers and cookies, type 8192. In Application Load Balancer or AWS AppSync web ACLs, for bodies, type 8192. For bodies in CloudFront, API Gateway, Amazon Cognito, App Runner, or Verified Access web ACLs, if you're using the default body size limit, type 16384. Otherwise, type the body size limit that you've defined for your web ACL. d. For Oversize handling, select Match. 4. For Action, select Block. 5. Choose Add rule. 6. After you add the rule, on the Set rule priority page, move it above any rules or rule groups in your web ACL that inspect the same component type. This gives the new rule a lower numeric priority setting, which causes AWS WAF to evaluate it first. For more information, see Setting rule priority in a web ACL. Supported regular expression syntax in AWS WAF AWS WAF supports the regular expression pattern syntax used by the PCRE library libpcre. The library is documented at PCRE - Perl Compatible Regular Expressions. AWS WAF doesn't support all constructs of the library. For example, it supports some zero-width assertions, but not all. We do not have comprehensive list of the constructs that are supported. However, if you provide a regex pattern that isn't valid or use unsupported constructs, the AWS WAF API reports a failure. AWS WAF does not support the following PCRE patterns: • Backreferences and capturing subexpressions • Subroutine references and recursive patterns • Conditional patterns • Backtracking control verbs Supported regular expression syntax 330 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide • The \C single-byte directive • The \R newline match directive • The \K start of match reset directive • Callouts and embedded code • Atomic grouping and possessive quantifiers IP sets and regex pattern sets in AWS WAF This section introduces the topics of IP sets and regex pattern sets. AWS WAF stores some more complex information in sets that you use by referencing them in your rules. Each of these sets has a name and is assigned an Amazon Resource Name (ARN) at creation. You can manage these sets from inside your rule statements and you can access and manage them on their own, through the console navigation pane. You can use a managed set in a rule group or web ACL. • To use an IP set, see IP set match rule statement. • To use a regex pattern set see Regex pattern set match rule statement. Temporary inconsistencies during updates When you create or change a web ACL or other AWS WAF resources, the changes take a small amount of time to propagate to all areas where the resources are stored. The propagation time can be from a few seconds to a number of minutes. The following are examples of the temporary inconsistencies that you might notice during change propagation: • After you create a web ACL, if you try to associate it with a resource, you might get an exception indicating that the web ACL is unavailable. |
waf-dg-109 | waf-dg.pdf | 109 | set see Regex pattern set match rule statement. Temporary inconsistencies during updates When you create or change a web ACL or other AWS WAF resources, the changes take a small amount of time to propagate to all areas where the resources are stored. The propagation time can be from a few seconds to a number of minutes. The following are examples of the temporary inconsistencies that you might notice during change propagation: • After you create a web ACL, if you try to associate it with a resource, you might get an exception indicating that the web ACL is unavailable. • After you add a rule group to a web ACL, the new rule group rules might be in effect in one area where the web ACL is used and not in another. • After you change a rule action setting, you might see the old action in some places and the new action in others. • After you add an IP address to an IP set that is in use in a blocking rule, the new address might be blocked in one area while still allowed in another. IP sets and regex pattern sets 331 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Topics • Creating and managing an IP set in AWS WAF • Creating and managing a regex pattern set in AWS WAF Creating and managing an IP set in AWS WAF An IP set provides a collection of IP addresses and IP address ranges that you want to use together in a rule statement. IP sets are AWS resources. To use an IP set in a web ACL or rule group, you first create an AWS resource, IPSet with your address specifications. Then you reference the set when you add an IP set rule statement to a web ACL or rule group. Creating an IP set Follow the procedure in this section to create a new IP set. Note In addition to the procedure in this section, you have the option to add a new IP set when you add an IP match rule to your web ACL or rule group. Choosing that option requires you to provide the same settings as those required by this procedure. To create an IP set 1. Sign in to the AWS Management Console and open the AWS WAF console at https:// console.aws.amazon.com/wafv2/. In the navigation pane, choose IP sets and then Create IP set. Enter a name and description for the IP set. You'll use these to identify the set when you want 2. 3. to use it. Note You can't change the name after you create the IP set. 4. For Region, choose Global (CloudFront) or choose the Region where you want to store the IP set. You can use regional IP sets only in web ACLs that protect regional resources. To use Creating and managing an IP set 332 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide an IP set in web ACLs that protect Amazon CloudFront distributions, you must use Global 5. 6. (CloudFront). For IP version, select the version you want to use. In the IP addresses text box, enter one IP address or IP address range per line, in CIDR notation. AWS WAF supports all IPv4 and IPv6 CIDR ranges except for /0. For more information about CIDR notation, see the Wikipedia article Classless Inter-Domain Routing. Here are some examples: • To specify the IPv4 address 192.0.2.44, type 192.0.2.44/32. • To specify the IPv6 address 2620:0:2d0:200:0:0:0:0, type 2620:0:2d0:200:0:0:0:0/128. • To specify the range of IPv4 addresses from 192.0.2.0 to 192.0.2.255, type 192.0.2.0/24. • To specify the range of IPv6 addresses from 2620:0:2d0:200:0:0:0:0 to 2620:0:2d0:200:ffff:ffff:ffff:ffff, enter 2620:0:2d0:200::/64. 7. Review the settings for the IP set, and choose Create IP set. Deleting an IP set Follow the guidance in this section to delete a referenced set. Deleting referenced sets and rule groups When you delete an entity that you can use in a web ACL, like an IP set, regex pattern set, or rule group, AWS WAF checks to see if the entity is currently being used in a web ACL. If it finds that it is in use, AWS WAF warns you. AWS WAF is almost always able to determine if an entity is being referenced by a web ACL. However, in rare cases it might not be able to do so. If you need to be sure that nothing is currently using the entity, check for it in your web ACLs before deleting it. If the entity is a referenced set, also check that no rule groups are using it. To delete an IP set 1. Sign in to the AWS Management Console and open the AWS WAF console at https:// console.aws.amazon.com/wafv2/. In the navigation pane, choose IP |
waf-dg-110 | waf-dg.pdf | 110 | WAF warns you. AWS WAF is almost always able to determine if an entity is being referenced by a web ACL. However, in rare cases it might not be able to do so. If you need to be sure that nothing is currently using the entity, check for it in your web ACLs before deleting it. If the entity is a referenced set, also check that no rule groups are using it. To delete an IP set 1. Sign in to the AWS Management Console and open the AWS WAF console at https:// console.aws.amazon.com/wafv2/. In the navigation pane, choose IP sets. Select the IP set that you want to delete and choose Delete. 2. 3. Creating and managing an IP set 333 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Creating and managing a regex pattern set in AWS WAF A regex pattern set provides a collection of regular expressions that you want to use together in a rule statement. Regex pattern sets are AWS resources. To use a regex pattern set in a web ACL or rule group, you first create an AWS resource, RegexPatternSet with your regex pattern specifications. Then you reference the set when you add a regex pattern set rule statement to a web ACL or rule group. A regex pattern set must contain at least one regex pattern. If your regex pattern set contains more than one regex pattern, when it's used in a rule, the pattern matching is combined with OR logic. That is, a web request will match the pattern set rule statement if the request component matches any of the patterns in the set. AWS WAF supports the pattern syntax used by the PCRE library libpcre with some exceptions. The library is documented at PCRE - Perl Compatible Regular Expressions. For information about AWS WAF support, see Supported regular expression syntax in AWS WAF. Creating a regex pattern set Follow the procedure in this section to create a new regex pattern set. To create a regex pattern set 1. Sign in to the AWS Management Console and open the AWS WAF console at https:// console.aws.amazon.com/wafv2/. 2. 3. In the navigation pane, choose Regex pattern sets and then Create regex pattern set. Enter a name and description for the regex pattern set. You'll use these to identify it when you want to use the set. Note You can't change the name after you create the regex pattern set. 4. For Region, choose Global (CloudFront) or choose the Region where you want to store the regex pattern set. You can use regional regex pattern sets only in web ACLs that protect regional resources. To use a regex pattern set in web ACLs that protect Amazon CloudFront distributions, you must use Global (CloudFront). Creating and managing a regex pattern set 334 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide 5. In the Regular expressions text box, enter one regex pattern per line. For example, the regular expression I[a@]mAB[a@]dRequest matches the following strings: IamABadRequest, IamAB@dRequest, I@mABadRequest, and I@mAB@dRequest. AWS WAF supports the pattern syntax used by the PCRE library libpcre with some exceptions. The library is documented at PCRE - Perl Compatible Regular Expressions. For information about AWS WAF support, see Supported regular expression syntax in AWS WAF. 6. Review the settings for the regex pattern set, and choose Create regex pattern set. Deleting a regex pattern set Follow the guidance in this section to delete a referenced set. Deleting referenced sets and rule groups When you delete an entity that you can use in a web ACL, like an IP set, regex pattern set, or rule group, AWS WAF checks to see if the entity is currently being used in a web ACL. If it finds that it is in use, AWS WAF warns you. AWS WAF is almost always able to determine if an entity is being referenced by a web ACL. However, in rare cases it might not be able to do so. If you need to be sure that nothing is currently using the entity, check for it in your web ACLs before deleting it. If the entity is a referenced set, also check that no rule groups are using it. To delete a regex pattern set 1. Sign in to the AWS Management Console and open the AWS WAF console at https:// console.aws.amazon.com/wafv2/. In the navigation pane, choose Regex pattern sets. Select the regex pattern set that you want to delete and choose Delete. 2. 3. Customized web requests and responses in AWS WAF This section explains how to add custom web request and response handling behavior to your AWS WAF rule actions and default web ACL actions. Your custom settings apply whenever the action they're attached to applies. You can customize web requests and |
waf-dg-111 | waf-dg.pdf | 111 | rule groups are using it. To delete a regex pattern set 1. Sign in to the AWS Management Console and open the AWS WAF console at https:// console.aws.amazon.com/wafv2/. In the navigation pane, choose Regex pattern sets. Select the regex pattern set that you want to delete and choose Delete. 2. 3. Customized web requests and responses in AWS WAF This section explains how to add custom web request and response handling behavior to your AWS WAF rule actions and default web ACL actions. Your custom settings apply whenever the action they're attached to applies. You can customize web requests and responses in the following ways: Customized web requests and responses 335 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide • With Allow, Count, CAPTCHA, and Challenge actions, you can insert custom headers into the web request. When AWS WAF forwards the web request to the protected resource, the request contains the entire original request plus the custom headers that you've inserted. For the CAPTCHA and Challenge actions, AWS WAF only applies the customization if the request passes the CAPTCHA or challenge token inspection. • With Block actions, you can define a complete custom response, with response code, headers, and body. The protected resource responds to the request using the custom response provided by AWS WAF. Your custom response replaces the default Block action response of 403 (Forbidden). Action settings that you can customize You can specify a custom request or response when you define the following action settings: • Rule action. For information, see Using rule actions in AWS WAF. • Default action for a web ACL. For information, see Setting the web ACL default action in AWS WAF. Action settings that you cannot customize You cannot specify custom request handling in the override action for a rule group that you use in a web ACL. See Using web ACLs with rules and rule groups in AWS WAF. Also see Using managed rule group statements in AWS WAF and Using rule group statements in AWS WAF. Temporary inconsistencies during updates When you create or change a web ACL or other AWS WAF resources, the changes take a small amount of time to propagate to all areas where the resources are stored. The propagation time can be from a few seconds to a number of minutes. The following are examples of the temporary inconsistencies that you might notice during change propagation: • After you create a web ACL, if you try to associate it with a resource, you might get an exception indicating that the web ACL is unavailable. • After you add a rule group to a web ACL, the new rule group rules might be in effect in one area where the web ACL is used and not in another. Customized web requests and responses 336 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide • After you change a rule action setting, you might see the old action in some places and the new action in others. • After you add an IP address to an IP set that is in use in a blocking rule, the new address might be blocked in one area while still allowed in another. Limits on your use of custom requests and responses AWS WAF defines maximum settings for your use of custom requests and responses. For example, a maximum number of request headers per web ACL or rule group, and a maximum number of custom headers for a single custom response definition. For information, see AWS WAF quotas. Topics • Inserting custom request headers for non-blocking actions • Sending custom responses for Block actions • Supported status codes for custom responses Inserting custom request headers for non-blocking actions This section explains how to instruct AWS WAF to insert custom headers into the original HTTP request when a rule action doesn't block the request. With this option, you only add to the request. You can't modify or replace any part of the original request. Use cases for custom header insertion include signaling a downstream application to process the request differently based on the inserted headers, and flagging the request for analysis. This option applies to the rule actions Allow, Count, CAPTCHA, and Challenge and to web ACL default actions that are set to Allow. For more information about rule actions, see Using rule actions in AWS WAF. For more information about default web ACL actions, see Setting the web ACL default action in AWS WAF. Custom request header names AWS WAF prefixes all request headers that it inserts with x-amzn-waf-, to avoid confusion with the headers that are already in the request. For example, if you specify the header name sample, AWS WAF inserts the header x-amzn-waf-sample. Headers with the same name Inserting custom request headers insertions |
waf-dg-112 | waf-dg.pdf | 112 | actions Allow, Count, CAPTCHA, and Challenge and to web ACL default actions that are set to Allow. For more information about rule actions, see Using rule actions in AWS WAF. For more information about default web ACL actions, see Setting the web ACL default action in AWS WAF. Custom request header names AWS WAF prefixes all request headers that it inserts with x-amzn-waf-, to avoid confusion with the headers that are already in the request. For example, if you specify the header name sample, AWS WAF inserts the header x-amzn-waf-sample. Headers with the same name Inserting custom request headers insertions 337 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide If the request already has a header with the same name that AWS WAF is inserting, AWS WAF overwrites the header. So, if you define headers in multiple rules with identical names, the last rule to inspect the request and find a match would have its header added, and any previous rules would not. Custom headers with non-terminating rule actions Unlike the Allow action, the Count action doesn't stop AWS WAF from processing the web request using the rest of the rules in the web ACL. Similarly, when CAPTCHA and Challenge determine that the request token is valid, these actions don't stop AWS WAF from processing the web request. So, if you insert custom headers using a rule with one of these actions, subsequent rules might also insert custom headers. For more information about rule action behavior, see Using rule actions in AWS WAF. For example, suppose you have the following rules, prioritized in the order shown: 1. RuleA with a Count action and a customized header named RuleAHeader. 2. RuleB with an Allow action and a customized header named RuleBHeader. If a request matches both RuleA and RuleB, AWS WAF inserts the headers x-amzn-waf- RuleAHeader and x-amzn-waf-RuleBHeader, and then forwards the request to the protected resource. AWS WAF inserts custom headers into a web request when it finishes inspecting the request. So if you use custom request handling with a rule that has the action set to Count, the custom headers that you add are not inspected by subsequent rules. Example custom request handling You define custom request handling for a rule's action or for a web ACL's default action. The following listing shows the JSON for custom handling added to the default action for a web ACL. { "Name": "SampleWebACL", "Scope": "REGIONAL", "DefaultAction": { "Allow": { "CustomRequestHandling": { "InsertHeaders": [ Inserting custom request headers insertions 338 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide { "Name": "fruit", "Value": "watermelon" }, { "Name": "pie", "Value": "apple" } ] } } }, "Description": "Sample web ACL with custom request handling configured for default action.", "Rules": [], "VisibilityConfig": { "SampledRequestsEnabled": true, "CloudWatchMetricsEnabled": true, "MetricName": "SampleWebACL" } } Sending custom responses for Block actions This section explains how to instruct AWS WAF to send a custom HTTP response back to the client for rule actions or web ACL default actions that are set to Block. For more information about rule actions, see Using rule actions in AWS WAF. For more information about default web ACL actions, see Setting the web ACL default action in AWS WAF. When you define custom response handling for a Block action, you define the status code, headers, and response body. For a list of status codes that you can use with AWS WAF, see the section that follows, Supported status codes for custom responses. Use cases The use cases for custom responses include the following: • Sending a non-default status code back to the client. • Sending custom response headers back to the client. You can specify any header name except for content-type. • Sending a static error page back to the client. Sending custom responses 339 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide • Redirecting the client to a different URL. To do this, you specify one of the 3xx redirection status codes, like 301 (Moved Permanently) or 302 (Found), and then specify a new header named Location with the new URL. Interaction with responses that you define in your protected resource Custom responses that you specify for the AWS WAF Block action take precedence over any response specifications that you define in your protected resource. The host service for the AWS resource that you protect with AWS WAF might permit custom response handling for web requests. Examples include the following: • With Amazon CloudFront, you can customize the error page based on status code. For information, see Generating custom error responses in the Amazon CloudFront Developer Guide. • With Amazon API Gateway you can define the response and status code for your gateway. For information, see Gateway responses in API Gateway in the Amazon API Gateway |
waf-dg-113 | waf-dg.pdf | 113 | for the AWS WAF Block action take precedence over any response specifications that you define in your protected resource. The host service for the AWS resource that you protect with AWS WAF might permit custom response handling for web requests. Examples include the following: • With Amazon CloudFront, you can customize the error page based on status code. For information, see Generating custom error responses in the Amazon CloudFront Developer Guide. • With Amazon API Gateway you can define the response and status code for your gateway. For information, see Gateway responses in API Gateway in the Amazon API Gateway Developer Guide. You can't combine AWS WAF custom response settings with custom response settings in the protected AWS resource. The response specification for any individual web request comes either completely from AWS WAF or completely from the protected resource. For web requests that AWS WAF blocks, the following shows the order of precedence. 1. AWS WAF custom response – If the AWS WAF Block action has a custom response enabled, the protected resource sends the configured custom response back to the client. Any response settings that you might have defined in the protected resource itself have no effect. 2. Custom response defined in the protected resource – Otherwise, if the protected resource has custom response settings specified, the protected resource uses those settings to respond to the client. 3. AWS WAF default Block response – Otherwise, the protected resource responds to the client with the AWS WAF default Block response 403 (Forbidden). For web requests that AWS WAF allows, your configuration of the protected resource determines the response that it sends back to the client. You can't configure response settings in AWS WAF for allowed requests. The only customization that you can configure in AWS WAF for allowed requests is the insertion of custom headers into the original request, before forwarding the request to the Sending custom responses 340 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide protected resource. This option is described in the preceding section, Inserting custom request headers for non-blocking actions. Custom response headers You can specify any header name except for content-type. Custom response bodies You define the body of a custom response within the context of the web ACL or rule group where you want to use it. After you've defined a custom response body, you can use it by reference anywhere else in the web ACL or rule group where you created it. In the individual Block action settings, you reference the custom body that you want to use and you define the status code and header of the custom response. When you create a custom response in the console, you can choose from response bodies that you've already defined or you can create a new body. Outside of the console, you define your custom response bodies at the web ACL or rule group level, and then reference them from the action settings within the web ACL or rule group. This is shown in the example JSON in the following section. Custom response example The following example lists the JSON for a rule group with custom response settings. The custom response body is defined for the entire rule group, then referenced by key in the rule action. { "ARN": "test_rulegroup_arn", "Capacity": 1, "CustomResponseBodies": { "CustomResponseBodyKey1": { "Content": "This is a plain text response body.", "ContentType": "TEXT_PLAIN" } }, "Description": "This is a test rule group.", "Id": "test_rulegroup_id", "Name": "TestRuleGroup", "Rules": [ Sending custom responses 341 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide { "Action": { "Block": { "CustomResponse": { "CustomResponseBodyKey": "CustomResponseBodyKey1", "ResponseCode": 404, "ResponseHeaders": [ { "Name": "BlockActionHeader1Name", "Value": "BlockActionHeader1Value" } ] } } }, "Name": "GeoMatchRule", "Priority": 1, "Statement": { "GeoMatchStatement": { "CountryCodes": [ "US" ] } }, "VisibilityConfig": { "CloudWatchMetricsEnabled": true, "MetricName": "TestRuleGroupReferenceMetric", "SampledRequestsEnabled": true } } ], "VisibilityConfig": { "CloudWatchMetricsEnabled": true, "MetricName": "TestRuleGroupMetric", "SampledRequestsEnabled": true } } Supported status codes for custom responses This section lists the status codes that you can use in a custom response. For detailed information about HTTP status codes, see Status Codes by the Internet Engineering Task Force (IETF) and List of HTTP status codes on Wikipedia. Supported response status codes 342 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide The following are the HTTP status codes that AWS WAF supports for custom responses. • 2xx Successful • 200 – OK • 201 – Created • 202 – Accepted • 204 – No Content • 206 – Partial Content • 3xx Redirection • 300 – Multiple Choices • 301 – Moved Permanently • 302 – Found • 303 –See Other • 304 – Not Modified • 307 – Temporary Redirect • 308 – Permanent Redirect • 4xx Client Error • 400 – Bad Request • 401 |
waf-dg-114 | waf-dg.pdf | 114 | status codes 342 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide The following are the HTTP status codes that AWS WAF supports for custom responses. • 2xx Successful • 200 – OK • 201 – Created • 202 – Accepted • 204 – No Content • 206 – Partial Content • 3xx Redirection • 300 – Multiple Choices • 301 – Moved Permanently • 302 – Found • 303 –See Other • 304 – Not Modified • 307 – Temporary Redirect • 308 – Permanent Redirect • 4xx Client Error • 400 – Bad Request • 401 – Unauthorized • 403 – Forbidden • 404 – Not Found • 405 – Method Not Allowed • 408 – Request Timeout • 409 – Conflict • 411 – Length Required • 412 – Precondition Failed • 413 – Request Entity Too Large • 414 – Request-URI Too Long • 415 – Unsupported Media Type Supported response status codes • 416 – Requested Range Not Satisfiable 343 • 421 – Misdirected Request AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide • 429 – Too Many Requests • 5xx Server Error • 500 – Internal Server Error • 501 – Not Implemented • 502 – Bad Gateway • 503 – Service Unavailable • 504 – Gateway Timeout • 505 – HTTP Version Not Supported Web request labeling in AWS WAF This section explains what AWS WAF labels are. A label is metadata added to a web request by a rule when the rule matches the request. Once added, a label remains available on the request until the web ACL evaluation ends. You can access labels in rules that run later in the web ACL evaluation by using a label match statement. For details, see Label match rule statement. Labels on web requests generate Amazon CloudWatch label metrics. For a list of metrics and dimensions, see Label metrics and dimensions. For information about accessing metrics and metric summaries through CloudWatch and through the AWS WAF console, see Monitoring and tuning your AWS WAF protections. Labeling use cases Common use cases for AWS WAF labels include the following: • Evaluating a web request against multiple rule statements before taking action on the request – After a match is found with a rule in a web ACL, AWS WAF continues evaluating the request against the web ACL if the rule action doesn't terminate the web ACL evaluation. You can use labels to evaluate and collect information from multiple rules before you decide to allow or block the request. To do this, change the actions for your existing rules to Count and configure them to add labels to matching requests. Then, add one or more new rules to run after your other rules, and configure them to evaluate the labels and manage the requests according to the label match combinations. Web request labeling 344 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide • Managing web requests by geographical region – You can use the geographic match rule alone to manage web requests by the country of origin. To fine-tune the location down to the region level, you use the geo match rule with a Count action followed by a label match rule. For information about the geo match rule, see Geographic match rule statement. • Reusing logic across multiple rules – If you need to reuse the same logic across multiple rules, you can use labels to single-source the logic and just test for the results. When you have multiple complex rules that use a common subset of nested rule statements, duplicating the common rule set across your complex rules can be time consuming and error prone. With labels, you can create a new rule with the common rule subset that counts matching requests and adds a label to them. You add the new rule to your web ACL so that it runs before your original complex rules. Then, in your original rules, you replace the shared rule subset with a single rule that checks for the label. For example, say you have multiple rules that you want to only apply to your login paths. Rather than have each rule specify the same logic to match potential login paths, you can implement a single new rule that contains that logic. Have the new rule add a label to matching requests to indicate that the request is on a login path. In your web ACL, give this new rule a lower numeric priority setting than your original rules so that it runs first. Then, in your original rules, replace the shared logic with a check for the presence of the label. For information about priority settings, see Setting rule priority in a web ACL. • Creating exceptions to rules in |
waf-dg-115 | waf-dg.pdf | 115 | rule specify the same logic to match potential login paths, you can implement a single new rule that contains that logic. Have the new rule add a label to matching requests to indicate that the request is on a login path. In your web ACL, give this new rule a lower numeric priority setting than your original rules so that it runs first. Then, in your original rules, replace the shared logic with a check for the presence of the label. For information about priority settings, see Setting rule priority in a web ACL. • Creating exceptions to rules in rule groups – This option is particularly useful for managed rule groups, which you can't view or alter. Many managed rule group rules add labels to matching web requests, to indicate the rules that matched and possibly to provide additional information about the match. When you use a rule group that adds labels to requests, you can override the rule group rules to count matches, and then run a rule after the rule group that handles the web request based on the rule group labels. All AWS Managed Rules add labels to matching web requests. For details, see the rule descriptions at AWS Managed Rules rule groups list. • Using label metrics to monitor traffic patterns – You can access metrics for labels that you add through your rules and for metrics added by any managed rule groups that you use in your web ACL. All of the AWS Managed Rules rule groups add labels to the web requests that they evaluate. For a list of label metrics and dimensions, see Label metrics and dimensions. You can access metrics and metric summaries through CloudWatch and through the web ACL page in the AWS WAF console. For information, see Monitoring and tuning your AWS WAF protections. How labeling works in AWS WAF This section explains how AWS WAF labels work. How labeling works 345 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide When a rule matches a web request, if the rule has labels defined, AWS WAF adds the labels to the request at the end of the rule evaluation. Rules that are evaluated after the matching rule in the web ACL can match against the labels that the rule has added. Who adds labels to requests The web ACL components that evaluate requests can add labels to the requests. • Any rule that isn't a rule group reference statement can add labels to matching web requests. The labeling criteria is part of the rule definition, and when a web request matches the rule, AWS WAF adds the rule's labels to the request. For information, see the section called “Rules that add labels”. • The geo match rule statement adds country and region labels to any request that it inspects, regardless of whether the statement results in a match. For information, see the section called “Geographic match”. • The AWS Managed Rules for AWS WAF all add labels to requests that they inspect. They add some labels based on rule matches in the rule group and they add some based on AWS processes that the managed rule groups use, such as the token labeling added when you use an intelligent threat mitigation rule group. For information about the labels that each managed rule group adds, see the section called “AWS Managed Rules rule groups list”. How AWS WAF manages labels AWS WAF adds the rule's labels to the request at the end of the rule's inspection of the request. Labeling is part of a rule's match activities, similar to the action. Labels don't persist with the web request after the web ACL evaluation ends. In order for other rules to match against a label that your rule adds, your rule action must not terminate the evaluation of the web request by the web ACL. The rule action must be set to Count, CAPTCHA, or Challenge. When the web ACL evaluation doesn't terminate, subsequent rules in the web ACL can run their label matching criteria against the request. For more information about rule actions, see Using rule actions in AWS WAF. Access to labels during web ACL evaluation Once added, labels remain available on the request as long as AWS WAF is evaluating the request against the web ACL. Any rule in a web ACL can access labels that have been added by the rules that have already run in the same web ACL. This includes rules that are defined directly inside the web ACL and rules defined inside rule groups that are used in the web ACL. How labeling works 346 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide • You can match against a label in your rule's request inspection criteria using the label |
waf-dg-116 | waf-dg.pdf | 116 | added, labels remain available on the request as long as AWS WAF is evaluating the request against the web ACL. Any rule in a web ACL can access labels that have been added by the rules that have already run in the same web ACL. This includes rules that are defined directly inside the web ACL and rules defined inside rule groups that are used in the web ACL. How labeling works 346 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide • You can match against a label in your rule's request inspection criteria using the label match statement. You can match against any label that's attached to the request. For statement details, see Label match rule statement. • The geographic match statement adds labels with or without a match, but they're only available after the statement's containing web ACL rule has completed the request evaluation. • You can't use a single rule, for example a logical AND statement, to run a geo match statement followed by a label match statement against the geographic labels. You must put the label match statement in a separate rule that runs after the rule that contains the geo match statement. • If you use a geo match statement as a scope-down statement inside a rate-based rule statement or managed rule group reference statement, the labels that the geo match statement adds are not available for inspection by the containing rule's statement. If you need to inspect geographic labeling in a rate-based rule statement or a rule group, you must run the geo match statement in a separate rule that runs beforehand. Access to label information outside of web ACL evaluation Labels don't persist with the web request after the web ACL evaluation ends, but AWS WAF records label information in the logs and in metrics. • AWS WAF stores Amazon CloudWatch metrics for the first 100 labels on any single request. For information about accessing label metrics, see Monitoring with Amazon CloudWatch and Label metrics and dimensions. • AWS WAF summarizes CloudWatch label metrics in the web ACL traffic overview dashboards in the AWS WAF console. You can access the dashboards on any web ACL page. For more information, see Web ACL traffic overview dashboards. • AWS WAF records labels in the logs for the first 100 labels on a request. You can use labels, along with the rule action, to filter the logs that AWS WAF records. For information, see Logging AWS WAF web ACL traffic. Your web ACL evaluation can apply more than 100 labels to a web request and match against more than 100 labels, but AWS WAF only records the first 100 in the logs and metrics. Label syntax and naming requirements in AWS WAF This section explains how to construct and match against an AWS WAF label. Label syntax and naming requirements 347 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide A label is a string made up of a prefix, optional namespaces, and a name. The components of a label are delimited with a colon. Labels have the following requirements and characteristics: • Labels are case-sensitive. • Each label namespace or label name can have up to 128 characters. • You can specify up to five namespaces in a label. • Components of a label are separated by colon (:). • You can't use the following reserved strings in the namespaces or name that you specify for a label: awswaf, aws, waf, rulegroup, webacl, regexpatternset, ipset, and managed. Label syntax A fully qualified label has a prefix, optional namespaces, and label name. The prefix identifies the rule group or web ACL context of the rule that added the label. Namespaces might be used to add more context for the label. The label name provides the lowest level of detail for a label. It often indicates the specific rule that added the label to the request. The label prefix varies depending on its origin. • Your labels – The following shows the full label syntax for labels that you create in your web ACL and rule group rules. The entity types are rulegroup and webacl. awswaf:<entity owner account id>:<entity type>:<entity name>:<custom namespace>:...:<label name> • Label namespace prefix: awswaf:<entity owner account id>:<entity type>:<entity name>: • Custom namespace additions: <custom namespace>:…: When you define a label for a rule in a rule group or web ACL, you control the custom namespace strings and the label name. The rest is generated for you by AWS WAF. AWS WAF automatically prefixes all labels with awswaf and the account and web ACL or rule group entity settings. • Managed rule group labels – The following shows the full label syntax for labels that are created by rules in managed rule groups. awswaf:managed:<vendor>:<rule group name>:<custom namespace>:...:<label name> Label |
waf-dg-117 | waf-dg.pdf | 117 | name> • Label namespace prefix: awswaf:<entity owner account id>:<entity type>:<entity name>: • Custom namespace additions: <custom namespace>:…: When you define a label for a rule in a rule group or web ACL, you control the custom namespace strings and the label name. The rest is generated for you by AWS WAF. AWS WAF automatically prefixes all labels with awswaf and the account and web ACL or rule group entity settings. • Managed rule group labels – The following shows the full label syntax for labels that are created by rules in managed rule groups. awswaf:managed:<vendor>:<rule group name>:<custom namespace>:...:<label name> Label syntax and naming requirements 348 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide • Label namespace prefix: awswaf:managed:<vendor>:<rule group name>: • Custom namespace additions: <custom namespace>:…: All AWS Managed Rules rule groups add labels. For information about managed rule groups, see Using managed rule groups in AWS WAF. • Labels from other AWS processes – These processes are used by AWS Managed Rules rule groups, so you see them added to web requests that you evaluate using managed rule groups. The following shows the full label syntax for labels that are created by processes that are called by managed rule groups. awswaf:managed:<process>:<custom namespace>:...:<label name> • Label namespace prefix: awswaf:managed:<process>: • Custom namespace additions: <custom namespace>:…: Labels of this type are listed for the managed rule groups that call the AWS process. For information about managed rule groups, see Using managed rule groups in AWS WAF. Label examples for your rules The following example labels are defined by rules in a rule group named testRules that belongs to the account, 111122223333. awswaf:111122223333:rulegroup:testRules:testNS1:testNS2:LabelNameA awswaf:111122223333:rulegroup:testRules:testNS1:LabelNameQ awswaf:111122223333:rulegroup:testRules:LabelNameZ The following listing shows an example label specification in JSON. These label names include custom namespace strings before the ending label name. Rule: { Name: "label_rule", Statement: {...} RuleLabels: [ Label syntax and naming requirements 349 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Name: "header:encoding:utf8", Name: "header:user_agent:firefox" ], Action: { Count: {} } } Note You can access this type of listing in the console through the rule JSON editor. If you run the preceding rule in the same rule group and account as the preceding label examples, the resulting, fully qualified labels would be the following: awswaf:111122223333:rulegroup:testRules:header:encoding:utf8 awswaf:111122223333:rulegroup:testRules:header:user_agent:firefox Label examples for managed rule groups The following show example labels from AWS Managed Rules rule groups and processes that they invoke. awswaf:managed:aws:core-rule-set:NoUserAgent_Header awswaf:managed:aws:sql-database:SQLiExtendedPatterns_QueryArguments awswaf:managed:aws:atp:aggregate:attribute:compromised_credentials awswaf:managed:token:accepted AWS WAF rules that add labels In almost all rules, you can define labels and AWS WAF will apply them to any matching request. The following rule types are the only exceptions: Rules that add labels 350 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide • Rate-based rules label only while rate limiting – Rate-based rules only add labels to web requests for a specific aggregation instance while that instance is being rate limited by AWS WAF. For information about rate-based rules, see Using rate-based rule statements in AWS WAF. • Labeling isn't allowed in rule group reference statements – The console doesn't accept labels for rule group statements or managed rule group statements. Through the API, specifying a label for either statement type results in a validation exception. For information about these statement types, see Using managed rule group statements in AWS WAF and Using rule group statements in AWS WAF. WCUs – 1 WCU for every 5 labels that you define in your web ACL or rule group rules. Where to find this • Rule builder on the console – Under the rule's Action settings, under Label. • API data type – Rule RuleLabels You define a label in a rule by specifying the custom namespace strings and name to append to the label namespace prefix. AWS WAF derives the prefix from the context in which you define the rule. For information about this, see the label syntax information under Label syntax and naming requirements in AWS WAF. AWS WAF rules that match labels This section explains how to use a label match statement to evaluate web request labels. You can match against Label, which requires the label name, or against Namespace, which requires a namespace specification. For either label or namespace, you can optionally include preceding namespaces and the prefix in your specification. For general information about this statement type, see Label match rule statement. A label's prefix defines the context of the rule group or web ACL where the label's rule is defined. In a rule's label match statement, if your label or namespace match string doesn't specify the prefix, AWS WAF uses the prefix for the label match rule. • Labels for rules that are defined directly inside a web ACL have a prefix that specifies the web ACL context. • Labels for rules that are inside |
waf-dg-118 | waf-dg.pdf | 118 | or namespace, you can optionally include preceding namespaces and the prefix in your specification. For general information about this statement type, see Label match rule statement. A label's prefix defines the context of the rule group or web ACL where the label's rule is defined. In a rule's label match statement, if your label or namespace match string doesn't specify the prefix, AWS WAF uses the prefix for the label match rule. • Labels for rules that are defined directly inside a web ACL have a prefix that specifies the web ACL context. • Labels for rules that are inside a rule group have a prefix that specifies the rule group context. This could be your own rule group or a rule group that's managed for you. Rules that match labels 351 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide For information about this, see label syntax under Label syntax and naming requirements in AWS WAF. Note Some managed rule groups add labels. You can retrieve these through the API by calling DescribeManagedRuleGroup. The labels are listed in the AvailableLabels property in the response. If you want to match against a rule that's in a different context than the context of your rule, you must provide the prefix in your match string. For example, if you want to match against labels that are added by rules in a managed rule group, you could add a rule in your web ACL with a label match statement whose match string specifies the rule group's prefix followed by your additional match criteria. In the match string for the label match statement, you specify either a label or a namespace: • Label – The label specification for a match consists of the ending part of the label. You can include any number of the contiguous namespaces that immediately precede the label name followed by the name. You can also provide the fully qualified label by starting the specification with the prefix. Example specifications: • testNS1:testNS2:LabelNameA • awswaf:managed:aws:managed-rule-set:testNS1:testNS2:LabelNameA • Namespace – The namespace specification for a match consists of any contiguous subset of the label specification excluding the name. You can include the prefix and you can include one or more namespace strings. Example specifications: • testNS1:testNS2: • awswaf:managed:aws:managed-rule-set:testNS1: AWS WAF label match examples This section provides examples of match specifications, for the label match rule statement. Rules that match labels 352 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Note These JSON listings were created in the console by adding a rule to a web ACL with the label match specifications and then editing the rule and switching to the Rule JSON editor. You can also get the JSON for a rule group or web ACL through the APIs or the command line interface. Topics • Match against a local label • Match against a label from another context • Match against a managed rule group label • Match against a local namespace • Match against a managed rule group namespace Match against a local label The following JSON listing shows a label match statement for a label that's been added to the web request locally, in the same context as this rule. Rule: { Name: "match_rule", Statement: { LabelMatchStatement: { Scope: "LABEL", Key: "header:encoding:utf8" } }, RuleLabels: [ ...generate_more_labels... ], Action: { Block: {} } } If you use this match statement in account 111122223333, in a rule that you define for web ACL testWebACL, it would match the following labels. awswaf:111122223333:webacl:testWebACL:header:encoding:utf8 Rules that match labels 353 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide awswaf:111122223333:webacl:testWebACL:testNS1:testNS2:header:encoding:utf8 It wouldn't match the following label, because the label string isn't an exact match. awswaf:111122223333:webacl:testWebACL:header:encoding2:utf8 It wouldn't match the following label, because the context isn't the same, so the prefix doesn't match. This is true even if you added the rule group productionRules to the web ACL testWebACL, where the rule is defined. awswaf:111122223333:rulegroup:productionRules:header:encoding:utf8 Match against a label from another context The following JSON listing shows a label match rule that matches against a label from a rule inside a user-created rule group. The prefix is required in the specification for all rules running in the web ACL that aren't part of the named rule group. This example label specification matches only the exact label. Rule: { Name: "match_rule", Statement: { LabelMatchStatement: { Scope: "LABEL", Key: "awswaf:111122223333:rulegroup:testRules:header:encoding:utf8" } }, RuleLabels: [ ...generate_more_labels... ], Action: { Block: {} } } Match against a managed rule group label This is a special case of matching against a label that's from another context than that of the match rule. The following JSON listing shows a label match statement for a managed rule group label. This matches only the exact label that's specified in the label match statement's key setting. Rule: { |
waf-dg-119 | waf-dg.pdf | 119 | that aren't part of the named rule group. This example label specification matches only the exact label. Rule: { Name: "match_rule", Statement: { LabelMatchStatement: { Scope: "LABEL", Key: "awswaf:111122223333:rulegroup:testRules:header:encoding:utf8" } }, RuleLabels: [ ...generate_more_labels... ], Action: { Block: {} } } Match against a managed rule group label This is a special case of matching against a label that's from another context than that of the match rule. The following JSON listing shows a label match statement for a managed rule group label. This matches only the exact label that's specified in the label match statement's key setting. Rule: { Rules that match labels 354 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Name: "match_rule", Statement: { LabelMatchStatement: { Scope: "LABEL", Key: "awswaf:managed:aws:managed-rule-set:header:encoding:utf8" } }, RuleLabels: [ ...generate_more_labels... ], Action: { Block: {} } } Match against a local namespace The following JSON listing shows a label match statement for a local namespace. Rule: { Name: "match_rule", Statement: { LabelMatchStatement: { Scope: "NAMESPACE", Key: "header:encoding:" } }, Labels: [ ...generate_more_labels... ], Action: { Block: {} } } Similar to the local Label match, if you use this statement in account 111122223333, in a rule that you define for web ACL testWebACL, it would match the following label. awswaf:111122223333:webacl:testWebACL:header:encoding:utf8 It wouldn't match the following label, because the account isn't the same, so the prefix doesn't match. awswaf:444455556666:webacl:testWebACL:header:encoding:utf8 Rules that match labels 355 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide The prefix also doesn't match any labels applied by managed rule groups, like the following. awswaf:managed:aws:managed-rule-set:header:encoding:utf8 Match against a managed rule group namespace The following JSON listing shows a label match statement for a managed rule group namespace. For a rule group that you own, you'd also need to provide the prefix in order to match for a namespace that's outside of the rule's context. Rule: { Name: "match_rule", Statement: { LabelMatchStatement: { Scope: "NAMESPACE", Key: "awswaf:managed:aws:managed-rule-set:header:" } }, RuleLabels: [ ...generate_more_labels... ], Action: { Block: {} } } This specification matches against the following example labels. awswaf:managed:aws:managed-rule-set:header:encoding:utf8 awswaf:managed:aws:managed-rule-set:header:encoding:unicode It doesn't match the following label. awswaf:managed:aws:managed-rule-set:query:badstring Intelligent threat mitigation in AWS WAF This section covers the managed intelligent threat mitigation features provided by AWS WAF. These are advanced, specialized protections that you can implement to protect against threats such as malicious bots and account takeover attempts. Intelligent threat mitigation 356 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Note The features described here incur additional costs, beyond the basic fees for using AWS WAF. For more information, see AWS WAF Pricing. The guidance provided in this section is intended for users who know generally how to create and manage AWS WAF web ACLs, rules, and rule groups. Those topics are covered in prior sections of this guide. Topics • Options for intelligent threat mitigation in AWS WAF • Best practices for intelligent threat mitigation in AWS WAF • Token use in AWS WAF intelligent threat mitigation • AWS WAF Fraud Control account creation fraud prevention (ACFP) • AWS WAF Fraud Control account takeover prevention (ATP) • AWS WAF Bot Control • Client application integrations in AWS WAF • CAPTCHA and Challenge in AWS WAF Options for intelligent threat mitigation in AWS WAF This section provides a detailed comparison of the options for implementing intelligent threat mitigation. AWS WAF offers the following types of protections for intelligent threat mitigation. • AWS WAF Fraud Control account creation fraud prevention (ACFP) – Detects and manages malicious account creation attempts on your application's sign-up page. The core functionality is provided by the ACFP managed rule group. For more information, see AWS WAF Fraud Control account creation fraud prevention (ACFP) and AWS WAF Fraud Control account creation fraud prevention (ACFP) rule group. • AWS WAF Fraud Control account takeover prevention (ATP) – Detects and manages malicious takeover attempts on your application's login page. The core functionality is provided by the ATP managed rule group. For more information, see AWS WAF Fraud Control account takeover prevention (ATP) and AWS WAF Fraud Control account takeover prevention (ATP) rule group. Mitigation options 357 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide • AWS WAF Bot Control – Identifies, labels, and manages both friendly and malicious bots. This feature provides management for common bots with signatures that are unique across applications, and also for targeted bots that have signatures specific to an application. The core functionality is provided by the Bot Control managed rule group. For more information, see AWS WAF Bot Control and AWS WAF Bot Control rule group. • Client application integration SDKs – Validate client sessions and end users on your web pages and acquire AWS WAF tokens for clients to use in their web requests. If you use ACFP, ATP, or Bot Control, implement |
waf-dg-120 | waf-dg.pdf | 120 | Identifies, labels, and manages both friendly and malicious bots. This feature provides management for common bots with signatures that are unique across applications, and also for targeted bots that have signatures specific to an application. The core functionality is provided by the Bot Control managed rule group. For more information, see AWS WAF Bot Control and AWS WAF Bot Control rule group. • Client application integration SDKs – Validate client sessions and end users on your web pages and acquire AWS WAF tokens for clients to use in their web requests. If you use ACFP, ATP, or Bot Control, implement the application integration SDKs in your client application if you can, to take full advantage of all of the rule group features. We only recommend using these rule groups without an SDK integration as a temporary measure, when a critical resource needs to be quickly secured and there isn’t enough time for the SDK integration. For information about implementing the SDKs, see Client application integrations in AWS WAF. • Challenge and CAPTCHA rule actions – Validate client sessions and end users and acquire AWS WAF tokens for clients to use in their web requests. You can implement these anywhere that you specify a rule action, in your rules and as overrides in rule groups that you use. These actions use AWS WAF JavaScript interstitials to interrogate the client or end user, and they require client applications that support JavaScript. For more information, see CAPTCHA and Challenge in AWS WAF. The intelligent threat mitigation AWS Managed Rules rule groups ACFP, ATP, and Bot Control use tokens for advanced detection. For information about the features that tokens enable in the rule groups, see Using application integration SDKs with ACFP, Using application integration SDKs with ATP, and Using application integration SDKs with Bot Control. Your options for implementing intelligent threat mitigation run from the basic use of rule actions to run challenges and enforce token acquisition, to the advanced features offered by the intelligent threat mitigation AWS Managed Rules rule groups. The following tables provide detailed comparisons of the options for the basic and advanced features. Topics • Options for challenges and token acquisition • Options for intelligent threat mitigation managed rule groups • Options for rate limiting in rate-based rules and targeted Bot Control rules Mitigation options 358 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Options for challenges and token acquisition This section compares challenge and token management options. You can provide challenges and acquire tokens using the AWS WAF application integration SDKs or the rule actions Challenge and CAPTCHA. Broadly speaking, the rule actions are easier to implement, but they incur added costs, intrude more on your customer experience, and require JavaScript. The SDKs require programming in your client applications, but they can provide a better customer experience, they're free to use, and they can be used with JavaScript or in Android or iOS applications. You can only use the application integration SDKs with web ACLs that use one of the paid intelligent threat mitigation managed rule groups, described in the following section. Comparison of options for challenges and token acquisition What it is Good choice for... Challenge rule action CAPTCHA rule action JavaScript SDK challenge Mobile SDK challenge Rule action that enforces acquisition of the AWS Rule action that enforces acquisition of the AWS Application integration Application integration layer, layer, for client for Android and browsers and iOS applicati WAF token by WAF token by other devices ons. Natively presenting the browser client with a presenting the that execute renders the client end user JavaScript. silent challenge with a visual or Renders the and acquires a silent challenge audio challenge i silent challenge token interstitial nterstitial and acquires a token Silent validatio n against bot sessions and enforcement of token acqui sition for clients that support End user and silent validatio n against bot sessions and enforcement of token acquisiti on, for clients Silent validatio n against bot sessions and enforcement of token acquisiti on for clients that support Silent validatio n against bot sessions and enforcement of token acquisiti on for native mobile applicati JavaScript that support JavaScript. ons on Android JavaScript and iOS. Mitigation options 359 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Challenge rule action CAPTCHA rule action JavaScript SDK challenge Mobile SDK challenge The SDKs The SDKs provide the lowest latency a provide the lowest latency nd best control and best control over where the over where the challenge script challenge script runs in the appli runs in the cation. application. Implementation considerations Implemented as a rule action Implemented as a rule action Requires one of the ACFP, ATP, Requires one of the ACFP, ATP, setting setting or Bot Control or Bot Control paid rule groups paid rule |
waf-dg-121 | waf-dg.pdf | 121 | options 359 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Challenge rule action CAPTCHA rule action JavaScript SDK challenge Mobile SDK challenge The SDKs The SDKs provide the lowest latency a provide the lowest latency nd best control and best control over where the over where the challenge script challenge script runs in the appli runs in the cation. application. Implementation considerations Implemented as a rule action Implemented as a rule action Requires one of the ACFP, ATP, Requires one of the ACFP, ATP, setting setting or Bot Control or Bot Control paid rule groups paid rule groups in the web ACL. in the web ACL. Requires coding Requires coding in the client application. in the client application. Runtime considerations Intrusive flow for requests Intrusive flow for requests Can be run behind the Can be run behind the without valid without valid scenes. Gives scenes. Gives tokens. Client tokens. Client you more you more is redirect is redirecte control over control over the challenge experience. the challenge experience. ed to an AWS WAF challenge interstitial. d to an AWS WAF CAPTCH A interstitial. Adds network Adds network round trips round trips and requires a and requires a second evaluatio second evaluatio n of the web n of the web request. request. Mitigation options 360 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Requires JavaScript Supported clients Challenge rule action CAPTCHA rule action JavaScript SDK challenge Mobile SDK challenge Yes Yes Yes No Browser and devices Browser and devices Browser and devices Android and iOS devices that execute that execute that execute Javascript Javascript Javascript Supports single- page applicati Enforcement only. Enforcement only. Yes N/A ons (SPA) You can use the You can use the Challenge action CAPTCHA action in conjunction in conjunction with the SDKs, with the SDKs, to ensure that to ensure that requests have a requests have a valid challenge valid CAPTCHA token. You can't token. You can't use the rule use the rule action to deliver action to deliver the challenge script to the the CAPTCHA script to the page. page. Mitigation options 361 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Challenge rule action CAPTCHA rule action JavaScript SDK challenge Mobile SDK challenge Additional cost Yes, for action settings that you Yes, for action settings that you No, but requires one of the paid No, but requires one of the paid explicitly specify, explicitly specify, rule groups rule groups either in the either in the ACFP, ATP, or Bot ACFP, ATP, or Bot rules that you rules that you Control. Control . define or as rule define or as rule action overrides action overrides in rule groups in rule groups that you use. that you use. No in all other No in all other cases. cases. For details about costs associated with these options, see the intelligent threat mitigation information at AWS WAF Pricing. It can be simpler to run challenges and provide basic token enforcement by just adding a rule with a Challenge or CAPTCHA action. You might be required to use the rule actions, for example if you don't have access to the application code. If you can implement the SDKs however, you can save costs and reduce latency in your web ACL evaluation of client web requests, compared to using the Challenge action: • You can write your SDK implementation to run the challenge at any point in your application. You can acquire the token in the background, prior to any customer action that would send a web request to your protected resource. This way, the token is available to send with your client's first request. • If instead you acquire tokens by implementing a rule with the Challenge action, the rule and action require additional web request evaluation and processing when the client first sends a request and anytime the token expires. The Challenge action blocks the request that doesn't have a valid, unexpired token, and sends the challenge interstitial back to the client. After the client successfully responds to the challenge, the interstitial resends the original web request with the valid token, which is then evaluated a second time by the web ACL. Mitigation options 362 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Options for intelligent threat mitigation managed rule groups This section compares managed rule group options. The intelligent threat mitigation AWS Managed Rules rule groups provide management of basic bots, detection and mitigation of sophisticated, malicious bots, detection and mitigation of account takeover attempts, and detection and mitigation of fraudulent account creation attempts. These rule groups, combined with the application integration SDKs described in the prior section, provide the most advanced protections and secure coupling with your client applications. Comparison of the managed rules group options |
waf-dg-122 | waf-dg.pdf | 122 | ACL. Mitigation options 362 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Options for intelligent threat mitigation managed rule groups This section compares managed rule group options. The intelligent threat mitigation AWS Managed Rules rule groups provide management of basic bots, detection and mitigation of sophisticated, malicious bots, detection and mitigation of account takeover attempts, and detection and mitigation of fraudulent account creation attempts. These rule groups, combined with the application integration SDKs described in the prior section, provide the most advanced protections and secure coupling with your client applications. Comparison of the managed rules group options What it is ACFP ATP Bot Control common level Bot Control targeted level Manages requests that Manages requests that Manages common bots might be part might be part that self- Manages targeted bots that don't self- of fraudulen t account cr of malicious identify, with identify, with takeover a signatures that signatures that eation attempts ttempts on an are unique are specific to an on an applicati application's across applicati application. on's registration login page. ons. and sign-up p ages. Does not manage bots. See AWS WAF Does not See AWS WAF Bot Control rule manage bots. Bot Control rule group. See AWS WAF group. See AWS WAF Fraud Control account Fraud Control takeover account creation prevention (ATP) fraud preventio rule group. n (ACFP) rule group. Good choice for... Inspection of account Inspection of login traffic Basic bot protection Targeted protection creation traffic for account and labeling against sophistic Mitigation options 363 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide ACFP ATP Bot Control common level Bot Control targeted level for fraudulen takeover attacks of common, ated bots, including rate limiting at the client session level and detection and mitigatio n of browser automation tools such as Selenium and Puppeteer. t account creation attacks such login attempts with automated bot traffic. such creat password ion attempts traversal and with username many login traversal and attempts from many new accounts c reated from a single IP address. the same IP address. When used with tokens, also provides aggregate protections such as rate limiting of IPs and client sessions for high volumes of failed login attempts. Adds labels that indicate evaluation results Adds token labels Yes Yes Yes Yes Yes Yes Yes Yes Mitigation options 364 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide ACFP ATP Bot Control common level Bot Control targeted level Blocking for requests that don't have a valid token Not included. Not included. Not included. See Blocking See Blocking See Blocking requests that requests that requests that don't have a don't have a don't have a valid AWS WAF valid AWS WAF valid AWS WAF Blocks client sessions that send 5 requests without a token. token. token. Requires the AWS WAF token Required for all rules. Required for many rules. token. No Yes aws-waf-t oken See Using application See Using application integration SDKs integration SDKs with ACFP. with ATP. Acquires the AWS WAF token Yes, enforced by the rule aws-waf-t AllRequests oken No No Some rules use Challenge or CAPTCHA rule actions, which acquire tokens. For details about costs associated with these options, see the intelligent threat mitigation information at AWS WAF Pricing. Options for rate limiting in rate-based rules and targeted Bot Control rules This section compares rate-based mitigation options. The targeted level of the AWS WAF Bot Control rule group and the AWS WAF rate-based rule statement both provide web request rate limiting. The following table compares the two options. Mitigation options 365 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Comparison of options for rate-based detection and mitigation AWS WAF rate-based rule AWS WAF Bot Control targeted rules How rate limiting is applied Acts on groups of requests that are Enforces human-like access patterns and coming at too high a applies dynamic rate rate. You can apply limiting, through the any action except for use of request tokens. Allow. No Yes Based on historical traffic baselines? Time required to accumulate historic N/A traffic baselines Five minutes for dynamic thresholds. N/A for token abse nt. Mitigation lag Usually 30-50 seconds. Can be up to Usually less than 10 seconds. Can be up to several minutes. several minutes. Mitigation targets Traffic volume level required to trigger mitigations Configurable. You can group requests using a scope-dow n statement and by one or more aggre gation keys, such as IP address, HTTP method, and query string. Medium - can be as low as 10 requests IP addresses and client sessions Low - intended to detect client patterns such as slow scrapers Mitigation options 366 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide AWS WAF rate-based rule AWS WAF Bot Control targeted in the specified time window Yes |
waf-dg-123 | waf-dg.pdf | 123 | 10 seconds. Can be up to several minutes. several minutes. Mitigation targets Traffic volume level required to trigger mitigations Configurable. You can group requests using a scope-dow n statement and by one or more aggre gation keys, such as IP address, HTTP method, and query string. Medium - can be as low as 10 requests IP addresses and client sessions Low - intended to detect client patterns such as slow scrapers Mitigation options 366 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide AWS WAF rate-based rule AWS WAF Bot Control targeted in the specified time window Yes rules No Customizable thresholds Default mitigation action Console default is Block. No default The rule group rule action settings are setting in the API; the Challenge for token setting is required. You can set this to any rule action except Allow. absent and CAPTCHA for high volume traffic from a single client session. You can set either of these rules to any valid rule action. Resiliency against highly distributed Medium - 10,000 IP address maximum for Medium - limited to 50,000 total between attacks IP address limiting on IP addresses and its own tokens AWS WAF Pricing Included in the standard fees for AWS WAF. Included in the fees for the targeted level of Bot Control intelligent threat mitigation. For more informati on Using rate-based rule statements in AWS WAF AWS WAF Bot Control rule group Mitigation options 367 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Best practices for intelligent threat mitigation in AWS WAF Follow the best practices in this section for the most efficient, cost-effective implementation of the intelligent threat mitigation features. • Implement the JavaScript and mobile application integration SDKs – Implement application integration to enable the full set of ACFP, ATP, or Bot Control functionality in the most effective way possible. The managed rule groups use the tokens provided by the SDKs to separate legitimate client traffic from unwanted traffic at the session level. The application integration SDKs ensure that these tokens are always available. For details, see the following: • Using application integration SDKs with ACFP • Using application integration SDKs with ATP • Using application integration SDKs with Bot Control Use the integrations to implement challenges in your client and, for JavaScript, to customize how CAPTCHA puzzles are presented to your end users. For details, see Client application integrations in AWS WAF. If you customize CAPTCHA puzzles using the JavaScript API and you use the CAPTCHA rule action anywhere in your web ACL, follow the guidance for handling the AWS WAF CAPTCHA response in your client at Handling a CAPTCHA response from AWS WAF. This guidance applies to any rules that use the CAPTCHA action, including those in the ACFP managed rule group and the targeted protection level of the Bot Control managed rule group. • Limit the requests that you send to the ACFP, ATP, and Bot Control rule groups – You incur additional fees for using the intelligent threat mitigation AWS Managed Rules rule groups. The ACFP rule group inspects requests to the account registration and creation endpoints that you specify. The ATP rule group inspects requests to the login endpoint that you specify. The Bot Control rule group inspects every request that reaches it in the web ACL evaluation. Consider the following approaches to reduce your use of these rule groups: • Exclude requests from inspection with a scope-down statement in the managed rule group statement. You can do this with any nestable statement. For information, see Using scope- down statements in AWS WAF. • Exclude requests from inspection by adding rules before the rule group. For rules that you can't use in a scope-down statement and for more complex situations, such as labeling followed by label matching, you might want to add rules that run before the rule groups. For Best practices 368 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide information, see Using scope-down statements in AWS WAF and Using rule statements in AWS WAF. • Run the rule groups after less expensive rules. If you have other standard AWS WAF rules that block requests for any reason, run them before these paid rule groups. For more information about rules and rule management, see Using rule statements in AWS WAF. • If you're using more than one of the intelligent threat mitigation managed rule groups, run them in the following order to keep costs down: Bot Control, ATP, ACFP. For detailed pricing information, see AWS WAF Pricing. • Enable the targeted protection level of the Bot Control rule group during normal web traffic – Some rules of the targeted protection level need time to establish baselines for normal traffic patterns before they can recognize and respond to irregular or malicious traffic patterns. |
waf-dg-124 | waf-dg.pdf | 124 | paid rule groups. For more information about rules and rule management, see Using rule statements in AWS WAF. • If you're using more than one of the intelligent threat mitigation managed rule groups, run them in the following order to keep costs down: Bot Control, ATP, ACFP. For detailed pricing information, see AWS WAF Pricing. • Enable the targeted protection level of the Bot Control rule group during normal web traffic – Some rules of the targeted protection level need time to establish baselines for normal traffic patterns before they can recognize and respond to irregular or malicious traffic patterns. For example, the TGT_ML_* rules need up to 24 hours to warm up. Add these protections when you are not experiencing an attack and give them time to establish their baselines before expecting them to respond appropriately to attacks. If you add these rules during an attack, after the attack subsides, the time to establish a baseline is usually from double to triple the normal required time, because of the skewing added by the attack traffic. For additional information about the rules and any warm-up times that they require, see Rules listing. • For distributed denial of service (DDoS) protection, use Shield Advanced automatic application layer DDoS mitigation – The intelligent threat mitigation rule groups don't provide DDoS protection. ACFP protects against fraudulent account creation attempts to your application's sign-up page. ATP protects against account takeover attempts to your login page. Bot Control focuses on enforcing human-like access patterns using tokens and dynamic rate limiting on client sessions. When you use Shield Advanced with automatic application layer DDoS mitigation enabled, Shield Advanced automatically responds to detected DDoS attacks by creating, evaluating, and deploying custom AWS WAF mitigations on your behalf. For more information about Shield Advanced, see AWS Shield Advanced overview, and Protecting the application layer (layer 7) with AWS Shield Advanced and AWS WAF. • Tune and configure token handling – Adjust the web ACL's token handling for the best user experience. • To reduce operating costs and improve your end user's experience, tune your token management immunity times to the longest that your security requirements permit. This Best practices 369 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide keeps the use of CAPTCHA puzzles and silent challenges to a minimum. For information, see Setting timestamp expiration and token immunity times in AWS WAF. • To enable token sharing between protected applications, configure a token domain list for your web ACL. For information, see Specifying token domains and domain lists in AWS WAF. • Reject requests with arbitrary host specifications – Configure your protected resources to require that the Host headers in web requests match the targeted resource. You can accept one value or a specific set of values, for example myExampleHost.com and www.myExampleHost.com, but don’t accept arbitrary values for the host. • For Application Load Balancers that are origins for CloudFront distributions, configure CloudFront and AWS WAF for proper token handling – If you associate your web ACL to an Application Load Balancer and you deploy the Application Load Balancer as the origin for a CloudFront distribution, see Required configuration for Application Load Balancers that are CloudFront origins. • Test and tune before deploying – Before you implement any changes to your web ACL, follow the testing and tuning procedures in this guide to be sure that you're getting the behavior you expect. This is especially important for these paid features. For general guidance, see Testing and tuning your AWS WAF protections. For information specific to the paid managed rule groups, see Testing and deploying ACFP, Testing and deploying ATP, and Testing and deploying AWS WAF Bot Control. Token use in AWS WAF intelligent threat mitigation This section explains what AWS WAF tokens do. AWS WAF tokens are an integral part of the enhanced protections offered by AWS WAF intelligent threat mitigation. A token, sometimes called a fingerprint, is a collection of information about a single client session that the client stores and provides with every web request that it sends. AWS WAF uses tokens to identify and separate malicious client sessions from legitimate sessions, even when both originate from a single IP address. Token use imposes costs that are negligible for legitimate users, but expensive at scale for botnets. AWS WAF uses tokens to support its browser and end user challenge functionality, which is provided by the application integration SDKs and by the rule actions Challenge and CAPTCHA. Additionally, tokens enable features of the AWS WAF Bot Control and account takeover prevention managed rule groups. Tokens in intelligent threat mitigation 370 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide AWS WAF creates, updates, and encrypts tokens for clients that successfully respond to silent challenges and CAPTCHA puzzles. When a client with |
waf-dg-125 | waf-dg.pdf | 125 | use imposes costs that are negligible for legitimate users, but expensive at scale for botnets. AWS WAF uses tokens to support its browser and end user challenge functionality, which is provided by the application integration SDKs and by the rule actions Challenge and CAPTCHA. Additionally, tokens enable features of the AWS WAF Bot Control and account takeover prevention managed rule groups. Tokens in intelligent threat mitigation 370 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide AWS WAF creates, updates, and encrypts tokens for clients that successfully respond to silent challenges and CAPTCHA puzzles. When a client with a token sends a web request, it includes the encrypted token, and AWS WAF decrypts the token and verifies its contents. Topics • How AWS WAF uses tokens • AWS WAF token characteristics • Setting timestamp expiration and token immunity times in AWS WAF • Specifying token domains and domain lists in AWS WAF • Types of token labels in AWS WAF • Blocking requests that don't have a valid AWS WAF token • Required configuration for Application Load Balancers that are CloudFront origins How AWS WAF uses tokens This section explains how AWS WAF uses tokens. AWS WAF uses tokens to record and verify the following types of client session validation: • CAPTCHA – CAPTCHA puzzles help distinguish bots from human users. A CAPTCHA is run only by the CAPTCHA rule action. Upon successful completion of the puzzle, the CAPTCHA script updates the token's CAPTCHA timestamp. For more information, see CAPTCHA and Challenge in AWS WAF. • Challenge – Challenges run silently to help distinguish regular client sessions from bot sessions and to make it more costly for bots to operate. When the challenge completes successfully, the challenge script automatically procures a new token from AWS WAF if needed, and then updates the token's challenge timestamp. AWS WAF runs challenges in the following situations: • Application integration SDKs – The application integration SDKs run inside your client application sessions and help ensure that login attempts are only allowed after the client has successfully responded to a challenge. For more information, see Client application integrations in AWS WAF. • Challenge rule action – For more information, see CAPTCHA and Challenge in AWS WAF. • CAPTCHA – When a CAPTCHA interstitial runs, if the client doesn't have a token yet, the script automatically runs a challenge first, to verify the client session and to initialize the token. Tokens in intelligent threat mitigation 371 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Tokens are required by many of the rules in the intelligent threat AWS Managed Rules rule groups. The rules use tokens to do things like distinguish between clients at the session level, to determine browser characteristics, and to understand the level of human interactivity on the application web page. These rule groups invoke AWS WAF token management, which applies token labeling that the rule groups then inspect. • AWS WAF Fraud Control account creation fraud prevention (ACFP) – The ACFP rules require web requests with valid tokens. For more information about the rules, see AWS WAF Fraud Control account creation fraud prevention (ACFP) rule group. • AWS WAF Fraud Control account takeover prevention (ATP) – The ATP rules that prevent high volume and long lasting client sessions require web requests that have a valid token with an unexpired challenge timestamp. For more information, see AWS WAF Fraud Control account takeover prevention (ATP) rule group. • AWS WAF Bot Control – The targeted rules in this rule group place a limit on the number of web requests that a client can send without a valid token, and they use token session tracking for session-level monitoring and management. As needed, the rules apply the Challenge and CAPTCHA rule actions to enforce token acquisition and valid client behavior. For more information, see AWS WAF Bot Control rule group. AWS WAF token characteristics Each token has the following characteristics: • The token is stored in a cookie named aws-waf-token. • The token is encrypted. • The token fingerprints the client session with a sticky granular identifier that contains the following information: • The timestamp of the client's latest successful response to a silent challenge. • The timestamp of the end user's latest successful response to a CAPTCHA. This is only present if you use CAPTCHA in your protections. • Additional information about the client and client behavior that can help separate your legitimate clients from unwanted traffic. The information includes various client identifiers and client-side signals that can be used to detect automated activities. The information gathered is non-unique and can't be mapped to an individual human being. Tokens in intelligent threat mitigation 372 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide • All tokens include data from |
waf-dg-126 | waf-dg.pdf | 126 | a silent challenge. • The timestamp of the end user's latest successful response to a CAPTCHA. This is only present if you use CAPTCHA in your protections. • Additional information about the client and client behavior that can help separate your legitimate clients from unwanted traffic. The information includes various client identifiers and client-side signals that can be used to detect automated activities. The information gathered is non-unique and can't be mapped to an individual human being. Tokens in intelligent threat mitigation 372 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide • All tokens include data from client browser interrogation, such as indications of automation and browser setting inconsistencies. This information is retrieved by the scripts that are run by the Challenge action and by the client application SDKs. The scripts actively interrogate the browser and put the results into the token. • Additionally, when you implement a client application integration SDK, the token includes passively collected information about the end user's interactivity with the application page. Interactivity includes mouse movements, key presses, and interactions with any HTML form that's present on the page. This information helps AWS WAF detect the level of human interactivity in the client, to challenge users that do not seem to be human. For information about client side integrations, see Client application integrations in AWS WAF. For security reasons, AWS doesn't provide a complete description of the contents of AWS WAF tokens or detailed information about the token encryption process. Setting timestamp expiration and token immunity times in AWS WAF This section explains how challenge and CAPTCHA timestamps expire. AWS WAF uses challenge and CAPTCHA immunity times to control how frequently a single client session can be presented with a challenge or CAPTCHA. After an end user successfully responds to a CAPTCHA, the CAPTCHA immunity time determines how long the end user remains immune from being presented with another CAPTCHA. Similarly, the challenge immunity time determines how long a client session remains immune from being challenged again after successfully responding to a challenge. How AWS WAF token immunity times work AWS WAF records a successful response to a challenge or CAPTCHA by updating the corresponding timestamp inside the token. When AWS WAF inspects the token for challenge or CAPTCHA, it subtracts the timestamp from the current time. If the result is greater than the configured immunity time, the timestamp is expired. Configurable aspects of AWS WAF token immunity times You can configure the challenge and CAPTCHA immunity times in the web ACL and also in any rule that uses the CAPTCHA or Challenge rule action. • The default web ACL setting for both immunity times is 300 seconds. Tokens in intelligent threat mitigation 373 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide • You can specify the immunity time for any rule that uses the CAPTCHA or Challenge action. If you don't specify the immunity time for the rule, it inherits the setting from the web ACL. • For a rule inside a rule group that uses the CAPTCHA or Challenge action, if you don't specify the immunity time for the rule, it will inherit the setting from each web ACL where you use the rule group. • The application integration SDKs use the web ACL's challenge immunity time. • The minimum value for the challenge immunity time is 300 seconds. The minimum value for the CAPTCHA immunity time is 60 seconds. The maximum value for both immunity times is 259,200 seconds, or three days. You can use the web ACL and rule level immunity time settings to tune the CAPTCHA action, Challenge, or SDK challenge management behavior. For example, you might configure rules that control access to highly sensitive data with low immunity times, and then set higher immunity times in your web ACL for your other rules and the SDKs to inherit. In particular for CAPTCHA, solving a puzzle can degrade your customer's website experience, so tuning the CAPTCHA immunity time can help you mitigate the impact on customer experience while still providing the protections that you want. For additional information about tuning the immunity times for your use of the Challenge and CAPTCHA rule actions, see Best practices for using the CAPTCHA and Challenge actions. Where to set the AWS WAF token immunity times You can set the immunity times in your web ACL and in your rules that use the Challenge and CAPTCHA rule actions. For general information about managing a web ACL and its rules, see Viewing web traffic metrics in AWS WAF. Where to set the immunity time for a web ACL • Console – When you edit the web ACL, in the Rules tab, edit and change the settings in the Web ACL CAPTCHA configuration and Web ACL Challenge configuration panes. In |
waf-dg-127 | waf-dg.pdf | 127 | Best practices for using the CAPTCHA and Challenge actions. Where to set the AWS WAF token immunity times You can set the immunity times in your web ACL and in your rules that use the Challenge and CAPTCHA rule actions. For general information about managing a web ACL and its rules, see Viewing web traffic metrics in AWS WAF. Where to set the immunity time for a web ACL • Console – When you edit the web ACL, in the Rules tab, edit and change the settings in the Web ACL CAPTCHA configuration and Web ACL Challenge configuration panes. In the console, you can configure the web ACL CAPTCHA and challenge immunity times only after you've created the web ACL. Tokens in intelligent threat mitigation 374 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide • Outside of the console – The web ACL data type has CAPTCHA and challenge configuration parameters, which you can configure and provide to your create and update operations on the web ACL. Where to set the immunity time for a rule • Console – When you create or edit a rule and specify the CAPTCHA or Challenge action, you can modify the rule's immunity time setting. • Outside of the console – The rule data type has CAPTCHA and challenge configuration parameters, which you can configure when you define the rule. Specifying token domains and domain lists in AWS WAF This section explains how to configure the domains that AWS WAF uses in tokens and that it accepts in tokens. When AWS WAF creates a token for a client, it configures it with a token domain. When AWS WAF inspects a token in a web request, it rejects the token as invalid if its domain doesn't match any of the domains that are considered valid for the web ACL. By default, AWS WAF only accepts tokens whose domain setting exactly matches the host domain of the resource that's associated with the web ACL. This is the value of the Host header in the web request. In a browser, you can find this domain in the JavaScript window.location.hostname property and in the address that your user sees in their address bar. You can also specify acceptable token domains in your web ACL configuration, as described in the following section. In this case, AWS WAF accepts both exact matches with the host header and matches with domains in the token domain list. You can specify token domains for AWS WAF to use when setting the domain and when evaluating a token in a web ACL. The domains that you specify can't be public suffixes such as gov.au. For the domains that you can't use, see the list https://publicsuffix.org/list/public_suffix_list.dat under Public suffix list. AWS WAF web ACL token domain list configuration You can configure a web ACL to share tokens across multiple protected resources by providing a token domain list with the additional domains that you want AWS WAF to accept. With a token Tokens in intelligent threat mitigation 375 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide domain list, AWS WAF still accepts the resource's host domain. Additionally, it accepts all domains in the token domain list, including their prefixed subdomains. For example, a domain specification example.com in your token domain list matches example.com (from http://example.com/), api.example.com, (from http:// api.example.com/), and www.example.com (from http://www.example.com/). It doesn't match example.api.com, (from http://example.api.com/), or apiexample.com (from http://apiexample.com/). You can configure the token domain list in your web ACL when you create or edit it. For general information about managing a web ACL, see Viewing web traffic metrics in AWS WAF. AWS WAF token domain settings AWS WAF creates tokens at the request of the challenge scripts, which are run by the application integration SDKs and the Challenge and CAPTCHA rule actions. The domain that AWS WAF sets in a token is determined by the type of challenge script that's requesting it and any additional token domain configuration that you provide. AWS WAF sets the domain in the token to the shortest, most general setting that it can find in the configuration. • JavaScript SDK – You can configure the JavaScript SDK with a token domain specification, which can include one or more domains. The domains that you configure must be domains that AWS WAF will accept, based on the protected host domain and the web ACL's token domain list. When AWS WAF issues a token for the client, it sets the token domain to one that matches the host domain and is the shortest, from among the host domain and the domains in your configured list. For example, if the host domain is api.example.com and the token domain list has example.com, AWS WAF uses example.com in the token, because it matches the host domain |
waf-dg-128 | waf-dg.pdf | 128 | domain specification, which can include one or more domains. The domains that you configure must be domains that AWS WAF will accept, based on the protected host domain and the web ACL's token domain list. When AWS WAF issues a token for the client, it sets the token domain to one that matches the host domain and is the shortest, from among the host domain and the domains in your configured list. For example, if the host domain is api.example.com and the token domain list has example.com, AWS WAF uses example.com in the token, because it matches the host domain and is shorter. If you don't provide a token domain list in the JavaScript API configuration, AWS WAF sets the domain to the host domain of the protected resource. For more information, see Providing domains for use in the tokens. • Mobile SDK – In your application code, you must configure the mobile SDK with a token domain property. This property must be a domain that AWS WAF will accept, based on the protected host domain and the web ACL's token domain list. When AWS WAF issues a token for the client, it uses this property as the token domain. AWS WAF doesn't use the host domain in the tokens that it issues for the mobile SDK client. Tokens in intelligent threat mitigation 376 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide For more information, see the WAFConfiguration domainName setting at AWS WAF mobile SDK specification. • Challenge action – If you specify a token domain list in the web ACL, AWS WAF sets the token domain to one that matches the host domain and is the shortest, from among the host domain and the domains in the list. For example, if the host domain is api.example.com and the token domain list has example.com, AWS WAF uses example.com in the token, because it matches the host domain and is shorter. If you don't provide a token domain list in the web ACL, AWS WAF sets the domain to the host domain of the protected resource. Types of token labels in AWS WAF This section describes the labels that AWS WAF token management adds to web requests. For general information about labels, see Web request labeling in AWS WAF. When you use any of the AWS WAF bot or fraud control managed rule groups, the rule groups use AWS WAF token management to inspect the web request tokens and apply token labeling to the requests. For information about the managed rule groups, see AWS WAF Fraud Control account creation fraud prevention (ACFP) rule group, AWS WAF Fraud Control account takeover prevention (ATP) rule group, and AWS WAF Bot Control rule group . Note AWS WAF applies token labels only when you use one of these intelligent threat mitigation managed rule groups. Token management can add the following labels to web requests. Client session label The label awswaf:managed:token:id:identifier contains a unique identifier that AWS WAF token management uses to identify the client session. The identifier can change if the client acquires a new token, for example after discarding the token it was using. Note AWS WAF doesn't report Amazon CloudWatch metrics for this label. Tokens in intelligent threat mitigation 377 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Browser fingerprint label The label awswaf:managed:token:fingerprint:fingerprint-identifier contains a robust browser fingerprint identifier that AWS WAF token management computes from various client browser signals. This identifier stays the same across multiple token acquisition attempts. The fingerprint identifier is not unique to a single client. Note AWS WAF doesn't report Amazon CloudWatch metrics for this label. Token status labels: Label namespace prefixes Token status labels report on the status of the token and of the challenge and CAPTCHA information that it contains. Each token status label begins with one of the following namespace prefixes: • awswaf:managed:token: – Used to report the general status of the token and to report on the status of the token's challenge information. • awswaf:managed:captcha: – Used to report on the status of the token's CAPTCHA information. Token status labels: Label names Following the prefix, the rest of the label provides detailed token status information: • accepted – The request token is present and contains the following: • A valid challenge or CAPTCHA solution. • An unexpired challenge or CAPTCHA timestamp. • A domain specification that's valid for the web ACL. Example: The label awswaf:managed:token:accepted indicates that the web requests's token has a valid challenge solution, an unexpired challenge timestamp, and a valid domain. • rejected – The request token is present but doesn't meet the acceptance criteria. Along with the rejected label, token management adds a custom label namespace and name to indicate the reason. Tokens in intelligent threat mitigation 378 AWS WAF, AWS Firewall |
waf-dg-129 | waf-dg.pdf | 129 | accepted – The request token is present and contains the following: • A valid challenge or CAPTCHA solution. • An unexpired challenge or CAPTCHA timestamp. • A domain specification that's valid for the web ACL. Example: The label awswaf:managed:token:accepted indicates that the web requests's token has a valid challenge solution, an unexpired challenge timestamp, and a valid domain. • rejected – The request token is present but doesn't meet the acceptance criteria. Along with the rejected label, token management adds a custom label namespace and name to indicate the reason. Tokens in intelligent threat mitigation 378 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide • rejected:not_solved – The token is missing the challenge or CAPTCHA solution. • rejected:expired – The token's challenge or CAPTCHA timestamp has expired, according to your web ACL's configured token immunity times. • rejected:domain_mismatch – The token's domain isn't a match for your web ACL's token domain configuration. • rejected:invalid – AWS WAF couldn't read the indicated token. Example: The labels awswaf:managed:captcha:rejected and awswaf:managed:captcha:rejected:expired together indicate that the request didn't have a valid CAPTCHA solve because the CAPTCHA timestamp in the token has exceeded the CAPTCHA token immunity time that's configured in the web ACL. • absent – The request doesn't have the token or the token manager couldn't read it. Example: The label awswaf:managed:captcha:absent indicates that the request doesn't have the token. Blocking requests that don't have a valid AWS WAF token This section explains how to block login requests that are missing their tokens when using the AWS WAF mobile SDK. When you use the intelligent threat AWS Managed Rules rule groups AWSManagedRulesACFPRuleSet, AWSManagedRulesATPRuleSet, and AWSManagedRulesBotControlRuleSet, the rule groups invoke AWS WAF token management to evaluate the status of the web request token and to label the requests accordingly. Note Token labeling is only applied to web requests that you evaluate using one of these managed rule groups. For information about the labeling that token management applies, see the preceding section, Types of token labels in AWS WAF. The intelligent threat mitigation managed rule groups then handle token requirements as follows: Tokens in intelligent threat mitigation 379 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide • The AWSManagedRulesACFPRuleSet AllRequests rule is configured to run the Challenge action against all requests, effectively blocking any that don't have the accepted token label. • The AWSManagedRulesATPRuleSet blocks requests that have the rejected token label, but it doesn't block requests with the absent token label. • The AWSManagedRulesBotControlRuleSet targeted protection level challenges clients after they send five requests without an accepted token label. It doesn't block an individual request that doesn't have a valid token. The common protection level of the rule group doesn't manage token requirements. For additional details about the intelligent threat rule groups, see AWS WAF Fraud Control account creation fraud prevention (ACFP) rule group, AWS WAF Fraud Control account takeover prevention (ATP) rule group and AWS WAF Bot Control rule group. To block requests that are missing tokens when using the Bot Control or ATP managed rule group With the Bot Control and ATP rule groups, it's possible for a request without a valid token to exit the rule group evaluation and continue to be evaluated by the web ACL. To block all requests that are missing their token or whose token is rejected, add a rule to run immediately after the managed rule group to capture and block requests that the rule group doesn't handle for you. The following is an example JSON listing for a web ACL that uses the ATP managed rule group. The web ACL has an added rule to capture the awswaf:managed:token:absent label and handle it. The rule narrows its evaluation to web requests going to the login endpoint, to match the scope of the ATP rule group. The added rule is listed in bold. { "Name": "exampleWebACL", "Id": "55555555-6666-7777-8888-999999999999", "ARN": "arn:aws:wafv2:us-east-1:111111111111:regional/webacl/ exampleWebACL/55555555-4444-3333-2222-111111111111", "DefaultAction": { "Allow": {} }, "Description": "", "Rules": [ { "Name": "AWS-AWSManagedRulesATPRuleSet", Tokens in intelligent threat mitigation 380 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide "Priority": 1, "Statement": { "ManagedRuleGroupStatement": { "VendorName": "AWS", "Name": "AWSManagedRulesATPRuleSet", "ManagedRuleGroupConfigs": [ { "AWSManagedRulesATPRuleSet": { "LoginPath": "/web/login", "RequestInspection": { "PayloadType": "JSON", "UsernameField": { "Identifier": "/form/username" }, "PasswordField": { "Identifier": "/form/password" } }, "ResponseInspection": { "StatusCode": { "SuccessCodes": [ 200 ], "FailureCodes": [ 401, 403, 500 ] } } } } ] } }, "OverrideAction": { "None": {} }, "VisibilityConfig": { "SampledRequestsEnabled": true, "CloudWatchMetricsEnabled": true, "MetricName": "AWS-AWSManagedRulesATPRuleSet" } }, Tokens in intelligent threat mitigation 381 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide { "Name": "RequireTokenForLogins", "Priority": 2, "Statement": { "AndStatement": { "Statements": [ { "Statement": { "LabelMatchStatement": { "Scope": "LABEL", "Key": "awswaf:managed:token:absent" } } }, { "ByteMatchStatement": { "SearchString": "/web/login", "FieldToMatch": { "UriPath": {} }, "TextTransformations": [ { |
waf-dg-130 | waf-dg.pdf | 130 | "UsernameField": { "Identifier": "/form/username" }, "PasswordField": { "Identifier": "/form/password" } }, "ResponseInspection": { "StatusCode": { "SuccessCodes": [ 200 ], "FailureCodes": [ 401, 403, 500 ] } } } } ] } }, "OverrideAction": { "None": {} }, "VisibilityConfig": { "SampledRequestsEnabled": true, "CloudWatchMetricsEnabled": true, "MetricName": "AWS-AWSManagedRulesATPRuleSet" } }, Tokens in intelligent threat mitigation 381 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide { "Name": "RequireTokenForLogins", "Priority": 2, "Statement": { "AndStatement": { "Statements": [ { "Statement": { "LabelMatchStatement": { "Scope": "LABEL", "Key": "awswaf:managed:token:absent" } } }, { "ByteMatchStatement": { "SearchString": "/web/login", "FieldToMatch": { "UriPath": {} }, "TextTransformations": [ { "Priority": 0, "Type": "NONE" } ], "PositionalConstraint": "STARTS_WITH" } }, { "ByteMatchStatement": { "SearchString": "POST", "FieldToMatch": { "Method": {} }, "TextTransformations": [ { "Priority": 0, "Type": "NONE" } ], "PositionalConstraint": "EXACTLY" } } Tokens in intelligent threat mitigation 382 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide ] } }, "Action": { "Block": {} }, "VisibilityConfig": { "SampledRequestsEnabled": true, "CloudWatchMetricsEnabled": true, "MetricName": "RequireTokenForLogins" } } ], "VisibilityConfig": { "SampledRequestsEnabled": true, "CloudWatchMetricsEnabled": true, "MetricName": "exampleWebACL" }, "Capacity": 51, "ManagedByFirewallManager": false, "RetrofittedByFirewallManager": false, "LabelNamespace": "awswaf:111111111111:webacl:exampleWebACL:" } Required configuration for Application Load Balancers that are CloudFront origins Read this section if you associate your web ACL to an Application Load Balancer and you deploy the Application Load Balancer as the origin for a CloudFront distribution. With this architecture, you need to provide the following additional configuration in order for the token information to be handled correctly. • Configure CloudFront to forward the aws-waf-token cookie to the Application Load Balancer. By default, CloudFront removes cookies from the web request before forwarding it to the origin. To keep the token cookie with the web request, configure CloudFront cache behavior to include either just the token cookie or all cookies. For information about how to do this, see Caching content based on cookies in the Amazon CloudFront Developer Guide. • Configure AWS WAF so that it recognizes the domain of the CloudFront distribution as a valid token domain. By default, CloudFront sets the Host header to the Application Load Balancer origin, and AWS WAF uses that as the domain of the protected resource. The client browser, however, sees the CloudFront distribution as the host domain, and tokens that are generated for Tokens in intelligent threat mitigation 383 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide the client use the CloudFront domain as the token domain. Without any additional configuration, when AWS WAF checks the protected resource domain against the token domain, it will get a mismatch. To fix this, add the CloudFront distribution domain name to the token domain list in your web ACL configuration. For information about how to do this, see AWS WAF web ACL token domain list configuration. AWS WAF Fraud Control account creation fraud prevention (ACFP) This section explains what AWS WAF Fraud Control account creation fraud prevention (ACFP) does. Account creation fraud is an online illegal activity in which an attacker tries to create one or more fake accounts. Attackers use fake accounts for fraudulent activities such as abusing promotional and sign up bonuses, impersonating someone, and cyberattacks like phishing. The presence of fake accounts can negatively impact your business by damaging your reputation with customers and exposure to financial fraud. You can monitor and control account creation fraud attempts by implementing the ACFP feature. AWS WAF offers this feature in the AWS Managed Rules rule group AWSManagedRulesACFPRuleSet with companion application integration SDKs. The ACFP managed rule group labels and manages requests that might be part of malicious account creation attempts. The rule group does this by inspecting account creation attempts that clients send to your application's account sign-up endpoint. ACFP protects your account sign-up pages by monitoring account sign-up requests for anomalous activity and by automatically blocking suspicious requests. The rule group uses request identifiers, behavioral analysis, and machine learning to detect fraudulent requests. • Request inspection – ACFP gives you visibility and control over anomalous account creation attempts and attempts that use stolen credentials, to prevent the creation of fraudulent accounts. ACFP checks email and password combinations against its stolen credential database, which is updated regularly as new leaked credentials are found on the dark web. ACFP evaluates the domains used in email addresses, and monitors the use of phone numbers and address fields to verify the entries and to detects fraudulent behavior. ACFP aggregates data by IP address and client session, to detect and block clients that send too many requests of a suspicious nature. • Response inspection – For CloudFront distributions, in addition to inspecting incoming account creation requests, the ACFP rule group inspects your application's responses to account creation attempts, to track success and failure rates. Using this information, ACFP can temporarily block AWS WAF Fraud Control account creation fraud |
waf-dg-131 | waf-dg.pdf | 131 | the dark web. ACFP evaluates the domains used in email addresses, and monitors the use of phone numbers and address fields to verify the entries and to detects fraudulent behavior. ACFP aggregates data by IP address and client session, to detect and block clients that send too many requests of a suspicious nature. • Response inspection – For CloudFront distributions, in addition to inspecting incoming account creation requests, the ACFP rule group inspects your application's responses to account creation attempts, to track success and failure rates. Using this information, ACFP can temporarily block AWS WAF Fraud Control account creation fraud prevention (ACFP) 384 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide client sessions or IP addresses that have too many failed attempts. AWS WAF performs response inspection asynchronously, so this doesn't increase latency in your web traffic. Note You are charged additional fees when you use this managed rule group. For more information, see AWS WAF Pricing. Note The ACFP feature is not available for Amazon Cognito user pools. Topics • AWS WAF ACFP components • Using application integration SDKs with ACFP • Adding the ACFP managed rule group to your web ACL • Testing and deploying ACFP • AWS WAF Fraud Control account creation fraud prevention (ACFP) examples AWS WAF ACFP components The primary components of AWS WAF Fraud Control account creation fraud prevention (ACFP) are the following: • AWSManagedRulesACFPRuleSet – The rules in this AWS Managed Rules rule group detect, label, and handle various types of fraudulent account creation activity. The rule group inspects HTTP GET text/html requests that clients send to the specified account registration endpoint and POST web requests that clients send to the specified account sign-up endpoint. For protected CloudFront distributions, the rule group also inspects the responses that the distribution sends back to account creation requests. For a list of this rule group's rules, see AWS WAF Fraud Control account creation fraud prevention (ACFP) rule group. You include this rule group in your web ACL using a managed rule group reference statement. For information about using this rule group, see Adding the ACFP managed rule group to your web ACL. AWS WAF Fraud Control account creation fraud prevention (ACFP) 385 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Note You are charged additional fees when you use this managed rule group. For more information, see AWS WAF Pricing. • Details about your application's account registration and creation pages – You must provide information about your account registration and creation pages when you add the AWSManagedRulesACFPRuleSet rule group to your web ACL. This lets the rule group narrow the scope of the requests it inspects and properly validate account creation web requests. The registration page must accept GET text/html requests. The account creation path must accept POST requests. The ACFP rule group works with usernames that are in email format. For more information, see Adding the ACFP managed rule group to your web ACL. • For protected CloudFront distributions, details about how your application responds to account creation attempts – You provide details about your application's responses to account creation attempts, and the ACFP rule group tracks and manages bulk account creation attempts from a single IP address or single client session. For information about configuring this option, see Adding the ACFP managed rule group to your web ACL. • JavaScript and mobile application integration SDKs – Implement the AWS WAF JavaScript and mobile SDKs with your ACFP implementation to enable the full set of capabilities that the rule group offers. Many of the ACFP rules use the information provided by the SDKs for session level client verification and behavior aggregation, required to separate legitimate client traffic from bot traffic. For more information about the SDKs, see Client application integrations in AWS WAF. You can combine your ACFP implementation with the following to help you monitor, tune, and customize your protections. • Logging and metrics – You can monitor your traffic, and understand how the ACFP managed rule group affects it, by configuring and enabling logs, Amazon Security Lake data collection, and Amazon CloudWatch metrics for your web ACL. The labels that AWSManagedRulesACFPRuleSet adds to your web requests are included in the data. For information about the options, see Logging AWS WAF web ACL traffic, Monitoring with Amazon CloudWatch, and What is Amazon Security Lake?. Depending on your needs and the traffic that you see, you might want to customize your AWSManagedRulesACFPRuleSet implementation. For example, you might want to exclude some traffic from ACFP evaluation, or you might want to alter how it handles some of the AWS WAF Fraud Control account creation fraud prevention (ACFP) 386 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide account creation fraud attempts that it identifies, using AWS WAF features |
waf-dg-132 | waf-dg.pdf | 132 | included in the data. For information about the options, see Logging AWS WAF web ACL traffic, Monitoring with Amazon CloudWatch, and What is Amazon Security Lake?. Depending on your needs and the traffic that you see, you might want to customize your AWSManagedRulesACFPRuleSet implementation. For example, you might want to exclude some traffic from ACFP evaluation, or you might want to alter how it handles some of the AWS WAF Fraud Control account creation fraud prevention (ACFP) 386 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide account creation fraud attempts that it identifies, using AWS WAF features like scope-down statements or label matching rules. • Labels and label matching rules – For any of the rules in AWSManagedRulesACFPRuleSet, you can switch the blocking behavior to count, and then match against the labels that are added by the rules. Use this approach to customize how you handle web requests that are identified by the ACFP managed rule group. For more information about labeling and using label match statements, see Label match rule statement and Web request labeling in AWS WAF. • Custom requests and responses – You can add custom headers to the requests that you allow and you can send custom responses for requests that you block. To do this, you pair your label matching with the AWS WAF custom request and response features. For more information about customizing requests and responses, see Customized web requests and responses in AWS WAF. Using application integration SDKs with ACFP We highly recommend implementing the application integration SDKs, for the most efficient use of the ACFP rule group. • Complete rule group functionality – The ACFP rule SignalClientHumanInteractivityAbsentLow only works with tokens that are populated by the application integrations. This rule detects and manages abnormal human interactivity with the application page. The application integration SDKs can detect normal human interactivity through mouse movements, key presses, and other measurements. The interstitials that are sent by the rule actions CAPTCHA and Challenge can't provide this type of data. • Reduced latency – The rule group rule AllRequests applies the Challenge rule action to any request that doesn't already have a challenge token. When this happens, the request is evaluated by the rule group twice: once without the token, and then a second time after the token is acquired by means of the Challenge action interstitial. You aren't charged any added fees for only using the AllRequests rule, but this approach adds overhead to your web traffic and adds latency to your end user experience. If you acquire the token client-side using the application integrations, before sending the account creation request, the ACFP rule group evaluates the request once. For more information about the rule group capabilities see AWS WAF Fraud Control account creation fraud prevention (ACFP) rule group. AWS WAF Fraud Control account creation fraud prevention (ACFP) 387 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide For information about the SDKs, see Client application integrations in AWS WAF. For information about AWS WAF tokens, see Token use in AWS WAF intelligent threat mitigation. For information about the rule actions, see CAPTCHA and Challenge in AWS WAF. Adding the ACFP managed rule group to your web ACL This section explains how to add and configure the AWSManagedRulesACFPRuleSet rule group. To configure the ACFP managed rule group to recognize account creation fraud activities in your web traffic, you provide information about how clients access your registration page and send account creation requests to your application. For protected Amazon CloudFront distributions, you also provide information about how your application responds to account creation requests. This configuration is in addition to the normal configuration for a managed rule group. For the rule group description and rules listing, see AWS WAF Fraud Control account creation fraud prevention (ACFP) rule group. Note The ACFP stolen credentials database only contains usernames in email format. This guidance is intended for users who know generally how to create and manage AWS WAF web ACLs, rules, and rule groups. Those topics are covered in prior sections of this guide. For basic information about how to add a managed rule group to your web ACL, see Adding a managed rule group to a web ACL through the console. Follow best practices Use the ACFP rule group in accordance with the best practices at Best practices for intelligent threat mitigation in AWS WAF. To use the AWSManagedRulesACFPRuleSet rule group in your web ACL 1. Add the AWS managed rule group, AWSManagedRulesACFPRuleSet to your web ACL, and Edit the rule group settings before saving. AWS WAF Fraud Control account creation fraud prevention (ACFP) 388 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Note You are charged additional fees when you use this managed rule group. For more information, see |
waf-dg-133 | waf-dg.pdf | 133 | group to a web ACL through the console. Follow best practices Use the ACFP rule group in accordance with the best practices at Best practices for intelligent threat mitigation in AWS WAF. To use the AWSManagedRulesACFPRuleSet rule group in your web ACL 1. Add the AWS managed rule group, AWSManagedRulesACFPRuleSet to your web ACL, and Edit the rule group settings before saving. AWS WAF Fraud Control account creation fraud prevention (ACFP) 388 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Note You are charged additional fees when you use this managed rule group. For more information, see AWS WAF Pricing. 2. In the Rule group configuration pane, provide the information that the ACFP rule group uses to inspect account creation requests. a. For Use regular expression in paths, toggle this on if you want AWS WAF to perform regular expression matching for your registration and account creation page path specifications. AWS WAF supports the pattern syntax used by the PCRE library libpcre with some exceptions. The library is documented at PCRE - Perl Compatible Regular Expressions. For information about AWS WAF support, see Supported regular expression syntax in AWS WAF. b. For Registration page path, provide the path of the registration page endpoint for your application. This page must accept GET text/html requests. The rule group inspects only HTTP GET text/html requests to your specified registration page endpoint. Note Matching for endpoints is case insensitive. Regex specifications must not contain the flag (?-i), which disables case insensitive matching. String specifications must start with a forward slash /. For example, for the URL https://example.com/web/registration, you could provide the string path specification /web/registration. Registration page paths that start with the path that you provide are considered a match. For example / web/registration matches the registration paths /web/registration, /web/ registration/, /web/registrationPage, and /web/registration/thisPage, but doesn't match the path /home/web/registration or /website/registration. AWS WAF Fraud Control account creation fraud prevention (ACFP) 389 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Note Ensure that your end users load the registration page before they submit an account creation request. This helps ensure that the account creation requests from the client include valid tokens. c. For Account creation path, provide the URI in your website that accepts completed new user details. This URI must accept POST requests. Note Matching for endpoints is case insensitive. Regex specifications must not contain the flag (?-i), which disables case insensitive matching. String specifications must start with a forward slash /. For example, for the URL https://example.com/web/newaccount, you could provide the string path specification /web/newaccount. Account creation paths that start with the path that you provide are considered a match. For example /web/newaccount matches the account creation paths /web/newaccount, /web/newaccount/, /web/ newaccountPage, and /web/newaccount/thisPage, but doesn't match the path / home/web/newaccount or /website/newaccount. d. For Request inspection, specify how your application accepts account creation attempts by providing the request payload type and the names of the fields within the request body where the username, password, and other account creation details are provided. Note For the primary address and phone number fields, provide the fields in the order in which they appear in the request payload. Your specification of the field names depends on the payload type. • JSON payload type – Specify the field names in JSON pointer syntax. For information about the JSON Pointer syntax, see the Internet Engineering Task Force (IETF) documentation JavaScript Object Notation (JSON) Pointer. AWS WAF Fraud Control account creation fraud prevention (ACFP) 390 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide For example, for the following example JSON payload, the username field specification is /signupform/username and the primary address field specifications are / signupform/addrp1, /signupform/addrp2, and /signupform/addrp3. { "signupform": { "username": "THE_USERNAME", "password": "THE_PASSWORD", "addrp1": "PRIMARY_ADDRESS_LINE_1", "addrp2": "PRIMARY_ADDRESS_LINE_2", "addrp3": "PRIMARY_ADDRESS_LINE_3", "phonepcode": "PRIMARY_PHONE_CODE", "phonepnumber": "PRIMARY_PHONE_NUMBER" } } • FORM_ENCODED payload type – Use the HTML form names. For example, for an HTML form with user and password input elements named username1 and password1, the username field specification is username1 and the password field specification is password1. e. If you're protecting Amazon CloudFront distributions, then under Response inspection, specify how your application indicates success or failure in its responses to account creation attempts. Note ACFP response inspection is available only in web ACLs that protect CloudFront distributions. Specify a single component in the account creation response that you want ACFP to inspect. For the Body and JSON component types, AWS WAF can inspect the first 65,536 bytes (64 KB) of the component. Provide your inspection criteria for the component type, as indicated by the interface. You must provide both success and failure criteria to inspect for in the component. AWS WAF Fraud Control account creation fraud prevention (ACFP) 391 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer |
waf-dg-134 | waf-dg.pdf | 134 | to account creation attempts. Note ACFP response inspection is available only in web ACLs that protect CloudFront distributions. Specify a single component in the account creation response that you want ACFP to inspect. For the Body and JSON component types, AWS WAF can inspect the first 65,536 bytes (64 KB) of the component. Provide your inspection criteria for the component type, as indicated by the interface. You must provide both success and failure criteria to inspect for in the component. AWS WAF Fraud Control account creation fraud prevention (ACFP) 391 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide For example, say your application indicates the status of an account creation attempt in the status code of the response, and uses 200 OK for success and 401 Unauthorized or 403 Forbidden for failure. You would set the response inspection Component type to Status code, then in the Success text box enter 200 and in the Failure text box, enter 401 on the first line and 403 on the second. The ACFP rule group only counts responses that match your success or failure inspection criteria. The rule group rules act on clients while they have too high a success rate among the responses that are counted, in order to mitigate bulk account creation attempts. For accurate behavior by the rule group rules, be sure to provide complete information for both successful and failed account creation attempts. To see the rules that inspect account creation responses, look for VolumetricIPSuccessfulResponse and VolumetricSessionSuccessfulResponse in the rules listing at AWS WAF Fraud Control account creation fraud prevention (ACFP) rule group. 3. Provide any additional configuration that you want for the rule group. You can further limit the scope of requests that the rule group inspects by adding a scope- down statement to the managed rule group statement. For example, you can inspect only requests with a specific query argument or cookie. The rule group will only inspect requests that match the criteria in your scope-down statement and that are sent to the account registration and account creation paths that you specified in the rule group configuration. For information about scope-down statements, see Using scope-down statements in AWS WAF. 4. Save your changes to the web ACL. Before you deploy your ACFP implementation for production traffic, test and tune it in a staging or testing environment until you are comfortable with the potential impact to your traffic. Then test and tune the rules in count mode with your production traffic before enabling them. See the section that follows for guidance. Testing and deploying ACFP This section provides general guidance for configuring and testing an AWS WAF Fraud Control account creation fraud prevention (ACFP) implementation for your site. The specific steps that you choose to follow will depend on your needs, resources, and web requests that you receive. AWS WAF Fraud Control account creation fraud prevention (ACFP) 392 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide This information is in addition to the general information about testing and tuning provided at Testing and tuning your AWS WAF protections. Note AWS Managed Rules are designed to protect you from common web threats. When used in accordance with the documentation, AWS Managed Rules rule groups add another layer of security for your applications. However, AWS Managed Rules rule groups aren't intended as a replacement for your security responsibilities, which are determined by the AWS resources that you select. Refer to the Shared Responsibility Model to ensure that your resources in AWS are properly protected. Production traffic risk Before you deploy your ACFP implementation for production traffic, test and tune it in a staging or testing environment until you are comfortable with the potential impact to your traffic. Then test and tune the rules in count mode with your production traffic before enabling them. AWS WAF provides test credentials that you can use to verify your ACFP configuration. In the following procedure, you'll configure a test web ACL to use the ACFP managed rule group, configure a rule to capture the label added by the rule group, and then run an account creation attempt using these test credentials. You'll verify that your web ACL has properly managed the attempt by checking the Amazon CloudWatch metrics for the account creation attempt. This guidance is intended for users who know generally how to create and manage AWS WAF web ACLs, rules, and rule groups. Those topics are covered in prior sections of this guide. To configure and test an AWS WAF Fraud Control account creation fraud prevention (ACFP) implementation Perform these steps first in a test environment, then in production. AWS WAF Fraud Control account creation fraud prevention (ACFP) 393 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide 1. Add the AWS WAF Fraud |
waf-dg-135 | waf-dg.pdf | 135 | properly managed the attempt by checking the Amazon CloudWatch metrics for the account creation attempt. This guidance is intended for users who know generally how to create and manage AWS WAF web ACLs, rules, and rule groups. Those topics are covered in prior sections of this guide. To configure and test an AWS WAF Fraud Control account creation fraud prevention (ACFP) implementation Perform these steps first in a test environment, then in production. AWS WAF Fraud Control account creation fraud prevention (ACFP) 393 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide 1. Add the AWS WAF Fraud Control account creation fraud prevention (ACFP) managed rule group in count mode Note You are charged additional fees when you use this managed rule group. For more information, see AWS WAF Pricing. Add the AWS Managed Rules rule group AWSManagedRulesACFPRuleSet to a new or existing web ACL and configure it so that it doesn't alter the current web ACL behavior. For details about the rules and labels for this rule group, see AWS WAF Fraud Control account creation fraud prevention (ACFP) rule group. • When you add the managed rule group, edit it and do the following: • In the Rule group configuration pane, provide the details of your application's account registration and creation pages. The ACFP rule group uses this information to monitor sign-in activities. For more information, see Adding the ACFP managed rule group to your web ACL. • In the Rules pane, open the Override all rule actions dropdown and choose Count. With this configuration, AWS WAF evaluates requests against all of the rules in the rule group and only counts the matches that result, while still adding labels to requests. For more information, see Overriding rule actions in a rule group. With this override, you can monitor the potential impact of the ACFP managed rules to determine whether you want to add exceptions, such as exceptions for internal use cases. • Position the rule group so that it's evaluated after your existing rules in the web ACL, with a priority setting that's numerically higher than any rules or rule groups that you're already using. For more information, see Setting rule priority in a web ACL. This way, your current handling of traffic isn't disrupted. For example, if you have rules that detect malicious traffic such as SQL injection or cross-site scripting, they'll continue to detect and log that. Alternately, if you have rules that allow known non-malicious traffic, they can continue to allow that traffic, without having it blocked by the ACFP managed rule group. You might decide to adjust the processing order during your testing and tuning activities. AWS WAF Fraud Control account creation fraud prevention (ACFP) 394 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide 2. Implement the application integration SDKs Integrate the AWS WAF JavaScript SDK into your browser's account registration and account creation paths. AWS WAF also provides mobile SDKs to integrate iOS and Android devices. For more information about the integration SDKs, see Client application integrations in AWS WAF. For information about this recommendation, see Using application integration SDKs with ACFP. Note If you are unable to use the application integration SDKs, it's possible to test the ACFP rule group by editing it in your web ACL and removing the override that you placed on the AllRequests rule. This enables the rule's Challenge action setting, to ensure that requests include a valid challenge token. Do this first in a test environment and then with great care in your production environment. This approach has the potential to block users. For example, if your registration page path doesn't accept GET text/html requests, then this rule configuration can effectively block all requests at the registration page. 3. Enable logging and metrics for the web ACL As needed, configure logging, Amazon Security Lake data collection, request sampling, and Amazon CloudWatch metrics for the web ACL. You can use these visibility tools to monitor the interaction of the ACFP managed rule group with your traffic. • For information about logging, see Logging AWS WAF web ACL traffic. • For information about Amazon Security Lake, see What is Amazon Security Lake? and Collecting data from AWS services in the Amazon Security Lake user guide. • For information about Amazon CloudWatch metrics, see Monitoring with Amazon CloudWatch. • For information about web request sampling, see Viewing a sample of web requests. 4. Associate the web ACL with a resource If the web ACL isn't already associated with a test resource, associate it. For information, see Associating or disassociating a web ACL with an AWS resource. AWS WAF Fraud Control account creation fraud prevention (ACFP) 395 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide 5. Monitor traffic and ACFP rule matches Make sure |
waf-dg-136 | waf-dg.pdf | 136 | from AWS services in the Amazon Security Lake user guide. • For information about Amazon CloudWatch metrics, see Monitoring with Amazon CloudWatch. • For information about web request sampling, see Viewing a sample of web requests. 4. Associate the web ACL with a resource If the web ACL isn't already associated with a test resource, associate it. For information, see Associating or disassociating a web ACL with an AWS resource. AWS WAF Fraud Control account creation fraud prevention (ACFP) 395 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide 5. Monitor traffic and ACFP rule matches Make sure that your normal traffic is flowing and that the ACFP managed rule group rules are adding labels to matching web requests. You can see the labels in the logs and see the ACFP and label metrics in the Amazon CloudWatch metrics. In the logs, the rules that you've overridden to count in the rule group show up in the ruleGroupList with action set to count, and with overriddenAction indicating the configured rule action that you overrode. 6. Test the rule group's credential checking capabilities Perform an account creation attempt with test compromised credentials and check that the rule group matches against them as expected. a. Access your protected resource's account registration page and try to add a new account. Use the following AWS WAF test credential pair and enter any test • User: [email protected] • Password: WAF_TEST_CREDENTIAL_PASSWORD These test credentials are categorized as compromised credentials, and the ACFP managed rule group will add the awswaf:managed:aws:acfp:signal:credential_compromised label to the account creation request, which you can see in the logs. b. In your web ACL logs, look for the awswaf:managed:aws:acfp:signal:credential_compromised label in the labels field on the log entries for your test account creation request. For information about logging, see Logging AWS WAF web ACL traffic. After you've verified that the rule group captures compromised credentials as expected, you can take steps to configure its implementation as you need for your protected resource. 7. For CloudFront distributions, test the rule group's management of bulk account creation attempts Run this test for each success response criteria that you configured for the ACFP rule group. Wait at least 30 minutes between tests. a. For each of your success criteria, identify an account creation attempt that will succeed with that success criteria in the response. Then, from a single client session, perform at AWS WAF Fraud Control account creation fraud prevention (ACFP) 396 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide least 5 successful account creation attempts in under 30 minutes. A user would normally only create a single account on your site. After the first successful account creation, the VolumetricSessionSuccessfulResponse rule should start matching against the rest of your account creation responses, labeling them and counting them, based on your rule action override. The rule might miss the first one or two due to latency. b. In your web ACL logs, look for the awswaf:managed:aws:acfp:aggregate:volumetric:session:successful_creation_response:high label in the labels field on the log entries for your test account creation web requests. For information about logging, see Logging AWS WAF web ACL traffic. These tests verify that your success criteria match your responses by checking that the successful counts aggregated by the rule surpass the rule's threshold. After you've reached the threshold, if you continue to send account creation requests from the same session, the rule will continue to match until the success rate drops below the threshold. While the threshold is exceeded, the rule matches both successful or failed account creation attempts from the session address. 8. Customize ACFP web request handling As needed, add your own rules that explicitly allow or block requests, to change how ACFP rules would otherwise handle them. For example, you can use ACFP labels to allow or block requests or to customize request handling. You can add a label match rule after the ACFP managed rule group to filter labeled requests for the handling that you want to apply. After testing, keep the related ACFP rules in count mode, and maintain the request handling decisions in your custom rule. For an example, see ACFP example: Custom response for compromised credentials. 9. Remove your test rules and enable the ACFP managed rule group settings Depending on your situation, you might have decided that you want to leave some ACFP rules in count mode. For the rules that you want to run as configured inside the rule group, disable count mode in the web ACL rule group configuration. When you're finished testing, you can also remove your test label match rules. AWS WAF Fraud Control account creation fraud prevention (ACFP) 397 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide 10. Monitor and tune To be sure that web requests are being handled as you |
waf-dg-137 | waf-dg.pdf | 137 | and enable the ACFP managed rule group settings Depending on your situation, you might have decided that you want to leave some ACFP rules in count mode. For the rules that you want to run as configured inside the rule group, disable count mode in the web ACL rule group configuration. When you're finished testing, you can also remove your test label match rules. AWS WAF Fraud Control account creation fraud prevention (ACFP) 397 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide 10. Monitor and tune To be sure that web requests are being handled as you want, closely monitor your traffic after you enable the ACFP functionality that you intend to use. Adjust the behavior as needed with the rules count override on the rule group and with your own rules. After you finish testing your ACFP rule group implementation, if you haven't already integrated the AWS WAF JavaScript SDK into your browser's account registration and account creation pages, we strongly recommend that you do so. AWS WAF also provides mobile SDKs to integrate iOS and Android devices. For more information about the integration SDKs, see Client application integrations in AWS WAF. For information about this recommendation, see Using application integration SDKs with ACFP. AWS WAF Fraud Control account creation fraud prevention (ACFP) examples This section shows example configurations that satisfy common use cases for the AWS WAF Fraud Control account creation fraud prevention (ACFP) implementations. Each example provides a description of the use case and then shows the solution in JSON listings for the custom configured rules. Note You can retrieve JSON listings like the ones shown in these examples through the console web ACL JSON download or rule JSON editor, or through the getWebACL operation in the APIs and the command line interface. Topics • ACFP example: Simple configuration • ACFP example: Custom response for compromised credentials • ACFP example: Response inspection configuration ACFP example: Simple configuration The following JSON listing shows an example web ACL with an AWS WAF Fraud Control account creation fraud prevention (ACFP) managed rule group. Note the additional CreationPath and AWS WAF Fraud Control account creation fraud prevention (ACFP) 398 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide RegistrationPagePath configurations, along with the payload type and the information needed to locate new account information in the payload, in order to verify it. The rule group uses this information to monitor and manage your account creation requests. This JSON includes the web ACL's automatically generated settings, like the label namespace and the web ACL's application integration URL. { "Name": "simpleACFP", "Id": "... ", "ARN": "arn:aws:wafv2:us-east-1:111122223333:regional/webacl/simpleACFP/... ", "DefaultAction": { "Allow": {} }, "Description": "", "Rules": [ { "Name": "AWS-AWSManagedRulesACFPRuleSet", "Priority": 0, "Statement": { "ManagedRuleGroupStatement": { "VendorName": "AWS", "Name": "AWSManagedRulesACFPRuleSet", "ManagedRuleGroupConfigs": [ { "AWSManagedRulesACFPRuleSet": { "CreationPath": "/web/signup/submit-registration", "RegistrationPagePath": "/web/signup/registration", "RequestInspection": { "PayloadType": "JSON", "UsernameField": { "Identifier": "/form/username" }, "PasswordField": { "Identifier": "/form/password" }, "EmailField": { "Identifier": "/form/email" }, "PhoneNumberFields": [ { "Identifier": "/form/country-code" }, { AWS WAF Fraud Control account creation fraud prevention (ACFP) 399 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide "Identifier": "/form/region-code" }, { "Identifier": "/form/phonenumber" } ], "AddressFields": [ { "Identifier": "/form/name" }, { "Identifier": "/form/street-address" }, { "Identifier": "/form/city" }, { "Identifier": "/form/state" }, { "Identifier": "/form/zipcode" } ] }, "EnableRegexInPath": false } } ] } }, "OverrideAction": { "None": {} }, "VisibilityConfig": { "SampledRequestsEnabled": true, "CloudWatchMetricsEnabled": true, "MetricName": "AWS-AWSManagedRulesACFPRuleSet" } } ], "VisibilityConfig": { "SampledRequestsEnabled": true, "CloudWatchMetricsEnabled": true, "MetricName": "simpleACFP" AWS WAF Fraud Control account creation fraud prevention (ACFP) 400 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide }, "Capacity": 50, "ManagedByFirewallManager": false, "RetrofittedByFirewallManager": false, "LabelNamespace": "awswaf:111122223333:webacl:simpleACFP:" } ACFP example: Custom response for compromised credentials By default, the credentials check that's performed by the rule group AWSManagedRulesACFPRuleSet handles compromised credentials by labeling the request and blocking it. For details about the rule group and rule behavior, see AWS WAF Fraud Control account creation fraud prevention (ACFP) rule group. To inform the user that the account credentials they've provided have been compromised, you can do the following: • Override the SignalCredentialCompromised rule to Count – This causes the rule to only count and label matching requests. • Add a label match rule with custom handling – Configure this rule to match against the ACFP label and to perform your custom handling. The following web ACL listings shows the ACFP managed rule group from the prior example, with the SignalCredentialCompromised rule action overridden to count. With this configuration, when this rule group evaluates any web request that uses compromised credentials, it will label the request, but not block it. In addition, the web ACL now has a custom response named aws-waf-credential- compromised and a new rule named AccountSignupCompromisedCredentialsHandling. The rule priority is a higher numeric setting than the rule |
waf-dg-138 | waf-dg.pdf | 138 | a label match rule with custom handling – Configure this rule to match against the ACFP label and to perform your custom handling. The following web ACL listings shows the ACFP managed rule group from the prior example, with the SignalCredentialCompromised rule action overridden to count. With this configuration, when this rule group evaluates any web request that uses compromised credentials, it will label the request, but not block it. In addition, the web ACL now has a custom response named aws-waf-credential- compromised and a new rule named AccountSignupCompromisedCredentialsHandling. The rule priority is a higher numeric setting than the rule group, so it runs after the rule group in the web ACL evaluation. The new rule matches any request with the rule group's compromised credentials label. When the rule finds a match, it applies the Block action to the request with the custom response body. The custom response body provides information to the end user that their credentials have been compromised and proposes an action to take. { "Name": "compromisedCreds", "Id": "... ", "ARN": "arn:aws:wafv2:us-east-1:111122223333:regional/webacl/compromisedCreds/...", "DefaultAction": { AWS WAF Fraud Control account creation fraud prevention (ACFP) 401 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide "Allow": {} }, "Description": "", "Rules": [ { "Name": "AWS-AWSManagedRulesACFPRuleSet", "Priority": 0, "Statement": { "ManagedRuleGroupStatement": { "VendorName": "AWS", "Name": "AWSManagedRulesACFPRuleSet", "ManagedRuleGroupConfigs": [ { "AWSManagedRulesACFPRuleSet": { "CreationPath": "/web/signup/submit-registration", "RegistrationPagePath": "/web/signup/registration", "RequestInspection": { "PayloadType": "JSON", "UsernameField": { "Identifier": "/form/username" }, "PasswordField": { "Identifier": "/form/password" }, "EmailField": { "Identifier": "/form/email" }, "PhoneNumberFields": [ { "Identifier": "/form/country-code" }, { "Identifier": "/form/region-code" }, { "Identifier": "/form/phonenumber" } ], "AddressFields": [ { "Identifier": "/form/name" }, { "Identifier": "/form/street-address" AWS WAF Fraud Control account creation fraud prevention (ACFP) 402 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide }, { "Identifier": "/form/city" }, { "Identifier": "/form/state" }, { "Identifier": "/form/zipcode" } ] }, "EnableRegexInPath": false } } ], "RuleActionOverrides": [ { "Name": "SignalCredentialCompromised", "ActionToUse": { "Count": {} } } ] } }, "OverrideAction": { "None": {} }, "VisibilityConfig": { "SampledRequestsEnabled": true, "CloudWatchMetricsEnabled": true, "MetricName": "AWS-AWSManagedRulesACFPRuleSet" } }, { "Name": "AccountSignupCompromisedCredentialsHandling", "Priority": 1, "Statement": { "LabelMatchStatement": { "Scope": "LABEL", "Key": "awswaf:managed:aws:acfp:signal:credential_compromised" } }, AWS WAF Fraud Control account creation fraud prevention (ACFP) 403 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide "Action": { "Block": { "CustomResponse": { "ResponseCode": 406, "CustomResponseBodyKey": "aws-waf-credential-compromised", "ResponseHeaders": [ { "Name": "aws-waf-credential-compromised", "Value": "true" } ] } } }, "VisibilityConfig": { "SampledRequestsEnabled": true, "CloudWatchMetricsEnabled": true, "MetricName": "AccountSignupCompromisedCredentialsHandling" } } ], "VisibilityConfig": { "SampledRequestsEnabled": true, "CloudWatchMetricsEnabled": true, "MetricName": "compromisedCreds" }, "Capacity": 51, "ManagedByFirewallManager": false, "RetrofittedByFirewallManager": false, "LabelNamespace": "awswaf:111122223333:webacl:compromisedCreds:", "CustomResponseBodies": { "aws-waf-credential-compromised": { "ContentType": "APPLICATION_JSON", "Content": "{\n \"credentials-compromised\": \"The credentials you provided have been found in a compromised credentials database.\\n\\nTry again with a different username, password pair.\"\n}" } } } AWS WAF Fraud Control account creation fraud prevention (ACFP) 404 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide ACFP example: Response inspection configuration The following JSON listing shows an example web ACL with an AWS WAF Fraud Control account creation fraud prevention (ACFP) managed rule group that is configured to inspect origin responses. Note the response inspection configuration, which specifies success and response status codes. You can also configure success and response settings based on header, body, and body JSON matches. This JSON includes the web ACL's automatically generated settings, like the label namespace and the web ACL's application integration URL. Note ATP response inspection is available only in web ACLs that protect CloudFront distributions. { "Name": "simpleACFP", "Id": "... ", "ARN": "arn:aws:wafv2:us-east-1:111122223333:regional/webacl/simpleACFP/... ", "DefaultAction": { "Allow": {} }, "Description": "", "Rules": [ { "Name": "AWS-AWSManagedRulesACFPRuleSet", "Priority": 0, "Statement": { "ManagedRuleGroupStatement": { "VendorName": "AWS", "Name": "AWSManagedRulesACFPRuleSet", "ManagedRuleGroupConfigs": [ { "AWSManagedRulesACFPRuleSet": { "CreationPath": "/web/signup/submit-registration", "RegistrationPagePath": "/web/signup/registration", "RequestInspection": { "PayloadType": "JSON", "UsernameField": { "Identifier": "/form/username" }, "PasswordField": { "Identifier": "/form/password" AWS WAF Fraud Control account creation fraud prevention (ACFP) 405 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide }, "EmailField": { "Identifier": "/form/email" }, "PhoneNumberFields": [ { "Identifier": "/form/country-code" }, { "Identifier": "/form/region-code" }, { "Identifier": "/form/phonenumber" } ], "AddressFields": [ { "Identifier": "/form/name" }, { "Identifier": "/form/street-address" }, { "Identifier": "/form/city" }, { "Identifier": "/form/state" }, { "Identifier": "/form/zipcode" } ] }, "ResponseInspection": { "StatusCode": { "SuccessCodes": [ 200 ], "FailureCodes": [ 401 ] } }, "EnableRegexInPath": false AWS WAF Fraud Control account creation fraud prevention (ACFP) 406 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide } } ] } }, "OverrideAction": { "None": {} }, "VisibilityConfig": { "SampledRequestsEnabled": true, "CloudWatchMetricsEnabled": true, "MetricName": "AWS-AWSManagedRulesACFPRuleSet" } } ], "VisibilityConfig": { "SampledRequestsEnabled": true, "CloudWatchMetricsEnabled": true, "MetricName": "simpleACFP" }, "Capacity": 50, "ManagedByFirewallManager": false, "RetrofittedByFirewallManager": false, "LabelNamespace": "awswaf:111122223333:webacl:simpleACFP:" } AWS WAF Fraud Control account takeover prevention (ATP) This section explains what AWS WAF Fraud Control account takeover prevention (ATP) does. Account takeover is an online illegal activity in which |
waf-dg-139 | waf-dg.pdf | 139 | 200 ], "FailureCodes": [ 401 ] } }, "EnableRegexInPath": false AWS WAF Fraud Control account creation fraud prevention (ACFP) 406 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide } } ] } }, "OverrideAction": { "None": {} }, "VisibilityConfig": { "SampledRequestsEnabled": true, "CloudWatchMetricsEnabled": true, "MetricName": "AWS-AWSManagedRulesACFPRuleSet" } } ], "VisibilityConfig": { "SampledRequestsEnabled": true, "CloudWatchMetricsEnabled": true, "MetricName": "simpleACFP" }, "Capacity": 50, "ManagedByFirewallManager": false, "RetrofittedByFirewallManager": false, "LabelNamespace": "awswaf:111122223333:webacl:simpleACFP:" } AWS WAF Fraud Control account takeover prevention (ATP) This section explains what AWS WAF Fraud Control account takeover prevention (ATP) does. Account takeover is an online illegal activity in which an attacker gains unauthorized access to a person's account. The attacker might do this in a number of ways, such as using stolen credentials or guessing the victim's password through a series of attempts. When the attacker gains access, they might steal money, information, or services from the victim. The attacker might pose as the victim to gain access to other accounts that the victim owns, or to gain access to the accounts of other people or organizations. Additionally, they might attempt to change the user's password in order to block the victim from their own accounts. You can monitor and control account takeover attempts by implementing the ATP feature. AWS WAF offers this feature in the AWS Managed Rules rule group AWSManagedRulesATPRuleSet and companion application integration SDKs. AWS WAF Fraud Control account takeover prevention (ATP) 407 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide The ATP managed rule group labels and manages requests that might be part of malicious account takeover attempts. The rule group does this by inspecting login attempts that clients send to your application's login endpoint. • Request inspection – ATP gives you visibility and control over anomalous login attempts and login attempts that use stolen credentials, to prevent account takeovers that might lead to fraudulent activity. ATP checks email and password combinations against its stolen credential database, which is updated regularly as new leaked credentials are found on the dark web. ATP aggregates data by IP address and client session, to detect and block clients that send too many requests of a suspicious nature. • Response inspection – For CloudFront distributions, in addition to inspecting incoming login requests, the ATP rule group inspects your application's responses to login attempts, to track success and failure rates. Using this information, ATP can temporarily block client sessions or IP addresses that have too many login failures. AWS WAF performs response inspection asynchronously, so this doesn't increase latency in your web traffic. Note You are charged additional fees when you use this managed rule group. For more information, see AWS WAF Pricing. Note The ATP feature is not available for Amazon Cognito user pools. Topics • AWS WAF ATP components • Using application integration SDKs with ATP • Adding the ATP managed rule group to your web ACL • Testing and deploying ATP • AWS WAF Fraud Control account takeover prevention (ATP) examples AWS WAF Fraud Control account takeover prevention (ATP) 408 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide AWS WAF ATP components The primary components of AWS WAF Fraud Control account takeover prevention (ATP) are the following: • AWSManagedRulesATPRuleSet – The rules in this AWS Managed Rules rule group detect, label, and handle various types of account takeover activity. The rule group inspects HTTP POST web requests that clients send to the specified login endpoint. For protected CloudFront distributions, the rule group also inspects the responses that the distribution sends back to these requests. For a list of the rule group's rules, see AWS WAF Fraud Control account takeover prevention (ATP) rule group. You include this rule group in your web ACL using a managed rule group reference statement. For information about using this rule group, see Adding the ATP managed rule group to your web ACL. Note You are charged additional fees when you use this managed rule group. For more information, see AWS WAF Pricing. • Details about your application's login page – You must provide information about your login page when you add the AWSManagedRulesATPRuleSet rule group to your web ACL. This lets the rule group narrow the scope of the requests it inspects and properly validate credentials usage in web requests. The ATP rule group works with usernames that are in email format. For more information, see Adding the ATP managed rule group to your web ACL. • For protected CloudFront distributions, details about how your application responds to login attempts – You provide details about your application's responses to login attempts, and the rule group tracks and manages clients that are sending too many failed login attempts. For information about configuring this option, see Adding the ATP managed rule group to your web ACL. • JavaScript |
waf-dg-140 | waf-dg.pdf | 140 | scope of the requests it inspects and properly validate credentials usage in web requests. The ATP rule group works with usernames that are in email format. For more information, see Adding the ATP managed rule group to your web ACL. • For protected CloudFront distributions, details about how your application responds to login attempts – You provide details about your application's responses to login attempts, and the rule group tracks and manages clients that are sending too many failed login attempts. For information about configuring this option, see Adding the ATP managed rule group to your web ACL. • JavaScript and mobile application integration SDKs – Implement the AWS WAF JavaScript and mobile SDKs with your ATP implementation to enable the full set of capabilities that the rule group offers. Many of the ATP rules use the information provided by the SDKs for session level client verification and behavior aggregation, required to separate legitimate client traffic from bot traffic. For more information about the SDKs, see Client application integrations in AWS WAF. You can combine your ATP implementation with the following to help you monitor, tune, and customize your protections. AWS WAF Fraud Control account takeover prevention (ATP) 409 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide • Logging and metrics – You can monitor your traffic, and understand how the ACFP managed rule group affects it, by configuring and enabling logs, Amazon Security Lake data collection, and Amazon CloudWatch metrics for your web ACL. The labels that AWSManagedRulesATPRuleSet adds to your web requests are included in the data. For information about the options, see Logging AWS WAF web ACL traffic, Monitoring with Amazon CloudWatch, and What is Amazon Security Lake?. Depending on your needs and the traffic that you see, you might want to customize your AWSManagedRulesATPRuleSet implementation. For example, you might want to exclude some traffic from ATP evaluation, or you might want to alter how it handles some of the account takeover attempts that it identifies, using AWS WAF features like scope-down statements or label matching rules. • Labels and label matching rules – For any of the rules in AWSManagedRulesATPRuleSet, you can switch the blocking behavior to count, and then match against the labels that are added by the rules. Use this approach to customize how you handle web requests that are identified by the ATP managed rule group. For more information about labeling and using label match statements, see Label match rule statement and Web request labeling in AWS WAF. • Custom requests and responses – You can add custom headers to the requests that you allow and you can send custom responses for requests that you block. To do this, you pair your label matching with the AWS WAF custom request and response features. For more information about customizing requests and responses, see Customized web requests and responses in AWS WAF. Using application integration SDKs with ATP This section explains how to use application integration SDKs with ATP. The ATP managed rule group requires the challenge tokens that the application integration SDKs generate. The tokens enable the full set of protections that the rule group offers. We highly recommend implementing the application integration SDKs, for the most effective use of the ATP rule group. The challenge script must run before the ATP rule group in order for the rule group to benefit from the tokens that the script acquires. This happens automatically with the application integration SDKs. If you are unable to use the SDKs, you can alternately configure your web ACL so that it runs the Challenge or CAPTCHA rule action against all requests that will be inspected by the ATP rule group. Using the Challenge or CAPTCHA rule action can incur additional fees. For pricing details, see AWS WAF Pricing. Capabilities of the ATP rule group that don't require a token AWS WAF Fraud Control account takeover prevention (ATP) 410 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide When web requests don't have a token, the ATP managed rule group is capable of blocking the following types of traffic: • Single IP addresses that make a lot of login requests. • Single IP addresses that make a lot of failed login requests in a short amount of time. • Login attempts with password traversal, using the same username but changing passwords. Capabilities of the ATP rule group that require a token The information provided in the challenge token expands the capabilities of the rule group and of your overall client application security. The token provides client information with each web request that enables the ATP rule group to separate legitimate client sessions from ill-behaved client sessions, even when both originate from a single IP address. The rule group uses information in the tokens to aggregate client |
waf-dg-141 | waf-dg.pdf | 141 | a lot of failed login requests in a short amount of time. • Login attempts with password traversal, using the same username but changing passwords. Capabilities of the ATP rule group that require a token The information provided in the challenge token expands the capabilities of the rule group and of your overall client application security. The token provides client information with each web request that enables the ATP rule group to separate legitimate client sessions from ill-behaved client sessions, even when both originate from a single IP address. The rule group uses information in the tokens to aggregate client session request behavior for fine-tuned detection and mitigation. When the token is available in web requests, the ATP rule group can detect and block the following additional categories of clients at the session level: • Client sessions that fail the silent challenge that the SDKs manage. • Client sessions that traverse usernames or passwords. This is also known as credential stuffing. • Client sessions that repeatedly use stolen credentials to log in. • Client sessions that spend a long time trying to log in. • Clients sessions that make a lot of login requests. The ATP rule group provides better client isolation than the AWS WAF rate-based rule, which can block clients by IP address. The ATP rule group also uses a lower threshold. • Clients sessions that make a lot of failed login requests in a short amount of time. This functionality is available for protected Amazon CloudFront distributions. For more information about the rule group capabilities see AWS WAF Fraud Control account takeover prevention (ATP) rule group. For information about the SDKs, see Client application integrations in AWS WAF. For information about AWS WAF tokens, see Token use in AWS WAF intelligent threat mitigation. For information about the rule actions, see CAPTCHA and Challenge in AWS WAF. AWS WAF Fraud Control account takeover prevention (ATP) 411 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Adding the ATP managed rule group to your web ACL This section explains how to add and configure the AWSManagedRulesATPRuleSet rule group. To configure the ATP managed rule group to recognize account takeover activities in your web traffic, you provide information about how clients send login requests to your application. For protected Amazon CloudFront distributions, you also provide information about how your application responds to login requests. This configuration is in addition to the normal configuration for a managed rule group. For the rule group description and rules listing, see AWS WAF Fraud Control account takeover prevention (ATP) rule group. Note The ATP stolen credentials database only contains usernames in email format. This guidance is intended for users who know generally how to create and manage AWS WAF web ACLs, rules, and rule groups. Those topics are covered in prior sections of this guide. For basic information about how to add a managed rule group to your web ACL, see Adding a managed rule group to a web ACL through the console. Follow best practices Use the ATP rule group in accordance with the best practices at Best practices for intelligent threat mitigation in AWS WAF. To use the AWSManagedRulesATPRuleSet rule group in your web ACL 1. Add the AWS managed rule group, AWSManagedRulesATPRuleSet to your web ACL, and Edit the rule group settings before saving. Note You are charged additional fees when you use this managed rule group. For more information, see AWS WAF Pricing. 2. In the Rule group configuration pane, provide the information that the ATP rule group uses to inspect login requests. AWS WAF Fraud Control account takeover prevention (ATP) 412 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide a. For Use regular expression in paths, toggle this on if you want AWS WAF to perform regular expression matching for your login page path specifications. AWS WAF supports the pattern syntax used by the PCRE library libpcre with some exceptions. The library is documented at PCRE - Perl Compatible Regular Expressions. For information about AWS WAF support, see Supported regular expression syntax in AWS WAF. b. For Login path, provide the path of the login endpoint for your application. The rule group inspects only HTTP POST requests to your specified login endpoint. Note Matching for endpoints is case insensitive. Regex specifications must not contain the flag (?-i), which disables case insensitive matching. String specifications must start with a forward slash /. For example, for the URL https://example.com/web/login, you could provide the string path specification /web/login. Login paths that start with the path that you provide are considered a match. For example /web/login matches the login paths /web/ login, /web/login/, /web/loginPage, and /web/login/thisPage, but doesn't match the login path /home/web/login or /website/login. c. For Request inspection, specify how your application accepts login attempts by providing |
waf-dg-142 | waf-dg.pdf | 142 | HTTP POST requests to your specified login endpoint. Note Matching for endpoints is case insensitive. Regex specifications must not contain the flag (?-i), which disables case insensitive matching. String specifications must start with a forward slash /. For example, for the URL https://example.com/web/login, you could provide the string path specification /web/login. Login paths that start with the path that you provide are considered a match. For example /web/login matches the login paths /web/ login, /web/login/, /web/loginPage, and /web/login/thisPage, but doesn't match the login path /home/web/login or /website/login. c. For Request inspection, specify how your application accepts login attempts by providing the request payload type and the names of the fields within the request body where the username and password are provided. Your specification of the field names depends on the payload type. • JSON payload type – Specify the field names in JSON pointer syntax. For information about the JSON Pointer syntax, see the Internet Engineering Task Force (IETF) documentation JavaScript Object Notation (JSON) Pointer. For example, for the following example JSON payload, the username field specification is /login/username and the password field specification is /login/password. { "login": { "username": "THE_USERNAME", AWS WAF Fraud Control account takeover prevention (ATP) 413 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide "password": "THE_PASSWORD" } } • FORM_ENCODED payload type – Use the HTML form names. For example, for an HTML form with input elements named username1 and password1, the username field specification is username1 and the password field specification is password1. d. If you're protecting Amazon CloudFront distributions, then under Response inspection, specify how your application indicates success or failure in its responses to login attempts. Note ATP response inspection is available only in web ACLs that protect CloudFront distributions. Specify a single component in the login response that you want ATP to inspect. For the Body and JSON component types, AWS WAF can inspect the first 65,536 bytes (64 KB) of the component. Provide your inspection criteria for the component type, as indicated by the interface. You must provide both success and failure criteria to inspect for in the component. For example, say your application indicates the status of a login attempt in the status code of the response, and uses 200 OK for success and 401 Unauthorized or 403 Forbidden for failure. You would set the response inspection Component type to Status code, then in the Success text box enter 200 and in the Failure text box, enter 401 on the first line and 403 on the second. The ATP rule group only counts responses that match your success or failure inspection criteria. The rule group rules act on clients while they have too high a failure rate among the responses that are counted. For accurate behavior by the rule group rules, be sure to provide complete information for both successful and failed login attempts. To see the rules that inspect login responses, look for VolumetricIpFailedLoginResponseHigh and AWS WAF Fraud Control account takeover prevention (ATP) 414 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide VolumetricSessionFailedLoginResponseHigh in the rules listing at AWS WAF Fraud Control account takeover prevention (ATP) rule group. 3. Provide any additional configuration that you want for the rule group. You can further limit the scope of requests that the rule group inspects by adding a scope- down statement to the managed rule group statement. For example, you can inspect only requests with a specific query argument or cookie. The rule group will inspect only HTTP POST requests to your specified login endpoint that match the criteria in your scope-down statement. For information about scope-down statements, see Using scope-down statements in AWS WAF. 4. Save your changes to the web ACL. Before you deploy your ATP implementation for production traffic, test and tune it in a staging or testing environment until you are comfortable with the potential impact to your traffic. Then test and tune the rules in count mode with your production traffic before enabling them. See the section that follows for guidance. Testing and deploying ATP This section provides general guidance for configuring and testing an AWS WAF Fraud Control account takeover prevention (ATP) implementation for your site. The specific steps that you choose to follow will depend on your needs, resources, and web requests that you receive. This information is in addition to the general information about testing and tuning provided at Testing and tuning your AWS WAF protections. Note AWS Managed Rules are designed to protect you from common web threats. When used in accordance with the documentation, AWS Managed Rules rule groups add another layer of security for your applications. However, AWS Managed Rules rule groups aren't intended as a replacement for your security responsibilities, which are determined by the AWS resources that you select. Refer to the |
waf-dg-143 | waf-dg.pdf | 143 | that you choose to follow will depend on your needs, resources, and web requests that you receive. This information is in addition to the general information about testing and tuning provided at Testing and tuning your AWS WAF protections. Note AWS Managed Rules are designed to protect you from common web threats. When used in accordance with the documentation, AWS Managed Rules rule groups add another layer of security for your applications. However, AWS Managed Rules rule groups aren't intended as a replacement for your security responsibilities, which are determined by the AWS resources that you select. Refer to the Shared Responsibility Model to ensure that your resources in AWS are properly protected. AWS WAF Fraud Control account takeover prevention (ATP) 415 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Production traffic risk Before you deploy your ATP implementation for production traffic, test and tune it in a staging or testing environment until you are comfortable with the potential impact to your traffic. Then test and tune the rules in count mode with your production traffic before enabling them. AWS WAF provides test credentials that you can use to verify your ATP configuration. In the following procedure, you'll configure a test web ACL to use the ATP managed rule group, configure a rule to capture the label added by the rule group, and then run a login attempt using these test credentials. You'll verify that your web ACL has properly managed the attempt by checking the Amazon CloudWatch metrics for the login attempt. This guidance is intended for users who know generally how to create and manage AWS WAF web ACLs, rules, and rule groups. Those topics are covered in prior sections of this guide. To configure and test an AWS WAF Fraud Control account takeover prevention (ATP) implementation Perform these steps first in a test environment, then in production. 1. Add the AWS WAF Fraud Control account takeover prevention (ATP) managed rule group in count mode Note You are charged additional fees when you use this managed rule group. For more information, see AWS WAF Pricing. Add the AWS Managed Rules rule group AWSManagedRulesATPRuleSet to a new or existing web ACL and configure it so that it doesn't alter the current web ACL behavior. For details about the rules and labels for this rule group, see AWS WAF Fraud Control account takeover prevention (ATP) rule group. • When you add the managed rule group, edit it and do the following: AWS WAF Fraud Control account takeover prevention (ATP) 416 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide • In the Rule group configuration pane, provide the details of your application's login page. The ATP rule group uses this information to monitor sign-in activities. For more information, see Adding the ATP managed rule group to your web ACL. • In the Rules pane, open the Override all rule actions dropdown and choose Count. With this configuration, AWS WAF evaluates requests against all of the rules in the rule group and only counts the matches that result, while still adding labels to requests. For more information, see Overriding rule actions in a rule group. With this override, you can monitor the potential impact of the ATP managed rules to determine whether you want to add exceptions, such as exceptions for internal use cases. • Position the rule group so that it's evaluated after your existing rules in the web ACL, with a priority setting that's numerically higher than any rules or rule groups that you're already using. For more information, see Setting rule priority in a web ACL. This way, your current handling of traffic isn't disrupted. For example, if you have rules that detect malicious traffic such as SQL injection or cross-site scripting, they'll continue to detect and log that. Alternately, if you have rules that allow known non-malicious traffic, they can continue to allow that traffic, without having it blocked by the ATP managed rule group. You might decide to adjust the processing order during your testing and tuning activities. 2. Enable logging and metrics for the web ACL As needed, configure logging, Amazon Security Lake data collection, request sampling, and Amazon CloudWatch metrics for the web ACL. You can use these visibility tools to monitor the interaction of the ATP managed rule group with your traffic. • For information about configuring and using logging, see Logging AWS WAF web ACL traffic. • For information about Amazon Security Lake, see What is Amazon Security Lake? and Collecting data from AWS services in the Amazon Security Lake user guide. • For information about Amazon CloudWatch metrics, see Monitoring with Amazon CloudWatch. • For information about web request sampling, see Viewing a sample of web requests. 3. Associate the web ACL with a resource If |
waf-dg-144 | waf-dg.pdf | 144 | metrics for the web ACL. You can use these visibility tools to monitor the interaction of the ATP managed rule group with your traffic. • For information about configuring and using logging, see Logging AWS WAF web ACL traffic. • For information about Amazon Security Lake, see What is Amazon Security Lake? and Collecting data from AWS services in the Amazon Security Lake user guide. • For information about Amazon CloudWatch metrics, see Monitoring with Amazon CloudWatch. • For information about web request sampling, see Viewing a sample of web requests. 3. Associate the web ACL with a resource If the web ACL isn't already associated with a test resource, associate it. For information, see Associating or disassociating a web ACL with an AWS resource. AWS WAF Fraud Control account takeover prevention (ATP) 417 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide 4. Monitor traffic and ATP rule matches Make sure that your normal traffic is flowing and that the ATP managed rule group rules are adding labels to matching web requests. You can see the labels in the logs and see the ATP and label metrics in the Amazon CloudWatch metrics. In the logs, the rules that you've overridden to count in the rule group show up in the ruleGroupList with action set to count, and with overriddenAction indicating the configured rule action that you overrode. 5. Test the rule group's credential checking capabilities Perform a login attempt with test compromised credentials and check that the rule group matches against them as expected. a. Log in to your protected resource's login page using the following AWS WAF test credential pair: • User: [email protected] • Password: WAF_TEST_CREDENTIAL_PASSWORD These test credentials are categorized as compromised credentials, and the ATP managed rule group will add the awswaf:managed:aws:atp:signal:credential_compromised label to the login request, which you can see in the logs. b. In your web ACL logs, look for the awswaf:managed:aws:atp:signal:credential_compromised label in the labels field on the log entries for your test login web requests. For information about logging, see Logging AWS WAF web ACL traffic. After you've verified that the rule group captures compromised credentials as expected, you can take steps to configure its implementation as you need for your protected resource. 6. For CloudFront distributions, test the rule group's login failure management a. Run a test for each failure response criteria that you configured for the ATP rule group. Wait at least 10 minutes between tests. AWS WAF Fraud Control account takeover prevention (ATP) 418 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide To test a single failure criteria, identify a login attempt that will fail with that criteria in the response. Then, from a single client IP address, perform at least 10 failed login attempts in under 10 minutes. After the first 6 failures, the volumetric failed login rule should start matching against the rest of your attempts, labeling and counting them. The rule might miss the first one or two due to latency. b. In your web ACL logs, look for the awswaf:managed:aws:atp:aggregate:volumetric:ip:failed_login_response:high label in the labels field on the log entries for your test login web requests. For information about logging, see Logging AWS WAF web ACL traffic. These tests verify that your failure criteria match your responses by checking that the failed login counts surpass the thresholds for the rule VolumetricIpFailedLoginResponseHigh. After you've reached the thresholds, if you continue to send login requests from the same IP address, the rule will continue to match until the failure rate drops below the threshold. While the thresholds are exceeded, the rule matches both successful or failed logins from the IP address. 7. Customize ATP web request handling As needed, add your own rules that explicitly allow or block requests, to change how ATP rules would otherwise handle them. For example, you can use ATP labels to allow or block requests or to customize request handling. You can add a label match rule after the ATP managed rule group to filter labeled requests for the handling that you want to apply. After testing, keep the related ATP rules in count mode, and maintain the request handling decisions in your custom rule. For an example, see ATP example: Custom handling for missing and compromised credentials. 8. Remove your test rules and enable the ATP managed rule group settings Depending on your situation, you might have decided that you want to leave some ATP rules in count mode. For the rules that you want to run as configured inside the rule group, disable count mode in the web ACL rule group configuration. When you're finished testing, you can also remove your test label match rules. AWS WAF Fraud Control account takeover prevention (ATP) 419 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide 9. |
waf-dg-145 | waf-dg.pdf | 145 | see ATP example: Custom handling for missing and compromised credentials. 8. Remove your test rules and enable the ATP managed rule group settings Depending on your situation, you might have decided that you want to leave some ATP rules in count mode. For the rules that you want to run as configured inside the rule group, disable count mode in the web ACL rule group configuration. When you're finished testing, you can also remove your test label match rules. AWS WAF Fraud Control account takeover prevention (ATP) 419 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide 9. Monitor and tune To be sure that web requests are being handled as you want, closely monitor your traffic after you enable the ATP functionality that you intend to use. Adjust the behavior as needed with the rules count override on the rule group and with your own rules. After you finish testing your ATP rule group implementation, if you haven't already done so, we strongly recommend that you integrate the AWS WAF JavaScript SDK into your browser login page, for enhanced detection capabilities. AWS WAF also provides mobile SDKs to integrate iOS and Android devices. For more information about the integration SDKs, see Client application integrations in AWS WAF. For information about this recommendation, see Using application integration SDKs with ATP. AWS WAF Fraud Control account takeover prevention (ATP) examples This section shows example configurations that satisfy common use cases for the AWS WAF Fraud Control account takeover prevention (ATP) implementations. Each example provides a description of the use case and then shows the solution in JSON listings for the custom configured rules. Note You can retrieve JSON listings like the ones shown in these examples through the console web ACL JSON download or rule JSON editor, or through the getWebACL operation in the APIs and the command line interface. Topics • ATP example: Simple configuration • ATP example: Custom handling for missing and compromised credentials • ATP example: Response inspection configuration ATP example: Simple configuration The following JSON listing shows an example web ACL with an AWS WAF Fraud Control account takeover prevention (ATP) managed rule group. Note the additional sign-in page configuration, AWS WAF Fraud Control account takeover prevention (ATP) 420 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide which gives the rule group the information it needs to monitor and manage your login requests. This JSON includes the web ACL's automatically generated settings, like the label namespace and the web ACL's application integration URL. { "WebACL": { "LabelNamespace": "awswaf:111122223333:webacl:ATPModuleACL:", "Capacity": 50, "Description": "This is a test web ACL for ATP.", "Rules": [ { "Priority": 1, "OverrideAction": { "None": {} }, "VisibilityConfig": { "SampledRequestsEnabled": true, "CloudWatchMetricsEnabled": true, "MetricName": "AccountTakeOverValidationRule" }, "Name": "DetectCompromisedUserCredentials", "Statement": { "ManagedRuleGroupStatement": { "VendorName": "AWS", "Name": "AWSManagedRulesATPRuleSet", "ManagedRuleGroupConfigs": [ { "AWSManagedRulesATPRuleSet": { "LoginPath": "/web/login", "RequestInspection": { "PayloadType": "JSON", "UsernameField": { "Identifier": "/form/username" }, "PasswordField": { "Identifier": "/form/password" } }, "EnableRegexInPath": false } } ] AWS WAF Fraud Control account takeover prevention (ATP) 421 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide } } } ], "VisibilityConfig": { "SampledRequestsEnabled": true, "CloudWatchMetricsEnabled": true, "MetricName": "ATPValidationAcl" }, "DefaultAction": { "Allow": {} }, "ManagedByFirewallManager": false, "RetrofittedByFirewallManager": false, "Id": "32q10987-65rs-4tuv-3210-98765wxyz432", "ARN": "arn:aws:wafv2:us-east-1:111122223333:regional/webacl/ ATPModuleACL/32q10987-65rs-4tuv-3210-98765wxyz432", "Name": "ATPModuleACL" }, "ApplicationIntegrationURL": "https://9z87abce34ea.us- east-1.sdk.awswaf.com/9z87abce34ea/1234567a1b10/", "LockToken": "6d0e6966-95c9-48b6-b51d-8e82e523b847" } ATP example: Custom handling for missing and compromised credentials By default, the credentials checks that are performed by the rule group AWSManagedRulesATPRuleSet handle web requests as follows: • Missing credentials – Label and block request. • Compromised credentials – Label request but don't block or count it. For details about the rule group and rule behavior, see AWS WAF Fraud Control account takeover prevention (ATP) rule group. You can add custom handling for web requests that have missing or compromised credentials by doing the following: • Override the MissingCredential rule to Count – This rule action override causes the rule to only count and label matching requests. AWS WAF Fraud Control account takeover prevention (ATP) 422 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide • Add a label match rule with custom handling – Configure this rule to match against both of the ATP labels and to perform your custom handling. For example, you might redirect the customer to your sign-up page. The following rule shows the ATP managed rule group from the prior example, with the MissingCredential rule action overridden to count. This causes the rule to apply its label to matching requests, and then only count the requests, instead of blocking them. "Rules": [ { "Priority": 1, "OverrideAction": { "None": {} }, "VisibilityConfig": { "SampledRequestsEnabled": true, "CloudWatchMetricsEnabled": true, "MetricName": "AccountTakeOverValidationRule" }, "Name": "DetectCompromisedUserCredentials", "Statement": { "ManagedRuleGroupStatement": { "ManagedRuleGroupConfigs": [ { "AWSManagedRulesATPRuleSet": { "LoginPath": "/web/login", "RequestInspection": { "PayloadType": "JSON", "UsernameField": { "Identifier": "/form/username" }, "PasswordField": { "Identifier": |
waf-dg-146 | waf-dg.pdf | 146 | your custom handling. For example, you might redirect the customer to your sign-up page. The following rule shows the ATP managed rule group from the prior example, with the MissingCredential rule action overridden to count. This causes the rule to apply its label to matching requests, and then only count the requests, instead of blocking them. "Rules": [ { "Priority": 1, "OverrideAction": { "None": {} }, "VisibilityConfig": { "SampledRequestsEnabled": true, "CloudWatchMetricsEnabled": true, "MetricName": "AccountTakeOverValidationRule" }, "Name": "DetectCompromisedUserCredentials", "Statement": { "ManagedRuleGroupStatement": { "ManagedRuleGroupConfigs": [ { "AWSManagedRulesATPRuleSet": { "LoginPath": "/web/login", "RequestInspection": { "PayloadType": "JSON", "UsernameField": { "Identifier": "/form/username" }, "PasswordField": { "Identifier": "/form/password" } }, "EnableRegexInPath": false } } ] "VendorName": "AWS", "Name": "AWSManagedRulesATPRuleSet", "RuleActionOverrides": [ AWS WAF Fraud Control account takeover prevention (ATP) 423 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide { "ActionToUse": { "Count": {} }, "Name": "MissingCredential" } ], "ExcludedRules": [] } } } ], With this configuration, when this rule group evaluates any web request that has missing or compromised credentials, it will label the request, but not block it. The following rule has a priority setting that is higher numerically than the preceding rule group. AWS WAF evaluates rules in numeric order, starting from the lowest, so this rule will be evaluated after the rule group evaluation. The rule is configured to match either of the credentials labels and to send a custom response for matching requests. "Name": "redirectToSignup", "Priority": 10, "Statement": { "OrStatement": { "Statements": [ { "LabelMatchStatement": { "Scope": "LABEL", "Key": "awswaf:managed:aws:atp:signal:missing_credential" } }, { "LabelMatchStatement": { "Scope": "LABEL", "Key": "awswaf:managed:aws:atp:signal:credential_compromised" } } ] } }, "Action": { "Block": { AWS WAF Fraud Control account takeover prevention (ATP) 424 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide "CustomResponse": { your custom response settings } } }, "VisibilityConfig": { "SampledRequestsEnabled": true, "CloudWatchMetricsEnabled": true, "MetricName": "redirectToSignup" } ATP example: Response inspection configuration The following JSON listing shows an example web ACL with an AWS WAF Fraud Control account takeover prevention (ATP) managed rule group that is configured to inspect origin responses. Note the response inspection configuration, which specifies success and response status codes. You can also configure success and response settings based on header, body, and body JSON matches. This JSON includes the web ACL's automatically generated settings, like the label namespace and the web ACL's application integration URL. Note ATP response inspection is available only in web ACLs that protect CloudFront distributions. { "WebACL": { "LabelNamespace": "awswaf:111122223333:webacl:ATPModuleACL:", "Capacity": 50, "Description": "This is a test web ACL for ATP.", "Rules": [ { "Priority": 1, "OverrideAction": { "None": {} }, "VisibilityConfig": { "SampledRequestsEnabled": true, "CloudWatchMetricsEnabled": true, "MetricName": "AccountTakeOverValidationRule" }, AWS WAF Fraud Control account takeover prevention (ATP) 425 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide "Name": "DetectCompromisedUserCredentials", "Statement": { "ManagedRuleGroupStatement": { "VendorName": "AWS", "Name": "AWSManagedRulesATPRuleSet", "ManagedRuleGroupConfigs": [ { "AWSManagedRulesATPRuleSet": { "LoginPath": "/web/login", "RequestInspection": { "PayloadType": "JSON", "UsernameField": { "Identifier": "/form/username" }, "PasswordField": { "Identifier": "/form/password" } }, "ResponseInspection": { "StatusCode": { "SuccessCodes": [ 200 ], "FailureCodes": [ 401 ] } }, "EnableRegexInPath": false } } ] } } } ], "VisibilityConfig": { "SampledRequestsEnabled": true, "CloudWatchMetricsEnabled": true, "MetricName": "ATPValidationAcl" }, "DefaultAction": { "Allow": {} }, AWS WAF Fraud Control account takeover prevention (ATP) 426 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide "ManagedByFirewallManager": false, "RetrofittedByFirewallManager": false, "Id": "32q10987-65rs-4tuv-3210-98765wxyz432", "ARN": "arn:aws:wafv2:us-east-1:111122223333:regional/webacl/ ATPModuleACL/32q10987-65rs-4tuv-3210-98765wxyz432", "Name": "ATPModuleACL" }, "ApplicationIntegrationURL": "https://9z87abce34ea.us- east-1.sdk.awswaf.com/9z87abce34ea/1234567a1b10/", "LockToken": "6d0e6966-95c9-48b6-b51d-8e82e523b847" } AWS WAF Bot Control This section explains what Bot Control does. With Bot Control, you can easily monitor, block, or rate limit bots such as scrapers, scanners, crawlers, status monitors, and search engines. If you use the targeted inspection level of the rule group, you can also challenge bots that don't self identify, making it harder and more expensive for malicious bots to operate against your website. You can protect your applications using the Bot Control managed rule group alone, or in combination with other AWS Managed Rules rule groups and your own custom AWS WAF rules. Bot Control includes a console dashboard that shows how much of your current traffic is coming from bots, based on request sampling. With the Bot Control managed rule group added to your web ACL, you can take action against bot traffic and receive detailed, real-time information about common bot traffic coming to your applications. Note You are charged additional fees when you use this managed rule group. For more information, see AWS WAF Pricing. The Bot Control managed rule group provides a basic, common protection level that adds labels to self-identifying bots, verifies generally desirable bots, and detects high confidence bot signatures. This gives you the ability to monitor and control common categories of bot traffic. The Bot Control rule group also provides a targeted protection level that adds detection for sophisticated bots that don't self identify. Targeted |
waf-dg-147 | waf-dg.pdf | 147 | against bot traffic and receive detailed, real-time information about common bot traffic coming to your applications. Note You are charged additional fees when you use this managed rule group. For more information, see AWS WAF Pricing. The Bot Control managed rule group provides a basic, common protection level that adds labels to self-identifying bots, verifies generally desirable bots, and detects high confidence bot signatures. This gives you the ability to monitor and control common categories of bot traffic. The Bot Control rule group also provides a targeted protection level that adds detection for sophisticated bots that don't self identify. Targeted protections use detection techniques such AWS WAF Bot Control 427 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide as browser interrogation, fingerprinting, and behavior heuristics to identify bad bot traffic. Additionally, targeted protections provide optional automated, machine-learning analysis of website traffic statistics to detect bot-related activity. When you enable machine learning, AWS WAF uses statistics about website traffic, such as timestamps, browser characteristics, and previous URL visited, to improve the Bot Control machine learning model. For more information about the Bot Control managed rule group, see AWS WAF Bot Control rule group. When AWS WAF evaluates a web request against the Bot Control managed rule group, the rule group adds labels to requests that it detects as bot related, for example the category of bot and the bot name. You can match against these labels in your own AWS WAF rules to customize handling. The labels that are generated by the Bot Control managed rule group are included in Amazon CloudWatch metrics and your web ACL logs. You can also use AWS Firewall Manager AWS WAF policies to deploy the Bot Control managed rule group across your applications in multiple accounts that are part of your organization in AWS Organizations. AWS WAF Bot Control components The main components of a Bot Control implementation are the following: • AWSManagedRulesBotControlRuleSet – The Bot Control managed rule group whose rules detect and handle various categories of bots. This rule group add labels to web requests that it detects as bot traffic. Note You are charged additional fees when you use this managed rule group. For more information, see AWS WAF Pricing. The Bot Control managed rule group provides two levels of protection that you can choose from: • Common – Detects a variety of self-identifying bots, such as web scraping frameworks, search engines, and automated browsers. Bot Control protections at this level identify common bots using traditional bot detection techniques, such as static request data analysis. The rules label traffic from these bots and block the ones that they cannot verify. AWS WAF Bot Control 428 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide • Targeted – Includes the common-level protections and adds targeted detection for sophisticated bots that do not self identify. Targeted protections mitigate bot activity using a combination of rate limiting and CAPTCHA and background browser challenges. • TGT_ – Rules that provide targeted protection have names that begin with TGT_. All targeted protections use detection techniques such as browser interrogation, fingerprinting, and behavior heuristics to identify bad bot traffic. • TGT_ML_ – Targeted protection rules that use machine learning have names that begin with TGT_ML_. These rules use automated, machine-learning analysis of website traffic statistics to detect anomalous behavior indicative of distributed, coordinated bot activity. AWS WAF analyzes statistics about your website traffic such as timestamps, browser characteristics, and previous URL visited, to improve the Bot Control machine learning model. Machine learning capabilities are enabled by default, but you can disable them in your rule group configuration. When machine learning is disabled, AWS WAF does not evaluate these rules. For details including information about the rule group's rules, see AWS WAF Bot Control rule group. You include this rule group in your web ACL using a managed rule group reference statement and indicating the inspection level that you want to use. For the targeted level, you also indicate whether to enable machine learning. For more information about adding this managed rule group to your web ACL, see Adding the AWS WAF Bot Control managed rule group to your web ACL. • Bot Control dashboard – The bot monitoring dashboard for your web ACL, available through the web ACL Bot Control tab. Use this dashboard to monitor your traffic and understand how much of it comes from various types of bots. This can be a starting point for customizing your bot management, as described in this topic. You can also use it to verify your changes and monitor activity for various bots and bot categories. • JavaScript and mobile application integration SDKs – You should implement the AWS WAF JavaScript and mobile SDKs if you use the targeted protection level of the Bot Control |
waf-dg-148 | waf-dg.pdf | 148 | dashboard – The bot monitoring dashboard for your web ACL, available through the web ACL Bot Control tab. Use this dashboard to monitor your traffic and understand how much of it comes from various types of bots. This can be a starting point for customizing your bot management, as described in this topic. You can also use it to verify your changes and monitor activity for various bots and bot categories. • JavaScript and mobile application integration SDKs – You should implement the AWS WAF JavaScript and mobile SDKs if you use the targeted protection level of the Bot Control rule group. The targeted rules use information provided by the SDKs in the client tokens for enhanced detection against malicious bots. For more information about the SDKs, see Client application integrations in AWS WAF. • Logging and metrics – You can monitor your bot traffic and understand how the Bot Control managed rule group evaluates and handles your traffic by studying the data that's collected for your web ACL by AWS WAF logs, Amazon Security Lake, and Amazon CloudWatch. The labels that Bot Control adds to your web requests are included in the data. For information about these AWS WAF Bot Control 429 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide options, see Logging AWS WAF web ACL traffic, Monitoring with Amazon CloudWatch, and What is Amazon Security Lake?. Depending on your needs and the traffic that you see, you might want to customize your Bot Control implementation. The following are some of the most commonly used options. • Scope-down statements – You can exclude some traffic from the web requests that the Bot Control managed rule group evaluates by adding a scope-down statement inside the Bot Control managed rule group reference statement. A scope-down statement can be any nestable rule statement. When a request doesn't match the scope-down statement, AWS WAF evaluates it as not matching the rule group reference statement without evaluating it against the rule group. For more information about scope-down statements, see Using scope-down statements in AWS WAF. Your costs for using the Bot Control managed rule group increase with the number of web requests that AWS WAF evaluates with it. You can help reduce these costs by using a scope-down statement to limit the requests that the rule group evaluates. For example, you might want to allow your homepage to load for everyone, including bots, and then apply the rule group rules to requests that are going to your application APIs or that contain a particular type of content. • Labels and label matching rules – You can customize how the Bot Control rule group handles some of the bot traffic that it identifies using the AWS WAF label match rule statement. The Bot Control rule group adds labels to your web requests. You can add label matching rules after the Bot Control rule group that match on Bot Control labels and apply the handling that you need. For more information about labeling and using label match statements, see Label match rule statement and Web request labeling in AWS WAF. • Custom requests and responses – You can add custom headers to requests that you allow and you can send custom responses for requests that you block by pairing label matching with the AWS WAF custom request and response features. For more information about customizing requests and responses, see Customized web requests and responses in AWS WAF. Using application integration SDKs with Bot Control This section explains how to use application integration SDKs with Bot Control. Most of the targeted protections of the Bot Control managed rule group require the challenge tokens that the application integration SDKs generate. The rules that don't require a challenge token on the request are the Bot Control common level protections and the targeted level machine AWS WAF Bot Control 430 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide learning rules. For descriptions of the protection levels and rules in the rule group, see AWS WAF Bot Control rule group. We highly recommend implementing the application integration SDKs, for the most effective use of the Bot Control rule group. The challenge script must run before the Bot Control rule group in order for the rule group to benefit from the tokens that the script acquires. • With the application integration SDKs, the script runs automatically. • If you're unable to use the SDKs, you can configure your web ACL so that it runs the Challenge or CAPTCHA rule action against all requests that will be inspected by the Bot Control rule group. Using the Challenge or CAPTCHA rule action can incur additional fees. For pricing details, see AWS WAF Pricing. When you implement the application integration SDKs in your clients or use one of |
waf-dg-149 | waf-dg.pdf | 149 | before the Bot Control rule group in order for the rule group to benefit from the tokens that the script acquires. • With the application integration SDKs, the script runs automatically. • If you're unable to use the SDKs, you can configure your web ACL so that it runs the Challenge or CAPTCHA rule action against all requests that will be inspected by the Bot Control rule group. Using the Challenge or CAPTCHA rule action can incur additional fees. For pricing details, see AWS WAF Pricing. When you implement the application integration SDKs in your clients or use one of the rule actions that runs the challenge script, you expand the capabilities of the rule group and of your overall client application security. Tokens provide client information with each web request. This additional information enables the Bot Control rule group to separate legitimate client sessions from ill-behaved client sessions, even when both originate from a single IP address. The rule group uses information in the tokens to aggregate client session request behavior for the fine-tuned detection and mitigation that the targeted protections level provide. For information about the SDKs, see Client application integrations in AWS WAF. For information about AWS WAF tokens, see Token use in AWS WAF intelligent threat mitigation. For information about the rule actions, see CAPTCHA and Challenge in AWS WAF. Adding the AWS WAF Bot Control managed rule group to your web ACL This section explains how to add and configure the AWSManagedRulesBotControlRuleSet rule group. The Bot Control managed rule group AWSManagedRulesBotControlRuleSet requires additional configuration to identify the protection level that you want to implement. For the rule group description and rules listing, see AWS WAF Bot Control rule group. This guidance is intended for users who know generally how to create and manage AWS WAF web ACLs, rules, and rule groups. Those topics are covered in prior sections of this guide. For basic AWS WAF Bot Control 431 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide information about how to add a managed rule group to your web ACL, see Adding a managed rule group to a web ACL through the console. Follow best practices Use the Bot Control rule group in accordance with the best practices at Best practices for intelligent threat mitigation in AWS WAF. To use the AWSManagedRulesBotControlRuleSet rule group in your web ACL 1. Add the AWS managed rule group, AWSManagedRulesBotControlRuleSet to your web ACL. For the full rule group description, see the section called “Bot Control rule group”. Note You are charged additional fees when you use this managed rule group. For more information, see AWS WAF Pricing. When you add the rule group, edit it to open the configuration page for the rule group. 2. On the rule group's configuration page, in the Inspection level pane, select the inspection level that you want to use. • Common – Detects a variety of self-identifying bots, such as web scraping frameworks, search engines, and automated browsers. Bot Control protections at this level identify common bots using traditional bot detection techniques, such as static request data analysis. The rules label traffic from these bots and block the ones that they cannot verify. • Targeted – Includes the common-level protections and adds targeted detection for sophisticated bots that do not self identify. Targeted protections mitigate bot activity using a combination of rate limiting and CAPTCHA and background browser challenges. • TGT_ – Rules that provide targeted protection have names that begin with TGT_. All targeted protections use detection techniques such as browser interrogation, fingerprinting, and behavior heuristics to identify bad bot traffic. • TGT_ML_ – Targeted protection rules that use machine learning have names that begin with TGT_ML_. These rules use automated, machine-learning analysis of website traffic statistics to detect anomalous behavior indicative of distributed, coordinated bot activity. AWS WAF analyzes statistics about your website traffic such as timestamps, browser characteristics, and previous URL visited, to improve the Bot Control machine learning AWS WAF Bot Control 432 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide model. Machine learning capabilities are enabled by default, but you can disable them in your rule group configuration. When machine learning is disabled, AWS WAF does not evaluate these rules. 3. If you're using the targeted protection level and you don't want AWS WAF to use machine learning (ML) to analyze web traffic for distributed, coordinated bot activity, disable the machine learning option. Machine learning is required for the Bot Control rules whose names start with TGT_ML_. For details about these rules, see Bot Control rules listing. 4. Add a scope-down statement for the rule group, to contain the costs of using it. A scope-down statement narrows the set of requests that the rule group inspects. For example use cases, start with |
waf-dg-150 | waf-dg.pdf | 150 | disabled, AWS WAF does not evaluate these rules. 3. If you're using the targeted protection level and you don't want AWS WAF to use machine learning (ML) to analyze web traffic for distributed, coordinated bot activity, disable the machine learning option. Machine learning is required for the Bot Control rules whose names start with TGT_ML_. For details about these rules, see Bot Control rules listing. 4. Add a scope-down statement for the rule group, to contain the costs of using it. A scope-down statement narrows the set of requests that the rule group inspects. For example use cases, start with Bot Control example: Using Bot Control only for the login page and Bot Control example: Using Bot Control only for dynamic content. 5. Provide any additional configuration that you need for the rule group. 6. Save your changes to the web ACL. Before you deploy your Bot Control implementation for production traffic, test and tune it in a staging or testing environment until you are comfortable with the potential impact to your traffic. Then test and tune the rules in count mode with your production traffic before enabling them. See the sections that follow for guidance. Example scenarios of false positives with AWS WAF Bot Control This section provides example situations where you might encounter false positives with AWS WAF Bot Control. We have carefully selected the rules in the AWS WAF Bot Control managed rule group to minimize false positives. We test the rules against global traffic and monitor their impact on test web ACLs. However, it's still possible to get false positives due to changes in traffic patterns. Additionally, some use cases are known to cause false positives and will require customization specific to your web traffic. Situations where you might encounter false positives include the following: • Mobile apps typically have non-browser user agents, which the SignalNonBrowserUserAgent rule blocks by default. If you expect traffic from mobile apps, or any other legitimate traffic with non-browser user agents, you'll need to add an exception to allow it. • You might rely on some specific bot traffic for things like uptime monitoring, integration testing, or marketing tools. If Bot Control identifies and blocks the bot traffic that you want to allow, you AWS WAF Bot Control 433 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide need to alter the handling by adding your own rules. While this isn't a false positive scenario for all customers, if it is for you, you will need to handle it the same as for a false positive. • The Bot Control managed rule group verifies bots using the IP addresses from AWS WAF. If you use Bot Control and you have verified bots that route through a proxy or load balancer, you might need to explicitly allow them using a custom rule. For information about how to create a custom rule of this type, see Using forwarded IP addresses in AWS WAF. • A Bot Control rule with a low global false positive rate might heavily impact specific devices or applications. For example, in testing and validation, we might not have observed requests from applications with low traffic volumes or from less common browsers or devices. • A Bot Control rule that has a historically low false positive rate might have increased false positives for valid traffic. This might be due to new traffic patterns or request attributes that emerge with valid traffic, causing it to match the rule where it didn't before. These changes might be due to situations like the following: • Traffic details that are altered as traffic flows through network appliances, such as load balancers or content distribution networks (CDN). • Emerging changes in traffic data, for example new browsers or new versions for existing browsers. For information about how to handle false positives that you might get from the AWS WAF Bot Control managed rule group, see the guidance in the section that follows, Testing and deploying AWS WAF Bot Control. Testing and deploying AWS WAF Bot Control This section provides general guidance for configuring and testing an AWS WAF Bot Control implementation for your site. The specific steps that you choose to follow will depend on your needs, resources, and the web requests that you receive. This information is in addition to the general information about testing and tuning provided at Testing and tuning your AWS WAF protections. Note AWS Managed Rules are designed to protect you from common web threats. When used in accordance with the documentation, AWS Managed Rules rule groups add another layer of security for your applications. However, AWS Managed Rules rule groups aren't intended as AWS WAF Bot Control 434 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide a replacement for your security responsibilities, which are |
waf-dg-151 | waf-dg.pdf | 151 | depend on your needs, resources, and the web requests that you receive. This information is in addition to the general information about testing and tuning provided at Testing and tuning your AWS WAF protections. Note AWS Managed Rules are designed to protect you from common web threats. When used in accordance with the documentation, AWS Managed Rules rule groups add another layer of security for your applications. However, AWS Managed Rules rule groups aren't intended as AWS WAF Bot Control 434 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide a replacement for your security responsibilities, which are determined by the AWS resources that you select. Refer to the Shared Responsibility Model to ensure that your resources in AWS are properly protected. Production traffic risk Before you deploy your Bot Control implementation for production traffic, test and tune it in a staging or testing environment until you are comfortable with the potential impact to your traffic. Then test and tune the rules in count mode with your production traffic before enabling them. This guidance is intended for users who know generally how to create and manage AWS WAF web ACLs, rules, and rule groups. Those topics are covered in prior sections of this guide. To configure and test a Bot Control implementation Perform these steps first in a test environment, then in production. 1. Add the Bot Control managed rule group Note You are charged additional fees when you use this managed rule group. For more information, see AWS WAF Pricing. Add the managed AWS rule group AWSManagedRulesBotControlRuleSet to a new or existing web ACL and configure it so that it doesn't alter current web ACL behavior. • When you add the managed rule group, edit it and do the following: • In the Inspection level pane, select the inspection level that you want to use. • Common – Detects a variety of self-identifying bots, such as web scraping frameworks, search engines, and automated browsers. Bot Control protections at this level identify common bots using traditional bot detection techniques, such as static request data analysis. The rules label traffic from these bots and block the ones that they cannot verify. AWS WAF Bot Control 435 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide • Targeted – Includes the common-level protections and adds targeted detection for sophisticated bots that do not self identify. Targeted protections mitigate bot activity using a combination of rate limiting and CAPTCHA and background browser challenges. • TGT_ – Rules that provide targeted protection have names that begin with TGT_. All targeted protections use detection techniques such as browser interrogation, fingerprinting, and behavior heuristics to identify bad bot traffic. • TGT_ML_ – Targeted protection rules that use machine learning have names that begin with TGT_ML_. These rules use automated, machine-learning analysis of website traffic statistics to detect anomalous behavior indicative of distributed, coordinated bot activity. AWS WAF analyzes statistics about your website traffic such as timestamps, browser characteristics, and previous URL visited, to improve the Bot Control machine learning model. Machine learning capabilities are enabled by default, but you can disable them in your rule group configuration. When machine learning is disabled, AWS WAF does not evaluate these rules. For more information about this choice, see AWS WAF Bot Control rule group. • In the Rules pane, open the Override all rule actions dropdown and choose Count. With this configuration, AWS WAF evaluates requests against all of the rules in the rule group and only counts the matches that result, while still adding labels to requests. For more information, see Overriding rule actions in a rule group. With this override, you can monitor the potential impact of the Bot Control rules on your traffic, to determine whether you want to add exceptions for things like internal use cases or desired bots. • Position the rule group so that it's evaluated last in the web ACL, with a priority setting that's numerically higher than any other rules or rule groups that you're already using. For more information, see Setting rule priority in a web ACL. This way, your current handling of traffic isn't disrupted. For example, if you have rules that detect malicious traffic such as SQL injection or cross-site scripting, they'll continue to detect and log those requests. Alternately, if you have rules that allow known non-malicious traffic, they can continue to allow that traffic, without having it blocked by the Bot Control managed rule group. You might decide to adjust the processing order during your testing and tuning activities, but this is a good way to start. AWS WAF Bot Control 436 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide 2. Enable logging and metrics for the web ACL As needed, configure logging, Amazon Security Lake data collection, |
waf-dg-152 | waf-dg.pdf | 152 | traffic such as SQL injection or cross-site scripting, they'll continue to detect and log those requests. Alternately, if you have rules that allow known non-malicious traffic, they can continue to allow that traffic, without having it blocked by the Bot Control managed rule group. You might decide to adjust the processing order during your testing and tuning activities, but this is a good way to start. AWS WAF Bot Control 436 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide 2. Enable logging and metrics for the web ACL As needed, configure logging, Amazon Security Lake data collection, request sampling, and Amazon CloudWatch metrics for the web ACL. You can use these visibility tools to monitor the interaction of the Bot Control managed rule group with your traffic. • For information about logging, see Logging AWS WAF web ACL traffic. • For information about Amazon Security Lake, see What is Amazon Security Lake? and Collecting data from AWS services in the Amazon Security Lake user guide. • For information about Amazon CloudWatch metrics, see Monitoring with Amazon CloudWatch. • For information about web request sampling, see Viewing a sample of web requests. 3. Associate the web ACL with a resource If the web ACL isn't already associated with a resource, associate it. For information, see Associating or disassociating a web ACL with an AWS resource. 4. Monitor traffic and Bot Control rule matches Make sure that traffic is flowing and that the Bot Control managed rule group rules are adding labels to matching web requests. You can see the labels in the logs and see bot and label metrics in the Amazon CloudWatch metrics. In the logs, the rules that you've overridden to count in the rule group show up in the ruleGroupList with action set to count, and with overriddenAction indicating the configured rule action that you overrode. Note The Bot Control managed rule group verifies bots using the IP addresses from AWS WAF. If you use Bot Control and you have verified bots that route through a proxy or load balancer, you might need to explicitly allow them using a custom rule. For information about how to create a custom rule, see Using forwarded IP addresses in AWS WAF. For information about how you can use the rule to customize Bot Control web request handling, see the next step. Carefully review the web request handling for any false positives that you might need to mitigate with custom handling. For examples of false positives, see Example scenarios of false positives with AWS WAF Bot Control. AWS WAF Bot Control 437 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide 5. Customize Bot Control web request handling As needed, add your own rules that explicitly allow or block requests, to change how Bot Control rules would otherwise handle them. How you do this depends on your use case, but the following are common solutions: • Explicitly allow requests with a rule that you add before the Bot Control managed rule group. With this, the allowed requests never reach the rule group for evaluation. This can help contain the cost of using the Bot Control managed rule group. • Exclude requests from Bot Control evaluation by adding a scope-down statement inside the Bot Control managed rule group statement. This functions the same as the preceding option. It can help contain the cost of using the Bot Control managed rule group because the requests that don't match the scope-down statement never reach rule group evaluation. For information about scope-down statements, see Using scope-down statements in AWS WAF. For examples, see the following: • Excluding IP range from bot management • Allowing traffic from a bot that you control • Use Bot Control labels in request handling to allow or block requests. Add a label match rule after the Bot Control managed rule group to filter out labeled requests that you want to allow from those that you want to block. After testing, keep the related Bot Control rules in count mode, and maintain the request handling decisions in your custom rule. For information about label match statements, see Label match rule statement. For examples of this type of customization, see the following: • Creating an exception for a blocked user agent • Allowing a specific blocked bot • Blocking verified bots For additional examples, see AWS WAF Bot Control examples. AWS WAF Bot Control 438 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide 6. As needed, enable the Bot Control managed rule group settings Depending on your situation, you might have decided that you want to leave some Bot Control rules in count mode or with a different action override. For the rules that you want to have run as they are configured inside the |
waf-dg-153 | waf-dg.pdf | 153 | customization, see the following: • Creating an exception for a blocked user agent • Allowing a specific blocked bot • Blocking verified bots For additional examples, see AWS WAF Bot Control examples. AWS WAF Bot Control 438 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide 6. As needed, enable the Bot Control managed rule group settings Depending on your situation, you might have decided that you want to leave some Bot Control rules in count mode or with a different action override. For the rules that you want to have run as they are configured inside the rule group, enable the regular rule configuration. To do this, edit the rule group statement in your web ACL and make your changes in the Rules pane. AWS WAF Bot Control examples This section shows example configurations that satisfy a variety of common use cases for AWS WAF Bot Control implementations. Each example provides a description of the use case and then shows the solution in JSON listings for the custom configured rules. Note The JSON listings shown in these examples were created in the console by configuring the rule and then editing it using the Rule JSON editor. Topics • Bot Control example: Simple configuration • Bot Control example: Explicitly allowing verified bots • Bot Control example: Blocking verified bots • Bot Control example: Allowing a specific blocked bot • Bot Control example: Creating an exception for a blocked user agent • Bot Control example: Using Bot Control only for the login page • Bot Control example: Using Bot Control only for dynamic content • Bot Control example: Excluding IP range from bot management • Bot Control example: Allowing traffic from a bot that you control • Bot Control example: Enabling targeted inspection level • Bot Control example: Using two statements to limit the use of the targeted inspection level AWS WAF Bot Control 439 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Bot Control example: Simple configuration The following JSON listing shows an example web ACL with an AWS WAF Bot Control managed rule group. Note the visibility configuration, which causes AWS WAF to store request samples and metrics for monitoring purposes. { "Name": "Bot-WebACL", "Id": "...", "ARN": "...", "DefaultAction": { "Allow": {} }, "Description": "Bot-WebACL", "Rules": [ { ... }, { "Name": "AWS-AWSBotControl-Example", "Priority": 5, "Statement": { "ManagedRuleGroupStatement": { "VendorName": "AWS", "Name": "AWSManagedRulesBotControlRuleSet", "ManagedRuleGroupConfigs": [ { "AWSManagedRulesBotControlRuleSet": { "InspectionLevel": "COMMON" } } ], "RuleActionOverrides": [], "ExcludedRules": [] }, "VisibilityConfig": { "SampledRequestsEnabled": true, "CloudWatchMetricsEnabled": true, "MetricName": "AWS-AWSBotControl-Example" } } } ], AWS WAF Bot Control 440 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide "VisibilityConfig": { ... }, "Capacity": 1496, "ManagedByFirewallManager": false, "RetrofittedByFirewallManager": false } Bot Control example: Explicitly allowing verified bots AWS WAF Bot Control doesn't block bots that are known by AWS to be common and verifiable bots. When Bot Control identifies a web request as coming from a verified bot, it adds a label that names the bot and a label that indicates that it's a verified bot. Bot Control doesn't add any other labels, such as signals labels, in order to prevent known good bots from being blocked. You might have other AWS WAF rules that block verified bots. If you want to ensure that verified bots are allowed, add a custom rule to allow them based on the Bot Control labels. Your new rule must run after the Bot Control managed rule group, so that the labels are available to match against. The following rule explicitly allows verified bots. { "Name": "match_rule", "Statement": { "LabelMatchStatement": { "Scope": "LABEL", "Key": "awswaf:managed:aws:bot-control:bot:verified" } }, "RuleLabels": [], "Action": { "Allow": {} } } Bot Control example: Blocking verified bots In order to block verified bots, you must add a rule to block them that runs after the AWS WAF Bot Control managed rule group. To do this, identify the bot names that you want to block and use a label match statement to identify and block them. If you want to just block all verified bots, you can omit the match against the bot:name: label. AWS WAF Bot Control 441 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide The following rule blocks only the bingbot verified bot. This rule must run after the Bot Control managed rule group. { "Name": "match_rule", "Statement": { "AndStatement": { "Statements": [ { "LabelMatchStatement": { "Scope": "LABEL", "Key": "awswaf:managed:aws:bot-control:bot:name:bingbot" } }, { "LabelMatchStatement": { "Scope": "LABEL", "Key": "awswaf:managed:aws:bot-control:bot:verified" } } ] } }, "RuleLabels": [], "Action": { "Block": {} } } The following rule blocks all verified bots. { "Name": "match_rule", "Statement": { "LabelMatchStatement": { "Scope": "LABEL", "Key": "awswaf:managed:aws:bot-control:bot:verified" } }, "RuleLabels": [], "Action": { "Block": {} } AWS WAF Bot Control 442 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced |
waf-dg-154 | waf-dg.pdf | 154 | Guide The following rule blocks only the bingbot verified bot. This rule must run after the Bot Control managed rule group. { "Name": "match_rule", "Statement": { "AndStatement": { "Statements": [ { "LabelMatchStatement": { "Scope": "LABEL", "Key": "awswaf:managed:aws:bot-control:bot:name:bingbot" } }, { "LabelMatchStatement": { "Scope": "LABEL", "Key": "awswaf:managed:aws:bot-control:bot:verified" } } ] } }, "RuleLabels": [], "Action": { "Block": {} } } The following rule blocks all verified bots. { "Name": "match_rule", "Statement": { "LabelMatchStatement": { "Scope": "LABEL", "Key": "awswaf:managed:aws:bot-control:bot:verified" } }, "RuleLabels": [], "Action": { "Block": {} } AWS WAF Bot Control 442 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide } Bot Control example: Allowing a specific blocked bot It's possible for a bot to be blocked by more than one of the Bot Control rules. Run through the following procedure for each blocking rule. If an AWS WAF Bot Control rule is blocking a bot that you do not want to block, do the following: 1. Identify the Bot Control rule that's blocking the bot by checking the logs. The blocking rule will be specified in the logs in the fields whose names start with terminatingRule. For information about the web ACL logs, see Logging AWS WAF web ACL traffic. Note the label that the rule is adds to the requests. 2. In your web ACL, override the action of the blocking rule to count. To do this in the console, edit the rule group rule in the web ACL and choose a rule action override of Count for the rule. This ensures that the bot is not blocked by the rule, but the rule will still apply its label to matching requests. 3. Add a label matching rule to your web ACL, after the Bot Control managed rule group. Configure the rule to match against the overridden rule's label and to block all matching requests except for the bot that you don't want to block. Your web ACL is now configured so that the bot you want to allow is no longer blocked by the blocking rule that you identified through the logs. Check traffic and your logs again, to be sure that the bot is being allowed through. If not, run through the above procedure again. For example, suppose you want to block all monitoring bots except for pingdom. In this case, you override the CategoryMonitoring rule to count and then write a rule to block all monitoring bots except for those with the bot name label pingdom. The following rule uses the Bot Control managed rule group but overrides the rule action for CategoryMonitoring to count. The category monitoring rule applies its labels as usual to matching requests, but only counts them instead of performing its usual action of block. { "Name": "AWS-AWSBotControl-Example", "Priority": 5, "Statement": { AWS WAF Bot Control 443 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide "ManagedRuleGroupStatement": { "VendorName": "AWS", "Name": "AWSManagedRulesBotControlRuleSet", "ManagedRuleGroupConfigs": [ { "AWSManagedRulesBotControlRuleSet": { "InspectionLevel": "COMMON" } } ], "RuleActionOverrides": [ { "ActionToUse": { "Count": {} }, "Name": "CategoryMonitoring" } ], "ExcludedRules": [] } }, "VisibilityConfig": { "SampledRequestsEnabled": true, "CloudWatchMetricsEnabled": true, "MetricName": "AWS-AWSBotControl-Example" } } The following rule matches against the category monitoring label that the preceding CategoryMonitoring rule adds to matching web requests. Among the category monitoring requests, this rule blocks all but those that have a label for the bot name pingdom. The following rule must run after the preceding Bot Control managed rule group in the web ACL processing order. { "Name": "match_rule", "Priority": 10, "Statement": { "AndStatement": { "Statements": [ { "LabelMatchStatement": { AWS WAF Bot Control 444 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide "Scope": "LABEL", "Key": "awswaf:managed:aws:bot-control:bot:category:monitoring" } }, { "NotStatement": { "Statement": { "LabelMatchStatement": { "Scope": "LABEL", "Key": "awswaf:managed:aws:bot-control:bot:name:pingdom" } } } } ] } }, "Action": { "Block": {} }, "VisibilityConfig": { "SampledRequestsEnabled": true, "CloudWatchMetricsEnabled": true, "MetricName": "match_rule" } } Bot Control example: Creating an exception for a blocked user agent If traffic from some non-browser user agents is being erroneously blocked, you can create an exception by setting the offending AWS WAF Bot Control rule SignalNonBrowserUserAgent to Count and then combining the rule's labeling with your exception criteria. Note Mobile apps typically have non-browser user agents, which the SignalNonBrowserUserAgent rule blocks by default. The following rule uses the Bot Control managed rule group but overrides the rule action for SignalNonBrowserUserAgent to Count. The signal rule applies its labels as usual to matching requests, but only counts them instead of performing its usual action of block. AWS WAF Bot Control 445 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide { "Name": "AWS-AWSBotControl-Example", "Priority": 5, "Statement": { "ManagedRuleGroupStatement": { "VendorName": "AWS", "Name": "AWSManagedRulesBotControlRuleSet", "ManagedRuleGroupConfigs": [ { "AWSManagedRulesBotControlRuleSet": { "InspectionLevel": "COMMON" } } ], "RuleActionOverrides": [ { "ActionToUse": { "Count": {} |
waf-dg-155 | waf-dg.pdf | 155 | typically have non-browser user agents, which the SignalNonBrowserUserAgent rule blocks by default. The following rule uses the Bot Control managed rule group but overrides the rule action for SignalNonBrowserUserAgent to Count. The signal rule applies its labels as usual to matching requests, but only counts them instead of performing its usual action of block. AWS WAF Bot Control 445 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide { "Name": "AWS-AWSBotControl-Example", "Priority": 5, "Statement": { "ManagedRuleGroupStatement": { "VendorName": "AWS", "Name": "AWSManagedRulesBotControlRuleSet", "ManagedRuleGroupConfigs": [ { "AWSManagedRulesBotControlRuleSet": { "InspectionLevel": "COMMON" } } ], "RuleActionOverrides": [ { "ActionToUse": { "Count": {} }, "Name": "SignalNonBrowserUserAgent" } ], "ExcludedRules": [] } }, "VisibilityConfig": { "SampledRequestsEnabled": true, "CloudWatchMetricsEnabled": true, "MetricName": "AWS-AWSBotControl-Example" } } The following rule matches against the signal label that the Bot Control SignalNonBrowserUserAgent rule adds to its matching web requests. Among the signal requests, this rule blocks all but those that have the user agent that we want to allow. The following rule must run after the preceding Bot Control managed rule group in the web ACL processing order. { "Name": "match_rule", "Statement": { AWS WAF Bot Control 446 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide "AndStatement": { "Statements": [ { "LabelMatchStatement": { "Scope": "LABEL", "Key": "awswaf:managed:aws:bot-control:signal:non_browser_user_agent" } }, { "NotStatement": { "Statement": { "ByteMatchStatement": { "FieldToMatch": { "SingleHeader": { "Name": "user-agent" } }, "PositionalConstraint": "EXACTLY", "SearchString": "PostmanRuntime/7.29.2", "TextTransformations": [ { "Priority": 0, "Type": "NONE" } ] } } } } ] } }, "RuleLabels": [], "Action": { "Block": {} }, "VisibilityConfig": { "SampledRequestsEnabled": true, "CloudWatchMetricsEnabled": true, "MetricName": "match_rule" } } AWS WAF Bot Control 447 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Bot Control example: Using Bot Control only for the login page The following example uses a scope-down statement to apply AWS WAF Bot Control only for traffic that's coming to a website's login page, which is identified by the URI path login. The URI path to your login page might be different from the example, depending on your application and environment. { "Name": "AWS-AWSBotControl-Example", "Priority": 5, "Statement": { "ManagedRuleGroupStatement": { "VendorName": "AWS", "Name": "AWSManagedRulesBotControlRuleSet", "ManagedRuleGroupConfigs": [ { "AWSManagedRulesBotControlRuleSet": { "InspectionLevel": "COMMON" } } ], "RuleActionOverrides": [], "ExcludedRules": [] }, "VisibilityConfig": { "SampledRequestsEnabled": true, "CloudWatchMetricsEnabled": true, "MetricName": "AWS-AWSBotControl-Example" }, "ScopeDownStatement": { "ByteMatchStatement": { "SearchString": "login", "FieldToMatch": { "UriPath": {} }, "TextTransformations": [ { "Priority": 0, "Type": "NONE" } ], "PositionalConstraint": "CONTAINS" } AWS WAF Bot Control 448 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide } } } Bot Control example: Using Bot Control only for dynamic content This example uses a scope-down statement to apply AWS WAF Bot Control only to dynamic content. The scope-down statement excludes static content by negating the match results for a regex pattern set: • The regex pattern set is configured to match extensions of static content. For example, the regex pattern set specification might be (?i)\.(jpe?g|gif|png|svg|ico|css|js|woff2?)$. For information about regex pattern sets and statements, see Regex pattern set match rule statement. • In the scope-down statement, we exclude the matching static content by nesting the regex pattern set statement inside a NOT statement. For information about the NOT statement, see NOT rule statement. { "Name": "AWS-AWSBotControl-Example", "Priority": 5, "Statement": { "ManagedRuleGroupStatement": { "VendorName": "AWS", "Name": "AWSManagedRulesBotControlRuleSet", "ManagedRuleGroupConfigs": [ { "AWSManagedRulesBotControlRuleSet": { "InspectionLevel": "COMMON" } } ], "RuleActionOverrides": [], "ExcludedRules": [] }, "VisibilityConfig": { "SampledRequestsEnabled": true, "CloudWatchMetricsEnabled": true, "MetricName": "AWS-AWSBotControl-Example" AWS WAF Bot Control 449 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide }, "ScopeDownStatement": { "NotStatement": { "Statement": { "RegexPatternSetReferenceStatement": { "ARN": "arn:aws:wafv2:us-east-1:123456789:regional/regexpatternset/ excludeset/00000000-0000-0000-0000-000000000000", "FieldToMatch": { "UriPath": {} }, "TextTransformations": [ { "Priority": 0, "Type": "NONE" } ] } } } } } } Bot Control example: Excluding IP range from bot management If you want to exclude a subset of web traffic from AWS WAF Bot Control management, and you can identify that subset using a rule statement, then exclude it by adding a scope-down statement to your Bot Control managed rule group statement. The following rule performs normal Bot Control bot management on all web traffic except for web requests coming from a specific IP address range. { "Name": "AWS-AWSBotControl-Example", "Priority": 5, "Statement": { "ManagedRuleGroupStatement": { "VendorName": "AWS", "Name": "AWSManagedRulesBotControlRuleSet", "ManagedRuleGroupConfigs": [ { "AWSManagedRulesBotControlRuleSet": { "InspectionLevel": "COMMON" AWS WAF Bot Control 450 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide } } ], "RuleActionOverrides": [], "ExcludedRules": [] }, "VisibilityConfig": { "SampledRequestsEnabled": true, "CloudWatchMetricsEnabled": true, "MetricName": "AWS-AWSBotControl-Example" }, "ScopeDownStatement": { "NotStatement": { "Statement": { "IPSetReferenceStatement": { "ARN": "arn:aws:wafv2:us-east-1:123456789:regional/ipset/ friendlyips/00000000-0000-0000-0000-000000000000" } } } } } } Bot Control example: Allowing traffic from a bot that you control You can configure some site monitoring bots and custom bots to send custom headers. If you want to allow traffic from these types of bots, you can configure |
waf-dg-156 | waf-dg.pdf | 156 | "VendorName": "AWS", "Name": "AWSManagedRulesBotControlRuleSet", "ManagedRuleGroupConfigs": [ { "AWSManagedRulesBotControlRuleSet": { "InspectionLevel": "COMMON" AWS WAF Bot Control 450 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide } } ], "RuleActionOverrides": [], "ExcludedRules": [] }, "VisibilityConfig": { "SampledRequestsEnabled": true, "CloudWatchMetricsEnabled": true, "MetricName": "AWS-AWSBotControl-Example" }, "ScopeDownStatement": { "NotStatement": { "Statement": { "IPSetReferenceStatement": { "ARN": "arn:aws:wafv2:us-east-1:123456789:regional/ipset/ friendlyips/00000000-0000-0000-0000-000000000000" } } } } } } Bot Control example: Allowing traffic from a bot that you control You can configure some site monitoring bots and custom bots to send custom headers. If you want to allow traffic from these types of bots, you can configure them to add a shared secret in a header. You then can exclude messages that have the header by adding a scope-down statement to the AWS WAF Bot Control managed rule group statement. The following example rule excludes traffic with a secret header from Bot Control inspection. { "Name": "AWS-AWSBotControl-Example", "Priority": 5, "Statement": { "ManagedRuleGroupStatement": { "VendorName": "AWS", "Name": "AWSManagedRulesBotControlRuleSet", "ManagedRuleGroupConfigs": [ { "AWSManagedRulesBotControlRuleSet": { AWS WAF Bot Control 451 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide "InspectionLevel": "COMMON" } } ], "RuleActionOverrides": [], "ExcludedRules": [] }, "VisibilityConfig": { "SampledRequestsEnabled": true, "CloudWatchMetricsEnabled": true, "MetricName": "AWS-AWSBotControl-Example" }, "ScopeDownStatement": { "NotStatement": { "Statement": { "ByteMatchStatement": { "SearchString": "YSBzZWNyZXQ=", "FieldToMatch": { "SingleHeader": { "Name": "x-bypass-secret" } }, "TextTransformations": [ { "Priority": 0, "Type": "NONE" } ], "PositionalConstraint": "EXACTLY" } } } } } } Bot Control example: Enabling targeted inspection level For an enhanced level of protection, you can enable the targeted inspection level in your AWS WAF Bot Control managed rule group. In the following example, machine learning features are enabled. You can opt out of this behavior by setting EnableMachineLearning to false. AWS WAF Bot Control 452 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide { "Name": "AWS-AWSBotControl-Example", "Priority": 5, "Statement": { "ManagedRuleGroupStatement": { "VendorName": "AWS", "Name": "AWSManagedRulesBotControlRuleSet", "ManagedRuleGroupConfigs": [ { "AWSManagedRulesBotControlRuleSet": { "InspectionLevel": "TARGETED", "EnableMachineLearning": true } } ], "RuleActionOverrides": [], "ExcludedRules": [] }, "VisibilityConfig": { "SampledRequestsEnabled": true, "CloudWatchMetricsEnabled": true, "MetricName": "AWS-AWSBotControl-Example" } } } Bot Control example: Using two statements to limit the use of the targeted inspection level As a cost optimization, you can use two AWS WAF Bot Control managed rule group statements in your web ACL, with separate inspection levels and scoping. For instance, you could scope the targeted inspection level statement only to more sensitive application endpoints. The two statements in the following example have mutually exclusive scoping. Without this configuration, a request could result in two billed Bot Control evaluations. Note Multiple statements referencing AWSManagedRulesBotControlRuleSet are not supported in the visual editor in the console. Instead, use the JSON editor. AWS WAF Bot Control 453 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide { "Name": "Bot-WebACL", "Id": "...", "ARN": "...", "DefaultAction": { "Allow": {} }, "Description": "Bot-WebACL", "Rules": [ { ... }, { "Name": "AWS-AWSBotControl-Common", "Priority": 5, "Statement": { "ManagedRuleGroupStatement": { "VendorName": "AWS", "Name": "AWSManagedRulesBotControlRuleSet", "ManagedRuleGroupConfigs": [ { "AWSManagedRulesBotControlRuleSet": { "InspectionLevel": "COMMON" } } ], "RuleActionOverrides": [], "ExcludedRules": [] }, "VisibilityConfig": { "SampledRequestsEnabled": true, "CloudWatchMetricsEnabled": true, "MetricName": "AWS-AWSBotControl-Common" }, "ScopeDownStatement": { "NotStatement": { "Statement": { "ByteMatchStatement": { "FieldToMatch": { "UriPath": {} }, "PositionalConstraint": "STARTS_WITH", "SearchString": "/sensitive-endpoint", AWS WAF Bot Control 454 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide "TextTransformations": [ { "Type": "NONE", "Priority": 0 } ] } } } } } }, { "Name": "AWS-AWSBotControl-Targeted", "Priority": 6, "Statement": { "ManagedRuleGroupStatement": { "VendorName": "AWS", "Name": "AWSManagedRulesBotControlRuleSet", "ManagedRuleGroupConfigs": [ { "AWSManagedRulesBotControlRuleSet": { "InspectionLevel": "TARGETED", "EnableMachineLearning": true } } ], "RuleActionOverrides": [], "ExcludedRules": [] }, "VisibilityConfig": { "SampledRequestsEnabled": true, "CloudWatchMetricsEnabled": true, "MetricName": "AWS-AWSBotControl-Targeted" }, "ScopeDownStatement": { "Statement": { "ByteMatchStatement": { "FieldToMatch": { "UriPath": {} }, "PositionalConstraint": "STARTS_WITH", "SearchString": "/sensitive-endpoint", "TextTransformations": [ AWS WAF Bot Control 455 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide { "Type": "NONE", "Priority": 0 } ] } } } } } ], "VisibilityConfig": { ... }, "Capacity": 1496, "ManagedByFirewallManager": false, "RetrofittedByFirewallManager": false } Client application integrations in AWS WAF This section explains how to use the intelligent threat integration APIs and JavaScript CAPTCHA integration API with your AWS WAF features. Use AWS WAF client application integration APIs to couple client-side protections with your AWS server-side web ACL protections, to help verify that the client applications that send web requests to your protected resources are the intended clients and that your end users are human beings. Use the client integrations to manage silent browser challenges and CAPTCHA puzzles, obtain tokens with proof of successful browser and end user responses, and to include these tokens in requests to your protected endpoints. For general information about AWS WAF tokens, see Token use in AWS WAF intelligent threat mitigation. Combine your client integrations with web ACL protections that require valid tokens for access to your resources. You can |
waf-dg-157 | waf-dg.pdf | 157 | server-side web ACL protections, to help verify that the client applications that send web requests to your protected resources are the intended clients and that your end users are human beings. Use the client integrations to manage silent browser challenges and CAPTCHA puzzles, obtain tokens with proof of successful browser and end user responses, and to include these tokens in requests to your protected endpoints. For general information about AWS WAF tokens, see Token use in AWS WAF intelligent threat mitigation. Combine your client integrations with web ACL protections that require valid tokens for access to your resources. You can use rule groups that check and monitor challenge tokens, like the ones listed in the next section, at Intelligent threat integration and AWS Managed Rules, and you can use the CAPTCHA and Challenge rule actions to check, as described in CAPTCHA and Challenge in AWS WAF. AWS WAF provides two levels of integration for JavaScript applications, and one for mobile applications: Client application integrations 456 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide • Intelligent threat integration – Verify the client application and provide AWS token acquisition and management. This is similar to the functionality provided by the AWS WAF Challenge rule action. This functionality fully integrates your client application with the AWSManagedRulesACFPRuleSet managed rule group, the AWSManagedRulesATPRuleSet managed rule group, and the targeted protection level of the AWSManagedRulesBotControlRuleSet managed rule group. The intelligent threat integration APIs use the AWS WAF silent browser challenge to help ensure that login attempts and other calls to your protected resource are only allowed after the client has acquired a valid token. The APIs manage token authorization for your client application sessions and gather information about the client to help determine whether it's being operated by a bot or by a human being. Note This is available for JavaScript and for Android and iOS mobile applications. • CAPTCHA integration – Verify end users with customized CAPTCHA puzzle that you manage in your application. This is similar to the functionality provided by the AWS WAF CAPTCHA rule action, but with added control over the puzzle placement and behavior. This integration leverages the JavaScript intelligent threat integration to run silent challenges and provide AWS WAF tokens to the customer's page. Note This is available for JavaScript applications. Topics • Intelligent threat integration and AWS Managed Rules • Accessing the AWS WAF client application integration APIs • AWS WAF JavaScript integrations • AWS WAF mobile application integration Client application integrations 457 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Intelligent threat integration and AWS Managed Rules This section explains how the intelligent threat integration APIs work with the AWS Managed Rules rule groups. The intelligent threat integration APIs work with web ACLs that use the intelligent threat rule groups to enable the full functionality of these advanced managed rule groups. • AWS WAF Fraud Control account creation fraud prevention (ACFP) managed rule group AWSManagedRulesACFPRuleSet. Account creation fraud is an online illegal activity in which an attacker creates invalid accounts in your application for purposes such as receiving sign-up bonuses or impersonating someone. The ACFP managed rule group provides rules to block, label, and manage requests that might be part of fraudulent account creation attempts. The APIs enable fine-tuned client browser verification and human interactivity information that the ACFP rules use to separate valid client traffic from malicious traffic. For more information, see AWS WAF Fraud Control account creation fraud prevention (ACFP) rule group and AWS WAF Fraud Control account creation fraud prevention (ACFP). • AWS WAF Fraud Control account takeover prevention (ATP) managed rule group AWSManagedRulesATPRuleSet. Account takeover is an online illegal activity in which an attacker gains unauthorized access to a person's account. The ATP managed rule group provides rules to block, label, and manage requests that might be part of malicious account takeover attempts. The APIs enable fine-tuned client verification and behavior aggregation that the ATP rules use to separate valid client traffic from malicious traffic. For more information, see AWS WAF Fraud Control account takeover prevention (ATP) rule group and AWS WAF Fraud Control account takeover prevention (ATP). • Targeted protection level of the AWS WAF Bot Control managed rule group AWSManagedRulesBotControlRuleSet. Bots run from self-identifying and useful ones, such as most search engines and crawlers, to malicious bots that operate against your website and don't self-identify. The Bot Control managed rule group provides rules to monitor, label, and manage the bot activity in your web traffic. When you use the targeted protection level of this rule group, the targeted rules use the client session information that the APIs provide to better detect malicious bots. Client application integrations 458 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide For more information, see AWS WAF Bot Control |
waf-dg-158 | waf-dg.pdf | 158 | managed rule group AWSManagedRulesBotControlRuleSet. Bots run from self-identifying and useful ones, such as most search engines and crawlers, to malicious bots that operate against your website and don't self-identify. The Bot Control managed rule group provides rules to monitor, label, and manage the bot activity in your web traffic. When you use the targeted protection level of this rule group, the targeted rules use the client session information that the APIs provide to better detect malicious bots. Client application integrations 458 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide For more information, see AWS WAF Bot Control rule group and AWS WAF Bot Control. To add one of these managed rule groups to your web ACL, see the procedures Adding the ACFP managed rule group to your web ACL, Adding the ATP managed rule group to your web ACL, and Adding the AWS WAF Bot Control managed rule group to your web ACL. Note The managed rule groups currently don't block requests that are missing tokens. In order to block requests that are missing tokens, after you implement your application integration APIs, follow the guidance at Blocking requests that don't have a valid AWS WAF token. Accessing the AWS WAF client application integration APIs This section explains where to find the application integration APIs in the AWS WAF console. The JavaScript integration APIs are generally available, and you can use them for your browsers and other devices that execute JavaScript. AWS WAF offers custom intelligent threat integration SDKs for Android and iOS mobile apps. • For Android mobile and TV apps, the SDKs work for Android API version 23 (Android version 6) and later. For information about Android versions, see SDK Platform release notes. • For iOS mobile apps, the SDKs work for iOS version 13 and later. For information about iOS versions, see iOS & iPadOS Release Notes. • For Apple TV apps, the SDKs work for tvOS version 14 or later. For information about tvOS versions, see tvOS Release Notes. To access the integration APIs through the console 1. Sign in to the AWS Management Console and open the AWS WAF console at https:// console.aws.amazon.com/wafv2/. 2. Choose Application integration in the navigation pane, and then choose the tab you're interested in. • Intelligent threat integration is available for JavaScript and mobile applications. Client application integrations 459 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide The tab contains the following: • A list of the web ACLs that are enabled for intelligent threat application integration. The list includes each web ACL that uses the AWSManagedRulesACFPRuleSet managed rule group, the AWSManagedRulesATPRuleSet managed rule group, or the targeted protection level of the AWSManagedRulesBotControlRuleSet managed rule group. When you implement the intelligent threat APIs, you use the integration URL for the web ACL that you want to integrate with. • The APIs that you have access to. The JavaScript APIs are always available. For access to the mobile SDKs, contact support at Contact AWS. • CAPTCHA integration is available for JavaScript applications. The tab contains the following: • The integration URL for use in your integration. • The API keys that you've created for your client application domains. Your use of the CAPTCHA API requires an encrypted API key that gives clients the right to access AWS WAF CAPTCHA from their domains. For each client that you integrate with, use an API key that contains the client's domain. For more information these requirements and about managing these keys, see Managing API keys for the JS CAPTCHA API. AWS WAF JavaScript integrations This section explains how to use the AWS WAF JavaScript integrations. You can use the JavaScript integration APIs to implement AWS WAF application integrations in your browsers and other devices that execute JavaScript. CAPTCHA puzzles and silent challenges can only run when browsers are accessing HTTPS endpoints. Browser clients must be running in secure contexts in order to acquire tokens. • The intelligent threat APIs let you manage token authorization through a silent client-side browser challenge, and to include the tokens in the requests that you send to your protected resources. • The CAPTCHA integration API adds to the intelligent threat APIs, and lets you customize the placement and characteristics of the CAPTCHA puzzle in your client applications. This API leverages the intelligent threat APIs to acquire AWS WAF tokens for use in the page after the end user successfully completes the CAPTCHA puzzle. Client application integrations 460 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide By using these integrations, you ensure that the remote procedure calls by your client contain a valid token. When these integration APIs are in place on your application's pages, you can implement mitigating rules in your web ACL, such as blocking requests that don't contain a |
waf-dg-159 | waf-dg.pdf | 159 | customize the placement and characteristics of the CAPTCHA puzzle in your client applications. This API leverages the intelligent threat APIs to acquire AWS WAF tokens for use in the page after the end user successfully completes the CAPTCHA puzzle. Client application integrations 460 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide By using these integrations, you ensure that the remote procedure calls by your client contain a valid token. When these integration APIs are in place on your application's pages, you can implement mitigating rules in your web ACL, such as blocking requests that don't contain a valid token. You can also implement rules that enforce the use of the tokens that your client applications obtain, by using the Challenge or CAPTCHA actions in your rules. Example implementation of intelligent threat APIs The following listing shows basic components of a typical implementation of the intelligent threat APIs in a web application page. <head> <script type="text/javascript" src="Web ACL integration URL/challenge.js" defer></ script> </head> <script> const login_response = await AwsWafIntegration.fetch(login_url, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: login_body }); </script> Example implementation of CAPTCHA JavaScript API The CAPTCHA integration API lets you customize your end users' CAPTCHA puzzle experience. The CAPTCHA integration leverages the JavaScript intelligent threat integration, for browser verification and token management, and adds a function for configuring and rendering the CAPTCHA puzzle. The following listing shows basic components of a typical implementation of the CAPTCHA JavaScript API in a web application page. <head> <script type="text/javascript" src="<Integration URL>/jsapi.js" defer></script> </head> <script type="text/javascript"> function showMyCaptcha() { var container = document.querySelector("#my-captcha-container"); Client application integrations 461 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide AwsWafCaptcha.renderCaptcha(container, { apiKey: "...API key goes here...", onSuccess: captchaExampleSuccessFunction, onError: captchaExampleErrorFunction, ...other configuration parameters as needed... }); } function captchaExampleSuccessFunction(wafToken) { // Use WAF token to access protected resources AwsWafIntegration.fetch("...WAF-protected URL...", { method: "POST", ... }); } function captchaExampleErrorFunction(error) { /* Do something with the error */ } </script> <div id="my-captcha-container"> <!-- The contents of this container will be replaced by the captcha widget --> </div> Topics • Providing domains for use in the tokens • Using the JavaScript API with content security policies • Using the intelligent threat JavaScript API • Using the CAPTCHA JavaScript API Providing domains for use in the tokens This section explains how to provide additional domains for tokens. By default, when AWS WAF creates a token, it uses the host domain of the resource that’s associated with the web ACL. You can provide additional domains for the tokens that AWS WAF creates for the JavaScript APIs. To do this, configure the global variable window.awsWafCookieDomainList, with one or more token domains. Client application integrations 462 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide When AWS WAF creates a token, it uses the most appropriate, shortest domain from among the combination of the domains in window.awsWafCookieDomainList and the host domain of the resource that’s associated with the web ACL. Example settings: window.awsWafCookieDomainList = ['.aws.amazon.com'] window.awsWafCookieDomainList = ['.aws.amazon.com', 'abc.aws.amazon.com'] You can't use public suffixes in this list. For example, you can't use gov.au or co.uk as token domains in the list. The domains that you specify in this list must be compatible with your other domains and domain configurations: • The domains must be ones that AWS WAF will accept, based on the protected host domain and the token domain list that's configured for the web ACL. For more information, see AWS WAF web ACL token domain list configuration. • If you use the JavaScript CAPTCHA API, at least one domain in your CAPTCHA API key must be an exact match for one of the token domains in window.awsWafCookieDomainList or it must be the apex domain of one of those token domains. For example, for the token domain mySubdomain.myApex.com, the API key mySubdomain.myApex.com is an exact match and the API key myApex.com is the apex domain. Either key matches the token domain. For more information about the API keys, see Managing API keys for the JS CAPTCHA API. If you use the AWSManagedRulesACFPRuleSet managed rule group, you might configure a domain that matches the one in the account creation path that you provided to the rule group configuration. For more information about this configuration, see Adding the ACFP managed rule group to your web ACL. If you use the AWSManagedRulesATPRuleSet managed rule group, you might configure a domain that matches the one in the login path that you provided to the rule group configuration. For more information about this configuration, see Adding the ATP managed rule group to your web ACL. Client application integrations 463 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Using the JavaScript API with content security policies This section provides an example configuration to allowlist the AWS WAF |
waf-dg-160 | waf-dg.pdf | 160 | rule group configuration. For more information about this configuration, see Adding the ACFP managed rule group to your web ACL. If you use the AWSManagedRulesATPRuleSet managed rule group, you might configure a domain that matches the one in the login path that you provided to the rule group configuration. For more information about this configuration, see Adding the ATP managed rule group to your web ACL. Client application integrations 463 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Using the JavaScript API with content security policies This section provides an example configuration to allowlist the AWS WAF apex domain. If you apply content security policies (CSP) to your resources, for your JavaScript implementation to work, you need to allowlist the AWS WAF apex domain awswaf.com. The JavaScript SDKs make calls to different AWS WAF endpoints, so allowlisting this domain provides the permissions that the SDKs need to operate. The following shows an example configuration to allowlist the AWS WAF apex domain: connect-src 'self' https://*.awswaf.com; script-src 'self' https://*.awswaf.com; script-src-elem 'self' https://*.awswaf.com; If you try to use the JavaScript SDKs with resources that use CSP, and you haven't allowlisted the AWS WAF domain, you'll receive errors like the following: Refused to load the script ...awswaf.com/<> because it violates the following Content Security Policy directive: “script-src ‘self’ Using the intelligent threat JavaScript API This section provides instructions for using the intelligent threat JavaScript API in your client application. The intelligent threat APIs provide operations for running silent challenges against the user's browser, and for handling the AWS WAF tokens that provide proof of successful challenge and CAPTCHA responses. Implement the JavaScript integration first in a test environment, then in production. For additional coding guidance, see the sections that follow. To use the intelligent threat APIs 1. Install the APIs If you use the CAPTCHA API, you can skip this step. When you install the CAPTCHA API, the script automatically installs the intelligent threat APIs. Client application integrations 464 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide a. Sign in to the AWS Management Console and open the AWS WAF console at https:// console.aws.amazon.com/wafv2/. b. c. d. In the navigation pane, choose Application integration. On the Application integration page, you can see tabbed options. Select Intelligent threat integration In the tab, select the web ACL that you want to integrate with. The web ACL list includes only web ACLs that use the AWSManagedRulesACFPRuleSet managed rule group, the AWSManagedRulesATPRuleSet managed rule group, or the targeted protection level of the AWSManagedRulesBotControlRuleSet managed rule group. e. Open the JavaScript SDK pane, and copy the script tag for use in your integration. f. In your application page code, in the <head> section, insert the script tag that you copied for the web ACL. This inclusion causes your client application to automatically retrieve a token in the background on page load. <head> <script type="text/javascript" src="Web ACL integration URL/challenge.js” defer></script> <head> This <script> listing is configured with the defer attribute, but you can change the setting to async if you want a different behavior for your page. 2. (Optional) Add domain configuration for the client's tokens – By default, when AWS WAF creates a token, it uses the host domain of the resource that’s associated with the web ACL. To provide additional domains for the JavaScript APIs, follow the guidance at Providing domains for use in the tokens. 3. Code your intelligent threat integration – Write your code to ensure that token retrieval completes before the client sends its requests to your protected endpoints. If you are already using the fetch API to make your call, you can substitute the AWS WAF integration fetch wrapper. If you don't use the fetch API, you can use the AWS WAF integration getToken operation instead. For coding guidance, see the following sections. 4. Add token verification in your web ACL – Add at least one rule to your web ACL that checks for a valid challenge token in the web requests that your client sends. You can use rule groups that check and monitor challenge tokens, like the targeted level of the Bot Control managed rule group, and you can use the Challenge rule action to check, as described in CAPTCHA and Challenge in AWS WAF. Client application integrations 465 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide The web ACL additions verify that requests to your protected endpoints include the token that you've acquired in your client integration. Requests that include a valid, unexpired token pass the Challenge inspection and do not send another silent challenge to your client. 5. (Optional) Block requests that are missing tokens – If you use the APIs with the ACFP managed rule group, the ATP managed rule group, or the targeted rules of the Bot Control rule |
waf-dg-161 | waf-dg.pdf | 161 | as described in CAPTCHA and Challenge in AWS WAF. Client application integrations 465 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide The web ACL additions verify that requests to your protected endpoints include the token that you've acquired in your client integration. Requests that include a valid, unexpired token pass the Challenge inspection and do not send another silent challenge to your client. 5. (Optional) Block requests that are missing tokens – If you use the APIs with the ACFP managed rule group, the ATP managed rule group, or the targeted rules of the Bot Control rule group, these rules don't block requests that are missing tokens. To block requests that are missing tokens, follow the guidance at Blocking requests that don't have a valid AWS WAF token. Topics • Intelligent threat API specification • How to use the integration fetch wrapper • How to use the integration getToken Intelligent threat API specification This section lists the specification for the methods and properties of the intelligent threat mitigation JavaScript APIs. Use these APIs for intelligent threat and CAPTCHA integrations. AwsWafIntegration.fetch() Sends the HTTP fetch request to the server using the AWS WAF integration implementation. AwsWafIntegration.getToken() Retrieves the stored AWS WAF token and stores it in a cookie on the current page with name aws-waf-token, and the value set to the token value. AwsWafIntegration.hasToken() Returns a boolean indicating whether the aws-waf-token cookie currently holds an unexpired token. If you're also using the CAPTCHA integration, see the specification for that at CAPTCHA JavaScript API specification. How to use the integration fetch wrapper This section provides instructions for using the integration fetch wrapper. Client application integrations 466 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide You can use the AWS WAF fetch wrapper by changing your normal fetch calls to the fetch API under the AwsWafIntegration namespace. The AWS WAF wrapper supports all of the same options as the standard JavaScript fetch API call and adds the token handling for the integration. This approach is generally the simplest way to integrate your application. Before the wrapper implementation The following example listing shows standard code before implementing the AwsWafIntegration fetch wrapper. const login_response = await fetch(login_url, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: login_body }); After the wrapper implementation The following listing shows the same code with the AwsWafIntegration fetch wrapper implementation. const login_response = await AwsWafIntegration.fetch(login_url, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: login_body }); How to use the integration getToken This section explains how to use the getToken operation. AWS WAF requires your requests to protected endpoints to include the cookie named aws-waf- token with the value of your current token. The getToken operation is an asynchronous API call that retrieves the AWS WAF token and stores it in a cookie on the current page with name aws-waf-token, and the value set to the token value. You can use this token cookie as needed in your page. Client application integrations 467 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide When you call getToken, it does the following: • If an unexpired token is already available, the call returns it immediately. • Otherwise, the call retrieves a new token from the token provider, waiting for up to 2 seconds for the token acquisition workflow to complete before timing out. If the operation times out, it throws an error, which your calling code must handle. The getToken operation has an accompanying hasToken operation, which indicates whether the aws-waf-token cookie currently holds an unexpired token. AwsWafIntegration.getToken() retrieves a valid token and stores it as a cookie. Most client calls automatically attach this cookie, but some don't. For example, calls made across host domains don't attach the cookie. In the implementation details that follow, we show how to work with both types of client calls. Basic getToken implementation, for calls that attach the aws-waf-token cookie The following example listing shows standard code for implementing the getToken operation with a login request. const login_response = await AwsWafIntegration.getToken() .catch(e => { // Implement error handling logic for your use case }) // The getToken call returns the token, and doesn't typically require special handling .then(token => { return loginToMyPage() }) async function loginToMyPage() { // Your existing login code } Submit form only after token is available from getToken The following listing shows how to register an event listener to intercept form submissions until a valid token is available for use. <body> Client application integrations 468 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide <h1>Login</h1> <p></p> <form id="login-form" action="/web/login" method="POST" enctype="application/x-www- form-urlencoded"> <label for="input_username">USERNAME</label> <input type="text" name="input_username" id="input_username"><br> <label for="input_password">PASSWORD</label> <input type="password" name="input_password" id="input_password"><br> <button type="submit">Submit<button> </form> <script> const form = document.querySelector("#login-form"); // Register an event listener to intercept form submissions form.addEventListener("submit", |
waf-dg-162 | waf-dg.pdf | 162 | => { return loginToMyPage() }) async function loginToMyPage() { // Your existing login code } Submit form only after token is available from getToken The following listing shows how to register an event listener to intercept form submissions until a valid token is available for use. <body> Client application integrations 468 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide <h1>Login</h1> <p></p> <form id="login-form" action="/web/login" method="POST" enctype="application/x-www- form-urlencoded"> <label for="input_username">USERNAME</label> <input type="text" name="input_username" id="input_username"><br> <label for="input_password">PASSWORD</label> <input type="password" name="input_password" id="input_password"><br> <button type="submit">Submit<button> </form> <script> const form = document.querySelector("#login-form"); // Register an event listener to intercept form submissions form.addEventListener("submit", (e) => { // Submit the form only after a token is available if (!AwsWafIntegration.hasToken()) { e.preventDefault(); AwsWafIntegration.getToken().then(() => { e.target.submit(); }, (reason) => { console.log("Error:"+reason) }); } }); </script> </body> Attaching the token when your client doesn't attach the aws-waf-token cookie by default AwsWafIntegration.getToken() retrieves a valid token and stores it as a cookie, but not all client calls attach this cookie by default. For example, calls made across host domains don't attach the cookie. The fetch wrapper handles these cases automatically, but if you aren't able to use the fetch wrapper, you can handle this by using a custom x-aws-waf-token header. AWS WAF reads tokens from this header, in addition to reading them from the aws-waf-token cookie. The following code shows an example of setting the header. const token = await AwsWafIntegration.getToken(); const result = await fetch('/url', { headers: { 'x-aws-waf-token': token, Client application integrations 469 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide }, }); By default, AWS WAF only accepts tokens that contain the same domain as the requested host domain. Any cross-domain tokens require corresponding entries in the web ACL token domain list. For more information, see AWS WAF web ACL token domain list configuration. For additional information about cross-domain token use, see aws-samples/aws-waf-bot-control- api-protection-with-captcha. Using the CAPTCHA JavaScript API This section provides instructions for using the CAPTCHA integration API. The CAPTCHA JavaScript API allows you to configure the CAPTCHA puzzle and place it where you want in your client application. This API leverages the features of the intelligent threat JavaScript APIs to acquire and use AWS WAF tokens after an end user successfully completes a CAPTCHA puzzle. Implement the JavaScript integration first in a test environment, then in production. For additional coding guidance, see the sections that follow. To use the CAPTCHA integration API 1. Install the API a. Sign in to the AWS Management Console and open the AWS WAF console at https:// console.aws.amazon.com/wafv2/. b. In the navigation pane, choose Application integration. On the Application integration page, you can see tabbed options. c. Select CAPTCHA integration. d. Copy the listed JavaScript integration script tag for use in your integration. e. In your application page code, in the <head> section, insert the script tag that you copied. This inclusion makes the CAPTCHA puzzle available for configuration and use. <head> <script type="text/javascript" src="integrationURL/jsapi.js" defer></ script> </head> Client application integrations 470 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide This <script> listing is configured with the defer attribute, but you can change the setting to async if you want a different behavior for your page. The CAPTCHA script also automatically loads the intelligent threat integration script if it isn't already present. The intelligent threat integration script causes your client application to automatically retrieve a token in the background on page load, and provides other token management functionality that you need for your use of the CAPTCHA API. 2. (Optional) Add domain configuration for the client's tokens – By default, when AWS WAF creates a token, it uses the host domain of the resource that’s associated with the web ACL. To provide additional domains for the JavaScript APIs, follow the guidance at Providing domains for use in the tokens. 3. Get the encrypted API key for the client – The CAPTCHA API requires an encrypted API key that contains a list of valid client domains. AWS WAF uses this key to verify that the client domain you're using with the integration is approved to use AWS WAF CAPTCHA. To generate your API key, follow the guidance at Managing API keys for the JS CAPTCHA API. 4. Code your CAPTCHA widget implementation – Implement the renderCaptcha() API call in your page, at the location where you want to use it. For information about configuring and using this function, see the following sections, CAPTCHA JavaScript API specification and How to render the CAPTCHA puzzle. The CAPTCHA implementation integrates with the intelligent threat integration APIs for token management and to run fetch calls that use the AWS WAF tokens. For guidance about using these APIs, see Using the intelligent threat JavaScript API. 5. Add token verification in your web ACL – Add at least |
waf-dg-163 | waf-dg.pdf | 163 | the JS CAPTCHA API. 4. Code your CAPTCHA widget implementation – Implement the renderCaptcha() API call in your page, at the location where you want to use it. For information about configuring and using this function, see the following sections, CAPTCHA JavaScript API specification and How to render the CAPTCHA puzzle. The CAPTCHA implementation integrates with the intelligent threat integration APIs for token management and to run fetch calls that use the AWS WAF tokens. For guidance about using these APIs, see Using the intelligent threat JavaScript API. 5. Add token verification in your web ACL – Add at least one rule to your web ACL that checks for a valid CAPTCHA token in the web requests that your client sends. You can use the CAPTCHA rule action to check, as described in CAPTCHA and Challenge in AWS WAF. The web ACL additions verify that requests going to your protected endpoints include the token that you've acquired in your client integration. Requests that include a valid, unexpired CAPTCHA token pass the CAPTCHA rule action inspection and do not present your end user with another CAPTCHA puzzle. After you've implemented the JavaScript API, you can review the CloudWatch metrics for CAPTCHA puzzle attempts and solutions. For metrics and dimension details, see Account metrics and dimensions. Client application integrations 471 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Topics • CAPTCHA JavaScript API specification • How to render the CAPTCHA puzzle • Handling a CAPTCHA response from AWS WAF • Managing API keys for the JS CAPTCHA API CAPTCHA JavaScript API specification This section lists the specification for the methods and properties of the CAPTCHA JavaScript APIs. Use the CAPTCHA JavaScript APIs to run custom CAPTCHA puzzles in your client applications. This API builds on the intelligent threat APIs, which you use to configure and manage AWS WAF token acquisition and use. See Intelligent threat API specification. . AwsWafCaptcha.renderCaptcha(container, configuration) Presents an AWS WAF CAPTCHA puzzle to the end user and, upon success, updates the client token with the CAPTCHA validation. This is available only with the CAPTCHA integration. Use this call along with the intelligent threat APIs to manage token retrieval and to provide the token in your fetch calls. See the intelligent threat APIs at Intelligent threat API specification. Unlike the CAPTCHA interstitial that AWS WAF sends, the CAPTCHA puzzle rendered by this method displays the puzzle immediately, without an initial title screen. container The Element object for the target container element on the page. This is commonly retrieved by calling document.getElementById() or document.querySelector(). Required: Yes Type: Element configuration An object containing CAPTCHA configuration settings, as follows: apiKey The encrypted API key that enables permissions for the client's domain. Use the AWS WAF console to generate your API keys for your client domains. You can use one key for up to five domains. For information, see Managing API keys for the JS CAPTCHA API. Client application integrations 472 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Required: Yes Type: string onSuccess: (wafToken: string) => void; Called with a valid AWS WAF token when the end user successfully completes a CAPTCHA puzzle. Use the token in the requests that you send to the endpoints that you protect with an AWS WAF web ACL. The token provides proof and the timestamp of the latest successful puzzle completion. Required: Yes onError?: (error: CaptchaError) => void; Called with an error object when an error occurs during the CAPTCHA operation. Required: No CaptchaError class definition – The onError handler supplies an error type with the following class definition. CaptchaError extends Error { kind: "internal_error" | "network_error" | "token_error" | "client_error"; statusCode?: number; } • kind – The kind of error returned. • statusCode – The HTTP status code, if available. This is used by network_error if the error is due to an HTTP error. onLoad?: () => void; Called when a new CAPTCHA puzzle loads. Required: No onPuzzleTimeout?: () => void; Called when a CAPTCHA puzzle isn't completed before it expires. Required: No onPuzzleCorrect?: () => void; Called when a correct answer is provided to a CAPTCHA puzzle. Client application integrations 473 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Required: No onPuzzleIncorrect?: () => void; Called when an incorrect answer is provided to a CAPTCHA puzzle. Required: No defaultLocale The default locale to use for the CAPTCHA puzzle. The written instructions for CAPTCHA puzzles are available in Arabic (ar-SA), simplified Chinese (zh-CN), Dutch (nl-NL), English (en-US), French (fr-FR), German (de-DE), Italian (it-IT), Japanese (ja-JP), Brazilian Portuguese (pt-BR), Spanish (es-ES), and Turkish (tr-TR). Audio instructions are available for all of the written languages except Chinese and Japanese, which default to English. To change the default language, provide the international language and locale code, for example, ar-SA. |
waf-dg-164 | waf-dg.pdf | 164 | Shield Advanced Developer Guide Required: No onPuzzleIncorrect?: () => void; Called when an incorrect answer is provided to a CAPTCHA puzzle. Required: No defaultLocale The default locale to use for the CAPTCHA puzzle. The written instructions for CAPTCHA puzzles are available in Arabic (ar-SA), simplified Chinese (zh-CN), Dutch (nl-NL), English (en-US), French (fr-FR), German (de-DE), Italian (it-IT), Japanese (ja-JP), Brazilian Portuguese (pt-BR), Spanish (es-ES), and Turkish (tr-TR). Audio instructions are available for all of the written languages except Chinese and Japanese, which default to English. To change the default language, provide the international language and locale code, for example, ar-SA. Default: The language currently in use in the end user's browser Required: No Type: string disableLanguageSelector If set to true, the CAPTCHA puzzle hides the language selector. Default: false Required: No Type: boolean dynamicWidth If set to true, the CAPTCHA puzzle changes width for compatibility with the browser window width. Default: false Required: No Type: boolean Client application integrations 474 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide skipTitle If set to true, the CAPTCHA puzzle doesn't display the puzzle title heading Solve the puzzle. Default: false Required: No Type: boolean How to render the CAPTCHA puzzle This section provides an example renderCaptcha implementation. You can use the AWS WAF renderCaptcha call where you want to in your client interface. The call retrieves a CAPTCHA puzzle from AWS WAF, renders it, and sends the results to AWS WAF for verification. When you make the call, you provide the puzzle rendering configuration and the callbacks that you want to run when your end users complete the puzzle. For details about the options, see the preceding section, CAPTCHA JavaScript API specification. Use this call in conjunction with the token management functionality of the intelligent threat integration APIs. This call gives your client a token that verifies the successful completion of the CAPTCHA puzzle. Use the intelligent threat integration APIs to manage the token and to provide the token in your client's calls to the endpoints that are protected with AWS WAF web ACLs. For information about the intelligent threat APIs, see Using the intelligent threat JavaScript API. Example implementation The following example listing shows a standard CAPTCHA implementation, including the placement of the AWS WAF integration URL in the <head> section. This listing configures the renderCaptcha function with a success callback that uses the AwsWafIntegration.fetch wrapper of the intelligent threat integration APIs. For information about this function, see How to use the integration fetch wrapper. <head> <script type="text/javascript" src="<Integration URL>/jsapi.js" defer></script> </head> <script type="text/javascript"> Client application integrations 475 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide function showMyCaptcha() { var container = document.querySelector("#my-captcha-container"); AwsWafCaptcha.renderCaptcha(container, { apiKey: "...API key goes here...", onSuccess: captchaExampleSuccessFunction, onError: captchaExampleErrorFunction, ...other configuration parameters as needed... }); } function captchaExampleSuccessFunction(wafToken) { // Captcha completed. wafToken contains a valid WAF token. Store it for // use later or call AwsWafIntegration.fetch() to use it easily. // It will expire after a time, so calling AwsWafIntegration.getToken() // again is advised if the token is needed later on, outside of using the // fetch wrapper. // Use WAF token to access protected resources AwsWafIntegration.fetch("...WAF-protected URL...", { method: "POST", headers: { "Content-Type": "application/json", }, body: "{ ... }" /* body content */ }); } function captchaExampleErrorFunction(error) { /* Do something with the error */ } </script> <div id="my-captcha-container"> <!-- The contents of this container will be replaced by the captcha widget --> </div> Example configuration settings The following example listing shows the renderCaptcha with non-default settings for the width and the title options. Client application integrations 476 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide AwsWafCaptcha.renderCaptcha(container, { apiKey: "...API key goes here...", onSuccess: captchaExampleSuccessFunction, onError: captchaExampleErrorFunction, dynamicWidth: true, skipTitle: true }); For full information about the configuration options, see CAPTCHA JavaScript API specification. Handling a CAPTCHA response from AWS WAF This section provides an example of handling a CAPTCHA response. An AWS WAF rule with a CAPTCHA action terminates the evaluation of a matching web request if the request doesn't have a token with a valid CAPTCHA timestamp. If the request is a GET text/ html call, the CAPTCHA action then serves the client an interstitial with a CAPTCHA puzzle. When you don't integrate the CAPTCHA JavaScript API, the interstitial runs the puzzle and, if the end user successfully solves it, automatically resubmits the request. When you integrate the CAPTCHA JavaScript API and customize your CAPTCHA handling, you need to detect the terminating CAPTCHA response, serve your custom CAPTCHA, and then if the end user successfully solves the puzzle, resubmit the client's web request. The following code example shows how to do this. Note The AWS WAF CAPTCHA action response has a status code of HTTP 405, which we use to recognize the CAPTCHA response |
waf-dg-165 | waf-dg.pdf | 165 | interstitial with a CAPTCHA puzzle. When you don't integrate the CAPTCHA JavaScript API, the interstitial runs the puzzle and, if the end user successfully solves it, automatically resubmits the request. When you integrate the CAPTCHA JavaScript API and customize your CAPTCHA handling, you need to detect the terminating CAPTCHA response, serve your custom CAPTCHA, and then if the end user successfully solves the puzzle, resubmit the client's web request. The following code example shows how to do this. Note The AWS WAF CAPTCHA action response has a status code of HTTP 405, which we use to recognize the CAPTCHA response in this code. If your protected endpoint uses an HTTP 405 status code to communicate any other type of response for the same call, this example code will render a CAPTCHA puzzle for those responses as well. <!DOCTYPE html> <html> <head> <script type="text/javascript" src="<Integration URL>/jsapi.js" defer></script> </head> <body> Client application integrations 477 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide <div id="my-captcha-box"></div> <div id="my-output-box"></div> <script type="text/javascript"> async function loadData() { // Attempt to fetch a resource that's configured to trigger a CAPTCHA // action if the rule matches. The CAPTCHA response has status=HTTP 405. const result = await AwsWafIntegration.fetch("/protected-resource"); // If the action was CAPTCHA, render the CAPTCHA and return // NOTE: If the endpoint you're calling in the fetch call responds with HTTP 405 // as an expected response status code, then this check won't be able to tell the // difference between that and the CAPTCHA rule action response. if (result.status === 405) { const container = document.querySelector("#my-captcha-box"); AwsWafCaptcha.renderCaptcha(container, { apiKey: "...API key goes here...", onSuccess() { // Try loading again, now that there is a valid CAPTCHA token loadData(); }, }); return; } const container = document.querySelector("#my-output-box"); const response = await result.text(); container.innerHTML = response; } window.addEventListener("load", () => { loadData(); }); </script> </body> </html> Managing API keys for the JS CAPTCHA API This section provides instructions for generating and deleting API keys. Client application integrations 478 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide To integrate AWS WAF CAPTCHA into a a client application with the JavaScript API, you need the JavaScript API integration tag and the encrypted API key for the client domain where you want to run your CAPTCHA puzzle. The CAPTCHA application integration for JavaScript uses the encrypted API keys to verify that the client application domain has permission to use the AWS WAF CAPTCHA API. When you call the CAPTCHA API from your JavaScript client, you provide an API key with a domain list that includes a domain for the current client. You can list up to 5 domains in a single encrypted key. API key requirements The API key that you use in your CAPTCHA integration must contain a domain that applies to the client where you use the key. • If you specify a window.awsWafCookieDomainList in your client's intelligent threat integration, then at least one domain in your API key must be an exact match for one of the token domains in window.awsWafCookieDomainList or it must be the apex domain of one of those token domains. For example, for the token domain mySubdomain.myApex.com, the API key mySubdomain.myApex.com is an exact match and the API key myApex.com is the apex domain. Either key matches the token domain. For information about the setting the token domain list, see Providing domains for use in the tokens. • Otherwise, the current domain must be contained in the API key. The current domain is the domain that you can see in the browser address bar. The domains that you use must be ones that AWS WAF will accept, based on the protected host domain and the token domain list that's configured for the web ACL. For more information, see AWS WAF web ACL token domain list configuration. How to choose the Region for your API key AWS WAF can generate CAPTCHA API keys in any Region where AWS WAF is available. As a general rule, you should use the same Region for your CAPTCHA API key as you use for your web ACL. If you expect a global audience for a regional web ACL, however, you can obtain a CAPTCHA JavaScript integration tag that's scoped to CloudFront and an API key that's scoped to Client application integrations 479 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide CloudFront, and use them with a regional web ACL. This approach allows clients to load a CAPTCHA puzzle from the Region that's closest to them, which reduces latency. CAPTCHA API keys that are scoped to Regions other than CloudFront are not supported for use across multiple Regions. They can only be used in the Region they are scoped to. To generate an API key for your client domains To obtain |
waf-dg-166 | waf-dg.pdf | 166 | CAPTCHA JavaScript integration tag that's scoped to CloudFront and an API key that's scoped to Client application integrations 479 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide CloudFront, and use them with a regional web ACL. This approach allows clients to load a CAPTCHA puzzle from the Region that's closest to them, which reduces latency. CAPTCHA API keys that are scoped to Regions other than CloudFront are not supported for use across multiple Regions. They can only be used in the Region they are scoped to. To generate an API key for your client domains To obtain the integration URL and generate and retrieve the API keys through the console. 1. Sign in to the AWS Management Console and open the AWS WAF console at https:// 2. 3. console.aws.amazon.com/wafv2/. In the navigation pane, choose Application integration. In the pane, Web ACLs that are enabled for application integration, select the Region that you want to use for your API key. You can also select the Region in the API keys pane of the CAPTCHA integration tab. 4. Choose the tab CAPTCHA integration. This tab provides the CAPTCHA JavaScript integration tag, which you can use in your integration, and the API keys listing. Both are scoped to the selected Region. 5. 6. In the API keys pane, choose Generate key. The key generation dialogue appears. Enter the client domains that you want to include in the key. You can enter up to 5. When you're finished, choose Generate key. The interface returns to the CAPTCHA integration tab, where your new key is listed. Once created, an API key is immutable. If you need to make changes to a key, generate a new key and use that instead. 7. (Optional) Copy the newly generated key for use in your integration. You can also use the REST APIs or one of the language-specific AWS SDKs for this work. The REST API calls are CreateAPIKey and ListAPIKeys. To delete an API key To delete an API key, you must use the REST API or one of the language specific AWS SDKs. The REST API call is DeleteAPIKey. You can't use the console to delete a key. After you delete a key, it can take up to 24 hours for AWS WAF to disallow use of the key in all regions. Client application integrations 480 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide AWS WAF mobile application integration This section introduces the topic of using the AWS WAF mobile SDKs to implement AWS WAF intelligent threat integration SDKs for Android and iOS mobile and TV apps. For TV apps, the SDKs are compatible with major smart TV platforms, including Android TV and Apple TV. • For Android mobile and TV apps, the SDKs work for Android API version 23 (Android version 6) and later. For information about Android versions, see SDK Platform release notes. • For iOS mobile apps, the SDKs work for iOS version 13 and later. For information about iOS versions, see iOS & iPadOS Release Notes. • For Apple TV apps, the SDKs work for tvOS version 14 or later. For information about tvOS versions, see tvOS Release Notes. With the mobile AWS WAF SDK, you can manage token authorization, and include the tokens in the requests that you send to your protected resources. By using the SDKs, you ensure that these remote procedure calls by your client contain a valid token. Additionally, when this integration is in place on your application's pages, you can implement mitigating rules in your web ACL, such as blocking requests that don't contain a valid token. For access to the mobile SDKs, contact support at Contact AWS. Note The AWS WAF mobile SDKs aren't available for CAPTCHA customization. The basic approach for using the SDK is to create a token provider using a configuration object, then to use the token provider to retrieve tokens from AWS WAF. By default, the token provider includes the retrieved tokens in your web requests to your protected resource. The following is a partial listing of an SDK implementation, which shows the main components. For more detailed examples, see Code examples for the AWS WAF mobile SDK. iOS let url: URL = URL(string: "Web ACL integration URL")! let configuration = WAFConfiguration(applicationIntegrationUrl: url, domainName: "Domain name") let tokenProvider = WAFTokenProvider(configuration) Client application integrations 481 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide let token = tokenProvider.getToken() Android URL applicationIntegrationURL = new URL("Web ACL integration URL"); String domainName = "Domain name"; WAFConfiguration configuration = WAFConfiguration.builder().applicationIntegrationURL(applicationIntegrationURL).domainName(domainName).build(); WAFTokenProvider tokenProvider = new WAFTokenProvider(Application context, configuration); WAFToken token = tokenProvider.getToken(); Installing the AWS WAF mobile SDK This section provides instructions for installing the AWS WAF mobile SDK. For access to the mobile SDKs, contact support at Contact AWS. Implement |
waf-dg-167 | waf-dg.pdf | 167 | SDK. iOS let url: URL = URL(string: "Web ACL integration URL")! let configuration = WAFConfiguration(applicationIntegrationUrl: url, domainName: "Domain name") let tokenProvider = WAFTokenProvider(configuration) Client application integrations 481 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide let token = tokenProvider.getToken() Android URL applicationIntegrationURL = new URL("Web ACL integration URL"); String domainName = "Domain name"; WAFConfiguration configuration = WAFConfiguration.builder().applicationIntegrationURL(applicationIntegrationURL).domainName(domainName).build(); WAFTokenProvider tokenProvider = new WAFTokenProvider(Application context, configuration); WAFToken token = tokenProvider.getToken(); Installing the AWS WAF mobile SDK This section provides instructions for installing the AWS WAF mobile SDK. For access to the mobile SDKs, contact support at Contact AWS. Implement the mobile SDK first in a test environment, then in production. To install the AWS WAF mobile SDK 1. Sign in to the AWS Management Console and open the AWS WAF console at https:// console.aws.amazon.com/wafv2/. 2. 3. In the navigation pane, choose Application integration. In the Intelligent threat integrations tab, do the following: a. In the pane Web ACLs that are enabled for application integration, locate the web ACL that you're integrating with. Copy and save the web ACL integration URL for use in your implementation. You can also obtain this URL through the API call GetWebACL. b. Choose the mobile device type and version, then choose Download. You can choose any version you like, but we recommend using the latest version. AWS WAF downloads the zip file for your device to your standard download location. 4. In your app development environment, unzip the file to a work location of your choice. In the top-level directory of the zip file, locate and open the README. Follow the instructions in the README file to install the AWS WAF mobile SDK for use in your mobile app code. 5. Program your app according to the guidance in the following sections. Client application integrations 482 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide AWS WAF mobile SDK specification This section lists the SDK objects, operations, and configuration settings for the latest available version of the AWS WAF mobile SDK. For detailed information about how the token provider and operations work for the various combinations of configuration settings, see How the AWS WAF mobile SDK works. WAFToken Holds an AWS WAF token. getValue() Retrieves the String representation of the WAFToken. WAFTokenProvider Manages tokens in your mobile app. Implement this using a WAFConfiguration object. getToken() If background refresh is enabled, this returns the cached token. If background refresh is disabled, this makes a synchronous, blocking call to AWS WAF to retrieve a new token. loadTokenIntoProvider(WAFToken) Loads the specified token into the WAFTokenProvider, replacing any token that the provider was managing. The token provider takes ownership of the new token and handles refreshing it going forward. This operation also updates the token in the cookie store, if setTokenCookie is enabled in the WAFConfiguration. onTokenReady(WAFTokenResultCallback) Instructs the token provider to refresh the token and invoke the provided callback when an active token is ready. The token provider will invoke your callback in a background thread when the token is cached and ready. Call this when your app first loads and also when it comes back to an active state. For more information about returning to an active state, see the section called “Retrieving a token following app inactivity”. For Android or iOS apps, you can set WAFTokenResultCallback to the operation that you want the token provider to invoke when a requested token is ready. Your implementation of WAFTokenResultCallback must take the parameters WAFToken, SdkError. For iOS apps, you can alternately create an inline function. Client application integrations 483 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide storeTokenInCookieStorage(WAFToken) Instructs the WAFTokenProvider to store the specified AWS WAF token into the SDK’s cookie manager. By default, the token is only added to the cookie store when it's first acquired and when it's refreshed. If the application clears the shared cookie store for any reason, the SDK doesn't automatically add the AWS WAF token back until the next refresh. WAFConfiguration Holds the configuration for the implementation of the WAFTokenProvider. When you implement this, you provide your web ACL’s integration URL, the domain name to use in the token, and any non-default settings that you want the token provider to use. The following list specifies the configuration settings that you can manage in the WAFConfiguration object. applicationIntegrationUrl The application integration URL. Get this from the AWS WAF console or through the getWebACL API call. Required: Yes Type: App-specific URL. For iOS, see iOS URL. For Android, see java.net URL. backgroundRefreshEnabled Indicates whether you want the token provider to refresh the token in the background. If you set this, the token provider refreshes your tokens in the background according to the configuration settings that govern automatic token refresh activities. Required: No Type: Boolean Default value: TRUE |
waf-dg-168 | waf-dg.pdf | 168 | want the token provider to use. The following list specifies the configuration settings that you can manage in the WAFConfiguration object. applicationIntegrationUrl The application integration URL. Get this from the AWS WAF console or through the getWebACL API call. Required: Yes Type: App-specific URL. For iOS, see iOS URL. For Android, see java.net URL. backgroundRefreshEnabled Indicates whether you want the token provider to refresh the token in the background. If you set this, the token provider refreshes your tokens in the background according to the configuration settings that govern automatic token refresh activities. Required: No Type: Boolean Default value: TRUE domainName The domain to use in the token, which is used in token acquisition and cookie storage. For example, example.com or aws.amazon.com. This is usually the host domain of your resource that’s associated with the web ACL, where you’ll be sending web requests. For the ACFP managed rule group, AWSManagedRulesACFPRuleSet, this will usually be a single domain that matches the domain in the account creation path that you provided in the rule Client application integrations 484 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide group configuration. For the ATP managed rule group, AWSManagedRulesATPRuleSet, this will usually be a single domain that matches the domain in the login path that you provided in the rule group configuration. Public suffixes aren't allowed. For example, you can't use gov.au or co.uk as the token domain. The domain must be one that AWS WAF will accept, based on the protected host domain and the web ACL's token domain list. For more information, see AWS WAF web ACL token domain list configuration. Required: Yes Type: String maxErrorTokenRefreshDelayMsec The maximum time in milliseconds to wait before repeating a token refresh after a failed attempt. This value is used after token retrieval has failed and been retried maxRetryCount times. Required: No Type: Integer Default value: 5000 (5 seconds) Minimum value allowed: 1 (1 millisecond) Maximum value allowed: 30000 (30 seconds) maxRetryCount The maximum number of retries to perform with exponential backoff when a token is requested. Required: No Type: Integer Default value: If background refresh is enabled, 5. Otherwise, 3. Minimum value allowed: 0 Maximum value allowed: 10 Client application integrations 485 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide setTokenCookie Indicates whether you want the SDK’s cookie manager to add a token cookie into requests and in other areas. With a TRUE value: • The cookie manager adds a token cookie to all requests whose path is under the path specified in tokenCookiePath. • The WAFTokenProvider operation loadTokenIntoProvider() updates the token in the cookie store, in addition to loading it into the token provider. Required: No Type: Boolean Default value: TRUE tokenCookiePath Used when setTokenCookie is TRUE. Indicates the top-level path where you want the SDK’s cookie manager to add a token cookie. The manager adds a token cookie to all requests that you send to this path and to all child paths. For example, if you set this to /web/login, then the manager includes the token cookie for everything sent to /web/login and any of its child paths, like /web/login/help. It doesn't include the token for requests sent to other paths, like /, /web, or /web/order. Required: No Type: String Default value: / tokenRefreshDelaySec Used for background refresh. The maximum amount of time in seconds between background token refreshes. Required: No Type: Integer Default value: 88 Client application integrations 486 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Minimum value allowed: 88 Maximum value allowed: 300 (5 minutes) How the AWS WAF mobile SDK works This section explains how the AWS WAF mobile SDK classes, properties, and operations work together. The mobile SDKs provide you with a configurable token provider that you can use for token retrieval and use. The token provider verifies that the requests that you allow are from legitimate customers. When you send requests to the AWS resources that you protect with AWS WAF, you include the token in a cookie, to validate the request. You can handle the token cookie manually or have the token provider do it for you. This section covers the interactions between the classes, properties, and methods that are included in the mobile SDK. For the SDK specification, see AWS WAF mobile SDK specification. Token retrieval and caching When you create the token provider instance in your mobile app, you configure how you want it to manage tokens and token retrieval. Your main choice is how to maintain valid, unexpired tokens for use in your app’s web requests: • Background refresh enabled – This is the default. The token provider automatically refreshes the token in the background and caches it. With background refresh enabled, when you call getToken(), the operation retrieves the cached token. The token provider performs |
waf-dg-169 | waf-dg.pdf | 169 | are included in the mobile SDK. For the SDK specification, see AWS WAF mobile SDK specification. Token retrieval and caching When you create the token provider instance in your mobile app, you configure how you want it to manage tokens and token retrieval. Your main choice is how to maintain valid, unexpired tokens for use in your app’s web requests: • Background refresh enabled – This is the default. The token provider automatically refreshes the token in the background and caches it. With background refresh enabled, when you call getToken(), the operation retrieves the cached token. The token provider performs the token refresh at configurable intervals, so that an unexpired token is always available in the cache while the application is active. Background refresh is paused while your application is in an inactive state. For information about this, see Retrieving a token following app inactivity. • Background refresh disabled – You can disable background token refresh, and then retrieve tokens only on demand. Tokens retrieved on demand aren't cached, and you can retrieve more than one if you want. Each token is independent of any others that you retrieve, and each has its own timestamp that's used to calculate expiration. You have the following choices for token retrieval when background refresh is disabled: Client application integrations 487 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide • getToken() – When you call getToken() with background refresh disabled, the call synchronously retrieves a new token from AWS WAF. This is a potentially blocking call that may affect app responsiveness if you invoke it on the main thread. • onTokenReady(WAFTokenResultCallback) – This call asynchronously retrieves a new token and then invokes the provided result callback in a background thread when a token is ready. How the token provider retries failed token retrievals The token provider automatically retries token retrieval when retrieval fails. Retries are initially performed using exponential backoff with a starting retry wait time of 100 ms. For information about exponential retries, see Error retries and exponential backoff in AWS. When the number of retries reaches the configured maxRetryCount, the token provider either stops trying or switches to trying every maxErrorTokenRefreshDelayMsec milliseconds, depending on the type of token retrieval: • onTokenReady() – The token provider switches to waiting maxErrorTokenRefreshDelayMsec milliseconds between attempts, and continues trying to retrieve the token. • Background refresh – The token provider switches to waiting maxErrorTokenRefreshDelayMsec milliseconds between attempts, and continues trying to retrieve the token. • On-demand getToken() calls, when background refresh is disabled – The token provider stops trying to retrieve a token and returns the previous token value, or a null value if there is no previous token. Retrieving a token following app inactivity Background refresh is only performed while your app is considered active for your app type: • iOS – Background refresh is performed when the app is in the foreground. • Android – Background refresh is performed when the app isn't closed, whether it's in the foreground or background. Client application integrations 488 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide If your app remains in any state that doesn’t support background refresh for longer than your configured tokenRefreshDelaySec seconds, the token provider pauses background refresh. For example, for an iOS app, if tokenRefreshDelaySec is 300 and the app closes or goes into the background for more than 300 seconds, the token provider stops refreshing the token. When the app returns to an active state, the token provider automatically restarts background refresh. When your app comes back to an active state, call onTokenReady() so you can be notified when the token provider has retrieved and cached a new token. Don't just call getToken(), because the cache may not yet contain a current, valid token. Code examples for the AWS WAF mobile SDK This section provides code examples for using the mobile SDK. Initializing the token provider and getting tokens You initiate your token provider instance using a configuration object. Then you can retrieve tokens using the available operations. The following shows the basic components of the required code. iOS let url: URL = URL(string: "Web ACL integration URL")! let configuration = WAFConfiguration(applicationIntegrationUrl: url, domainName: "Domain name") let tokenProvider = WAFTokenProvider(configuration) //onTokenReady can be add as an observer for UIApplication.willEnterForegroundNotification self.tokenProvider.onTokenReady() { token, error in if let token = token { //token available } if let error = error { //error occurred after exhausting all retries } } //getToken() let token = tokenProvider.getToken() Client application integrations 489 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Android Java example: String applicationIntegrationURL = "Web ACL integration URL"; //Or URL applicationIntegrationURL = new URL("Web ACL integration URL"); String domainName = "Domain name"; WAFConfiguration configuration = WAFConfiguration.builder().applicationIntegrationURL(applicationIntegrationURL).domainName(domainName).build(); WAFTokenProvider tokenProvider = new WAFTokenProvider(Application context, configuration); // implement a token |
waf-dg-170 | waf-dg.pdf | 170 | let tokenProvider = WAFTokenProvider(configuration) //onTokenReady can be add as an observer for UIApplication.willEnterForegroundNotification self.tokenProvider.onTokenReady() { token, error in if let token = token { //token available } if let error = error { //error occurred after exhausting all retries } } //getToken() let token = tokenProvider.getToken() Client application integrations 489 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Android Java example: String applicationIntegrationURL = "Web ACL integration URL"; //Or URL applicationIntegrationURL = new URL("Web ACL integration URL"); String domainName = "Domain name"; WAFConfiguration configuration = WAFConfiguration.builder().applicationIntegrationURL(applicationIntegrationURL).domainName(domainName).build(); WAFTokenProvider tokenProvider = new WAFTokenProvider(Application context, configuration); // implement a token result callback WAFTokenResultCallback callback = (wafToken, error) -> { if (wafToken != null) { // token available } else { // error occurred in token refresh } }; // Add this callback to application creation or activity creation where token will be used tokenProvider.onTokenReady(callback); // Once you have token in token result callback // if background refresh is enabled you can call getToken() from same tokenprovider object // if background refresh is disabled you can directly call getToken()(blocking call) for new token WAFToken token = tokenProvider.getToken(); Kotlin example: import com.amazonaws.waf.mobilesdk.token.WAFConfiguration import com.amazonaws.waf.mobilesdk.token.WAFTokenProvider private lateinit var wafConfiguration: WAFConfiguration private lateinit var wafTokenProvider: WAFTokenProvider Client application integrations 490 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide private val WAF_INTEGRATION_URL = "Web ACL integration URL" private val WAF_DOMAIN_NAME = "Domain name" fun initWaf() { // Initialize the tokenprovider instance val applicationIntegrationURL = URL(WAF_INTEGRATION_URL) wafConfiguration = WAFConfiguration.builder().applicationIntegrationURL(applicationIntegrationURL) .domainName(WAF_DOMAIN_NAME).backgroundRefreshEnabled(true).build() wafTokenProvider = WAFTokenProvider(getApplication(), wafConfiguration) // getToken from tokenprovider object println("WAF: "+ wafTokenProvider.token.value) // implement callback for where token will be used wafTokenProvider.onTokenReady { wafToken, sdkError -> run { println("WAF Token:" + wafToken.value) } } } Allowing the SDK to provide the token cookie in your HTTP requests If setTokenCookie is TRUE, the token provider includes the token cookie for you in your web requests to all locations under the path that's specified in tokenCookiePath. By default,setTokenCookie is TRUE and tokenCookiePath is /. You can narrow the scope of the requests that include a token cookie by specifying the token cookie path, for example, /web/login. If you do this, check that your AWS WAF rules don't inspect for tokens in the requests that you send to other paths. When you use the AWSManagedRulesACFPRuleSet rule group, you configure the account registration and creation paths, and the rule group checks for tokens in requests that are sent to those paths. For more information, see Adding the ACFP managed rule group to your web ACL. Similarly, when you use the AWSManagedRulesATPRuleSet rule group, you configure the login path, and the rule group checks for tokens in requests that are sent to that path. For more information, see Adding the ATP managed rule group to your web ACL. Client application integrations 491 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide iOS When setTokenCookie is TRUE, the token provider stores the AWS WAF token in a HTTPCookieStorage.shared and automatically includes the cookie in requests to the domain that you specified in WAFConfiguration. let request = URLRequest(url: URL(string: domainEndpointUrl)!) //The token cookie is set automatically as cookie header let task = URLSession.shared.dataTask(with: request) { data, urlResponse, error in }.resume() Android When setTokenCookie is TRUE, the token provider stores the AWS WAF token in a CookieHandler instance that's shared application wide. The token provider automatically includes the cookie in requests to the domain that you specified in WAFConfiguration. Java example: URL url = new URL("Domain name"); //The token cookie is set automatically as cookie header HttpsURLConnection connection = (HttpsURLConnection) url.openConnection(); connection.getResponseCode(); Kotlin example: val url = URL("Domain name") //The token cookie is set automatically as cookie header val connection = (url.openConnection() as HttpsURLConnection) connection.responseCode If you already have the CookieHandler default instance initialized, the token provider will use it to manage cookies. If not, the token provider will initialize a new CookieManager instance with the AWS WAF token and CookiePolicy.ACCEPT_ORIGINAL_SERVER and then set this new instance as the default instance in CookieHandler. The following code shows how the SDK initializes the cookie manager and cookie handler when they aren't available in your app. Java example: Client application integrations 492 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide CookieManager cookieManager = (CookieManager) CookieHandler.getDefault(); if (cookieManager == null) { // Cookie manager is initialized with CookiePolicy.ACCEPT_ORIGINAL_SERVER cookieManager = new CookieManager(); CookieHandler.setDefault(cookieManager); } Kotlin example: var cookieManager = CookieHandler.getDefault() as? CookieManager if (cookieManager == null) { // Cookie manager is initialized with CookiePolicy.ACCEPT_ORIGINAL_SERVER cookieManager = CookieManager() CookieHandler.setDefault(cookieManager) } Manually providing the token cookie in your HTTP requests If you set setTokenCookie to FALSE, then you need to provide the token cookie manually, as a Cookie HTTP request header, in your requests to your protected endpoint. The following code shows how to do this. iOS var request = URLRequest(url: |
waf-dg-171 | waf-dg.pdf | 171 | Developer Guide CookieManager cookieManager = (CookieManager) CookieHandler.getDefault(); if (cookieManager == null) { // Cookie manager is initialized with CookiePolicy.ACCEPT_ORIGINAL_SERVER cookieManager = new CookieManager(); CookieHandler.setDefault(cookieManager); } Kotlin example: var cookieManager = CookieHandler.getDefault() as? CookieManager if (cookieManager == null) { // Cookie manager is initialized with CookiePolicy.ACCEPT_ORIGINAL_SERVER cookieManager = CookieManager() CookieHandler.setDefault(cookieManager) } Manually providing the token cookie in your HTTP requests If you set setTokenCookie to FALSE, then you need to provide the token cookie manually, as a Cookie HTTP request header, in your requests to your protected endpoint. The following code shows how to do this. iOS var request = URLRequest(url: wafProtectedEndpoint) request.setValue("aws-waf-token=token from token provider", forHTTPHeaderField: "Cookie") request.httpShouldHandleCookies = true URLSession.shared.dataTask(with: request) { data, response, error in } Android Java example: URL url = new URL("Domain name"); HttpsURLConnection connection = (HttpsURLConnection) url.openConnection(); String wafTokenCookie = "aws-waf-token=token from token provider"; connection.setRequestProperty("Cookie", wafTokenCookie); connection.getInputStream(); Kotlin example: Client application integrations 493 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide val url = URL("Domain name") val connection = (url.openConnection() as HttpsURLConnection) val wafTokenCookie = "aws-waf-token=token from token provider" connection.setRequestProperty("Cookie", wafTokenCookie) connection.inputStream CAPTCHA and Challenge in AWS WAF This section explains how CAPTCHA and Challenge work with AWS WAF. You can configure your AWS WAF rules to run a CAPTCHA or Challenge action against web requests that match your rule's inspection criteria. You can also program your JavaScript client applications to run CAPTCHA puzzles and browser challenges locally. CAPTCHA puzzles and silent challenges can only run when browsers are accessing HTTPS endpoints. Browser clients must be running in secure contexts in order to acquire tokens. • CAPTCHA – Requires the end user to solve a CAPTCHA puzzle to prove that a human being is sending the request. CAPTCHA puzzles are intended to be fairly easy and quick for humans to complete successfully and hard for computers to either complete successfully or to randomly complete with any meaningful rate of success. In web ACL rules, CAPTCHA is commonly used when a Block action would stop too many legitimate requests, but letting all traffic through would result in unacceptably high levels of unwanted requests, such as from bots. For information about the rule action behavior, see How the AWS WAFCAPTCHA and Challenge rule actions work. You can also program a CAPTCHA puzzle implementation in your client application integration APIs. When you do this, you can customize the behavior and placement of the puzzle in your client application. For more information, see Client application integrations in AWS WAF. • Challenge – Runs a silent challenge that requires the client session to verify that it's a browser, and not a bot. The verification runs in the background without involving the end user. This is a good option for verifying clients that you suspect of being invalid without negatively impacting the end user experience with a CAPTCHA puzzle. For information about the rule action behavior, see How the AWS WAFCAPTCHA and Challenge rule actions work. The Challenge rule action is similar to the challenge run by the client intelligent threat integration APIs, described at Client application integrations in AWS WAF. CAPTCHA and Challenge 494 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Note You are charged additional fees when you use the CAPTCHA or Challenge rule action in one of your rules or as a rule action override in a rule group. For more information, see AWS WAF Pricing. For descriptions of all of the rule action options, see Using rule actions in AWS WAF. Topics • AWS WAF CAPTCHA puzzles • How the AWS WAFCAPTCHA and Challenge rule actions work • Best practices for using the CAPTCHA and Challenge actions AWS WAF CAPTCHA puzzles This section explains the features and functionality of the AWS WAF CAPTCHA puzzle. AWS WAF provides standard CAPTCHA functionality that challenges users to confirm that they are human beings. CAPTCHA stands for Completely Automated Public Turing test to tell Computers and Humans Apart. CAPTCHA puzzles are designed to verify that a human is sending requests and to prevent activity like web scraping, credential stuffing, and spam. CAPTCHA puzzles can't weed out all unwanted requests. Many puzzles have been solved using machine learning and artificial intelligence. In an effort to circumvent CAPTCHA, some organizations supplement automated techniques with human intervention. In spite of this, CAPTCHA continues to be a useful tool to prevent less sophisticated bot traffic and to increase the resources required for large-scale operations. AWS WAF randomly generates its CAPTCHA puzzles and rotates through them to ensure that users are presented with unique challenges. AWS WAF regularly adds new types and styles of puzzles to remain effective against automation techniques. In addition to the puzzles, the AWS WAF CAPTCHA script gathers data about the client to ensure that the task is being completed by a human and to |
waf-dg-172 | waf-dg.pdf | 172 | circumvent CAPTCHA, some organizations supplement automated techniques with human intervention. In spite of this, CAPTCHA continues to be a useful tool to prevent less sophisticated bot traffic and to increase the resources required for large-scale operations. AWS WAF randomly generates its CAPTCHA puzzles and rotates through them to ensure that users are presented with unique challenges. AWS WAF regularly adds new types and styles of puzzles to remain effective against automation techniques. In addition to the puzzles, the AWS WAF CAPTCHA script gathers data about the client to ensure that the task is being completed by a human and to prevent replay attacks. Each CAPTCHA puzzle includes a standard set of controls for the end user to request a new puzzle, switch between audio and visual puzzles, access additional instructions, and submit a puzzle solution. All puzzles include support for screen readers, keyboard controls, and contrasting colors. CAPTCHA and Challenge 495 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide The AWS WAF CAPTCHA puzzles meet the requirements of the Web Content Accessibility Guidelines (WCAG). For information, see Web Content Accessibility Guidelines (WCAG) Overview at the World Wide Web Consortium (W3C) website. Topics • CAPTCHA puzzle language support • CAPTCHA puzzle examples CAPTCHA puzzle language support This section lists what languages are supported in AWS WAF CAPTCHA puzzles. The CAPTCHA puzzle starts with written instructions in the client browser language or, if the browser language is unsupported, in English. The puzzle provides alternate language options through a dropdown menu. The user can switch to audio instructions by selecting the headphone icon at the bottom of the page. The audio version of the puzzle provides spoken instructions about text that the user should type into a text box, overlaid by background noise. The following table lists the languages that you can select for the written instructions in a CAPTCHA puzzle and the audio support for each selection. AWS WAF CAPTCHA puzzle supported languages Written instructions support Locale code Audio instructions support Arabic ar-SA Arabic Simplified Chinese zh-CN Audio in English Dutch English French nl-NL en-US fr-FR Dutch English French CAPTCHA and Challenge 496 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Written instructions support Locale code Audio instructions support German Italian Japanese de-DE it-IT ja-JP German Italian Audio in English Brazilian Portuguese pt-BR Brazilian Portuguese Spanish Turkish es-ES tr-TR Spanish Turkish CAPTCHA puzzle examples A typical visual CAPTCHA puzzle requires interaction to show that the user can comprehend and interact with one or more images. The following screenshot shows an example of a picture grid puzzle. This puzzle requires you to select all of the pictures in the grid that include a specific type of object. CAPTCHA and Challenge 497 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide The following screenshot shows an example puzzle that requires you to identify the endpoint of a car's path in a drawing. CAPTCHA and Challenge 498 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide An audio puzzle provides background noise overlaid with spoken instructions about text that the user should type into a text box. The following screenshot shows the display for the audio puzzle choice. CAPTCHA and Challenge 499 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide How the AWS WAFCAPTCHA and Challenge rule actions work This section explains how CAPTCHA and Challenge work. AWS WAF CAPTCHA and Challenge are standard rule actions, so they're relatively easy to implement. To use either of them, you create the inspection criteria for your rule that identifies the requests that you want to inspect, and then specify one of the two rule actions. For general information about rule action options, see Using rule actions in AWS WAF. In addition to implementing silent challenges and CAPTCHA puzzles from the server side, you can integrate silent challenges in your JavaScript and iOS and Android client applications, and you can render CAPTCHA puzzles in your JavaScript clients. These integrations allow you to provide your end users with better performance and CAPTCHA puzzle experiences, and they can reduce costs associated with using the rule actions and the intelligent threat mitigation rule groups. For more information about these options, see Client application integrations in AWS WAF. For pricing information, see AWS WAF Pricing. CAPTCHA and Challenge 500 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Topics • CAPTCHA and Challenge action behavior • CAPTCHA and Challenge actions in the logs and metrics CAPTCHA and Challenge action behavior This section explains what the CAPTCHA and Challenge actions do. When a web request matches the inspection criteria of a rule with CAPTCHA or Challenge action, AWS WAF determines how to handle the request according to the state of its token and immunity time configuration. AWS WAF |
waf-dg-173 | waf-dg.pdf | 173 | these options, see Client application integrations in AWS WAF. For pricing information, see AWS WAF Pricing. CAPTCHA and Challenge 500 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Topics • CAPTCHA and Challenge action behavior • CAPTCHA and Challenge actions in the logs and metrics CAPTCHA and Challenge action behavior This section explains what the CAPTCHA and Challenge actions do. When a web request matches the inspection criteria of a rule with CAPTCHA or Challenge action, AWS WAF determines how to handle the request according to the state of its token and immunity time configuration. AWS WAF also considers whether the request can handle the CAPTCHA puzzle or challenge script interstitials. The scripts are designed to be handled as HTML content, and they can only be handled properly by a client that's expecting HTML content. Note You are charged additional fees when you use the CAPTCHA or Challenge rule action in one of your rules or as a rule action override in a rule group. For more information, see AWS WAF Pricing. How the action handles the web request AWS WAF applies the CAPTCHA or Challenge action to a web request as follows: • Valid token – AWS WAF handles this similar to a Count action. AWS WAF applies any labels and request customizations that you've configured for the rule action, and then continues evaluating the request using the remaining rules in the web ACL. • Missing, invalid, or expired token – AWS WAF discontinues the web ACL evaluation of the request and blocks it from going to its intended destination. AWS WAF generates a response that it sends back to the client, according to the rule action type: • Challenge – AWS WAF includes the following in the response: • The header x-amzn-waf-action with a value of challenge. CAPTCHA and Challenge 501 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Note For Javascript applications running in the client browser, this header is only available within the application's domain. The header isn't available for cross-domain retrieval. For details, see the section that follows. • The HTTP status code 202 Request Accepted. • If the request contains an Accept header with a value of text/html, the response includes a JavaScript page interstitial with a challenge script. • CAPTCHA – AWS WAF includes the following in the response: • The header x-amzn-waf-action with a value of captcha. Note For Javascript applications running in the client browser, this header is only available within the application's domain. The header isn't available for cross-domain retrieval. For details, see the section that follows. • The HTTP status code 405 Method Not Allowed. • If the request contains an Accept header with a value of text/html, the response includes a JavaScript page interstitial with a CAPTCHA script. To configure the timing of token expiration at the web ACL or rule level, see Setting timestamp expiration and token immunity times in AWS WAF. Headers are unavailable to JavaScript applications that run in the client browser When AWS WAF responds to a client request with a CAPTCHA or challenge response, it doesn't include cross-origin resource sharing (CORS) headers. CORS headers are a set of access control headers that tell the client web browser which domains, HTTP methods, and HTTP headers can be used by JavaScript applications. Without CORS headers, JavaScript applications running in a client browser are not granted access to HTTP headers and so are unable to read the x-amzn- waf-action header that's provided in the CAPTCHA and Challenge responses. What the challenge and CAPTCHA interstitials do CAPTCHA and Challenge 502 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide When a challenge interstitial runs, after the client responds successfully, if it doesn't already have a token, the interstitial initializes one for it. Then it updates the token with the challenge solve timestamp. When a CAPTCHA interstitial runs, if the client doesn't have a token yet, the CAPTCHA interstitial invokes the challenge script first to challenge the browser and initialize the token. Then the interstitial runs its CAPTCHA puzzle. When the end user successfully completes the puzzle, the interstitial updates the token with the CAPTCHA solve timestamp. In either case, after the client responds successfully and the script updates the token, the script resubmits the original web request using the updated token. You can configure how AWS WAF handles tokens. For information, see Token use in AWS WAF intelligent threat mitigation. CAPTCHA and Challenge actions in the logs and metrics This section explains how AWS WAF handles logging and metrics for the CAPTCHA and Challenge actions. The CAPTCHA and Challenge actions can be non-terminating, like Count, or terminating, like Block. The outcome depends on whether the request has a valid token with an unexpired timestamp for the action type. • |
waf-dg-174 | waf-dg.pdf | 174 | after the client responds successfully and the script updates the token, the script resubmits the original web request using the updated token. You can configure how AWS WAF handles tokens. For information, see Token use in AWS WAF intelligent threat mitigation. CAPTCHA and Challenge actions in the logs and metrics This section explains how AWS WAF handles logging and metrics for the CAPTCHA and Challenge actions. The CAPTCHA and Challenge actions can be non-terminating, like Count, or terminating, like Block. The outcome depends on whether the request has a valid token with an unexpired timestamp for the action type. • Valid token – When the action finds a valid token and doesn't block the request, AWS WAF captures metrics and logs as follows: • Increments the metrics for either CaptchaRequests and RequestsWithValidCaptchaToken or ChallengeRequests and RequestsWithValidChallengeToken. • Logs the match as a nonTerminatingMatchingRules entry with action of CAPTCHA or Challenge. The following listing shows the section of a log for this type of match with the CAPTCHA action. "nonTerminatingMatchingRules": [ { "ruleId": "captcha-rule", "action": "CAPTCHA", "ruleMatchDetails": [], "captchaResponse": { "responseCode": 0, CAPTCHA and Challenge 503 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide "solveTimestamp": 1632420429 } } ] • Missing, invalid, or expired token – When the action blocks the request due to a missing or invalid token, AWS WAF captures metrics and logs as follows: • Increments the metric for CaptchaRequests or ChallengeRequests. • Logs the match as a CaptchaResponse entry with HTTP 405 status code or as a ChallengeResponse entry with HTTP 202 status code. The log indicates whether the request was missing the token or had an expired timestamp. The log also indicates whether AWS WAF sent a CAPTCHA interstitial page to the client or a silent challenge to the client browser. The following listing shows the sections of a log for this type of match with the CAPTCHA action. "terminatingRuleId": "captcha-rule", "terminatingRuleType": "REGULAR", "action": "CAPTCHA", "terminatingRuleMatchDetails": [], ... "responseCodeSent": 405, ... "captchaResponse": { "responseCode": 405, "solveTimestamp": 0, "failureReason": "TOKEN_MISSING" } For information about the AWS WAF logs, see Logging AWS WAF web ACL traffic. For information about AWS WAF metrics, see AWS WAF metrics and dimensions. For general information about rule action options, see Using rule actions in AWS WAF. Requests with no token seem to show up twice in logs and metrics Based on the CAPTCHA and Challenge action behavior and the logging and metrics described in this section, a request with no token will generally be represented twice in the logs and metrics. This is because the one intended request is actually sent twice by the client. CAPTCHA and Challenge 504 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide • The first request, with no token, receives the logging and metrics handling described above for missing, invalid, or expired token. The CAPTCHA or Challenge action terminates this first request, and then responds back to the client with either a silent challenge or CAPTCHA puzzle. • The client evaluates the challenge or puzzle and, if the client browser or end user responds successfully, sends the request a second time with the newly acquired token. This second request receives the logging and metrics handling described above for a request with a valid token. Best practices for using the CAPTCHA and Challenge actions Follow the guidance in this section to plan and implement AWS WAF CAPTCHA or challenge. Plan your CAPTCHA and challenge implementation Determine where to place CAPTCHA puzzles or silent challenges based on your website usage, the sensitivity of the data that you want to protect, and the type of requests. Select the requests where you'll apply CAPTCHA so that you present the puzzles as needed, but avoid presenting them where they wouldn't be useful and might degrade the user experience. Use the Challenge action to run silent challenges that have less impact on the end user, but still help verify that the request is coming from a JavaScript enabled browser. CAPTCHA puzzles and silent challenges can only run when browsers are accessing HTTPS endpoints. Browser clients must be running in secure contexts in order to acquire tokens. Decide where to run CAPTCHA puzzles and silent challenges on your clients Identify requests that you don't want to have impacted by CAPTCHA, for example, requests for CSS or images. Use CAPTCHA only when necessary. For example, if you plan to have a CAPTCHA check at login, and the user is always taken directly from the login to another screen, requiring a CAPTCHA check at the second screen would probably not be needed and might degrade your end user experience. Configure your Challenge and CAPTCHA use so that AWS WAF only sends CAPTCHA puzzles and silent challenges in response to GET text/html requests. You can't run either the puzzle or the |
waf-dg-175 | waf-dg.pdf | 175 | clients Identify requests that you don't want to have impacted by CAPTCHA, for example, requests for CSS or images. Use CAPTCHA only when necessary. For example, if you plan to have a CAPTCHA check at login, and the user is always taken directly from the login to another screen, requiring a CAPTCHA check at the second screen would probably not be needed and might degrade your end user experience. Configure your Challenge and CAPTCHA use so that AWS WAF only sends CAPTCHA puzzles and silent challenges in response to GET text/html requests. You can't run either the puzzle or the challenge in response to POST requests, Cross-Origin Resource Sharing (CORS) preflight OPTIONS requests, or any other non-GET request types. Browser behavior for other request types can vary and might not be able to handle the interstitials properly. It's possible for a client to accept HTML but still not be able to handle the CAPTCHA or challenge interstitial. For example, a widget on a webpage with a small iFrame might accept HTML but not be CAPTCHA and Challenge 505 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide able to display a CAPTCHA or process it. Avoid placing the rule actions for these types of requests, the same as for requests that don't accept HTML. Use CAPTCHA or Challenge to verify prior token acquisition You can use the rule actions solely to verify the existence of a valid token, at locations where legitimate users should always have one. In these situations, it doesn't matter whether the request can handle the interstitials. For example, if you implement the JavaScript client application CAPTCHA API, and run the CAPTCHA puzzle on the client immediately before you send the first request to your protected endpoint, your first request should always include a token that's valid for both challenge and CAPTCHA. For information about JavaScript client application integration, see AWS WAF JavaScript integrations. For this situation, in your web ACL, you can add a rule that matches against this first call and configure it with the Challenge or CAPTCHA rule action. When the rule matches for a legitimate end user and browser, the action will find a valid token, and therefore will not block the request or send a challenge or CAPTCHA puzzle in response. For more information about how the rule actions work, see CAPTCHA and Challenge action behavior. Protect your sensitive non-HTML data with CAPTCHA and Challenge You can use CAPTCHA and Challenge protections for sensitive non-HTML data, like APIs, with the following approach. 1. Identify requests that take HTML responses and that are run in close proximity to the requests for your sensitive, non-HTML data. 2. Write CAPTCHA or Challenge rules that match against the requests for HTML and that match against the requests for your sensitive data. 3. Tune your CAPTCHA and Challenge immunity time settings so that, for normal user interactions, the tokens that clients obtain from the HTML requests are available and unexpired in their requests for your sensitive data. For tuning information, see Setting timestamp expiration and token immunity times in AWS WAF. When a request for your sensitive data matches a CAPTCHA or Challenge rule, it won't be blocked if the client still has a valid token from the prior puzzle or challenge. If the token isn't available or the timestamp is expired, the request to access your sensitive data will fail. For more information about how the rule actions work, see CAPTCHA and Challenge action behavior. CAPTCHA and Challenge 506 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Use CAPTCHA and Challenge to tune your existing rules Review your existing rules, to see if you want to alter or add to them. The following are some common scenarios to consider. • If you have a rate-based rule that blocks traffic, but you keep the rate limit relatively high to avoid blocking legitimate users, consider adding a second rate-based rule after the blocking rule. Give the second rule a lower limit than the blocking rule and set the rule action to CAPTCHA or Challenge. The blocking rule will still block requests that are coming at too high a rate, and the new rule will block most automated traffic at an even lower rate. For information about rate- based rules, see Using rate-based rule statements in AWS WAF. • If you have a managed rule group that blocks requests, you can switch the behavior for some or all of the rules from Block to CAPTCHA or Challenge. To do this, in the managed rule group configuration, override the rule action setting. For information about overriding rule actions, see Rule group rule action overrides. Test your CAPTCHA and challenge implementations before you deploy them As for all new functionality, follow the guidance at the section |
waf-dg-176 | waf-dg.pdf | 176 | will block most automated traffic at an even lower rate. For information about rate- based rules, see Using rate-based rule statements in AWS WAF. • If you have a managed rule group that blocks requests, you can switch the behavior for some or all of the rules from Block to CAPTCHA or Challenge. To do this, in the managed rule group configuration, override the rule action setting. For information about overriding rule actions, see Rule group rule action overrides. Test your CAPTCHA and challenge implementations before you deploy them As for all new functionality, follow the guidance at the section called “Testing and tuning your protections”. During testing, review your token timestamp expiration requirements and set your web ACL and rule level immunity time configurations so that you achieve a good balance between controlling access to your website and providing a good experience for your customers. For information, see Setting timestamp expiration and token immunity times in AWS WAF. Data protection and logging for AWS WAF web ACL traffic This section explains the data logging, collection, and protection options that you can use with AWS WAF. The options are the following: • Logging – You can configure your web ACL to send logs for web request traffic to a logging destination of your choice. You can configure field redaction and filtering for this choice. Logging uses the data that's available after any data protection setting are applied. For information about this option, see Logging AWS WAF web ACL traffic. Data protection and logging for web traffic 507 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide • Request sampling – You can configure your web ACL to sample the web requests that it evaluates, to get an idea of the type of traffic that your application is receiving. Request sampling uses the data that's available after any data protection settings are applied. For information about this option, see Viewing a sample of web requests. • Amazon Security Lake – You can configure Security Lake to collect web ACL data. Security Lake collects log and event data from various AWS sources for normalization, analysis, and management. Security Lake collects from the data that's available after any data protection settings are applied. For information about this option, see What is Amazon Security Lake? and Collecting data from AWS services in the Amazon Security Lake user guide. AWS WAF doesn't charge you for using this option. For pricing information, see Security Lake Pricing and How Security Lake pricing is determined in the Amazon Security Lake user guide. • Data protection – You can configure data protections for web traffic data at two levels: • Data protection for the web ACL – You can configure data protection for each web ACL, which enables you to substitute certain web traffic data with static strings or cryptographic hashing. Data protection at this level can be configured centrally, and applies across all logging and data collection options. For information about this option, see Data protection. • Logging redaction and filtering – For logging only, you can configure some of the web traffic data for redaction from the logs, and you can filter the data that you log. This option is in addition to any data protection setting you've configured, and it only affects the data that AWS WAF sends to the configured logging destination. Topics • Logging AWS WAF web ACL traffic • Data protection Logging AWS WAF web ACL traffic This section explains the logging options for your AWS WAF web ACLs. You can enable logging to get detailed information about traffic that is analyzed by your web ACL. Logged information includes the time that AWS WAF received a web request from your AWS Logging 508 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide resource, detailed information about the request, and details about the rules that the request matched. You can send web ACL logs to an Amazon CloudWatch Logs log group, an Amazon Simple Storage Service (Amazon S3) bucket, or an Amazon Data Firehose delivery stream. In addition to logs that you can enable for your web ACLs, AWS also uses service logs of website or application traffic processed by AWS WAF to provide support for and protect the security of AWS customers and services. Note Web ACL logging configuration only affects the AWS WAF logs. In particular, the redacted fields configuration for logging has no impact on request sampling or Security Lake data collection. You can exclude fields from collection or sampling by configuring web ACL data protection. Other than data protection, Security Lake data collection is configured entirely through the Security Lake service. Topics • Pricing for logging web ACL traffic information • AWS WAF logging destinations • Configuring logging for a web ACL • Finding your web |
waf-dg-177 | waf-dg.pdf | 177 | AWS WAF to provide support for and protect the security of AWS customers and services. Note Web ACL logging configuration only affects the AWS WAF logs. In particular, the redacted fields configuration for logging has no impact on request sampling or Security Lake data collection. You can exclude fields from collection or sampling by configuring web ACL data protection. Other than data protection, Security Lake data collection is configured entirely through the Security Lake service. Topics • Pricing for logging web ACL traffic information • AWS WAF logging destinations • Configuring logging for a web ACL • Finding your web ACL records • Log fields for web ACL traffic • Log examples for web ACL traffic Other data collection and analysis options In addition to logging, you can enable the following options for data collection and analysis: • Amazon Security Lake – You can configure Security Lake to collect web ACL data. Security Lake collects log and event data from various sources for normalization, analysis, and management. For information about this option, see What is Amazon Security Lake? and Collecting data from AWS services in the Amazon Security Lake user guide. AWS WAF doesn't charge you for using this option. For pricing information, see Security Lake Pricing and How Security Lake pricing is determined in the Amazon Security Lake user guide. Logging 509 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide • Request sampling – You can configure your web ACL to sample the web requests that it evaluates, to get an idea of the type of traffic that your application is receiving. For information about this option, see Viewing a sample of web requests. Pricing for logging web ACL traffic information This section explains the pricing considerations for using web ACL traffic logs. You are charged for logging web ACL traffic information according to the costs associated with each log destination type. These charges are in addition to the charges for using AWS WAF. Your costs can vary depending on factors such as the destination type that you choose and the amount of data that you log. The following provides links to the pricing information for each logging destination type: • CloudWatch Logs – The charges are for vended log delivery. See Amazon CloudWatch Logs Pricing. Under Paid Tier, choose the Logs tab, and then under Vended Logs, see the information for Delivery to CloudWatch Logs. • Amazon S3 buckets – The Amazon S3 charges are the combined charges for CloudWatch Logs vended log delivery to the Amazon S3 buckets and for using Amazon S3. • For Amazon S3, see Amazon S3 Pricing. • For CloudWatch Logs vended log delivery to the Amazon S3, see Amazon CloudWatch Logs Pricing. Under Paid Tier, choose the Logs tab, and then under Vended Logs, see the information for Delivery to S3 • Firehose – See Amazon Data Firehose Pricing. For information about AWS WAF pricing, see AWS WAF Pricing. AWS WAF logging destinations This section describes the logging options that you can choose from for your AWS WAF logs. Each section provides guidance for configuring logging including information about any behavior that's specific to the destination type. After you've configured the logging destination, you can provide its specifications to your web ACL logging configuration to start logging to it. Topics • Sending web ACL traffic logs to a Amazon CloudWatch Logs log group Logging 510 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide • Sending web ACL traffic logs to an Amazon Simple Storage Service bucket • Sending web ACL traffic logs to an Amazon Data Firehose delivery stream Sending web ACL traffic logs to a Amazon CloudWatch Logs log group This topic provides information for sending your web ACL traffic logs to a CloudWatch Logs log group. Note You are charged for logging in addition to the charges for using AWS WAF. For information, see Pricing for logging web ACL traffic information. To send logs to Amazon CloudWatch Logs, you create a CloudWatch Logs log group. When you enable logging in AWS WAF, you provide the log group ARN. After you enable logging for your web ACL, AWS WAF delivers logs to the CloudWatch Logs log group in log streams. When you use CloudWatch Logs, you can explore the logs for your web ACL in the AWS WAF console. In your web ACL page, select the tab Logging insights. This option is in addition to the logging insights that are provided for CloudWatch Logs through the CloudWatch console. Configure the log group for AWS WAF web ACL logs in the same Region as the web ACL and using the same account as you use to manage the web ACL. For information about configuring a CloudWatch Logs log group, see Working with Log Groups and Log |
waf-dg-178 | waf-dg.pdf | 178 | log group in log streams. When you use CloudWatch Logs, you can explore the logs for your web ACL in the AWS WAF console. In your web ACL page, select the tab Logging insights. This option is in addition to the logging insights that are provided for CloudWatch Logs through the CloudWatch console. Configure the log group for AWS WAF web ACL logs in the same Region as the web ACL and using the same account as you use to manage the web ACL. For information about configuring a CloudWatch Logs log group, see Working with Log Groups and Log Streams. Quotas for CloudWatch Logs log groups CloudWatch Logs has a default maximum quota for throughput, shared across all log groups within a region, which you can request to increase. If your logging requirements are too high for the current throughput setting, you'll see throttling metrics for PutLogEvents for your account. To view the limit in the Service Quotas console and request an increase, see the CloudWatch Logs PutLogEvents quota. Log group naming Your log group names must start with aws-waf-logs- and can end with any suffix you like, for example, aws-waf-logs-testLogGroup2. The resulting ARN format is as follows: Logging 511 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide arn:aws:logs:Region:account-id:log-group:aws-waf-logs-log-group-suffix The log streams have the following naming format: Region_web-acl-name_log-stream-number The following shows an example log stream for web ACL TestWebACL in Region us-east-1. us-east-1_TestWebACL_0 Permissions required to publish logs to CloudWatch Logs Configuring web ACL traffic logging for a CloudWatch Logs log group requires the permissions settings described in this section. The permissions are set for you when you use one of the AWS WAF full access managed policies, AWSWAFConsoleFullAccess or AWSWAFFullAccess. If you want to manage finer-grained access to your logging and AWS WAF resources, you can set the permissions yourself. For information about managing permissions, see Access management for AWS resources in the IAM User Guide. For information about the AWS WAF managed policies, see AWS managed policies for AWS WAF. These permissions allow you to change the web ACL logging configuration, to configure log delivery for CloudWatch Logs, and to retrieve information about your log group. These permissions must be attached to the user that you use to manage AWS WAF. { "Version":"2012-10-17", "Statement":[ { "Action":[ "wafv2:PutLoggingConfiguration", "wafv2:DeleteLoggingConfiguration" ], "Resource":[ "*" ], "Effect":"Allow", "Sid":"LoggingConfigurationAPI" } { Logging 512 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide "Sid":"WebACLLoggingCWL", "Action":[ "logs:CreateLogDelivery", "logs:DeleteLogDelivery", "logs:PutResourcePolicy", "logs:DescribeResourcePolicies", "logs:DescribeLogGroups" ], "Resource":[ "*" ], "Effect":"Allow" } ] } When actions are permitted on all AWS resources, it's indicated in the policy with a "Resource" setting of "*". This means that the actions are permitted on all AWS resources that each action supports. For example, the action wafv2:PutLoggingConfiguration is supported only for wafv2 logging configuration resources. Sending web ACL traffic logs to an Amazon Simple Storage Service bucket This topic provides information for sending your web ACL traffic logs to an Amazon S3 bucket. Note You are charged for logging in addition to the charges for using AWS WAF. For information, see Pricing for logging web ACL traffic information. To send your web ACL traffic logs to Amazon S3, you set up an Amazon S3 bucket from the same account as you use to manage the web ACL, and you name the bucket starting with aws-waf- logs-. When you enable logging in AWS WAF, you provide the bucket name. For information about creating a logging bucket, see Create a Bucket in the Amazon Simple Storage Service User Guide. You can access and analyze your Amazon S3 logs using the Amazon Athena interactive query service. Athena makes it easy to analyze data directly in Amazon S3 using standard SQL. With a few actions in the AWS Management Console, you can point Athena at data stored in Amazon S3 and quickly begin using standard SQL to run ad-hoc queries and get results. For more information, Logging 513 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide see Querying AWS WAF logs in the Amazon Athena user guide. For additional sample Amazon Athena queries, see aws-samples/waf-log-sample-athena-queries on the GitHub website. Note AWS WAF supports encryption with Amazon S3 buckets for key type Amazon S3 key (SSE- S3) and for AWS Key Management Service (SSE-KMS) AWS KMS keys. AWS WAF doesn't support encryption for AWS Key Management Service keys that are managed by AWS. Web ACLs publish their log files to the Amazon S3 bucket at 5-minute intervals. Each log file contains log records for the traffic recorded in the previous 5 minutes. The maximum file size for a log file is 75 MB. If the log file reaches the file size limit within the 5- minute period, the log stops adding records to it, publishes it to the Amazon S3 |
waf-dg-179 | waf-dg.pdf | 179 | key type Amazon S3 key (SSE- S3) and for AWS Key Management Service (SSE-KMS) AWS KMS keys. AWS WAF doesn't support encryption for AWS Key Management Service keys that are managed by AWS. Web ACLs publish their log files to the Amazon S3 bucket at 5-minute intervals. Each log file contains log records for the traffic recorded in the previous 5 minutes. The maximum file size for a log file is 75 MB. If the log file reaches the file size limit within the 5- minute period, the log stops adding records to it, publishes it to the Amazon S3 bucket, and then creates a new log file. The log files are compressed. If you open the files using the Amazon S3 console, Amazon S3 decompresses the log records and displays them. If you download the log files, you must decompress them to view the records. A single log file contains interleaved entries with multiple records. To see all the log files for a web ACL, look for entries aggregated by the web ACL name, Region, and your account ID. Naming requirements and syntax Bucket names for AWS WAF logging must start with aws-waf-logs- and can end with any suffix you want. For example, aws-waf-logs-LOGGING-BUCKET-SUFFIX. Bucket location The bucket locations use the following syntax: s3://aws-waf-logs-LOGGING-BUCKET-SUFFIX/ Bucket ARN The format of the bucket Amazon Resource Name (ARN) is as follows: arn:aws:s3:::aws-waf-logs-LOGGING-BUCKET-SUFFIX Logging 514 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Bucket locations with prefixes If you use prefixes in your object keys name to organize the data that you store in your buckets, you can provide your prefixes in your logging bucket names. Note This option is not available through the console. Use the AWS WAF APIs, CLI, or AWS CloudFormation. For information about using prefixes in Amazon S3, see Organizing objects using prefixes in the Amazon Simple Storage Service User Guide. The bucket locations with prefixes use the following syntax: s3://aws-waf-logs-LOGGING-BUCKET-SUFFIX/KEY-NAME-PREFIX/ Bucket folders and file names Inside your buckets, and following any prefixes that you provide, your AWS WAF logs are written under a folder structure that's determined by your account ID, the Region, the web ACL name, and the date and time. AWSLogs/account-id/WAFLogs/Region/web-acl-name/YYYY/MM/dd/HH/mm Inside the folders, the log file names follow a similar format: account-id_waflogs_Region_web-acl-name_timestamp_hash.log.gz The time specifications used in the folder structure and in the log file name adhere to the timestamp format specification YYYYMMddTHHmmZ. The following shows an example log file in an Amazon S3 bucket for a bucket named aws-waf- logs-LOGGING-BUCKET-SUFFIX. The AWS account is 11111111111. The web ACL is TEST- WEBACL and the Region is us-east-1. s3://aws-waf-logs-LOGGING-BUCKET-SUFFIX/AWSLogs/11111111111/WAFLogs/us- east-1/TEST-WEBACL/2021/10/28/19/50/11111111111_waflogs_us-east-1_TEST- WEBACL_20211028T1950Z_e0ca43b5.log.gz Logging 515 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Note Your bucket names for AWS WAF logging must start with aws-waf-logs- and can end with any suffix you want. Permissions required to publish logs to Amazon S3 Configuring web ACL traffic logging for an Amazon S3 bucket requires the following permissions settings. These permissions are set for you when you use one of the AWS WAF full access managed policies, AWSWAFConsoleFullAccess or AWSWAFFullAccess. If you want to further manage access to your logging and AWS WAF resources, you can set these permissions yourself. For information about managing permissions, see Access management for AWS resources in the IAM User Guide. For information about the AWS WAF managed policies, see AWS managed policies for AWS WAF. The following permissions allow you to change the web ACL logging configuration and to configure log delivery to your Amazon S3 bucket. These permissions must be attached to the user that you use to manage AWS WAF. Note When you set the permissions listed below, you might see errors in your AWS CloudTrail logs that indicate access denied, but the permissions are correct for AWS WAF logging. { "Version":"2012-10-17", "Statement":[ { "Action":[ "wafv2:PutLoggingConfiguration", "wafv2:DeleteLoggingConfiguration" ], "Resource":[ "*" ], "Effect":"Allow", "Sid":"LoggingConfigurationAPI" }, Logging 516 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide { "Sid":"WebACLLogDelivery", "Action":[ "logs:CreateLogDelivery", "logs:DeleteLogDelivery" ], "Resource": "*", "Effect":"Allow" }, { "Sid":"WebACLLoggingS3", "Action":[ "s3:PutBucketPolicy", "s3:GetBucketPolicy" ], "Resource": [ "arn:aws:s3:::aws-waf-logs-LOGGING-BUCKET-SUFFIX" ], "Effect":"Allow" } ] } When actions are permitted on all AWS resources, it's indicated in the policy with a "Resource" setting of "*". This means that the actions are permitted on all AWS resources that each action supports. For example, the action wafv2:PutLoggingConfiguration is supported only for wafv2 logging configuration resources. By default, Amazon S3 buckets and the objects that they contain are private. Only the bucket owner can access the bucket and the objects stored in it. The bucket owner, however, can grant access to other resources and users by writing an access policy. If the user creating the log owns the bucket, the service automatically attaches the following policy to the bucket to give the log permission to |
waf-dg-180 | waf-dg.pdf | 180 | setting of "*". This means that the actions are permitted on all AWS resources that each action supports. For example, the action wafv2:PutLoggingConfiguration is supported only for wafv2 logging configuration resources. By default, Amazon S3 buckets and the objects that they contain are private. Only the bucket owner can access the bucket and the objects stored in it. The bucket owner, however, can grant access to other resources and users by writing an access policy. If the user creating the log owns the bucket, the service automatically attaches the following policy to the bucket to give the log permission to publish logs to it: Logging 517 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide { "Version": "2012-10-17", "Statement": [ { "Sid": "AWSLogDeliveryWrite", "Effect": "Allow", "Principal": { "Service": "delivery.logs.amazonaws.com" }, "Action": "s3:PutObject", "Resource": "arn:aws:s3:::aws-waf-logs-LOGGING-BUCKET-SUFFIX/AWSLogs/account-id/ *", "Condition": { "StringEquals": { "s3:x-amz-acl": "bucket-owner-full-control", "aws:SourceAccount": ["account-id"] }, "ArnLike": { "aws:SourceArn": ["arn:aws:logs:region:account-id:*"] } } }, { "Sid": "AWSLogDeliveryAclCheck", "Effect": "Allow", "Principal": { "Service": "delivery.logs.amazonaws.com" }, "Action": "s3:GetBucketAcl", "Resource": "arn:aws:s3:::aws-waf-logs-LOGGING-BUCKET-SUFFIX", "Condition": { "StringEquals": { "aws:SourceAccount": ["account-id"] }, "ArnLike": { "aws:SourceArn": ["arn:aws:logs:region:account-id:*"] } } } ] } Logging 518 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Note Your bucket names for AWS WAF logging must start with aws-waf-logs- and can end with any suffix you want. If the user creating the log doesn't own the bucket, or doesn't have the GetBucketPolicy and PutBucketPolicy permissions for the bucket, the log creation fails. In this case, the bucket owner must manually add the preceding policy to the bucket and specify the log creator's AWS account ID. For more information, see How Do I Add an S3 Bucket Policy? in the Amazon Simple Storage Service User Guide. If the bucket receives logs from multiple accounts, add a Resource element entry to the AWSLogDeliveryWrite policy statement for each account. For example, the following bucket policy allows AWS account 111122223333 to publish logs to a bucket named aws-waf-logs-LOGGING-BUCKET-SUFFIX: { "Version": "2012-10-17", "Id": "AWSLogDeliveryWrite20150319", "Statement": [ { "Sid": "AWSLogDeliveryWrite", "Effect": "Allow", "Principal": { "Service": "delivery.logs.amazonaws.com" }, "Action": "s3:PutObject", "Resource": "arn:aws:s3:::aws-waf-logs-LOGGING-BUCKET-SUFFIX/ AWSLogs/111122223333/*", "Condition": { "StringEquals": { "s3:x-amz-acl": "bucket-owner-full-control", "aws:SourceAccount": ["111122223333"] }, "ArnLike": { "aws:SourceArn": ["arn:aws:logs:us-east-1:111122223333:*"] } } }, { "Sid": "AWSLogDeliveryAclCheck", Logging 519 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide "Effect": "Allow", "Principal": { "Service": "delivery.logs.amazonaws.com" }, "Action": "s3:GetBucketAcl", "Resource": "arn:aws:s3:::aws-waf-logs-LOGGING-BUCKET-SUFFIX", "Condition": { "StringEquals": { "aws:SourceAccount": ["111122223333"] }, "ArnLike": { "aws:SourceArn": ["arn:aws:logs:us-east-1:111122223333:*"] } } } ] } Note In some cases, you may see AccessDenied errors in AWS CloudTrail if the s3:ListBucket permission has not been granted to delivery.logs.amazonaws.com. To avoid these errors in your CloudTrail logs, you must grant the s3:ListBucket permission to delivery.logs.amazonaws.com and you must include the Condition parameters shown with the s3:GetBucketAcl permission set in the preceding bucket policy. To make this simpler, instead of creating a new Statement, you can directly update the AWSLogDeliveryAclCheck to be “Action”: [“s3:GetBucketAcl”, “s3:ListBucket”]. Permissions for using AWS Key Management Service with a KMS key If your logging destination uses server-side encryption with keys that are stored in AWS Key Management Service (SSE-KMS) and you use a customer managed key (KMS key), you must give AWS WAF permission to use your KMS key. To do this, you add a key policy to the KMS key for your chosen destination. This permits AWS WAF logging to write your log files to your destination. Add the following key policy to your KMS key to allow AWS WAF to log to your Amazon S3 bucket. { Logging 520 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide "Sid": "Allow AWS WAF to use the key", "Effect": "Allow", "Principal": { "Service": [ "delivery.logs.amazonaws.com" ] }, "Action": "kms:GenerateDataKey*", "Resource": "*" } Permissions required to access Amazon S3 log files Amazon S3 uses access control lists (ACLs) to manage access to the log files created by an AWS WAF log. By default, the bucket owner has FULL_CONTROL permissions on each log file. The log delivery owner, if different from the bucket owner, has no permissions. The log delivery account has READ and WRITE permissions. For more information, see Access Control List (ACL) Overview in the Amazon Simple Storage Service User Guide. Sending web ACL traffic logs to an Amazon Data Firehose delivery stream This section provides information for sending your web ACL traffic logs to an Amazon Data Firehose delivery stream. Note You are charged for logging in addition to the charges for using AWS WAF. For information, see Pricing for logging web ACL traffic information. To send logs to Amazon Data Firehose, you send logs from your web ACL to an Amazon Data Firehose delivery stream which you configure in Firehose. After you enable logging, AWS WAF delivers logs to your storage destination through the HTTPS endpoint of Firehose. One AWS WAF log is equivalent to |
waf-dg-181 | waf-dg.pdf | 181 | an Amazon Data Firehose delivery stream This section provides information for sending your web ACL traffic logs to an Amazon Data Firehose delivery stream. Note You are charged for logging in addition to the charges for using AWS WAF. For information, see Pricing for logging web ACL traffic information. To send logs to Amazon Data Firehose, you send logs from your web ACL to an Amazon Data Firehose delivery stream which you configure in Firehose. After you enable logging, AWS WAF delivers logs to your storage destination through the HTTPS endpoint of Firehose. One AWS WAF log is equivalent to one Firehose record. If you typically receive 10,000 requests per second and you enable full logs, you should have a 10,000 records per second setting in Firehose. If you don't configure Firehose correctly, AWS WAF won't record all logs. For more information, see Amazon Kinesis Data Firehose quotas. For information about how to create an Amazon Data Firehose delivery stream and review your stored logs, see What is Amazon Data Firehose? Logging 521 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide For information about creating your delivery stream, see Creating an Amazon Data Firehose delivery stream. Configuring an Amazon Data Firehose delivery stream for your web ACL Configure an Amazon Data Firehose delivery stream for your web ACL as follows. • Create it using the same account as you use to manage the web ACL. • Create it in the same Region as the web ACL. If you are capturing logs for Amazon CloudFront, create the firehose in US East (N. Virginia) Region, us-east-1. • Give the data firehose a name that starts with the prefix aws-waf-logs-. For example, aws- waf-logs-us-east-2-analytics. • Configure it for direct put, which allows applications to access the delivery stream directly. In the Amazon Data Firehose console, for the delivery stream Source setting, choose Direct PUT or other sources. Through the API, set the delivery stream property DeliveryStreamType to DirectPut. Note Do not use a Kinesis stream as your source. Permissions required to publish logs to an Amazon Data Firehose delivery stream To understand the permissions required for your Kinesis Data Firehose configuration, see Controlling Access with Amazon Kinesis Data Firehose. You must have the following permissions to successfully enable web ACL logging with an Amazon Data Firehose delivery stream. • iam:CreateServiceLinkedRole • firehose:ListDeliveryStreams • wafv2:PutLoggingConfiguration For information about service-linked roles and the iam:CreateServiceLinkedRole permission, see Using service-linked roles for AWS WAF. Logging 522 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Configuring logging for a web ACL This section provides instructions for configuring data protection for a web ACL. Note You are charged for logging in addition to the charges for using AWS WAF. For information, see Pricing for logging web ACL traffic information. To enable logging for a web ACL, you must have already configured the logging destination that you're going to use. For information about your destination choices and the requirements for each, see AWS WAF logging destinations. To configure logging for a web ACL 1. Sign in to the AWS Management Console and open the AWS WAF console at https:// console.aws.amazon.com/wafv2/. 2. In the navigation pane, choose Web ACLs. 3. Choose the name of the web ACL that you want to enable logging for. The console takes you to the web ACL's description, where you can edit it. 4. On the Logging and metrics tab, choose Enable logging. 5. Choose the logging destination type, and then choose the logging destination that you configured. You must choose a logging destination whose name begins with aws-waf-logs-. 6. (Optional) If you don't want some fields included in the logs, redact them. Choose the field to redact, and then choose Add. Repeat as necessary to redact additional fields. Redacted fields appear in the logs as xxx. Note This setting has no impact on request sampling. You can exclude fields from request sampling by configuring web ACL data protection or by disabling sampling for the web ACL. 7. (Optional) If you don't want to send all requests to the logs, add your filtering criteria and behavior. Under Filter logs, for each filter that you want to apply, choose Add filter, then choose your filtering criteria and specify whether you want to keep or drop requests that Logging 523 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide match the criteria. When you finish adding filters, if needed, modify the Default logging behavior. 8. Choose Enable logging. Note When you successfully enable logging, AWS WAF will create a service-linked role with the necessary permissions to write logs to the logging destination. For more information, see Using service-linked roles for AWS WAF. Finding your web ACL records This section explains how to find your web ACL records. Note You are |
waf-dg-182 | waf-dg.pdf | 182 | then choose your filtering criteria and specify whether you want to keep or drop requests that Logging 523 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide match the criteria. When you finish adding filters, if needed, modify the Default logging behavior. 8. Choose Enable logging. Note When you successfully enable logging, AWS WAF will create a service-linked role with the necessary permissions to write logs to the logging destination. For more information, see Using service-linked roles for AWS WAF. Finding your web ACL records This section explains how to find your web ACL records. Note You are charged for logging in addition to the charges for using AWS WAF. For information, see Pricing for logging web ACL traffic information. If you can't find a log record in your logs On rare occasions, it's possible for AWS WAF log delivery to fall below 100%, with logs delivered on a best effort basis. The AWS WAF architecture prioritizes the security of your applications over all other considerations. In some situations, such as when logging flows experience traffic throttling, this can result in records being dropped. This shouldn't affect more than a few records. If you notice a number of missing log entries, contact the AWS Support Center. In the logging configuration for your web ACL, you can customize what AWS WAF sends to the logs. • Field redaction – You can redact the following fields from the log records for the rules that use the corresponding match settings: URI path, Query string, Single header, and HTTP method. Redacted fields appear as REDACTED in the logs. For example, if you redact the Query string field, in the logs, it will be listed as REDACTED for all rules that use the Query string match component setting. Redaction applies only to the request component that you specify for matching in the rule, so the redaction of the Single header component doesn't apply to rules that match on Headers. For a list of the log fields, see Log fields for web ACL traffic. Logging 524 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Note This setting has no impact on request sampling. You can exclude fields from request sampling by configuring web ACL data protection or by disabling sampling for the web ACL. • Log filtering – You can add filtering to specify which web requests are kept in the logs and which are dropped. You filter on the settings that AWS WAF applies during the web request evaluation. You can filter on the following settings: • Fully qualified label – Fully qualified labels have a prefix, optional namespaces, and label name. The prefix identifies the rule group or web ACL context of the rule that added the label. For information about labels, see Web request labeling in AWS WAF. • Rule action – You can filter on any normal rule action setting and also on the legacy EXCLUDED_AS_COUNT override option for rule group rules. For information about rule action settings, see Using rule actions in AWS WAF. For information about current and legacy rule action overrides for rule group rules, see Overriding rule group actions in AWS WAF. • The normal rule action filters apply to actions that are configured in rules and also to actions that are configured using the current option for overriding a rule group rule action. • The EXCLUDED_AS_COUNT log filter overlaps with the Count action log filter. EXCLUDED_AS_COUNT filters both the current and legacy options for overriding a rule group rule action to Count. Log fields for web ACL traffic The following list describes the possible log fields. action The terminating action that AWS WAF applied to the request. This indicates either allow, block, CAPTCHA, or challenge. The CAPTCHA and Challenge actions are terminating when the web request doesn't contain a valid token. args The query string. Logging 525 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide captchaResponse The CAPTCHA action status for the request, populated when a CAPTCHA action is applied to the request. This field is populated for any CAPTCHA action, whether terminating or non- terminating. If a request has the CAPTCHA action applied multiple times, this field is populated from the last time the action was applied. The CAPTCHA action terminates web request inspection when the request either doesn't include a token or the token is invalid or expired. If the CAPTCHA action is terminating, this field includes a response code and failure reason. If the action is non-terminating, this field includes a solve timestamp. To differentiate between a terminating and non-terminating action, you can filter for a non-empty failureReason attribute in this field. cfDistributionTenantId The identifier for the CloudFront distribution tenant associated with the web request. This field is optional and only applies to web ACLs associated |
waf-dg-183 | waf-dg.pdf | 183 | populated from the last time the action was applied. The CAPTCHA action terminates web request inspection when the request either doesn't include a token or the token is invalid or expired. If the CAPTCHA action is terminating, this field includes a response code and failure reason. If the action is non-terminating, this field includes a solve timestamp. To differentiate between a terminating and non-terminating action, you can filter for a non-empty failureReason attribute in this field. cfDistributionTenantId The identifier for the CloudFront distribution tenant associated with the web request. This field is optional and only applies to web ACLs associated with CloudFront distribution tenants. challengeResponse The challenge action status for the request, populated when a Challenge action is applied to the request. This field is populated for any Challenge action, whether terminating or non- terminating. If a request has the Challenge action applied multiple times, this field is populated from the last time the action was applied. The Challenge action terminates web request inspection when the request either doesn't include a token or the token is invalid or expired. If the Challenge action is terminating, this field includes a response code and failure reason. If the action is non-terminating, this field includes a solve timestamp. To differentiate between a terminating and non-terminating action, you can filter for a non-empty failureReason attribute in this field. clientIp The IP address of the client sending the request. country The source country of the request. If AWS WAF is unable to determine the country of origin, it sets this field to -. excludedRules Used only for rule group rules. The list of rules in the rule group that you have excluded. The action for these rules is set to Count. Logging 526 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide If you override a rule to count using the override rule action option, matches aren't listed here. They're listed as the action pairs action and overriddenAction. exclusionType A type that indicates that the excluded rule has the action Count. ruleId The ID of the rule within the rule group that is excluded. formatVersion The format version for the log. headers The list of headers. httpMethod The HTTP method in the request. httpRequest The metadata about the request. httpSourceId The ID of the associated resource: • For an Amazon CloudFront distribution, the ID is the distribution-id in the ARN syntax: arn:partitioncloudfront::account-id:distribution/distribution-id • For an Application Load Balancer, the ID is the load-balancer-id in the ARN syntax: arn:partition:elasticloadbalancing:region:account-id:loadbalancer/ app/load-balancer-name/load-balancer-id • For an Amazon API Gateway REST API, the ID is the api-id in the ARN syntax: arn:partition:apigateway:region::/restapis/api-id/stages/stage-name • For an AWS AppSync GraphQL API, the ID is the GraphQLApiId in the ARN syntax: arn:partition:appsync:region:account-id:apis/GraphQLApiId • For an Amazon Cognito user pool, the ID is the user-pool-id in the ARN syntax: arn:partition:cognito-idp:region:account-id:userpool/user-pool-id Logging 527 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide • For an AWS App Runner service, the ID is the apprunner-service-id in the ARN syntax: arn:partition:apprunner:region:account-id:service/apprunner-service- name/apprunner-service-id httpSourceName The source of the request. Possible values: CF for Amazon CloudFront, APIGW for Amazon API Gateway, ALB for Application Load Balancer, APPSYNC for AWS AppSync, COGNITOIDP for Amazon Cognito, APPRUNNER for App Runner, and VERIFIED_ACCESS for Verified Access. httpVersion The HTTP version. ja3Fingerprint The JA3 fingerprint of the request. Note JA3 fingerprint inspection is available only for Amazon CloudFront distributions and Application Load Balancers. The JA3 fingerprint is a 32-character hash derived from the TLS Client Hello of an incoming request. This fingerprint serves as a unique identifier for the client's TLS configuration. AWS WAF calculates and logs this fingerprint for each request that has enough TLS Client Hello information for the calculation. You provide this value when you configure a JA3 fingerprint match in your web ACL rules. For information about creating a match against the JA3 fingerprint, see JA3 fingerprint in the Request components in AWS WAF for a rule statement. ja4Fingerprint The JA4 fingerprint of the request. Note JA4 fingerprint inspection is available only for Amazon CloudFront distributions and Application Load Balancers. Logging 528 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide The JA4 fingerprint is a 36-character hash derived from the TLS Client Hello of an incoming request. This fingerprint serves as a unique identifier for the client's TLS configuration. AWS WAF calculates and logs this fingerprint for each request that has enough TLS Client Hello information for the calculation. You provide this value when you configure a JA4 fingerprint match in your web ACL rules. For information about creating a match against the JA4 fingerprint, see JA4 fingerprint in the Request components in AWS WAF for a rule statement. labels The labels on the web request. These labels were applied by rules that were used to evaluate the request. AWS WAF logs |
waf-dg-184 | waf-dg.pdf | 184 | Hello of an incoming request. This fingerprint serves as a unique identifier for the client's TLS configuration. AWS WAF calculates and logs this fingerprint for each request that has enough TLS Client Hello information for the calculation. You provide this value when you configure a JA4 fingerprint match in your web ACL rules. For information about creating a match against the JA4 fingerprint, see JA4 fingerprint in the Request components in AWS WAF for a rule statement. labels The labels on the web request. These labels were applied by rules that were used to evaluate the request. AWS WAF logs the first 100 labels. nonTerminatingMatchingRules The list of non-terminating rules that matched the request. Each item in the list contains the following information. action The action that AWS WAF applied to the request. This indicates either count, CAPTCHA, or challenge. The CAPTCHA and Challenge are non-terminating when the web request contains a valid token. ruleId The ID of the rule that matched the request and was non-terminating. ruleMatchDetails Detailed information about the rule that matched the request. This field is only populated for SQL injection and cross-site scripting (XSS) match rule statements. A matching rule might require a match for more than one inspection criteria, so these match details are provided as an array of match criteria. Any additional information provided for each rule varies according factors such as the rule configuration, rule match type, and details of the match. For example for rules with a CAPTCHA or Challenge action, the captchaResponse or challengeResponse will be listed. If the matching rule is in a rule group and you've overridden its configured rule action, the configured action will be provided in overriddenAction. Logging 529 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide oversizeFields The list of fields in the web request that were inspected by the web ACL and that are over the AWS WAF inspection limit. If a field is oversize but the web ACL doesn't inspect it, it won't be listed here. This list can contain zero or more of the following values: REQUEST_BODY, REQUEST_JSON_BODY, REQUEST_HEADERS, and REQUEST_COOKIES. For more information about oversize fields, see Oversize web request components in AWS WAF. rateBasedRuleList The list of rate-based rules that acted on the request. For information about rate-based rules, see Using rate-based rule statements in AWS WAF. rateBasedRuleId The ID of the rate-based rule that acted on the request. If this has terminated the request, the ID for rateBasedRuleId is the same as the ID for terminatingRuleId. rateBasedRuleName The name of the rate-based rule that acted on the request. limitKey The type of aggregation that the rule is using. Possible values are IP for web request origin, FORWARDED_IP for an IP forwarded in a header in the request, CUSTOMKEYS for custom aggregate key settings. and CONSTANT for count all requests together, with no aggregation. limitValue Used only when rate limiting by a single IP address type. If a request contains an IP address that isn't valid, the limitvalue is INVALID. maxRateAllowed The maximum number of requests allowed in the specified time window for a specific aggregation instance. The aggregation instance is defined by the limitKey plus any additional key specifications that you've provided in the rate-based rule configuration. evaluationWindowSec The amount of time that AWS WAF included in its request counts, in seconds. Logging 530 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide customValues Unique values identified by the rate-based rule in the request. For string values, the logs print the first 32 characters of the string value. Depending on the key type, these values might be for just a key, such as for HTTP method or query string, or they might be for a key and name, such as for header and the header name. requestHeadersInserted The list of headers inserted for custom request handling. requestId The ID of the request, which is generated by the underlying host service. For Application Load Balancer, this is the trace ID. For all others, this is the request ID. responseCodeSent The response code sent with a custom response. ruleGroupId The ID of the rule group. If the rule blocked the request, the ID for ruleGroupID is the same as the ID for terminatingRuleId. ruleGroupList The list of rule groups that acted on this request, with match information. terminatingRule The rule that terminated the request. If this is present, it contains the following information. action The terminating action that AWS WAF applied to the request. This indicates either allow, block, CAPTCHA, or challenge. The CAPTCHA and Challenge actions are terminating when the web request doesn't contain a valid token. ruleId The ID of the rule that matched the request. ruleMatchDetails Detailed information about the rule that matched the request. This field is only populated for SQL injection |
waf-dg-185 | waf-dg.pdf | 185 | the same as the ID for terminatingRuleId. ruleGroupList The list of rule groups that acted on this request, with match information. terminatingRule The rule that terminated the request. If this is present, it contains the following information. action The terminating action that AWS WAF applied to the request. This indicates either allow, block, CAPTCHA, or challenge. The CAPTCHA and Challenge actions are terminating when the web request doesn't contain a valid token. ruleId The ID of the rule that matched the request. ruleMatchDetails Detailed information about the rule that matched the request. This field is only populated for SQL injection and cross-site scripting (XSS) match rule statements. A matching rule Logging 531 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide might require a match for more than one inspection criteria, so these match details are provided as an array of match criteria. Any additional information provided for each rule varies according factors such as the rule configuration, rule match type, and details of the match. For example for rules with a CAPTCHA or Challenge action, the captchaResponse or challengeResponse will be listed. If the matching rule is in a rule group and you've overridden its configured rule action, the configured action will be provided in overriddenAction. terminatingRuleId The ID of the rule that terminated the request. If nothing terminates the request, the value is Default_Action. terminatingRuleMatchDetails Detailed information about the terminating rule that matched the request. A terminating rule has an action that ends the inspection process against a web request. Possible actions for a terminating rule include Allow, Block, CAPTCHA, and Challenge. During the inspection of a web request, at the first rule that matches the request and that has a terminating action, AWS WAF stops the inspection and applies the action. The web request might contain other threats, in addition to the one that's reported in the log for the matching terminating rule. This is only populated for SQL injection and cross-site scripting (XSS) match rule statements. The matching rule might require a match for more than one inspection criteria, so these match details are provided as an array of match criteria. terminatingRuleType The type of rule that terminated the request. Possible values: RATE_BASED, REGULAR, GROUP, and MANAGED_RULE_GROUP. timestamp The timestamp in milliseconds. uri The URI of the request. fragment The part of a URL that follows the "#" symbol, providing additional information about the resource, for example, #section2. Logging 532 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide webaclId The GUID of the web ACL. Log examples for web ACL traffic This section provides examples for logging web ACL traffic. Example Rate-based rule 1: Rule configuration with one key, set to Header:dogname { "Name": "RateBasedRule", "Priority": 1, "Statement": { "RateBasedStatement": { "Limit": 100, "AggregateKeyType": "CUSTOM_KEYS", "CustomKeys": [ { "Header": { "Name": "dogname", "TextTransformations": [ { "Priority": 0, "Type": "NONE" } ] } } ] } }, "Action": { "Block": {} }, "VisibilityConfig": { "SampledRequestsEnabled": true, "CloudWatchMetricsEnabled": true, "MetricName": "RateBasedRule" } } Logging 533 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Example Rate-based rule 1: Log entry for request blocked by rate-based rule { "timestamp":1683355579981, "formatVersion":1, "webaclId": ..., "terminatingRuleId":"RateBasedRule", "terminatingRuleType":"RATE_BASED", "action":"BLOCK", "terminatingRuleMatchDetails":[ ], "httpSourceName":"APIGW", "httpSourceId":"EXAMPLE11:rjvegx5guh:CanaryTest", "ruleGroupList":[ ], "rateBasedRuleList":[ { "rateBasedRuleId": ..., "rateBasedRuleName":"RateBasedRule", "limitKey":"CUSTOMKEYS", "maxRateAllowed":100, "evaluationWindowSec":"120", "customValues":[ { "key":"HEADER", "name":"dogname", "value":"ella" } ] } ], "nonTerminatingMatchingRules":[ ], "requestHeadersInserted":null, "responseCodeSent":null, "httpRequest":{ "clientIp":"52.46.82.45", "country":"FR", "headers":[ { "name":"X-Forwarded-For", Logging 534 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide "value":"52.46.82.45" }, { "name":"X-Forwarded-Proto", "value":"https" }, { "name":"X-Forwarded-Port", "value":"443" }, { "name":"Host", "value":"rjvegx5guh.execute-api.eu-west-3.amazonaws.com" }, { "name":"X-Amzn-Trace-Id", "value":"Root=1-645566cf-7cb058b04d9bb3ee01dc4036" }, { "name":"dogname", "value":"ella" }, { "name":"User-Agent", "value":"RateBasedRuleTestKoipOneKeyModulePV2" }, { "name":"Accept-Encoding", "value":"gzip,deflate" } ], "uri":"/CanaryTest", "args":"", "httpVersion":"HTTP/1.1", "httpMethod":"GET", "requestId":"Ed0AiHF_CGYF-DA=" } } Example Rate-based rule 2: Rule configuration with two keys, set to Header:dogname and Header:catname { Logging 535 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide "Name": "RateBasedRule", "Priority": 1, "Statement": { "RateBasedStatement": { "Limit": 100, "AggregateKeyType": "CUSTOM_KEYS", "CustomKeys": [ { "Header": { "Name": "dogname", "TextTransformations": [ { "Priority": 0, "Type": "NONE" } ] } }, { "Header": { "Name": "catname", "TextTransformations": [ { "Priority": 0, "Type": "NONE" } ] } } ] } }, "Action": { "Block": {} }, "VisibilityConfig": { "SampledRequestsEnabled": true, "CloudWatchMetricsEnabled": true, "MetricName": "RateBasedRule" } } Logging 536 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Example Rate-based rule 2: Log entry for request blocked by rate-based rule { "timestamp":1633322211194, "formatVersion":1, "webaclId":..., "terminatingRuleId":"RateBasedRule", "terminatingRuleType":"RATE_BASED", "action":"BLOCK", "terminatingRuleMatchDetails":[ ], "httpSourceName":"APIGW", "httpSourceId":"EXAMPLE11:rjvegx5guh:CanaryTest", "ruleGroupList":[ ], "rateBasedRuleList":[ { "rateBasedRuleId":..., "rateBasedRuleName":"RateBasedRule", "limitKey":"CUSTOMKEYS", "maxRateAllowed":100, "evaluationWindowSec":"120", "customValues":[ { "key":"HEADER", "name":"dogname", "value":"ella" }, { "key":"HEADER", "name":"catname", "value":"goofie" } ] } ], "nonTerminatingMatchingRules":[ ], "requestHeadersInserted":null, "responseCodeSent":null, "httpRequest":{ Logging 537 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide "clientIp":"52.46.82.35", "country":"FR", "headers":[ { "name":"X-Forwarded-For", "value":"52.46.82.35" }, { "name":"X-Forwarded-Proto", "value":"https" }, { "name":"X-Forwarded-Port", "value":"443" |
waf-dg-186 | waf-dg.pdf | 186 | { "SampledRequestsEnabled": true, "CloudWatchMetricsEnabled": true, "MetricName": "RateBasedRule" } } Logging 536 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Example Rate-based rule 2: Log entry for request blocked by rate-based rule { "timestamp":1633322211194, "formatVersion":1, "webaclId":..., "terminatingRuleId":"RateBasedRule", "terminatingRuleType":"RATE_BASED", "action":"BLOCK", "terminatingRuleMatchDetails":[ ], "httpSourceName":"APIGW", "httpSourceId":"EXAMPLE11:rjvegx5guh:CanaryTest", "ruleGroupList":[ ], "rateBasedRuleList":[ { "rateBasedRuleId":..., "rateBasedRuleName":"RateBasedRule", "limitKey":"CUSTOMKEYS", "maxRateAllowed":100, "evaluationWindowSec":"120", "customValues":[ { "key":"HEADER", "name":"dogname", "value":"ella" }, { "key":"HEADER", "name":"catname", "value":"goofie" } ] } ], "nonTerminatingMatchingRules":[ ], "requestHeadersInserted":null, "responseCodeSent":null, "httpRequest":{ Logging 537 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide "clientIp":"52.46.82.35", "country":"FR", "headers":[ { "name":"X-Forwarded-For", "value":"52.46.82.35" }, { "name":"X-Forwarded-Proto", "value":"https" }, { "name":"X-Forwarded-Port", "value":"443" }, { "name":"Host", "value":"23llbyn8v3.execute-api.eu-west-3.amazonaws.com" }, { "name":"X-Amzn-Trace-Id", "value":"Root=1-64556629-17ac754c2ed9f0620e0f2a0c" }, { "name":"catname", "value":"goofie" }, { "name":"dogname", "value":"ella" }, { "name":"User-Agent", "value":"Apache-HttpClient/UNAVAILABLE (Java/11.0.19)" }, { "name":"Accept-Encoding", "value":"gzip,deflate" } ], "uri":"/CanaryTest", "args":"", "httpVersion":"HTTP/1.1", "httpMethod":"GET", Logging 538 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide "requestId":"EdzmlH5OCGYF1vQ=" } } Example Log output for a rule that triggered on SQLi detection (terminating) { "timestamp": 1576280412771, "formatVersion": 1, "webaclId": "arn:aws:wafv2:ap-southeast-2:111122223333:regional/webacl/ STMTest/1EXAMPLE-2ARN-3ARN-4ARN-123456EXAMPLE", "terminatingRuleId": "STMTest_SQLi_XSS", "terminatingRuleType": "REGULAR", "action": "BLOCK", "terminatingRuleMatchDetails": [ { "conditionType": "SQL_INJECTION", "sensitivityLevel": "HIGH", "location": "HEADER", "matchedData": [ "10", "AND", "1" ] } ], "httpSourceName": "-", "httpSourceId": "-", "ruleGroupList": [], "rateBasedRuleList": [], "nonTerminatingMatchingRules": [], "httpRequest": { "clientIp": "1.1.1.1", "country": "AU", "headers": [ { "name": "Host", "value": "localhost:1989" }, { "name": "User-Agent", "value": "curl/7.61.1" }, Logging 539 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide { "name": "Accept", "value": "*/*" }, { "name": "x-stm-test", "value": "10 AND 1=1" } ], "uri": "/myUri", "args": "", "httpVersion": "HTTP/1.1", "httpMethod": "GET", "requestId": "rid" }, "labels": [ { "name": "value" } ] } Example Log output for a rule that triggered on SQLi detection (non-terminating) { "timestamp":1592357192516 ,"formatVersion":1 ,"webaclId":"arn:aws:wafv2:us-east-1:123456789012:global/webacl/hello- world/5933d6d9-9dde-js82-v8aw-9ck28nv9" ,"terminatingRuleId":"Default_Action" ,"terminatingRuleType":"REGULAR" ,"action":"ALLOW" ,"terminatingRuleMatchDetails":[] ,"httpSourceName":"-" ,"httpSourceId":"-" ,"ruleGroupList":[] ,"rateBasedRuleList":[] ,"nonTerminatingMatchingRules": [{ "ruleId":"TestRule" ,"action":"COUNT" ,"ruleMatchDetails": [{ Logging 540 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide "conditionType":"SQL_INJECTION" ,"sensitivityLevel": "HIGH" ,"location":"HEADER" ,"matchedData":[ "10" ,"and" ,"1"] }] }] ,"httpRequest":{ "clientIp":"3.3.3.3" ,"country":"US" ,"headers":[ {"name":"Host","value":"localhost:1989"} ,{"name":"User-Agent","value":"curl/7.61.1"} ,{"name":"Accept","value":"*/*"} ,{"name":"myHeader","myValue":"10 AND 1=1"} ] ,"uri":"/myUri","args":"" ,"httpVersion":"HTTP/1.1" ,"httpMethod":"GET" ,"requestId":"rid" }, "labels": [ { "name": "value" } ] } Example Log output for multiple rules that triggered inside a rule group (RuleA-XSS is terminating and Rule-B is non-terminating) { "timestamp":1592361810888, "formatVersion":1, "webaclId":"arn:aws:wafv2:us-east-1:123456789012:global/webacl/hello- world/5933d6d9-9dde-js82-v8aw-9ck28nv9" ,"terminatingRuleId":"RG-Reference" ,"terminatingRuleType":"GROUP" ,"action":"BLOCK", "terminatingRuleMatchDetails": [{ Logging 541 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide "conditionType":"XSS" ,"location":"HEADER" ,"matchedData":["<","frameset"] }] ,"httpSourceName":"-" ,"httpSourceId":"-" ,"ruleGroupList": [{ "ruleGroupId":"arn:aws:wafv2:us-east-1:123456789012:global/rulegroup/hello- world/c05lb698-1f11-4m41-aef4-99a506d53f4b" ,"terminatingRule":{ "ruleId":"RuleA-XSS" ,"action":"BLOCK" ,"ruleMatchDetails":null } ,"nonTerminatingMatchingRules": [{ "ruleId":"RuleB-SQLi" ,"action":"COUNT" ,"ruleMatchDetails": [{ "conditionType":"SQL_INJECTION" ,"sensitivityLevel": "LOW" ,"location":"HEADER" ,"matchedData":[ "10" ,"and" ,"1"] }] }] ,"excludedRules":null }] ,"rateBasedRuleList":[] ,"nonTerminatingMatchingRules":[] ,"httpRequest":{ "clientIp":"3.3.3.3" ,"country":"US" ,"headers": [ {"name":"Host","value":"localhost:1989"} ,{"name":"User-Agent","value":"curl/7.61.1"} ,{"name":"Accept","value":"*/*"} ,{"name":"myHeader1","value":"<frameset onload=alert(1)>"} ,{"name":"myHeader2","value":"10 AND 1=1"} Logging 542 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide ] ,"uri":"/myUri" ,"args":"" ,"httpVersion":"HTTP/1.1" ,"httpMethod":"GET" ,"requestId":"rid" }, "labels": [ { "name": "value" } ] } Example Log output for a rule that triggered for the inspection of the request body with content type JSON AWS WAF currently reports the location for JSON body inspection as UNKNOWN. { "timestamp": 1576280412771, "formatVersion": 1, "webaclId": "arn:aws:wafv2:ap-southeast-2:123456789012:regional/webacl/test/111", "terminatingRuleId": "STMTest_SQLi_XSS", "terminatingRuleType": "REGULAR", "action": "BLOCK", "terminatingRuleMatchDetails": [ { "conditionType": "SQL_INJECTION", "sensitivityLevel": "LOW", "location": "UNKNOWN", "matchedData": [ "10", "AND", "1" ] } ], "httpSourceName": "ALB", "httpSourceId": "alb", "ruleGroupList": [], "rateBasedRuleList": [], "nonTerminatingMatchingRules": [], Logging 543 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide "requestHeadersInserted":null, "responseCodeSent":null, "httpRequest": { "clientIp": "1.1.1.1", "country": "AU", "headers": [], "uri": "", "args": "", "httpVersion": "HTTP/1.1", "httpMethod": "POST", "requestId": "null" }, "labels": [ { "name": "value" } ] } Example Log output for a CAPTCHA rule against a web request with a valid, unexpired CAPTCHA token The following log listing is for a web request that matched a rule with CAPTCHA action. The web request has a valid and unexpired CAPTCHA token, and is only noted as a CAPTCHA match by AWS WAF, similar to the behavior for the Count action. This CAPTCHA match is noted under nonTerminatingMatchingRules. { "timestamp": 1632420429309, "formatVersion": 1, "webaclId": "arn:aws:wafv2:us-east-1:123456789012:regional/webacl/captcha-web- acl/585e38b5-afce-4d2a-b417-14fb08b66c67", "terminatingRuleId": "Default_Action", "terminatingRuleType": "REGULAR", "action": "ALLOW", "terminatingRuleMatchDetails": [], "httpSourceName": "APIGW", "httpSourceId": "123456789012:b34myvfw0b:pen-test", "ruleGroupList": [], "rateBasedRuleList": [], "nonTerminatingMatchingRules": [ { "ruleId": "captcha-rule", Logging 544 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide "action": "CAPTCHA", "ruleMatchDetails": [], "captchaResponse": { "responseCode": 0, "solveTimestamp": 1632420429 } } ], "requestHeadersInserted": [ { "name": "x-amzn-waf-test-header-name", "value": "test-header-value" } ], "responseCodeSent": null, "httpRequest": { "clientIp": "72.21.198.65", "country": "US", "headers": [ { "name": "X-Forwarded-For", "value": "72.21.198.65" }, { "name": "X-Forwarded-Proto", "value": "https" }, { "name": "X-Forwarded-Port", "value": "443" }, { "name": "Host", "value": "b34myvfw0b.gamma.execute-api.us-east-1.amazonaws.com" }, { "name": "X-Amzn-Trace-Id", "value": "Root=1-614cc24d-5ad89a09181910c43917a888" }, { "name": "cache-control", "value": "max-age=0" }, { Logging 545 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide "name": "sec-ch-ua", "value": "\"Chromium\";v=\"94\", \"Google Chrome\";v=\"94\", \";Not A Brand \";v=\"99\"" }, { "name": "sec-ch-ua-mobile", "value": "?0" }, { "name": "sec-ch-ua-platform", "value": "\"Windows\"" }, { "name": "upgrade-insecure-requests", "value": "1" }, { "name": |
waf-dg-187 | waf-dg.pdf | 187 | "requestHeadersInserted": [ { "name": "x-amzn-waf-test-header-name", "value": "test-header-value" } ], "responseCodeSent": null, "httpRequest": { "clientIp": "72.21.198.65", "country": "US", "headers": [ { "name": "X-Forwarded-For", "value": "72.21.198.65" }, { "name": "X-Forwarded-Proto", "value": "https" }, { "name": "X-Forwarded-Port", "value": "443" }, { "name": "Host", "value": "b34myvfw0b.gamma.execute-api.us-east-1.amazonaws.com" }, { "name": "X-Amzn-Trace-Id", "value": "Root=1-614cc24d-5ad89a09181910c43917a888" }, { "name": "cache-control", "value": "max-age=0" }, { Logging 545 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide "name": "sec-ch-ua", "value": "\"Chromium\";v=\"94\", \"Google Chrome\";v=\"94\", \";Not A Brand \";v=\"99\"" }, { "name": "sec-ch-ua-mobile", "value": "?0" }, { "name": "sec-ch-ua-platform", "value": "\"Windows\"" }, { "name": "upgrade-insecure-requests", "value": "1" }, { "name": "user-agent", "value": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.54 Safari/537.36" }, { "name": "accept", "value": "text/html,application/xhtml+xml,application/xml;q=0.9,image/ avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9" }, { "name": "sec-fetch-site", "value": "same-origin" }, { "name": "sec-fetch-mode", "value": "navigate" }, { "name": "sec-fetch-user", "value": "?1" }, { "name": "sec-fetch-dest", "value": "document" }, { "name": "referer", Logging 546 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide "value": "https://b34myvfw0b.gamma.execute-api.us-east-1.amazonaws.com/pen- test/pets" }, { "name": "accept-encoding", "value": "gzip, deflate, br" }, { "name": "accept-language", "value": "en-US,en;q=0.9" }, { "name": "cookie", "value": "aws-waf-token=51c71352-41f5-4f6d-b676-c24907bdf819:EQoAZ/J +AAQAAAAA:t9wvxbw042wva7E2Y6lgud/ bS6YG0CJKVAJqaRqDZ140ythKW0Zj9wKB2O8lSkYDRqf1yONcVBFo5u0eYi0tvT4rtQCXsu +KanAardW8go4QSLw4yoED59lgV7oAhGyCalAzE7ra29j+RvvZPsQyoQuDCrtoY/TvQyMTXIXzGPDC/rKBbg==" } ], "uri": "/pen-test/pets", "args": "", "httpVersion": "HTTP/1.1", "httpMethod": "GET", "requestId": "GINMHHUgoAMFxug=" } } Example Log output for a CAPTCHA rule against a web request that doesn't have a CAPTCHA token The following log listing is for a web request that matched a rule with CAPTCHA action. The web request didn't have a CAPTCHA token, and was blocked by AWS WAF. { "timestamp": 1632420416512, "formatVersion": 1, "webaclId": "arn:aws:wafv2:us-east-1:123456789012:regional/webacl/captcha-web- acl/585e38b5-afce-4d2a-b417-14fb08b66c67", "terminatingRuleId": "captcha-rule", "terminatingRuleType": "REGULAR", "action": "CAPTCHA", "terminatingRuleMatchDetails": [], "httpSourceName": "APIGW", Logging 547 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide "httpSourceId": "123456789012:b34myvfw0b:pen-test", "ruleGroupList": [], "rateBasedRuleList": [], "nonTerminatingMatchingRules": [], "requestHeadersInserted": null, "responseCodeSent": 405, "httpRequest": { "clientIp": "72.21.198.65", "country": "US", "headers": [ { "name": "X-Forwarded-For", "value": "72.21.198.65" }, { "name": "X-Forwarded-Proto", "value": "https" }, { "name": "X-Forwarded-Port", "value": "443" }, { "name": "Host", "value": "b34myvfw0b.gamma.execute-api.us-east-1.amazonaws.com" }, { "name": "X-Amzn-Trace-Id", "value": "Root=1-614cc240-18b57ff33c10e5c016b508c5" }, { "name": "sec-ch-ua", "value": "\"Chromium\";v=\"94\", \"Google Chrome\";v=\"94\", \";Not A Brand \";v=\"99\"" }, { "name": "sec-ch-ua-mobile", "value": "?0" }, { "name": "sec-ch-ua-platform", "value": "\"Windows\"" }, { Logging 548 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide "name": "upgrade-insecure-requests", "value": "1" }, { "name": "user-agent", "value": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.54 Safari/537.36" }, { "name": "accept", "value": "text/html,application/xhtml+xml,application/xml;q=0.9,image/ avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9" }, { "name": "sec-fetch-site", "value": "cross-site" }, { "name": "sec-fetch-mode", "value": "navigate" }, { "name": "sec-fetch-user", "value": "?1" }, { "name": "sec-fetch-dest", "value": "document" }, { "name": "accept-encoding", "value": "gzip, deflate, br" }, { "name": "accept-language", "value": "en-US,en;q=0.9" } ], "uri": "/pen-test/pets", "args": "", "httpVersion": "HTTP/1.1", "httpMethod": "GET", "requestId": "GINKHEssoAMFsrg=" }, Logging 549 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide "captchaResponse": { "responseCode": 405, "solveTimestamp": 0, "failureReason": "TOKEN_MISSING" } } Data protection AWS WAF data protection settings let you implement customized and granular protection of sensitive information (passwords, API keys, authentication tokens, and other confidential data) on specific data fields such as headers, parameters, and body content. You can configure data protection at either: • The web ACL level, which applies across all output destinations. • Logging only, which only affects the data that AWS WAF sends to the configured logging destination. Data protection can be specified as either a substitution or hashing. Substitution refers to replacing content with the word REDACTED. Hashing refers to replacing content with sha256(account_number + content[:64]). You should review the characteristics of SHA-256 hashing to determine if it meets your requirements before you select the appropriate data protection method. We do not recommend relying on SHA-256 hashing if you intend to achieve an outcome equivalent to encryption or tokenization. Topics • Enabling data protection • Data protection exceptions • Data protection limitations • Examples of data protection • Configuring data protection for a web ACL Enabling data protection This section explains the data protection and log configuration options you can select from the console. You can protect data that appears in logs by enabling data protection on certain fields. Data protection 550 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Data protection can be applied to transform sensitive information in various types of outputs, including full logs, sample requests, and Security Lake. To enable data protection in the AWS WAF console Navigate to the Web ACLs page in the console to enable protection settings. To enable data protection for your logs, choose whether to apply it to all logs or to a specific logging destination. For information, see Log fields for web ACL traffic. Note You don't need to enable logging to apply data protection on all logging. Data protection will be applied across all output destinations, regardless of whether logging is enabled. At the bottom of the Enable protection settings page, |
waf-dg-188 | waf-dg.pdf | 188 | of outputs, including full logs, sample requests, and Security Lake. To enable data protection in the AWS WAF console Navigate to the Web ACLs page in the console to enable protection settings. To enable data protection for your logs, choose whether to apply it to all logs or to a specific logging destination. For information, see Log fields for web ACL traffic. Note You don't need to enable logging to apply data protection on all logging. Data protection will be applied across all output destinations, regardless of whether logging is enabled. At the bottom of the Enable protection settings page, select the Add field button on the Data protection fields panel. Select the field type from the drop down menu. For information about how each field's data is protected with data protection, see the table below. Field type Single header Body Query string Single query argument Details Permanently transform the specified header key value according to the specified option (hashing or subsitution). The transformed value will also be reflected in full Logs. Permanently transforms the body value. Only applicable for RuleMatchDetails in the log. Permanently transform the query string according to the specified option (hashing or subsitution). The transformed value will also be reflected in full Logs. Permanently transform the specified query arg value according to the specified option (hashing or subsitution). The transformed value will also be reflected in full Logs. Data protection 551 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Field type Single cookie Details Permanently transform the cookie value according to the specified option (hashing or subsitution). The transformed value will also be reflected in full Logs. Data protection exceptions When enabled, data protection will apply to the fields it is enabled on, including RuleMatchDetails and rateBasedRuleList. However, there are instances when you may want to include the protected data and content in RuleMatchDetails and rateBasedRuleList for troubleshooting and visibility purposes. In these scenarios, you can specify exceptions to the data protection for that field. • ExcludeRuleMatchDetails: If you specify this exception for a specific field, RuleMatchDetails will show the value of the field and won't be in scope for data protection. • ExcludeRateBasedDetails: If you specify this exception for a specific field, rateBasedRuleList will show the value of the field and won't be in scope for data protection. Example: The ExcludeRateBasedDetails rule is enabled on SINGLE_HEADER and HEADER_NAME for "dogname". If an exception is not applied to the rule, the value for "dogname" will appear as REDACTED. "rateBasedRuleList":[ {"rateBasedRuleId": ..., "rateBasedRuleName":"RateBasedRule", "limitKey":"CUSTOMKEYS", "maxRateAllowed":100, "evaluationWindowSec":"120", "customValues":[ {"key":"HEADER", "name":"dogname", "value":"REDACTED" } ] } ] If an exception is enabled on the rule, the "dogname" value will appear in the log. "rateBasedRuleList":[ {"rateBasedRuleId": ..., "rateBasedRuleName":"RateBasedRule", "limitKey":"CUSTOMKEYS", "maxRateAllowed":100, "evaluationWindowSec":"120", "customValues":[ {"key":"HEADER", "name":"dogname", "value":"ELLA" } ] } ] Data protection 552 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Warning The data protection feature may potentially affect troubleshooting AWS WAF capabilities. These settings can cause unexpected detection and mitigation behaviors. Limit data protection for specific parameters to only those that are absolutely necessary. Data protection limitations The following are limitations to consider when using data protection. QueryString and SingleQueryArg QueryString Protection • Data protection on QueryString applies to all query arguments, substituting/hashing both keys and values according to the specified settings. QueryString in RuleMatch details and RateBased rule lists • If data protection is applied to a single-query argument, then the entire query string will be substituted/hashed in the RuleMatchDetails and RateBasedRule section in full logs. • If different protection methods are specified (substitution and hashing) in multiple single-query arguments, the stricter method, substitution, will be applied to the entire query string in the RuleMatchDetails and RateBasedRule section in full logs. Cookies Note Data protection is only applied to the values of the cookie when the single header cookie is protected. Single cookie in RuleMatchDetails and RateBasedRule lists • If data protection is applied to a single cookie, then the entire cookie header will be substituted/ hashed in the RuleMatchDetails and RateBasedRule section in full logs. Data protection 553 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide • If different protection methods are specified (substitution and hashing), the stricter method, substitution, will be applied to the entire cookie in the RuleMatchDetails and RateBasedRule section in full logs. Examples of data protection This section provides log examples of data protection logging of web ACL traffic. DataProtection hashing Webacl config "data_protection_config": { "data_protections": [ { "field": { "field_type": "SINGLE_QUERY_ARGUMENT", "field_keys": [ "hoppy" ] }, "action": "HASH", "exclude_rule_match_details": false, "exclude_rate_based_details": false } ] } Example DataProtection hashing: Log entry with the SingleQuery argument "hoppy" protected. { "timestamp": 1738705092889, "formatVersion": 1, "webaclId": "arn:aws:wafv2:us-east-1:111122223333:regional/webacl/ DataProtectionhashACL/4eede063-e611-44f5-b357-ffc9d7b7fed5", "terminatingRuleId": "Default_Action", "terminatingRuleType": "REGULAR", "action": "ALLOW", "terminatingRuleMatchDetails": [], "httpSourceName": "APIGW", "httpSourceId": "746533260405:xt7v59bhn7:ABC", "ruleGroupList": [], Data protection 554 AWS WAF, AWS Firewall |
waf-dg-189 | waf-dg.pdf | 189 | will be applied to the entire cookie in the RuleMatchDetails and RateBasedRule section in full logs. Examples of data protection This section provides log examples of data protection logging of web ACL traffic. DataProtection hashing Webacl config "data_protection_config": { "data_protections": [ { "field": { "field_type": "SINGLE_QUERY_ARGUMENT", "field_keys": [ "hoppy" ] }, "action": "HASH", "exclude_rule_match_details": false, "exclude_rate_based_details": false } ] } Example DataProtection hashing: Log entry with the SingleQuery argument "hoppy" protected. { "timestamp": 1738705092889, "formatVersion": 1, "webaclId": "arn:aws:wafv2:us-east-1:111122223333:regional/webacl/ DataProtectionhashACL/4eede063-e611-44f5-b357-ffc9d7b7fed5", "terminatingRuleId": "Default_Action", "terminatingRuleType": "REGULAR", "action": "ALLOW", "terminatingRuleMatchDetails": [], "httpSourceName": "APIGW", "httpSourceId": "746533260405:xt7v59bhn7:ABC", "ruleGroupList": [], Data protection 554 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide "rateBasedRuleList": [], "nonTerminatingMatchingRules": [{ "ruleId": "ProtectedSQLIHeadersVisibleInSTM", "action": "COUNT", "ruleMatchDetails": [{ "conditionType": "SQL_INJECTION", "sensitivityLevel": "HIGH", "location": "SINGLE_QUERY_ARG", "matchedData": [ "z6hpYAFaMYdtiTeHhxnN5ydgRE5E1WgyVIdgqH0D3iM=" ], "matchedFieldName": "hoppy" }] }], "requestHeadersInserted": null, "responseCodeSent": null, "httpRequest": { "clientIp": "54.239.98.137", "country": "US", "headers": [{ "name": "X-Forwarded-For", "value": "54.239.98.137" }, { "name": "X-Forwarded-Proto", "value": "https" }, { "name": "X-Forwarded-Port", "value": "443" }, { "name": "Host", "value": "xt7xxx9bhn7.gamma.execute-api.us-east-1.amazonaws.com" }, { "name": "X-Amzn-Trace-Id", "value": "Root=1-67a288c4-27acb3cd5795dd8456b7e3c3" }, { "name": "Accept-Encoding", "value": "gzip" }, { "name": "User-Agent", "value": "okhttp/3.12.1" }], "uri": "/CanaryTest", "args": "hoppy=z6hpYAFaMYdtiTeHhxnN5ydgRE5E1WgyVIdgqH0D3iM=&yellow=hello&x-hoppy- extra=generic-%3Cwords%3E-in-angle-brackets", "httpVersion": "HTTP/1.1", "httpMethod": "GET", Data protection 555 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide "requestId": "FepO0F8fIAMEqoQ=" }, "labels": [{ "name": "awswaf:forwardedip:geo:country:US" }, { "name": "awswaf:forwardedip:geo:region:US-VA" }] } DataProtection substitution Webacl Config "data_protection_config": { "data_protections": [ { "field": { "field_type": "SINGLE_QUERY_ARGUMENT", "field_keys": [ "hoppy" ] }, "action": "SUBSTITUTION", "exclude_rule_match_details": false, "exclude_rate_based_details": false } ] } Example DataProtection substitution: Log entry with Single Query Argument “hoppy” protected { "timestamp": 1738705092889, "formatVersion": 1, "webaclId": "arn:aws:wafv2:us-east-1:111122223333:regional/webacl/ DataProtectionhashACL/4eede063-e611-44f5-b357-ffc9d7b7fed5", "terminatingRuleId": "Default_Action", "terminatingRuleType": "REGULAR", "action": "ALLOW", "terminatingRuleMatchDetails": [], "httpSourceName": "APIGW", "httpSourceId": "746533260405:xt7v59bhn7:ABC", "ruleGroupList": [], Data protection 556 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide "rateBasedRuleList": [], "nonTerminatingMatchingRules": [] "requestHeadersInserted": null, "responseCodeSent": null, "httpRequest": { "clientIp": "54.239.98.137", "country": "US", "headers": [{ "name": "X-Forwarded-For", "value": "54.239.98.137" }, { "name": "X-Forwarded-Proto", "value": "https" }, { "name": "X-Forwarded-Port", "value": "443" }, { "name": "Host", "value": "xt7xxx9bhn7.gamma.execute-api.us-east-1.amazonaws.com" }, { "name": "X-Amzn-Trace-Id", "value": "Root=1-67a288c4-27acb3cd5795dd8456b7e3c3" }, { "name": "Accept-Encoding", "value": "gzip" }, { "name": "User-Agent", "value": "okhttp/3.12.1" }], "uri": "/CanaryTest", "args": "hoppy=REDACTED&yellow=hello&x-hoppy-extra=generic-%3Cwords%3E-in-angle- brackets", "httpVersion": "HTTP/1.1", "httpMethod": "GET", "requestId": "FepO0F8fIAMEqoQ=" }, "labels": [{ "name": "awswaf:forwardedip:geo:country:US" }, { "name": "awswaf:forwardedip:geo:region:US-VA" }] } Data protection 557 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Retaining data in RuleMatchDetails Webacl config "data_protection_config": { "data_protections": [ { "field": { "field_type": "SINGLE_HEADER", "field_keys": [ "hoppy" ] }, "action": "HASH", "exclude_rule_match_details": true, "exclude_rate_based_details": false } ] } Example of retaining data in RuleMatchDetails: Log entry with single Header “hoppy” protected but the value is retained only in RuleMatchDetails. { "timestamp": 1738705092889, "formatVersion": 1, "webaclId": "arn:aws:wafv2:us-east-1:111122223333:regional/webacl/ DataProtectionhashACL/4eede063-e611-44f5-b357-ffc9d7b7fed5", "terminatingRuleId": "Default_Action", "terminatingRuleType": "REGULAR", "action": "ALLOW", "terminatingRuleMatchDetails": [], "httpSourceName": "APIGW", "httpSourceId": "746533260405:xt7v59bhn7:ABC", "ruleGroupList": [], "rateBasedRuleList": [], "nonTerminatingMatchingRules": [{ "ruleId": "ProtectedSQLIHeadersVisibleInSTM", "action": "COUNT", "ruleMatchDetails": [{ "conditionType": "SQL_INJECTION", "sensitivityLevel": "HIGH", "location": "HEADER", Data protection 558 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide "matchedData": [ "10", "AND", "1" ], "matchedFieldName": "hoppy" }] }], "requestHeadersInserted": null, "responseCodeSent": null, "httpRequest": { "clientIp": "54.239.98.137", "country": "US", "headers": [{ "name": "X-Forwarded-For", "value": "54.239.98.137" }, { "name": "X-Forwarded-Proto", "value": "https" }, { "name": "X-Forwarded-Port", "value": "443" }, { "name": "Host", "value": "xt7xxx9bhn7.gamma.execute-api.us-east-1.amazonaws.com" }, { "name": "X-Amzn-Trace-Id", "value": "Root=1-67a288c4-27acb3cd5795dd8456b7e3c3" }, { "name": "hoppy", "value": "zuomr2mxQxofg6EI6f7hMNGaJhhPxt0rFVAXog6FLxE=" }, { "name": "Accept-Encoding", "value": "gzip" }, { "name": "User-Agent", "value": "okhttp/3.12.1" }, { "name": "hoppy", "value": "z6hpYAFaMYdtiTeHhxnN5ydgRE5E1WgyVIdgqH0D3iM=" }], "uri": "/CanaryTest", "args": "happy=true", "httpVersion": "HTTP/1.1", "httpMethod": "GET", "requestId": "FepO0F8fIAMEqoQ=" }, "labels": [{ Data protection 559 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide "name": "awswaf:forwardedip:geo:country:US" }, { "name": "awswaf:forwardedip:geo:region:US-VA" }] } Retaining data in rateBasedRule "data_protection_config": { "data_protections": [ { "field": { "field_type": "SINGLE_HEADER", "field_keys": [ "hoppy" ] }, "action": "HASH", "exclude_rule_match_details": false, "exclude_rate_based_details": true } ] } Example Retaining data in rateBasedRuleList: Log entry with the Single Header “hoppy” protected but the value is retained only in rateBasedRuleList { "timestamp": 1683355579981, "formatVersion": 1, "webaclId": ..., "terminatingRuleId": "RateBasedRule", "terminatingRuleType": "RATE_BASED", "action": "BLOCK", "terminatingRuleMatchDetails": [], "httpSourceName": "APIGW", "httpSourceId": "EXAMPLE11:rjvegx5guh:CanaryTest", "ruleGroupList": [], "rateBasedRuleList": [{ "rateBasedRuleId": ..., "rateBasedRuleName": "RateBasedRule", "limitKey": "CUSTOMKEYS", "maxRateAllowed": 100, Data protection 560 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide "evaluationWindowSec": "120", "customValues": [{ "key": "HEADER", "name": "hoppy", "value": "ella" }] }], "nonTerminatingMatchingRules": [], "requestHeadersInserted": null, "responseCodeSent": null, "httpRequest": { "clientIp": "52.46.82.45", "country": "FR", "headers": [{ "name": "X-Forwarded-For", "value": "52.46.82.45" }, { "name": "X-Forwarded-Proto", "value": "https" }, { "name": "X-Forwarded-Port", "value": "443" }, { "name": "Host", "value": "rjvegx5guh.execute-api.eu-west-3.amazonaws.com" }, { "name": "X-Amzn-Trace-Id", "value": "Root=1-645566cf-7cb058b04d9bb3ee01dc4036" }, { "name": "hoppy", "value": "zuomr2mxQxofg6EI6f7hMNGaJhhPxt0rFVAXog6FLxE=" }, { "name": "User-Agent", "value": "RateBasedRuleTestKoipOneKeyModulePV2" }, { "name": "Accept-Encoding", "value": "gzip,deflate" }], "uri": "/CanaryTest", "args": "", "httpVersion": "HTTP/1.1", "httpMethod": "GET", "requestId": "Ed0AiHF_CGYF-DA=" } Data protection 561 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide } Data protection for Body AWS WAF only log subsets |
waf-dg-190 | waf-dg.pdf | 190 | "value": "ella" }] }], "nonTerminatingMatchingRules": [], "requestHeadersInserted": null, "responseCodeSent": null, "httpRequest": { "clientIp": "52.46.82.45", "country": "FR", "headers": [{ "name": "X-Forwarded-For", "value": "52.46.82.45" }, { "name": "X-Forwarded-Proto", "value": "https" }, { "name": "X-Forwarded-Port", "value": "443" }, { "name": "Host", "value": "rjvegx5guh.execute-api.eu-west-3.amazonaws.com" }, { "name": "X-Amzn-Trace-Id", "value": "Root=1-645566cf-7cb058b04d9bb3ee01dc4036" }, { "name": "hoppy", "value": "zuomr2mxQxofg6EI6f7hMNGaJhhPxt0rFVAXog6FLxE=" }, { "name": "User-Agent", "value": "RateBasedRuleTestKoipOneKeyModulePV2" }, { "name": "Accept-Encoding", "value": "gzip,deflate" }], "uri": "/CanaryTest", "args": "", "httpVersion": "HTTP/1.1", "httpMethod": "GET", "requestId": "Ed0AiHF_CGYF-DA=" } Data protection 561 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide } Data protection for Body AWS WAF only log subsets of Body in RuleMatchDetails. Webacl config "data_protection_config": { "data_protections": [ { "field": { "field_type": "BODY" }, "action": "SUBSTITUTE", "exclude_rule_match_details": false, "exclude_rate_based_details": false } ] } Example DataProtection for Body: Log entry with Body Subsituted in ruleMatchDetails. { "timestamp": 1738705092889, "formatVersion": 1, "webaclId": "arn:aws:wafv2:us-east-1:111122223333:regional/webacl/ DataProtectionhashACL/4eede063-e611-44f5-b357-ffc9d7b7fed5", "terminatingRuleId": "Default_Action", "terminatingRuleType": "REGULAR", "action": "ALLOW", "terminatingRuleMatchDetails": [], "httpSourceName": "APIGW", "httpSourceId": "746533260405:xt7v59bhn7:ABC", "ruleGroupList": [], "rateBasedRuleList": [], "nonTerminatingMatchingRules": [{ "ruleId": "ProtectedSQLIBody", "action": "COUNT", "ruleMatchDetails": [{ "conditionType": "SQL_INJECTION", "sensitivityLevel": "HIGH", "location": "BODY", Data protection 562 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide "matchedData": ["REDACTED"] }] }], "requestHeadersInserted": null, "responseCodeSent": null, "httpRequest": { "clientIp": "54.239.98.137", "country": "US", "headers": [{ "name": "X-Forwarded-For", "value": "54.239.98.137" }, { "name": "X-Forwarded-Proto", "value": "https" }, { "name": "X-Forwarded-Port", "value": "443" }, { "name": "Host", "value": "xt7xxx9bhn7.gamma.execute-api.us-east-1.amazonaws.com" }, { "name": "X-Amzn-Trace-Id", "value": "Root=1-67a288c4-27acb3cd5795dd8456b7e3c3" }, { "name": "Accept-Encoding", "value": "gzip" }, { "name": "User-Agent", "value": "okhttp/3.12.1" }, { "name": "cookie", "value": "hoppy=dog;" }], "uri": "/CanaryTest", "args": "baloo=abc&hoppy-query=xyz&x-hoppy-extra=generic-%3Cwords%3E-in-angle- brackets", "httpVersion": "HTTP/1.1", "httpMethod": "GET", "requestId": "FepO0F8fIAMEqoQ=" }, "labels": [{ "name": "awswaf:forwardedip:geo:country:US" }, { "name": "awswaf:forwardedip:geo:region:US-VA" Data protection 563 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide }] } Data protection for SINGLE_COOKIE Webacl config "data_protection_config": { "data_protections": [ { "field": { "field_type": "SINGLE_COOKIE", "field_keys": [ "MILO" ] }, "action": "HASH", "exclude_rule_match_details": false, "exclude_rate_based_details": false } ] } Example DataProtection for SINGLE_COOKIE: Log entry with a SINGLE_COOKIE named "MILO" protected. The full Log shows the Cookie named MILO is protected in ruleMatchDetails and the cookie header. Only cookie values are protected and key names are excluded. Note All protected fields (single header, cookie, query arg) are not case sensitive. So, for this example, "MILO" matches "milo". { "timestamp": 1738705092889, "formatVersion": 1, "webaclId": "arn:aws:wafv2:us-east-1:111122223333:regional/webacl/ DataProtectionhashACL/4eede063-e611-44f5-b357-ffc9d7b7fed5", "terminatingRuleId": "Default_Action", "terminatingRuleType": "REGULAR", Data protection 564 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide "action": "ALLOW", "terminatingRuleMatchDetails": [], "httpSourceName": "APIGW", "httpSourceId": "746533260405:xt7v59bhn7:ABC", "ruleGroupList": [], "rateBasedRuleList": [], "nonTerminatingMatchingRules": [{ "ruleId": "ProtectedSQLIHeadersVisibleInSTM", "action": "COUNT", "ruleMatchDetails": [{ "conditionType": "SQL_INJECTION", "sensitivityLevel": "HIGH", "location": "COOKIE", "matchedData": ["zuomr2mxQxofg6EI6f7hMNGaJhhPxt0rFVAXog6FLxE="], "matchedFieldName": "milo" }] }], "requestHeadersInserted": null, "responseCodeSent": null, "httpRequest": { "clientIp": "54.239.98.137", "country": "US", "headers": [{ "name": "X-Forwarded-For", "value": "54.239.98.137" }, { "name": "X-Forwarded-Proto", "value": "https" }, { "name": "X-Forwarded-Port", "value": "443" }, { "name": "Host", "value": "xt7xxx9bhn7.gamma.execute-api.us-east-1.amazonaws.com" }, { "name": "X-Amzn-Trace-Id", "value": "Root=1-67a288c4-27acb3cd5795dd8456b7e3c3" }, { "name": "Accept-Encoding", "value": "gzip" }, { "name": "User-Agent", "value": "okhttp/3.12.1" }, { Data protection 565 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide "name": "cookie", "value": "hoppy=dog;milo=zuomr2mxQxofg6EI6f7hMNGaJhhPxt0rFVAXog6FLxE=;aws- waf-token=51c71352-41f5-4f6d-b676-c24907bdf819:EQoAZ/J+AAQAAAAA:t9wvxbw042wva7E2Y6lgud/ bS6YG0CJKVAJqaRqDZ140ythKW0Zj9wKB2O8lSkYDRqf1yONcVBFo5u0eYi0tvT4rtQCXsu +KanAardW8go4QSLw4yoED59lgV7oAhGyCalAzE7ra29j+RvvZPsQyoQuDCrtoY/TvQyMTXIXzGPDC/rKBbg==" }], "uri": "/CanaryTest", "args": "baloo=abc&hoppy-query=xyz&x-hoppy-extra=generic-%3Cwords%3E-in-angle- brackets", "httpVersion": "HTTP/1.1", "httpMethod": "GET", "requestId": "FepO0F8fIAMEqoQ=" }, "labels": [{ "name": "awswaf:forwardedip:geo:country:US" }, { "name": "awswaf:forwardedip:geo:region:US-VA" }] } Data protection for all cookies You can configure data protection for cookies by using SINGLE_HEADER. Only cookie values are protected and key names are excluded. "DataProtectionConfig": { "DataProtections": [ { "Field": { "FieldType": "SINGLE_HEADER", "FieldKeys": ["cookie"] }, "Action": "SUBSTITUTION", "ExcludeRuleMatchDetails": false, "ExcludeRateBasedDetails": false } ] } Example DataProtection for the header "COOKIE": Log entry with the cookie header protected. Data protection 566 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide Note The cookie name AWS-WAF-TOKEN is out of scope for data protection. { "timestamp": 1738705092889, "formatVersion": 1, "webaclId": "arn:aws:wafv2:us-east-1:111122223333:regional/webacl/ DataProtectionhashACL/4eede063-e611-44f5-b357-ffc9d7b7fed5", "terminatingRuleId": "Default_Action", "terminatingRuleType": "REGULAR", "action": "ALLOW", "terminatingRuleMatchDetails": [], "httpSourceName": "APIGW", "httpSourceId": "746533260405:xt7v59bhn7:ABC", "ruleGroupList": [], "rateBasedRuleList": [], "nonTerminatingMatchingRules": [], "requestHeadersInserted": null, "responseCodeSent": null, "httpRequest": { "clientIp": "54.239.98.137", "country": "US", "headers": [{ "name": "X-Forwarded-For", "value": "54.239.98.137" }, { "name": "X-Forwarded-Proto", "value": "https" }, { "name": "X-Forwarded-Port", "value": "443" }, { "name": "Host", "value": "xt7xxx9bhn7.gamma.execute-api.us-east-1.amazonaws.com" }, { "name": "X-Amzn-Trace-Id", "value": "Root=1-67a288c4-27acb3cd5795dd8456b7e3c3" }, { "name": "Accept-Encoding", "value": "gzip" Data protection 567 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide }, { "name": "User-Agent", "value": "okhttp/3.12.1" }, { "name": "cookie", "value": "hoppy=REDACTED;milo=REDACTED;aws-waf- token=51c71352-41f5-4f6d-b676-c24907bdf819:EQoAZ/J+AAQAAAAA:t9wvxbw042wva7E2Y6lgud/ bS6YG0CJKVAJqaRqDZ140ythKW0Zj9wKB2O8lSkYDRqf1yONcVBFo5u0eYi0tvT4rtQCXsu +KanAardW8go4QSLw4yoED59lgV7oAhGyCalAzE7ra29j+RvvZPsQyoQuDCrtoY/TvQyMTXIXzGPDC/rKBbg==" }], "uri": "/CanaryTest", "args": "baloo=xyz=&hoppy-query=abc&x-hoppy-extra=abc", "httpVersion": "HTTP/1.1", "httpMethod": "GET", "requestId": "FepO0F8fIAMEqoQ=" }, "labels": [{ "name": "awswaf:forwardedip:geo:country:US" }, { "name": "awswaf:forwardedip:geo:region:US-VA" }] } Data protection for single query arguments You can configure data protection for a query string by using SINGLE_QUERY_ARGUMENT. This affects the keys and values of all query args. For the following examples, the original query string was baloo=10 AND 1=1&hoppy=10 AND 1=1&x-hoppy-extra=generic-%3Cwords. Webacl config "DataProtectionConfig": { "DataProtections": [ { "Field": { "FieldType": "SINGLE_QUERY_ARGUMENT", "FieldKeys": ["hoppy"] }, "Action": "SUBSTITUTION", "ExcludeRuleMatchDetails": false, "ExcludeRateBasedDetails": false |
waf-dg-191 | waf-dg.pdf | 191 | Guide }, { "name": "User-Agent", "value": "okhttp/3.12.1" }, { "name": "cookie", "value": "hoppy=REDACTED;milo=REDACTED;aws-waf- token=51c71352-41f5-4f6d-b676-c24907bdf819:EQoAZ/J+AAQAAAAA:t9wvxbw042wva7E2Y6lgud/ bS6YG0CJKVAJqaRqDZ140ythKW0Zj9wKB2O8lSkYDRqf1yONcVBFo5u0eYi0tvT4rtQCXsu +KanAardW8go4QSLw4yoED59lgV7oAhGyCalAzE7ra29j+RvvZPsQyoQuDCrtoY/TvQyMTXIXzGPDC/rKBbg==" }], "uri": "/CanaryTest", "args": "baloo=xyz=&hoppy-query=abc&x-hoppy-extra=abc", "httpVersion": "HTTP/1.1", "httpMethod": "GET", "requestId": "FepO0F8fIAMEqoQ=" }, "labels": [{ "name": "awswaf:forwardedip:geo:country:US" }, { "name": "awswaf:forwardedip:geo:region:US-VA" }] } Data protection for single query arguments You can configure data protection for a query string by using SINGLE_QUERY_ARGUMENT. This affects the keys and values of all query args. For the following examples, the original query string was baloo=10 AND 1=1&hoppy=10 AND 1=1&x-hoppy-extra=generic-%3Cwords. Webacl config "DataProtectionConfig": { "DataProtections": [ { "Field": { "FieldType": "SINGLE_QUERY_ARGUMENT", "FieldKeys": ["hoppy"] }, "Action": "SUBSTITUTION", "ExcludeRuleMatchDetails": false, "ExcludeRateBasedDetails": false } ] Data protection 568 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide } Example DataProtection for SINGLE_QUERY_ARGUEMENT: Log entry with "hoppy" query string protected with substitution. { "timestamp": 1738705092889, "formatVersion": 1, "webaclId": "arn:aws:wafv2:us-east-1:111122223333:regional/webacl/ DataProtectionSubstituteQueryString/4eede063-e611-44f5-b357-ffc9d7b7fed5", "terminatingRuleId": "Default_Action", "terminatingRuleType": "REGULAR", "action": "ALLOW", "terminatingRuleMatchDetails": [], "httpSourceName": "APIGW", "httpSourceId": "746533260405:xt7v59bhn7:ABC", "ruleGroupList": [], "rateBasedRuleList": [], "nonTerminatingMatchingRules": [ { "ruleId": "ProtectedHoppyQueryArg", "action": "COUNT", "ruleMatchDetails": [ { "conditionType": "SQL_INJECTION", "sensitivityLevel": "HIGH", "location": "SINGLE_QUERY_ARG", "matchedData": ["REDACTED"], "matchedFieldName": "hoppy" }] }, { "ruleId": "FullQueryStringInspectionWhichDetectsTheFirstFieldWithSQLi_Baloo_IsAlsoMaskedMasked", "action": "COUNT", "ruleMatchDetails": [ { "conditionType": "SQL_INJECTION", "sensitivityLevel": "HIGH", "location": "QUERY_ARGS", "matchedData": ["REDACTED"], }] }, Data protection 569 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide { "ruleId": "ProtectedBalooQueryArg", "action": "COUNT", "ruleMatchDetails": [ { "conditionType": "SQL_INJECTION", "sensitivityLevel": "HIGH", "location": "SINGLE_QUERY_ARG", "matchedData": [ "10", "AND", "1" ], "matchedFieldName": "baloo" }] } ], "requestHeadersInserted": null, "responseCodeSent": null, "httpRequest": { "clientIp": "54.239.98.137", "country": "US", "headers": [{ "name": "X-Forwarded-For", "value": "54.239.98.137" }, { "name": "X-Forwarded-Proto", "value": "https" }, { "name": "X-Forwarded-Port", "value": "443" }, { "name": "Host", "value": "xt7xxx9bhn7.gamma.execute-api.us-east-1.amazonaws.com" }, { "name": "X-Amzn-Trace-Id", "value": "Root=1-67a288c4-27acb3cd5795dd8456b7e3c3" }, { "name": "Accept-Encoding", "value": "gzip" }, { "name": "User-Agent", "value": "okhttp/3.12.1" }], "uri": "/CanaryTest", "args": "baloo=10 AND 1=1&hoppy=REDACTED&x-hoppy-extra=generic-%3Cwords", "httpVersion": "HTTP/1.1", "httpMethod": "GET", Data protection 570 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide "requestId": "FepO0F8fIAMEqoQ=" }, "labels": [{ "name": "awswaf:forwardedip:geo:country:US" }, { "name": "awswaf:forwardedip:geo:region:US-VA" }] } Data protection for query strings You can configure data protection for a query string by using QUERY_STRING. This affects the keys and values of all query args. For the following examples, the original query string was baloo=10 AND 1=1&hoppy-query=10 AND 1=1&x-hoppy-extra=generic-%3Cwords. Webacl config "DataProtectionConfig": { "DataProtections": [ { "Field": { "FieldType": "QUERY_STRING" }, "Action": "SUBSTITUTION", "ExcludeRuleMatchDetails": false, "ExcludeRateBasedDetails": false } ] } Example DataProtection for QUERY_STRING: Log entry with query string protected with substitution. { "timestamp": 1738705092889, "formatVersion": 1, "webaclId": "arn:aws:wafv2:us-east-1:111122223333:regional/webacl/ DataProtectionSubstituteQueryString/4eede063-e611-44f5-b357-ffc9d7b7fed5", "terminatingRuleId": "Default_Action", "terminatingRuleType": "REGULAR", "action": "ALLOW", "terminatingRuleMatchDetails": [], "httpSourceName": "APIGW", Data protection 571 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide "httpSourceId": "746533260405:xt7v59bhn7:ABC", "ruleGroupList": [], "rateBasedRuleList": [], "nonTerminatingMatchingRules": [ { "ruleId": "ProtectedHoppyQueryArg", "action": "COUNT", "ruleMatchDetails": [ { "conditionType": "SQL_INJECTION", "sensitivityLevel": "HIGH", "location": "QUERY_STRING", "matchedData": ["REDACTED"] }] }, { "ruleId": "ProtectedBalooQueryArg", "action": "COUNT", "ruleMatchDetails": [ { "conditionType": "SQL_INJECTION", "sensitivityLevel": "HIGH", "location": "SINGLE_QUERY_ARG", "matchedData": [ "REDACTED" ], "matchedFieldName": "REDACTED" }] } ], "requestHeadersInserted": null, "responseCodeSent": null, "httpRequest": { "clientIp": "54.239.98.137", "country": "US", "headers": [{ "name": "X-Forwarded-For", "value": "54.239.98.137" }, { "name": "X-Forwarded-Proto", "value": "https" }, { "name": "X-Forwarded-Port", "value": "443" }, { "name": "Host", Data protection 572 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide "value": "xt7xxx9bhn7.gamma.execute-api.us-east-1.amazonaws.com" }, { "name": "X-Amzn-Trace-Id", "value": "Root=1-67a288c4-27acb3cd5795dd8456b7e3c3" }, { "name": "Accept-Encoding", "value": "gzip" }, { "name": "User-Agent", "value": "okhttp/3.12.1" }], "uri": "/CanaryTest", "args": "REDACTED", "httpVersion": "HTTP/1.1", "httpMethod": "GET", "requestId": "FepO0F8fIAMEqoQ=" }, "labels": [{ "name": "awswaf:forwardedip:geo:country:US" }, { "name": "awswaf:forwardedip:geo:region:US-VA" }] } Data protection for multiple query arguments You can configure data protection for individual query args by using SINGLE_QUERY_ARGUMENT. When reporting local information we use local protections. However, strings that matched in query string and cookie header have many protection configs that could apply. To simplify, the strictest protection for RuleMatchDetails is applied, even if it doesn't overlap with the specific data range that matched. For the following examples, the original query string was baloo=is_a_good_boy&hoppy=likes_to_sleep&x-hoppy-extra=10 AND 1=1. "DataProtectionConfig": { "DataProtections": [ { "Field": { "FieldType": "SINGLE_QUERY_ARGUMENT", "FieldKeys": ["hoppy"] }, "Action": "SUBSTITUTION", Data protection 573 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide "ExcludeRuleMatchDetails": false, "ExcludeRateBasedDetails": false }, { "Field": { "FieldType": "SINGLE_QUERY_ARGUMENT", "FieldKeys": ["baloo"] }, "Action": "HASH", "ExcludeRuleMatchDetails": false, "ExcludeRateBasedDetails": false } ] } Example DataProtection for multiple query arguments. { "timestamp": 1738705092889, "formatVersion": 1, "webaclId": "arn:aws:wafv2:us-east-1:111122223333:regional/webacl/ DataProtectionSubstituteQueryString/4eede063-e611-44f5-b357-ffc9d7b7fed5", "terminatingRuleId": "Default_Action", "terminatingRuleType": "REGULAR", "action": "ALLOW", "terminatingRuleMatchDetails": [], "httpSourceName": "APIGW", "httpSourceId": "746533260405:xt7v59bhn7:ABC", "ruleGroupList": [], "rateBasedRuleList": [], "nonTerminatingMatchingRules": [ { "ruleId": "ProtectedHoppyQueryArg", "action": "COUNT", "ruleMatchDetails": [ { "conditionType": "SQL_INJECTION", "sensitivityLevel": "HIGH", "location": "SINGLE_QUERY_ARG", "matchedData": ["REDACTED"], "matchedFieldName": "hoppy" }] }, Data protection 574 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide { "ruleId": "ProtectedBalooQueryArg", "action": "COUNT", "ruleMatchDetails": [ { "conditionType": "SQL_INJECTION", "sensitivityLevel": "HIGH", "location": "SINGLE_QUERY_ARG", "matchedData": ["zuomr2mxQxofg6EI6f7hMNGaJhhPxt0rFVAXog6FLxE="], "matchedFieldName": "baloo" }] }, { "ruleId": "FullQueryStringDetects_x-hoppy-extra_IsSubstituted", "action": "COUNT", "ruleMatchDetails": [ { "conditionType": "SQL_INJECTION", "sensitivityLevel": "HIGH", "location": "QUERY_ARGS", "matchedData": ["REDACTED"], // Harshest of Protection Config }] |
waf-dg-192 | waf-dg.pdf | 192 | 1738705092889, "formatVersion": 1, "webaclId": "arn:aws:wafv2:us-east-1:111122223333:regional/webacl/ DataProtectionSubstituteQueryString/4eede063-e611-44f5-b357-ffc9d7b7fed5", "terminatingRuleId": "Default_Action", "terminatingRuleType": "REGULAR", "action": "ALLOW", "terminatingRuleMatchDetails": [], "httpSourceName": "APIGW", "httpSourceId": "746533260405:xt7v59bhn7:ABC", "ruleGroupList": [], "rateBasedRuleList": [], "nonTerminatingMatchingRules": [ { "ruleId": "ProtectedHoppyQueryArg", "action": "COUNT", "ruleMatchDetails": [ { "conditionType": "SQL_INJECTION", "sensitivityLevel": "HIGH", "location": "SINGLE_QUERY_ARG", "matchedData": ["REDACTED"], "matchedFieldName": "hoppy" }] }, Data protection 574 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide { "ruleId": "ProtectedBalooQueryArg", "action": "COUNT", "ruleMatchDetails": [ { "conditionType": "SQL_INJECTION", "sensitivityLevel": "HIGH", "location": "SINGLE_QUERY_ARG", "matchedData": ["zuomr2mxQxofg6EI6f7hMNGaJhhPxt0rFVAXog6FLxE="], "matchedFieldName": "baloo" }] }, { "ruleId": "FullQueryStringDetects_x-hoppy-extra_IsSubstituted", "action": "COUNT", "ruleMatchDetails": [ { "conditionType": "SQL_INJECTION", "sensitivityLevel": "HIGH", "location": "QUERY_ARGS", "matchedData": ["REDACTED"], // Harshest of Protection Config }] } ], "requestHeadersInserted": null, "responseCodeSent": null, "httpRequest": { "clientIp": "54.239.98.137", "country": "US", "headers": [{ "name": "X-Forwarded-For", "value": "54.239.98.137" }, { "name": "X-Forwarded-Proto", "value": "https" }, { "name": "X-Forwarded-Port", "value": "443" }, { "name": "Host", "value": "xt7xxx9bhn7.gamma.execute-api.us-east-1.amazonaws.com" }, { "name": "X-Amzn-Trace-Id", "value": "Root=1-67a288c4-27acb3cd5795dd8456b7e3c3" Data protection 575 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide }, { "name": "Accept-Encoding", "value": "gzip" }, { "name": "User-Agent", "value": "okhttp/3.12.1" }], "uri": "/CanaryTest", "args": "baloo=zuomr2mxQxofg6EI6f7hMNGaJhhPxt0rFVAXog6FLxE=&hoppy=REDACTED&x- hoppy-extra=10 AND 1=1", "httpVersion": "HTTP/1.1", "httpMethod": "GET", "requestId": "FepO0F8fIAMEqoQ=" }, "labels": [{ "name": "awswaf:forwardedip:geo:country:US" }, { "name": "awswaf:forwardedip:geo:region:US-VA" }] } Note You cannot specify both QueryString Masking and Single Query Arg Masking in the same webACL. Configuring data protection for a web ACL This section provides instructions for configuring data protection for a web ACL. To configure data protection for a web ACL 1. Sign in to the AWS Management Console and open the AWS WAF console at https:// console.aws.amazon.com/wafv2/. 2. In the navigation pane, choose Web ACLs. 3. Choose the name of the web ACL that you want to enable data protection for. The console takes you to the web ACL's description, where you can edit it. 4. On the Logging and metrics tab, in the Data protection settings pane, choose Enable or Edit. Data protection 576 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide 5. Choose the scope Global and then make your field data protection selections. For each field data protection configuration, you can also specify exceptions to exclude from the protection behavior. 6. When you've completed your selections, choose Save. The interface returns to the Logging and metrics tab where your selections are summarized. Testing and tuning your AWS WAF protections This section provides guidance for testing and tuning your AWS WAF web ACLs, rules, rule groups, IP sets, and regex pattern sets. We recommend that you test and tune any changes to your AWS WAF web ACL before applying them to your website or web application traffic. Production traffic risk Before you deploy your web ACL implementation for production traffic, test and tune it in a staging or testing environment until you are comfortable with the potential impact to your traffic. Then test and tune the rules in count mode with your production traffic before enabling them. This section also provides general guidance for testing your use of rule groups that are managed by someone else. These include AWS Managed Rules rule groups, AWS Marketplace managed rule groups, and rule groups that are shared with you by another account. For these rule groups, also follow any guidance that you get from the rule group provider. • For the Bot Control AWS Managed Rules rule group, also see Testing and deploying AWS WAF Bot Control. • For the account takeover prevention AWS Managed Rules rule group, also see Testing and deploying ATP. • For the account creation fraud prevention AWS Managed Rules rule group, also see Testing and deploying ACFP. Temporary inconsistencies during updates Testing and tuning your protections 577 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide When you create or change a web ACL or other AWS WAF resources, the changes take a small amount of time to propagate to all areas where the resources are stored. The propagation time can be from a few seconds to a number of minutes. The following are examples of the temporary inconsistencies that you might notice during change propagation: • After you create a web ACL, if you try to associate it with a resource, you might get an exception indicating that the web ACL is unavailable. • After you add a rule group to a web ACL, the new rule group rules might be in effect in one area where the web ACL is used and not in another. • After you change a rule action setting, you might see the old action in some places and the new action in others. • After you add an IP address to an IP set that is in use in a blocking rule, the new address might be blocked in one area while still allowed in another. Testing and tuning high-level steps This section provides a checklist of the |
waf-dg-193 | waf-dg.pdf | 193 | After you add a rule group to a web ACL, the new rule group rules might be in effect in one area where the web ACL is used and not in another. • After you change a rule action setting, you might see the old action in some places and the new action in others. • After you add an IP address to an IP set that is in use in a blocking rule, the new address might be blocked in one area while still allowed in another. Testing and tuning high-level steps This section provides a checklist of the steps for testing changes to your web ACL, including any rules or rule groups that it uses. Note To follow the guidance in this section, you need to understand how to create and manage AWS WAF protections like web ACLs, rules, and rule groups. That information is covered in earlier sections of this guide. To test and tune your web ACL Perform these steps first in a test environment, then in production. 1. Prepare for testing Prepare your monitoring environment, switch your new AWS WAF protections to count mode for testing, and create any resource associations that you need. See Preparing for testing your AWS WAF protections. Testing and tuning high-level steps 578 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide 2. Monitor and tune in test and production environments Monitor and adjust your AWS WAF protections first in a test or staging environment, then in production, until you're satisfied that they can handle traffic as you need them to. See Monitoring and tuning your AWS WAF protections. 3. Enable your protections in production When you're satisfied with your test protections, switch them to production mode, clean up any unnecessary testing artifacts, and continue monitoring. See Enabling your protections in production. After you've finished implementing your changes, continue monitoring your web traffic and protections in production to make sure that they're working as you want them to. Web traffic patterns can change over time, so you might need to adjust the protections occasionally. Preparing for testing your AWS WAF protections This section describes how to get set up to test and tune your AWS WAF protections. Note To follow the guidance in this section, you need to understand generally how to create and manage AWS WAF protections like web ACLs, rules, and rule groups. That information is covered in earlier sections of this guide. To prepare for testing 1. Enable web ACL logging, Amazon CloudWatch metrics, and web request sampling for the web ACL Use logging, metrics, and sampling to monitor the interaction of the web ACL rules with your web traffic. • Logging – You can configure AWS WAF to log the web requests that a web ACL evaluates. You can send logs to CloudWatch logs, an Amazon S3 bucket, or an Amazon Data Firehose Preparing for testing 579 AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide delivery stream. You can redact fields and apply filtering. For more information, see Logging AWS WAF web ACL traffic. • Amazon Security Lake – You can configure Security Lake to collect web ACL data. Security Lake collects log and event data from various sources for normalization, analysis, and management. For information about this option, see What is Amazon Security Lake? and Collecting data from AWS services in the Amazon Security Lake user guide. • Amazon CloudWatch metrics – In your web ACL configuration, provide metric specifications for everything that you want to monitor. You can view metrics through the AWS WAF and CloudWatch consoles. For more information, see Monitoring with Amazon CloudWatch. • Web request sampling – You can view a sample of all web requests that your web ACL evaluates. For information about web request sampling, see Viewing a sample of web requests. 2. Set your protections to Count mode In your web ACL configuration, switch anything that you want to test to count mode. This causes the test protections to record matches against web requests without altering how the requests are handled. You'll be able to see the matches in your metrics, logs, and sampled requests, to verify the match criteria and to understand what the effects might be on your web traffic. Rules that add labels to matching requests will add labels regardless of the rule action. • Rule defined in the web ACL – Edit the rules in the web ACL and set their actions to Count. • Rule group – In your web ACL configuration, edit the rule statement for the rule group and, in the Rules pane, open the Override all rule actions dropdown and choose Count. If you manage the web ACL in JSON, add the rules to the RuleActionOverrides settings in the rule group reference statement, with ActionToUse |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.