owasp-crs-request action enables rule processing on incoming HTTP requests
to your endpoint. To use rule processing to block malicious HTTP responses,
enable the OWASP CRS Response
action.
OWASP stands for the Open Web Application Security
Project, an online community that, among other things, maintains annual lists of
the most critical web application security risks. The OWASP Core Rule
Set (CRS) is a set of
attack detection rules that we expose for you to use in your Traffic Policies.
It includes protections against attacks like SQL Injection, Cross Site
Scripting, Local File Inclusion, and many others.
Configuration reference
This is the Traffic Policy configuration reference for this action.Supported phases
on_http_request
Type
owasp-crs-request
Configuration fields
Behavior if there is an error. Must be one of either “continue” or “halt” (default “halt”)
More information can be found in the Managing Fallback Behavior section.
If false, we do not process rules for the request body. Default is false.
List of OWASP CRS rule IDs to exclude from evaluation.
The minimum value is 900000 and the maximum value is 999999.
Behavior
This action evaluates rules for request headers and body (whenprocess_body is enabled), and each matching rule adds to the overall score of a request. If the score exceeds the set score threshold, the action will block the request.
The tallying process is called Anomaly Scoring, and is detailed on the CRS website.
Default behavior
The default behavior for this action is based on the following Coraza directives and rules from v4.14.0 of the CRS: Included in these rules is an inbound anomaly score threshold of 5 and a paranoia level of 1.Managing fallback behavior (on_error)
If on_error is set to halt (default) and the action encounters an error when forwarding traffic, the Traffic Policy chain will halt and no further actions will be executed. For example, if you have a log action after the owasp-crs-request action, the log action will not be run and the error will be returned.
However, if on_error is set to continue, actions that appear after the owasp-crs-request action will still be executed even if the owasp-crs-request action encounters an error.
Body processing
Whenprocess_body is enabled, ngrok evaluates rules against the first 4kb of the body. If the body is larger than 4kb, we ignore the portion after the first 4kb.
Rule exclusion
Whenexclude_rule_ids is configured, ngrok skips evaluation of the specified rule IDs. This allows you to disable specific OWASP CRS rules that may be causing false positives in your environment.
Inbound anomaly score threshold exceeded
If the anomaly score accumulated from matching rules exceeds the threshold, ngrok blocks the request with aHTTP 403 response. The request does not make it to your upstream.
Failure to process the body successfully
If ngrok is unable to read the request body successfully, ngrok blocks the request with aHTTP 500 response. The request does not make it to your upstream.
Examples
Running in block mode
The following configuration demonstrates how to run theowasp-crs-request action in block mode.
Example Traffic Policy document
Example request that ngrok would block
In this example, we attempt to connect toexample.ngrok.app using the
curl command, and ngrok blocks the request returning back ERR_NGROK_3700
Running in test mode
The following configuration demonstrates how to run theowasp-crs-request action in test mode where rules are evaluated but blocks are not enforced.
Example Traffic Policy document
Action result variables
The following variables are made available for use in subsequent expressions and CEL interpolations after the action has run. Variable values will only apply to the last action execution, results are not concatenated.The action taken for this request.
The total anomaly score for the request. If it equals to or exceeds the set threshold, it will block the request.
The total anomaly score threshold for the request. By default, it is set to 5.
The list of all rules matched by this request that have a non-zero score.
A machine-readable code describing an error that occurred during the action’s execution.
A human-readable message providing details about an error that occurred during the action’s execution.