本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
封鎖沒有有效 AWS WAF 字符的請求
本節說明如何封鎖在使用 AWS WAF 行動 SDK 時缺少字符的登入請求。
當您使用智慧型威脅 AWS 受管規則規則群組 AWSManagedRulesACFPRuleSet
、 AWSManagedRulesATPRuleSet
和 AWSManagedRulesBotControlRuleSet
時,規則群組會叫用 AWS WAF 權杖管理來評估 Web 請求權杖的狀態,並相應地標記請求。
注意
權杖標籤只會套用至您使用其中一個受管規則群組評估的 Web 請求。
如需權杖管理套用之標籤的相關資訊,請參閱上一節:中的字符標籤類型 AWS WAF。
智慧型威脅緩解受管規則群組接著會處理字符需求,如下所示:
-
AWSManagedRulesACFPRuleSet
AllRequests
規則設定為針對所有請求執行Challenge動作,有效地封鎖任何沒有accepted
字符標籤的 。 -
會
AWSManagedRulesATPRuleSet
封鎖具有rejected
字符標籤的請求,但不會封鎖具有absent
字符標籤的請求。 -
AWSManagedRulesBotControlRuleSet
目標防護層級會在用戶端傳送五個沒有accepted
字符標籤的請求後,向他們提出挑戰。它不會封鎖沒有有效字符的個別請求。規則群組的常見保護層級不會管理字符需求。
如需智慧型威脅規則群組的其他詳細資訊,請參閱 AWS WAF 詐騙控制帳戶建立詐騙預防 (ACFP) 規則群組AWS WAF 詐騙控制帳戶接管預防 (ATP) 規則群組和 AWS WAF Bot Control 規則群組。
使用 Bot Control 或 ATP 受管規則群組時,封鎖缺少字符的請求
使用 Bot Control 和 ATP 規則群組時,如果請求沒有有效的權杖,則可以結束規則群組評估,並繼續由 Web ACL 進行評估。
若要封鎖缺少其權杖或權杖遭到拒絕的所有請求,請新增規則,以便在受管規則群組擷取並封鎖規則群組未為您處理的請求之後立即執行。
以下是使用 ATP 受管規則群組之 Web ACL 的範例 JSON 清單。Web ACL 具有新增的規則,可擷取awswaf:managed:token:absent
標籤並加以處理。此規則會將評估範圍縮小至前往登入端點的 Web 請求,以符合 ATP 規則群組的範圍。新增的規則會以粗體列出。
{ "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", "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" } }, { "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" } } ] } }, "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:" }