✳ The reference desk / In practice

WAF

A control that inspects web application traffic and applies rules to detect or block unwanted requests, often including known attack patterns.

Web application firewall

What it means

A WAF applies rules to web requests and, in some deployments, responses. It commonly sits in front of an application as a reverse proxy, but deployment models vary. Rules may reject suspicious request patterns, enforce request-size limits, or restrict abusive traffic. Because legitimate and malicious requests can look similar, tuning is necessary. A WAF is one layer around the application: it does not repair vulnerable code, understand every business rule, or guarantee that an authenticated person is allowed to access a particular record.

See the idea / Applications

A rule match is not automatically a block.

Send the same harmless request through a block action and a count action.

Synthetic UploadDesk receives Maya’s valid upload request with a 17-byte ASCII body. Rule R190 matches bodies larger than 16 bytes on this covered path. Compare R190 configured to block with R190 configured only to count; the remaining policy allows forwarding. The app separately checks Maya’s upload permission. Original F190 stays unchanged.

WAF: Send the same harmless request through a block action and a count action. The chapter text below describes every state.UploadDesk · selected WAF rule R19017-byte body · rule limit is 16 bytesMaya · valid upload permissionPOST body: 17 ASCII bytesOriginal F190 remainsCovered proxy · match + actionR190 evaluation not runSame body in two isolated runsApp · separate upload grantApp not reachedOther-owner access stays refusedCaller + independent checksCaller has no responseNo code repair is demonstratedSAME REQUEST · TWO RULE ACTIONS

01 / 04

Request

Maya sends the same 17-byte harmless body through the configured WAF path. Her valid app permission is unchanged.

More about this step

The synthetic ASCII string has exactly 17 bytes. R190 is a chosen size condition: more than 16 bytes, not a claim of malicious content. Maya holds a valid session and has upload permission. F190 remains the original. The two isolated runs differ only in R190’s action; no app operation or response exists yet.

Keep in mindThis is a local HTTP proxy/rule exercise, not an actual WAF or attack detector. The tiny size rule is for teaching, not a production recommendation. Decrypted supported bodies, identity and protected channels are assumed. Count does not decide access; the remaining policy does. Rule ordering, large-body handling, direct origins, other patterns, false positives and code repair are untested.

Read the visual, step by step

Block matching request

  1. Request. Maya sends the same 17-byte harmless body through the configured WAF path. Her valid app permission is unchanged. The synthetic ASCII string has exactly 17 bytes. R190 is a chosen size condition: more than 16 bytes, not a claim of malicious content. Maya holds a valid session and has upload permission. F190 remains the original. The two isolated runs differ only in R190’s action; no app operation or response exists yet.
  2. Match. R190 matches the body-size condition. Its configured action is block. The covered proxy receives and measures the supported body rather than trusting a claimed length. It stores one match record. Block stops forwarding; count records the match and continues to the exercise’s default allow. Other rules could still block in a real rule set. At this boundary the application has not handled the request and the caller has no response.
  3. Act. The proxy creates a 403 response without calling UploadDesk. No U190 is stored. The block run has zero app-upload calls and no U190. In the count run the forwarded request reaches UploadDesk, which validates the session and its own upload grant before storing the 17-byte copy. The response is ready but has not yet arrived at the caller in this authored boundary. Original F190 remains in both. This chapter combines forwarding, app evaluation and response preparation; no traveler or real network timing is depicted.
  4. Return. The caller receives the proxy’s 403. Separate checks still permit a 16-byte upload and refuse another owner’s record. The completed caller response is now 403 or 201. Count’s U190 is independently read back with the original 17 bytes; block’s store has no U190. Separate fresh tests send a 16-byte permitted upload (201) and request Nora’s F191 with Maya’s same valid session (403 at the app). The latter is the app’s resource rule, not a WAF content decision. F190 stays unchanged. This selected rule/path proves no code repair, complete attack coverage or closure of direct-origin routes.

Count, then default allow

  1. Request. Maya sends the same 17-byte harmless body through the configured WAF path. Her valid app permission is unchanged. The synthetic ASCII string has exactly 17 bytes. R190 is a chosen size condition: more than 16 bytes, not a claim of malicious content. Maya holds a valid session and has upload permission. F190 remains the original. The two isolated runs differ only in R190’s action; no app operation or response exists yet.
  2. Match. R190 matches and counts the request. Counting is non-terminating; the remaining policy allows it to proceed. The covered proxy receives and measures the supported body rather than trusting a claimed length. It stores one match record. Block stops forwarding; count records the match and continues to the exercise’s default allow. Other rules could still block in a real rule set. At this boundary the application has not handled the request and the caller has no response.
  3. Act. UploadDesk independently permits Maya’s upload, stores U190 and creates a 201 response. A WAF match did not grant app permission. The block run has zero app-upload calls and no U190. In the count run the forwarded request reaches UploadDesk, which validates the session and its own upload grant before storing the 17-byte copy. The response is ready but has not yet arrived at the caller in this authored boundary. Original F190 remains in both. This chapter combines forwarding, app evaluation and response preparation; no traveler or real network timing is depicted.
  4. Return. The caller receives the app’s 201 and reads U190 back. Separate checks still permit a 16-byte upload and refuse another owner’s record. The completed caller response is now 403 or 201. Count’s U190 is independently read back with the original 17 bytes; block’s store has no U190. Separate fresh tests send a 16-byte permitted upload (201) and request Nora’s F191 with Maya’s same valid session (403 at the app). The latter is the app’s resource rule, not a WAF content decision. F190 stays unchanged. This selected rule/path proves no code repair, complete attack coverage or closure of direct-origin routes.

This is a local HTTP proxy/rule exercise, not an actual WAF or attack detector. The tiny size rule is for teaching, not a production recommendation. Decrypted supported bodies, identity and protected channels are assumed. Count does not decide access; the remaining policy does. Rule ordering, large-body handling, direct origins, other patterns, false positives and code repair are untested.

Flow references: OWASP: WAF HTTP rules and deployment scope · AWS WAF: blocking versus non-terminating count actions

AN ILLUSTRATIVE SCENARIO

A rule match is not automatically a block

Synthetic UploadDesk receives Vera’s valid upload request with a 17-byte ASCII body. Rule R190 matches bodies larger than 16 bytes on this covered path. Compare R190 configured to block with R190 configured only to count; the remaining policy allows forwarding. The app separately checks Vera’s upload permission. Original F190 stays unchanged.

Put it to work

  1. Map public hostnames, application origins, and direct access paths. Identify where encrypted traffic is inspected and which requests are outside the WAF policy.
  2. Evaluate a narrow rule with representative legitimate traffic and an authorized harmless test case. Start in observation mode when appropriate and define a rapid rollback for false blocks.
  3. Monitor rule matches and application errors together. Assign an owner to tune the rule, complete the underlying code fix, and decide whether the temporary rule remains useful.

How to check your work

Confirm the test request is rejected at the intended entry point and that normal browsing, checkout, and uploads still work. Check the origin cannot be reached through an unintended route, then separately verify the application patch.

Connect the ideas

  • HTTP

    The application protocol that names methods, paths, headers, and bodies for web requests.

  • Compensating control

    An alternative safeguard used in place of a specified control, with evidence that it provides comparable protection for the intended security objective.

  • Patch

    A vendor or internal change that removes or reduces a vulnerability in running software.

Explore a field lesson

Find your next idea.

Tip: press / to open search. Escape closes this window.