Prompt

SQL injection XSS WAF rules

Technology / Cybersecurity1 observationLast seen Oct 29, 2026

Latest observation

Oct 29, 2026OpenAI APIWeb search: off

I can help with defensive WAF rule design for SQL injection and XSS. If your goal is to protect an app, here are practical rules and patterns you can use.

1) SQL injection: WAF rule ideas

Common indicators to inspect

  • SQL keywords: select, union, insert, update, delete, drop, create, alter, exec, execute
  • Boolean logic abuse: or 1=1, and 1=1
  • Comment markers: --, #, /* ... */
  • Tautology / payload patterns
  • Suspicious encodings: URL-encoded, double-encoded, mixed case, Unicode homoglyphs
  • Delimiter abuse: ', ", ;

Example ModSecurity-style rule patterns

SecRule ARGS|ARGS_NAMES|REQUEST_HEADERS|REQUEST_COOKIES "@rx (?i)(\bunion\b.*\bselect\b|\bor\b\s+1=1\b|\band\b\s+1=1\b|(--|#|/\*|\*/)|\b(select|insert|update|delete|drop|alter|create|exec|execute)\b)"
    "id:100100,phase:2,deny,status:403,msg:'Possible SQL injection attempt'"

Stronger approach

Instead of a single broad regex, use several targeted rules:

  • Detect SQL meta characters only when combined with suspicious context
  • Normalize input first:
    • URL decode
    • lowercase
    • compress whitespace
  • Apply stricter rules on parameters that should be numeric or enum-only

Reduce false positives

  • Allowlist known-safe parameters
  • Use parameter-specific validation:
    • user_id → digits only
    • sort → one of predefined values
    • email → email format
  • Log first, then block after tuning

2) XSS: WAF rule ideas

Common indicators

  • Script tags: <script
  • Event handlers: onload=, onerror=, onclick=
  • JavaScript URLs: javascript:
  • Dangerous HTML tags: iframe, svg, img, object, embed
  • HTML entity encoded payloads
  • DOM-based vectors in query strings or form fields

Example rule

SecRule ARGS|ARGS_NAMES|REQUEST_HEADERS|REQUEST_COOKIES "@rx (?i)(<\s*script\b|javascript\s*:|on\w+\s*=|<\s*(iframe|svg|img|object|embed)\b)"
    "id:100200,phase:2,deny,status:403,msg:'Possible XSS attempt'"

Better XSS mitigation

  • Block only in contexts where HTML is not expected
  • Use output encoding in the app:
    • HTML encode for HTML context
    • JS encode for JavaScript context
    • URL encode for URL context
  • Add a Content Security Policy (CSP)
  • Sanitize rich text inputs with an allowlist sanitizer

3) Recommended WAF tuning approach

Baseline strategy

  1. Start in detection-only mode
  2. Review logs for legitimate requests
  3. Add exclusions for safe parameters
  4. Tighten to block mode
  5. Re-test with real traffic

Normalize before matching

Handle:

  • URL encoding
  • HTML entity decoding
  • case folding
  • whitespace collapsing
  • multi-encoding attempts

Score-based detection

Instead of one rule, assign points:

  • SQL keyword: +2
  • comment marker: +2
  • quote + operator combo: +3
  • XSS tag/event handler: +4 Block if score exceeds threshold.

4) Example high-level WAF policy

SQLi

  • Block if request contains:
    • SQL keyword + operator combo
    • comment markers near SQL keywords
    • malformed numeric parameter
  • Allow if parameter schema matches expected type

XSS

  • Block if request contains:
    • <script
    • event handler attributes
    • javascript:
    • HTML tags in fields expected to be plain text
  • Allow sanitized rich text only through a separate field with strict sanitizer

5) Important limitations

  • WAF rules are helpful, but not sufficient alone
  • The strongest protection is:
    • parameterized queries / prepared statements
    • server-side validation
    • output encoding
    • CSP for XSS
    • least-privilege DB accounts

If you want, I can provide:

  1. ModSecurity rules for SQLi/XSS
  2. AWS WAF regex patterns
  3. Cloudflare WAF expressions
  4. A tuned rule set for a specific application/framework

Observation history

How did Obsurfable measure this prompt?

Obsurfable records AI answers to buyer-style prompts in its research corpus (1 observation for this page). Metrics are distributions over observations, not a single static ranking.

Which AI systems does Obsurfable collect answers from?

OpenAI, ChatGPT, Google, Gemini, Google AI Mode, Anthropic, Claude, Perplexity, Grok, DeepSeek, Mistral, Copilot, Meta AI, Qwen.

How can brands improve their AEO?

Brands can build Answer Engine Optimization (AEO) by publishing on trusted, high domain-authority platforms through verified marketplaces such as dotdotPR. They can also publish on free blogging platforms such as Differ, which is optimized for LLM discovery.

Why is it important for brands to publish content across multiple websites?

Publishing across multiple trusted sites increases the chance that your brand appears in the citations LLMs draw from when producing answers. Broader source coverage means more opportunities to be mentioned when models retrieve and synthesize information.

Want this interpreted for your brand?

Explorer is the free public corpus. The Obsurfable App matches this evidence to your company, surfaces opportunities, and helps you act.