[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7EMAA75AZ3E9Z4HTQXCF6VM":3,"skill-same:01M7EMAA75AZ3E9Z4HTQXCF6VM":75},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":47,"commitSha":48,"skillDirectory":49,"forksCount":50,"repositoryHtmlUrl":51,"repositoryHomepageUrl":6,"ownerHtmlUrl":52,"ownerBlogUrl":6,"ownerDescription":53,"updatedAt":54,"install":55,"resources":68},"01M7EMAA75AZ3E9Z4HTQXCF6VM","implementing-cloud-waf-rules",null,"Deploys and tunes Web Application Firewall rules on AWS WAF, Azure WAF, and Cloudflare, covering managed rule sets, custom business-logic rules, rate limiting, bot management, and false-positive reduction. Use when deploying new apps behind a cloud WAF, when pentests reveal injection\u002FXSS flaws, when facing bot or credential-stuffing traffic, or when compliance (e.g. PCI-DSS) mandates a WAF.","lza6\u002FArmor-piercing-system-prompts","lza6","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F128880206?v=4","01M7EB3K7WPX5T28EJ2NVHE6EG","Chinese-tingfeng","01M7EB3K97E1KQ16QWKJMFNGX8",11,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F04-安全渗透\u002Fimplementing-cloud-waf-rules\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: implementing-cloud-waf-rules\ndescription: 'Deploys and tunes Web Application Firewall rules on AWS WAF, Azure WAF,\n  and Cloudflare, covering managed rule sets, custom business-logic rules, rate limiting,\n  bot management, and false-positive reduction. Use when deploying new apps behind\n  a cloud WAF, when pentests reveal injection\u002FXSS flaws, when facing bot or credential-stuffing\n  traffic, or when compliance (e.g. PCI-DSS) mandates a WAF.\n\n  '\ndomain: cybersecurity\nsubdomain: cloud-security\ntags:\n- cloud-waf\n- aws-waf\n- azure-waf\n- cloudflare-waf\n- owasp-protection\n- rate-limiting\nversion: 1.0.0\nauthor: mahipal\nlicense: Apache-2.0\nnist_csf:\n- PR.IR-01\n- ID.AM-08\n- GV.SC-06\n- DE.CM-01\nmitre_attack:\n- T1078.004\n- T1530\n- T1537\n- T1580\n- T0816\n---\n\n# Implementing Cloud WAF Rules\n\n## When to Use\n\n- When deploying new web applications or APIs behind cloud load balancers requiring OWASP protection\n- When application penetration testing reveals SQL injection, XSS, or other injection vulnerabilities\n- When experiencing brute force, credential stuffing, or bot attacks against authentication endpoints\n- When compliance requirements mandate a WAF for PCI-DSS or similar standards\n- When tuning WAF rules to reduce false positives blocking legitimate application traffic\n\n**Do not use** for network-level DDoS protection (use AWS Shield or Azure DDoS Protection), for API authentication design (see managing-cloud-identity-with-okta), or for application code-level security fixes (WAF is a compensating control, not a replacement for secure code).\n\n## Prerequisites\n\n- AWS ALB\u002FCloudFront, Azure Application Gateway, or Cloudflare configured as the application entry point\n- Application traffic logs for baseline analysis before WAF deployment\n- Test environment for validating WAF rules before production enforcement\n- Understanding of application request patterns to minimize false positives\n\n## Workflow\n\n### Step 1: Deploy Managed Rule Sets\n\nEnable cloud provider managed rule sets that cover OWASP Top 10 vulnerabilities. Start in Count (detection) mode before switching to Block (prevention) mode.\n\n```bash\n# AWS WAF: Create Web ACL with AWS Managed Rules\naws wafv2 create-web-acl \\\n  --name production-waf \\\n  --scope REGIONAL \\\n  --default-action '{\"Allow\": {}}' \\\n  --visibility-config '{\n    \"SampledRequestsEnabled\": true,\n    \"CloudWatchMetricsEnabled\": true,\n    \"MetricName\": \"production-waf\"\n  }' \\\n  --rules '[\n    {\n      \"Name\": \"AWSManagedRulesCommonRuleSet\",\n      \"Priority\": 1,\n      \"Statement\": {\n        \"ManagedRuleGroupStatement\": {\n          \"VendorName\": \"AWS\",\n          \"Name\": \"AWSManagedRulesCommonRuleSet\"\n        }\n      },\n      \"OverrideAction\": {\"Count\": {}},\n      \"VisibilityConfig\": {\n        \"SampledRequestsEnabled\": true,\n        \"CloudWatchMetricsEnabled\": true,\n        \"MetricName\": \"CommonRuleSet\"\n      }\n    },\n    {\n      \"Name\": \"AWSManagedRulesSQLiRuleSet\",\n      \"Priority\": 2,\n      \"Statement\": {\n        \"ManagedRuleGroupStatement\": {\n          \"VendorName\": \"AWS\",\n          \"Name\": \"AWSManagedRulesSQLiRuleSet\"\n        }\n      },\n      \"OverrideAction\": {\"Count\": {}},\n      \"VisibilityConfig\": {\n        \"SampledRequestsEnabled\": true,\n        \"CloudWatchMetricsEnabled\": true,\n        \"MetricName\": \"SQLiRuleSet\"\n      }\n    },\n    {\n      \"Name\": \"AWSManagedRulesKnownBadInputsRuleSet\",\n      \"Priority\": 3,\n      \"Statement\": {\n        \"ManagedRuleGroupStatement\": {\n          \"VendorName\": \"AWS\",\n          \"Name\": \"AWSManagedRulesKnownBadInputsRuleSet\"\n        }\n      },\n      \"OverrideAction\": {\"Count\": {}},\n      \"VisibilityConfig\": {\n        \"SampledRequestsEnabled\": true,\n        \"CloudWatchMetricsEnabled\": true,\n        \"MetricName\": \"KnownBadInputs\"\n      }\n    }\n  ]'\n```\n\n### Step 2: Create Custom Rate Limiting Rules\n\nDeploy rate-based rules to protect login endpoints against brute force and credential stuffing attacks.\n\n```bash\n# Rate limiting rule for login endpoint (100 requests per 5 minutes per IP)\naws wafv2 update-web-acl \\\n  --name production-waf \\\n  --scope REGIONAL \\\n  --id \u003Cweb-acl-id> \\\n  --lock-token \u003Clock-token> \\\n  --default-action '{\"Allow\": {}}' \\\n  --rules '[\n    {\n      \"Name\": \"RateLimitLogin\",\n      \"Priority\": 0,\n      \"Statement\": {\n        \"RateBasedStatement\": {\n          \"Limit\": 100,\n          \"AggregateKeyType\": \"IP\",\n          \"ScopeDownStatement\": {\n            \"ByteMatchStatement\": {\n              \"FieldToMatch\": {\"UriPath\": {}},\n              \"PositionalConstraint\": \"STARTS_WITH\",\n              \"SearchString\": \"\u002Fapi\u002Fauth\u002Flogin\",\n              \"TextTransformations\": [{\"Priority\": 0, \"Type\": \"LOWERCASE\"}]\n            }\n          }\n        }\n      },\n      \"Action\": {\"Block\": {\"CustomResponse\": {\"ResponseCode\": 429}}},\n      \"VisibilityConfig\": {\n        \"SampledRequestsEnabled\": true,\n        \"CloudWatchMetricsEnabled\": true,\n        \"MetricName\": \"RateLimitLogin\"\n      }\n    }\n  ]'\n```\n\n### Step 3: Configure Geo-Blocking and IP Reputation\n\nBlock traffic from countries where the application has no legitimate users and leverage IP reputation lists to block known malicious sources.\n\n```bash\n# AWS WAF: Geo-blocking rule\n# Block countries not in the allowed list\naws wafv2 create-ip-set \\\n  --name blocked-ips \\\n  --scope REGIONAL \\\n  --ip-address-version IPV4 \\\n  --addresses \"198.51.100.0\u002F24\" \"203.0.113.0\u002F24\"\n\n# Add Amazon IP Reputation rule\n# AWSManagedRulesAmazonIpReputationList blocks IPs flagged by AWS threat intelligence\n```\n\n### Step 4: Tune Rules to Reduce False Positives\n\nAnalyze WAF logs in Count mode to identify legitimate requests being flagged. Create rule exceptions for specific URI paths or request patterns.\n\n```bash\n# Enable WAF logging to S3\naws wafv2 put-logging-configuration \\\n  --logging-configuration '{\n    \"ResourceArn\": \"arn:aws:wafv2:us-east-1:123456789012:regional\u002Fwebacl\u002Fproduction-waf\u002Fid\",\n    \"LogDestinationConfigs\": [\"arn:aws:s3:::waf-logs-bucket\"],\n    \"RedactedFields\": [{\"SingleHeader\": {\"Name\": \"authorization\"}}]\n  }'\n\n# Query WAF logs with Athena to find false positives\n# Find rules triggered most frequently for legitimate traffic\ncat \u003C\u003C 'EOF' > waf-analysis.sql\nSELECT\n  terminatingRuleId,\n  httpRequest.uri,\n  httpRequest.httpMethod,\n  COUNT(*) as block_count\nFROM waf_logs\nWHERE action = 'BLOCK'\n  AND timestamp > date_add('day', -7, now())\nGROUP BY terminatingRuleId, httpRequest.uri, httpRequest.httpMethod\nORDER BY block_count DESC\nLIMIT 20\nEOF\n```\n\n```bash\n# Exclude specific rule from managed rule set that causes false positives\n# Example: Exclude SizeRestrictions_BODY for file upload endpoint\naws wafv2 update-web-acl \\\n  --name production-waf \\\n  --scope REGIONAL \\\n  --id \u003Cweb-acl-id> \\\n  --lock-token \u003Clock-token> \\\n  --rules '[{\n    \"Name\": \"AWSManagedRulesCommonRuleSet\",\n    \"Priority\": 1,\n    \"Statement\": {\n      \"ManagedRuleGroupStatement\": {\n        \"VendorName\": \"AWS\",\n        \"Name\": \"AWSManagedRulesCommonRuleSet\",\n        \"ExcludedRules\": [{\"Name\": \"SizeRestrictions_BODY\"}]\n      }\n    },\n    \"OverrideAction\": {\"None\": {}},\n    \"VisibilityConfig\": {\n      \"SampledRequestsEnabled\": true,\n      \"CloudWatchMetricsEnabled\": true,\n      \"MetricName\": \"CommonRuleSet\"\n    }\n  }]'\n```\n\n### Step 5: Switch to Block Mode After Validation\n\nAfter 7-14 days of Count mode with acceptable false positive rates, switch managed rules to Block mode for active protection.\n\n```bash\n# Change OverrideAction from Count to None (use rule group's default Block action)\n# Update each managed rule group from {\"Count\": {}} to {\"None\": {}}\n# Monitor CloudWatch metrics for sudden changes in blocked request volume\n```\n\n## Key Concepts\n\n| Term | Definition |\n|------|------------|\n| Web ACL | Web Access Control List defining the set of rules evaluated against every HTTP request to a protected resource |\n| Managed Rule Group | Pre-configured rule set maintained by the cloud provider or third-party vendor covering common attack patterns |\n| Rate-Based Rule | WAF rule that tracks request rates per IP address and blocks IPs exceeding the threshold within a time window |\n| Count Mode | WAF action that logs matching requests without blocking them, used for rule validation before enforcement |\n| Rule Priority | Numerical ordering determining which rules are evaluated first; lower numbers have higher priority |\n| Custom Response | WAF capability to return specific HTTP status codes and headers when blocking requests |\n| Scope-Down Statement | Condition that narrows a rate-based rule to specific URI paths, methods, or headers |\n| False Positive | Legitimate request incorrectly blocked by a WAF rule, requiring rule tuning or exclusion |\n\n## Tools & Systems\n\n- **AWS WAF**: Cloud-native WAF integrated with ALB, CloudFront, API Gateway, and AppSync\n- **Azure WAF**: Web application firewall on Application Gateway or Front Door with OWASP CRS rule sets\n- **AWS Firewall Manager**: Centralized WAF policy management across multiple AWS accounts in an Organization\n- **WAF Security Automations**: AWS solution that deploys Lambda-based automated WAF rule updates based on log analysis\n- **CloudWatch Metrics**: Monitoring dashboard for tracking WAF rule match rates, block counts, and allowed requests\n\n## Common Scenarios\n\n### Scenario: Credential Stuffing Attack Against Authentication API\n\n**Context**: An e-commerce application experiences 50,000 login attempts per hour from a botnet using stolen credential lists. The attacker rotates source IPs every few minutes to evade simple IP-based blocking.\n\n**Approach**:\n1. Deploy rate-based rules limiting login endpoint requests to 10 per 5 minutes per IP\n2. Enable AWS WAF Bot Control managed rule group to detect automated request patterns beyond IP rotation\n3. Add a custom rule requiring valid CAPTCHA tokens for login requests exceeding 5 failures\n4. Implement IP reputation blocking using AWSManagedRulesAmazonIpReputationList\n5. Create a custom rule matching on User-Agent patterns common to credential stuffing tools\n6. Monitor blocked request metrics and adjust thresholds based on legitimate traffic patterns\n\n**Pitfalls**: Setting rate limits too aggressively blocks legitimate users behind shared NAT IPs. Blocking by User-Agent alone is easily bypassed by rotating agent strings.\n\n## Output Format\n\n```text\nCloud WAF Configuration Report\n================================\nWeb ACL: production-waf\nScope: Regional (us-east-1)\nProtected Resources: ALB (arn:aws:elasticloadbalancing:...)\nReport Date: 2025-02-23\n\nRULE CONFIGURATION:\n  [P0] RateLimitLogin          - BLOCK (100 req\u002F5min\u002FIP)\n  [P1] AWSManagedRulesCommon   - BLOCK (1 exclusion: SizeRestrictions_BODY)\n  [P2] AWSManagedRulesSQLi     - BLOCK\n  [P3] AWSManagedRulesKnownBad - BLOCK\n  [P4] AWSManagedRulesBotControl - COUNT (evaluation phase)\n  [P5] GeoBlockRule            - BLOCK (12 countries blocked)\n\nTRAFFIC ANALYSIS (Last 7 Days):\n  Total Requests:    2,847,293\n  Allowed:           2,791,456 (98.0%)\n  Blocked:              51,234 (1.8%)\n  Counted:               4,603 (0.2%)\n\nTOP BLOCKED RULES:\n  RateLimitLogin:              23,456 blocks (45.8%)\n  SQLi Detection:               8,234 blocks (16.1%)\n  CommonRuleSet (XSS):          7,891 blocks (15.4%)\n  GeoBlockRule:                 6,543 blocks (12.8%)\n  KnownBadInputs:              5,110 blocks (10.0%)\n\nFALSE POSITIVE ANALYSIS:\n  Reported False Positives: 3\n  Confirmed False Positives: 1 (SizeRestrictions_BODY for \u002Fapi\u002Fupload)\n  Action Taken: Rule exclusion applied\n```\n","# Implementing Cloud WAF Rules\n\n## When to Use\n\n- When deploying new web applications or APIs behind cloud load balancers requiring OWASP protection\n- When application penetration testing reveals SQL injection, XSS, or other injection vulnerabilities\n- When experiencing brute force, credential stuffing, or bot attacks against authentication endpoints\n- When compliance requirements mandate a WAF for PCI-DSS or similar standards\n- When tuning WAF rules to reduce false positives blocking legitimate application traffic\n\n**Do not use** for network-level DDoS protection (use AWS Shield or Azure DDoS Protection), for API authentication design (see managing-cloud-identity-with-okta), or for application code-level security fixes (WAF is a compensating control, not a replacement for secure code).\n\n## Prerequisites\n\n- AWS ALB\u002FCloudFront, Azure Application Gateway, or Cloudflare configured as the application entry point\n- Application traffic logs for baseline analysis before WAF deployment\n- Test environment for validating WAF rules before production enforcement\n- Understanding of application request patterns to minimize false positives\n\n## Workflow\n\n### Step 1: Deploy Managed Rule Sets\n\nEnable cloud provider managed rule sets that cover OWASP Top 10 vulnerabilities. Start in Count (detection) mode before switching to Block (prevention) mode.\n\n```bash\n# AWS WAF: Create Web ACL with AWS Managed Rules\naws wafv2 create-web-acl \\\n  --name production-waf \\\n  --scope REGIONAL \\\n  --default-action '{\"Allow\": {}}' \\\n  --visibility-config '{\n    \"SampledRequestsEnabled\": true,\n    \"CloudWatchMetricsEnabled\": true,\n    \"MetricName\": \"production-waf\"\n  }' \\\n  --rules '[\n    {\n      \"Name\": \"AWSManagedRulesCommonRuleSet\",\n      \"Priority\": 1,\n      \"Statement\": {\n        \"ManagedRuleGroupStatement\": {\n          \"VendorName\": \"AWS\",\n          \"Name\": \"AWSManagedRulesCommonRuleSet\"\n        }\n      },\n      \"OverrideAction\": {\"Count\": {}},\n      \"VisibilityConfig\": {\n        \"SampledRequestsEnabled\": true,\n        \"CloudWatchMetricsEnabled\": true,\n        \"MetricName\": \"CommonRuleSet\"\n      }\n    },\n    {\n      \"Name\": \"AWSManagedRulesSQLiRuleSet\",\n      \"Priority\": 2,\n      \"Statement\": {\n        \"ManagedRuleGroupStatement\": {\n          \"VendorName\": \"AWS\",\n          \"Name\": \"AWSManagedRulesSQLiRuleSet\"\n        }\n      },\n      \"OverrideAction\": {\"Count\": {}},\n      \"VisibilityConfig\": {\n        \"SampledRequestsEnabled\": true,\n        \"CloudWatchMetricsEnabled\": true,\n        \"MetricName\": \"SQLiRuleSet\"\n      }\n    },\n    {\n      \"Name\": \"AWSManagedRulesKnownBadInputsRuleSet\",\n      \"Priority\": 3,\n      \"Statement\": {\n        \"ManagedRuleGroupStatement\": {\n          \"VendorName\": \"AWS\",\n          \"Name\": \"AWSManagedRulesKnownBadInputsRuleSet\"\n        }\n      },\n      \"OverrideAction\": {\"Count\": {}},\n      \"VisibilityConfig\": {\n        \"SampledRequestsEnabled\": true,\n        \"CloudWatchMetricsEnabled\": true,\n        \"MetricName\": \"KnownBadInputs\"\n      }\n    }\n  ]'\n```\n\n### Step 2: Create Custom Rate Limiting Rules\n\nDeploy rate-based rules to protect login endpoints against brute force and credential stuffing attacks.\n\n```bash\n# Rate limiting rule for login endpoint (100 requests per 5 minutes per IP)\naws wafv2 update-web-acl \\\n  --name production-waf \\\n  --scope REGIONAL \\\n  --id \u003Cweb-acl-id> \\\n  --lock-token \u003Clock-token> \\\n  --default-action '{\"Allow\": {}}' \\\n  --rules '[\n    {\n      \"Name\": \"RateLimitLogin\",\n      \"Priority\": 0,\n      \"Statement\": {\n        \"RateBasedStatement\": {\n          \"Limit\": 100,\n          \"AggregateKeyType\": \"IP\",\n          \"ScopeDownStatement\": {\n            \"ByteMatchStatement\": {\n              \"FieldToMatch\": {\"UriPath\": {}},\n              \"PositionalConstraint\": \"STARTS_WITH\",\n              \"SearchString\": \"\u002Fapi\u002Fauth\u002Flogin\",\n              \"TextTransformations\": [{\"Priority\": 0, \"Type\": \"LOWERCASE\"}]\n            }\n          }\n        }\n      },\n      \"Action\": {\"Block\": {\"CustomResponse\": {\"ResponseCode\": 429}}},\n      \"VisibilityConfig\": {\n        \"SampledRequestsEnabled\": true,\n        \"CloudWatchMetricsEnabled\": true,\n        \"MetricName\": \"RateLimitLogin\"\n      }\n    }\n  ]'\n```\n\n### Step 3: Configure Geo-Blocking and IP Reputation\n\nBlock traffic from countries where the application has no legitimate users and leverage IP reputation lists to block known malicious sources.\n\n```bash\n# AWS WAF: Geo-blocking rule\n# Block countries not in the allowed list\naws wafv2 create-ip-set \\\n  --name blocked-ips \\\n  --scope REGIONAL \\\n  --ip-address-version IPV4 \\\n  --addresses \"198.51.100.0\u002F24\" \"203.0.113.0\u002F24\"\n\n# Add Amazon IP Reputation rule\n# AWSManagedRulesAmazonIpReputationList blocks IPs flagged by AWS threat intelligence\n```\n\n### Step 4: Tune Rules to Reduce False Positives\n\nAnalyze WAF logs in Count mode to identify legitimate requests being flagged. Create rule exceptions for specific URI paths or request patterns.\n\n```bash\n# Enable WAF logging to S3\naws wafv2 put-logging-configuration \\\n  --logging-configuration '{\n    \"ResourceArn\": \"arn:aws:wafv2:us-east-1:123456789012:regional\u002Fwebacl\u002Fproduction-waf\u002Fid\",\n    \"LogDestinationConfigs\": [\"arn:aws:s3:::waf-logs-bucket\"],\n    \"RedactedFields\": [{\"SingleHeader\": {\"Name\": \"authorization\"}}]\n  }'\n\n# Query WAF logs with Athena to find false positives\n# Find rules triggered most frequently for legitimate traffic\ncat \u003C\u003C 'EOF' > waf-analysis.sql\nSELECT\n  terminatingRuleId,\n  httpRequest.uri,\n  httpRequest.httpMethod,\n  COUNT(*) as block_count\nFROM waf_logs\nWHERE action = 'BLOCK'\n  AND timestamp > date_add('day', -7, now())\nGROUP BY terminatingRuleId, httpRequest.uri, httpRequest.httpMethod\nORDER BY block_count DESC\nLIMIT 20\nEOF\n```\n\n```bash\n# Exclude specific rule from managed rule set that causes false positives\n# Example: Exclude SizeRestrictions_BODY for file upload endpoint\naws wafv2 update-web-acl \\\n  --name production-waf \\\n  --scope REGIONAL \\\n  --id \u003Cweb-acl-id> \\\n  --lock-token \u003Clock-token> \\\n  --rules '[{\n    \"Name\": \"AWSManagedRulesCommonRuleSet\",\n    \"Priority\": 1,\n    \"Statement\": {\n      \"ManagedRuleGroupStatement\": {\n        \"VendorName\": \"AWS\",\n        \"Name\": \"AWSManagedRulesCommonRuleSet\",\n        \"ExcludedRules\": [{\"Name\": \"SizeRestrictions_BODY\"}]\n      }\n    },\n    \"OverrideAction\": {\"None\": {}},\n    \"VisibilityConfig\": {\n      \"SampledRequestsEnabled\": true,\n      \"CloudWatchMetricsEnabled\": true,\n      \"MetricName\": \"CommonRuleSet\"\n    }\n  }]'\n```\n\n### Step 5: Switch to Block Mode After Validation\n\nAfter 7-14 days of Count mode with acceptable false positive rates, switch managed rules to Block mode for active protection.\n\n```bash\n# Change OverrideAction from Count to None (use rule group's default Block action)\n# Update each managed rule group from {\"Count\": {}} to {\"None\": {}}\n# Monitor CloudWatch metrics for sudden changes in blocked request volume\n```\n\n## Key Concepts\n\n| Term | Definition |\n|------|------------|\n| Web ACL | Web Access Control List defining the set of rules evaluated against every HTTP request to a protected resource |\n| Managed Rule Group | Pre-configured rule set maintained by the cloud provider or third-party vendor covering common attack patterns |\n| Rate-Based Rule | WAF rule that tracks request rates per IP address and blocks IPs exceeding the threshold within a time window |\n| Count Mode | WAF action that logs matching requests without blocking them, used for rule validation before enforcement |\n| Rule Priority | Numerical ordering determining which rules are evaluated first; lower numbers have higher priority |\n| Custom Response | WAF capability to return specific HTTP status codes and headers when blocking requests |\n| Scope-Down Statement | Condition that narrows a rate-based rule to specific URI paths, methods, or headers |\n| False Positive | Legitimate request incorrectly blocked by a WAF rule, requiring rule tuning or exclusion |\n\n## Tools & Systems\n\n- **AWS WAF**: Cloud-native WAF integrated with ALB, CloudFront, API Gateway, and AppSync\n- **Azure WAF**: Web application firewall on Application Gateway or Front Door with OWASP CRS rule sets\n- **AWS Firewall Manager**: Centralized WAF policy management across multiple AWS accounts in an Organization\n- **WAF Security Automations**: AWS solution that deploys Lambda-based automated WAF rule updates based on log analysis\n- **CloudWatch Metrics**: Monitoring dashboard for tracking WAF rule match rates, block counts, and allowed requests\n\n## Common Scenarios\n\n### Scenario: Credential Stuffing Attack Against Authentication API\n\n**Context**: An e-commerce application experiences 50,000 login attempts per hour from a botnet using stolen credential lists. The attacker rotates source IPs every few minutes to evade simple IP-based blocking.\n\n**Approach**:\n1. Deploy rate-based rules limiting login endpoint requests to 10 per 5 minutes per IP\n2. Enable AWS WAF Bot Control managed rule group to detect automated request patterns beyond IP rotation\n3. Add a custom rule requiring valid CAPTCHA tokens for login requests exceeding 5 failures\n4. Implement IP reputation blocking using AWSManagedRulesAmazonIpReputationList\n5. Create a custom rule matching on User-Agent patterns common to credential stuffing tools\n6. Monitor blocked request metrics and adjust thresholds based on legitimate traffic patterns\n\n**Pitfalls**: Setting rate limits too aggressively blocks legitimate users behind shared NAT IPs. Blocking by User-Agent alone is easily bypassed by rotating agent strings.\n\n## Output Format\n\n```text\nCloud WAF Configuration Report\n================================\nWeb ACL: production-waf\nScope: Regional (us-east-1)\nProtected Resources: ALB (arn:aws:elasticloadbalancing:...)\nReport Date: 2025-02-23\n\nRULE CONFIGURATION:\n  [P0] RateLimitLogin          - BLOCK (100 req\u002F5min\u002FIP)\n  [P1] AWSManagedRulesCommon   - BLOCK (1 exclusion: SizeRestrictions_BODY)\n  [P2] AWSManagedRulesSQLi     - BLOCK\n  [P3] AWSManagedRulesKnownBad - BLOCK\n  [P4] AWSManagedRulesBotControl - COUNT (evaluation phase)\n  [P5] GeoBlockRule            - BLOCK (12 countries blocked)\n\nTRAFFIC ANALYSIS (Last 7 Days):\n  Total Requests:    2,847,293\n  Allowed:           2,791,456 (98.0%)\n  Blocked:              51,234 (1.8%)\n  Counted:               4,603 (0.2%)\n\nTOP BLOCKED RULES:\n  RateLimitLogin:              23,456 blocks (45.8%)\n  SQLi Detection:               8,234 blocks (16.1%)\n  CommonRuleSet (XSS):          7,891 blocks (15.4%)\n  GeoBlockRule:                 6,543 blocks (12.8%)\n  KnownBadInputs:              5,110 blocks (10.0%)\n\nFALSE POSITIVE ANALYSIS:\n  Reported False Positives: 3\n  Confirmed False Positives: 1 (SizeRestrictions_BODY for \u002Fapi\u002Fupload)\n  Action Taken: Rule exclusion applied\n```\n",{"name":5,"tags":24,"author":31,"domain":32,"license":15,"version":33,"nist_csf":34,"subdomain":39,"description":40,"mitre_attack":41},[25,26,27,28,29,30],"cloud-waf","aws-waf","azure-waf","cloudflare-waf","owasp-protection","rate-limiting","mahipal","cybersecurity","1.0.0",[35,36,37,38],"PR.IR-01","ID.AM-08","GV.SC-06","DE.CM-01","cloud-security","Deploys and tunes Web Application Firewall rules on AWS WAF, Azure WAF, and Cloudflare, covering managed rule sets, custom business-logic rules, rate limiting, bot management, and false-positive reduction. Use when deploying new apps behind a cloud WAF, when pentests reveal injection\u002FXSS flaws, when facing bot or credential-stuffing traffic, or when compliance (e.g. PCI-DSS) mandates a WAF.\n",[42,43,44,45,46],"T1078.004","T1530","T1537","T1580","T0816","main","d69096e239f2a89aabc2cd078c47664a9d3b1e11","04-安全渗透\u002Fimplementing-cloud-waf-rules",3,"https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts","https:\u002F\u002Fgithub.com\u002Flza6","个人vx：Tf00798\r\n个人✈：@TFGY999","2026-10-08 14:29:22",{"source":8,"skillName":5,"commands":56,"prompt":66,"zipAvailable":67},[57,60,63],{"tool":58,"command":59},"npx","npx skills add lza6\u002FArmor-piercing-system-prompts --skill implementing-cloud-waf-rules",{"tool":61,"command":62},"bunx","bunx skills add lza6\u002FArmor-piercing-system-prompts --skill implementing-cloud-waf-rules",{"tool":64,"command":65},"pnpm","pnpm dlx skills add lza6\u002FArmor-piercing-system-prompts --skill implementing-cloud-waf-rules","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F04-安全渗透\u002Fimplementing-cloud-waf-rules\u002FSKILL.md",true,[69],{"path":70,"resourceType":71,"resourceTypeDesc":72,"sizeBytes":73,"sourceHtmlUrl":74},"references\u002Fapi-reference.md","REFERENCE","参考文档",2347,"https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F04-安全渗透\u002Fimplementing-cloud-waf-rules\u002Freferences\u002Fapi-reference.md",[76,85,90,97,104,111],{"skillNo":77,"name":78,"nameZh":6,"description":79,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":80,"licenseFileUrl":6,"sourceHtmlUrl":81,"categories":82,"keywords":83,"publishedAt":84},"01M7FFG485KY83TD6HSC4YPCMC","obsidian-clipper-template-creator","Guide for creating templates for the Obsidian Web Clipper. Use when you want to create a new clipping template, understand available variables, or format clipped content.","MIT","https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F07-后端与架构\u002Fobsidian-clipper-template-creator\u002FSKILL.md",[],[],"2026-11-16 10:05:34",{"skillNo":86,"name":78,"nameZh":6,"description":79,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":80,"licenseFileUrl":6,"sourceHtmlUrl":87,"categories":88,"keywords":89,"publishedAt":84},"01M7FFG0T6AZ0STEJPSB3CX84K","https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F07-后端与架构\u002Fobsidian-clipper-template-creator-antigravity-awesome-skills-main\u002FSKILL.md",[],[],{"skillNo":91,"name":92,"nameZh":6,"description":93,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":80,"licenseFileUrl":6,"sourceHtmlUrl":94,"categories":95,"keywords":96,"publishedAt":84},"01M7FFFY0QEM14SKWPDYGMXM2P","python-api","Programmatic Object-Detection-Metrics API guidance for BoundingBox, BoundingBoxes, Evaluator, enums, coordinate conversion, AP\u002FmAP semantics, and source-style import diagnostics.","https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F07-后端与架构\u002Fobject-detection-metrics\u002Fsub-skills\u002Fpython-api\u002FSKILL.md",[],[],{"skillNo":98,"name":99,"nameZh":6,"description":100,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":80,"licenseFileUrl":6,"sourceHtmlUrl":101,"categories":102,"keywords":103,"publishedAt":84},"01M7FFFVZQZ2GJ0C0TGP7JHD20","file-evaluation","Folder-based PASCAL VOC AP\u002FmAP evaluation from ground-truth and detection text files.","https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F07-后端与架构\u002Fobject-detection-metrics\u002Fsub-skills\u002Ffile-evaluation\u002FSKILL.md",[],[],{"skillNo":105,"name":106,"nameZh":6,"description":107,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":80,"licenseFileUrl":6,"sourceHtmlUrl":108,"categories":109,"keywords":110,"publishedAt":84},"01M7FFFSFNYSE77SJ6PE1CK2DA","object-detection-metrics","Guides legacy Object-Detection-Metrics PASCAL VOC AP\u002FmAP evaluation from detection text folders and direct Python API classes.","https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F07-后端与架构\u002Fobject-detection-metrics\u002FSKILL.md",[],[],{"skillNo":112,"name":113,"nameZh":6,"description":114,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":80,"licenseFileUrl":6,"sourceHtmlUrl":115,"categories":116,"keywords":117,"publishedAt":84},"01M7FFFP0GCK1RVXBCPQ8APBMT","nx-workspace-patterns","Configure and optimize Nx monorepo workspaces. Use when setting up Nx, configuring project boundaries, optimizing build caching, or implementing affected commands.","https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F07-后端与架构\u002Fnx-workspace-patterns\u002FSKILL.md",[],[]]