View a markdown version of this page

Blocking a prompt attack only from unauthenticated clients - AWS WAF, AWS Firewall Manager, AWS Shield Advanced, and AWS Shield network security director

Introducing a new console experience for AWS WAF

You can now use the updated experience to access AWS WAF functionality anywhere in the console. For more details, see Working with the console.

Blocking a prompt attack only from unauthenticated clients

The following rule blocks a request that has a prompt attack finding at any severity and has no Authorization header.

{ "Name": "Block-prompt-attack-when-anonymous", "Priority": 120, "Statement": { "AndStatement": { "Statements": [ { "LabelMatchStatement": { "Scope": "NAMESPACE", "Key": "awswaf:managed:aws:ai-security:request:guardrails:prompt_attack:" } }, { "NotStatement": { "Statement": { "SizeConstraintStatement": { "FieldToMatch": { "SingleHeader": { "Name": "authorization" } }, "ComparisonOperator": "GT", "Size": 0, "TextTransformations": [ { "Priority": 0, "Type": "NONE" } ] } } } } ] } }, "Action": { "Block": {} }, "VisibilityConfig": { "SampledRequestsEnabled": true, "CloudWatchMetricsEnabled": true, "MetricName": "Block-prompt-attack-when-anonymous" } }

The LabelMatchStatement matches the three request-phase prompt attack labels. The NotStatement matches a request whose Authorization header is missing or empty. For these requests, the rule blocks medium-severity and low-severity findings, which the rule group counts by default. If a proxy in front of your resource removes or renames the Authorization header, match the header your proxy sets.