Documentation

Web firewall: rules and exceptions

Every rule of the web firewall with what it reads, and how to keep it on for APIs, code and chat messages.

How the firewall decides

Each rule that matches adds its score; a request with 5 or more is blocked with a 403 page in "block" mode and only recorded in "detect" mode. Most rules score 5 on their own; level 2 and 3 rules score 3.

The sensitivity of the zone (1 standard, 2 strict, 3 very strict) decides which rules run: a rule runs at its level and above.

The 403 page shows the request id. Search it under Security analytics -> Security events to see the rule that matched.

What a rule reads

  • uri: the path and query of the request line, URL-decoded
  • path: the path nginx routes on
  • args: query argument names and values
  • body: form fields, or the raw body of a JSON or XML request: the whole body up to 1 MB, of a larger one its first 1 MB and last 64 KB (file uploads are not read)
  • headers: every header value except Cookie
  • cookies, ua (User-Agent), method

The rules

IDCategoryMatchesReadsLevel
100100Attack tool or scannerAttack tool user agentua1 standard
100110Attack tool or scannerKnown exploit or probe pathpath1 standard
100200Attack tool or scannerMissing or scripted user agentua3 very strict
200100Malformed or abusive requestMethod not allowedmethod1 standard
200110Malformed or abusive requestNull byteuri, args, body, headers1 standard
200120Malformed or abusive requestHTTP header injectionuri, args1 standard
300100Path traversal or local file accessPath traversaluri, args, body, cookies1 standard
300110Path traversal or local file accessOperating system file accessuri, args, body, cookies, headers1 standard
300120Path traversal or local file accessSystem path in a parameterargs, body, cookies2 strict
310100Access to sensitive filesHidden configuration filepath1 standard
310110Access to sensitive filesConfiguration backup filepath1 standard
310120Access to sensitive filesBackup or dump filepath2 strict
400100Command injectionUnix or Windows commanduri, args, body, cookies, headers1 standard
400110Command injectionShell pathuri, args, body, cookies, headers1 standard
400120Command injectionShellshockheaders, ua, cookies1 standard
400130Command injectionShort shell commandargs, body, cookies2 strict
500100PHP code injectionPHP open taguri, args, body, cookies1 standard
500110PHP code injectionPHP stream wrapperuri, args, body, cookies1 standard
500120PHP code injectionPHP function calluri, args, body, cookies1 standard
500130PHP code injectionCode evaluation or PHP object injectionargs, body, cookies2 strict
600100Cross-site scriptingScript taguri, args, body, cookies, headers1 standard
600110Cross-site scriptingEvent handler in a taguri, args, cookies1 standard
600120Cross-site scriptingDangerous HTML taguri, args, cookies1 standard
600130Cross-site scriptingScript URLuri, args, cookies1 standard
600140Cross-site scriptingEvent handler, script URL or dangerous tag in the bodybody2 strict
600150Cross-site scriptingScript functionuri, args, body, cookies2 strict
700100SQL injectionUNION SELECTuri, args, body, cookies1 standard
700110SQL injectionSQL tautologyuri, args, body, cookies1 standard
700120SQL injectionSQL time delayuri, args, body, cookies, headers1 standard
700130SQL injectionSQL system table or variableuri, args, body, cookies1 standard
700140SQL injectionStacked SQL queryuri, args, body, cookies1 standard
700150SQL injectionSQL file access or error-based functionuri, args, body, cookies1 standard
700160SQL injectionQuote followed by an SQL commentargs, body, cookies2 strict
700170SQL injectionSQL statementargs, body, cookies2 strict
700180SQL injectionSQL SELECT or string functionargs, body, cookies3 very strict
800100Java and template injectionLog4Shell (JNDI lookup)uri, args, body, cookies, headers, ua1 standard
800110Java and template injectionJava class manipulationuri, args, body1 standard
800120Java and template injectionServer-side template injectionuri, args, body, cookies2 strict
800130Java and template injectionXML external entitybody1 standard
810100Server-side request forgeryCloud metadata addressuri, args, body1 standard
810110Server-side request forgeryUnusual URL schemeargs, body2 strict
820100NoSQL injectionMongoDB operator in a parameteruri, args1 standard
820110NoSQL injectionMongoDB operator in JSONbody2 strict

Rules that read the body

These rules also read the request body. A body that holds code (a programming exercise, an AI chat message, a pasted file) can match them although it is not an attack:

  • SQL injection: 700100, 700110, 700120, 700130, 700140, 700150, 700160, 700170, 700180
  • PHP code injection: 500100, 500110, 500120, 500130
  • Cross-site scripting: 600100, 600140, 600150
  • Command injection: 400100, 400110, 400130
  • Path traversal or local file access: 300100, 300110, 300120

Exceptions for code and user content

On the Web firewall page, under Exceptions, one line per exception. A path matches as a prefix: /api/run covers /api/run, /api/run/42 and also /api/runner, so end a path with / where you mean a folder.

/api/run                 every rule skips this path
/api/run body            the body is user content: no rule reads it,
                         the address, query and headers are still checked
/api/run body 500100     only rule 500100 skips the body here
/api/exercises/ 500100,600100   these rules are off on this path
500100                   rule 500100 is off for the whole zone

For a code runner such as /api/run, "/api/run body" is the safest choice: an attack in the address, query or headers is still blocked. Turning every rule off for the path (no rule ids) is wider than needed.

Exceptions by address, header or method

Attack protection -> Exceptions skips the firewall, the browser check or the limits for requests that match a path, addresses, a user agent part, a header (present or equal) and methods, for example webhooks from Telegram's addresses or calls that carry your own secret header. Ready-made: Telegram bot webhooks, an API or MCP path, a Bale or other webhook.

Verified bots

Two lists of bots are let through the browser check and robot blocks, each with its own switch under Attack protection -> Access rules, both on by default. A bot is verified only by the networks its service publishes, never by its user agent: a request that only claims to be Googlebot gets the same checks as anyone. Neither list skips the web firewall.

  • Search engines ("Let search engines through"): Google (common and special crawlers), Bing, Apple (Applebot) and DuckDuckGo, from their published lists. They also skip the request limits.
  • Link previews and monitors ("Let link previews and monitors through"): Telegram (its published networks), WhatsApp, Facebook and Instagram previews (Meta, AS32934), X/Twitter (AS13414), LinkedIn (AS14413), UptimeRobot, Pingdom and Better Stack (their published address lists). The request limits still apply.
  • Not in the lists: Slack and Discord fetch previews from shared cloud networks and publish no ranges, so they cannot be verified. Add an exception by path or header for them if you need to.
  • The lists are fetched at most once a day; a source that cannot be reached keeps its last list.

API and MCP

# firewall exceptions (the whole list)
curl -X POST -H "Authorization: Bearer oscust_..." -H "Content-Type: application/json" \
  -d '{"exclusions":"/api/run body\n/api/exercises/ body"}' \
  https://my.cloud9.ir/api/customer/v1/domains/example.com/services/wafexcl
# find a blocked request by its id
curl -H "Authorization: Bearer oscust_..." \
  "https://my.cloud9.ir/api/customer/v1/domains/example.com/security-events?rid=1a42c81abc80d1bdbe04440c04bd1fb9"

Our own panel addresses (/mcp, /api/, /oauth/ and any request with an Authorization header on my.cloud9.ir and admin.cloud9.ir) never get the browser check; their limits still apply.

No answer here? Sign in to the portal and open a ticket. Open a ticket