owasp-crs-response action enables rule processing on HTTP responses from your upstream service.
To use rule processing to block malicious HTTP requests, enable the OWASP CRS Request 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 exposed for 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_response
Type
owasp-crs-response
Configuration fields
Behavior
This action evaluates rules for response headers and body (whenprocess_body is enabled), and each matching rule adds to the overall score of a response. If the score exceeds the set score threshold, the action will block the response.
The tallying process is called Anomaly Scoring, and is detailed on the CRS website.
This action costs 10 Traffic Policy Units (TPUs) per response evaluated.
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 outbound anomaly score threshold of 4 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 while evaluating rules, 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-response 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-response action will still be executed even if the owasp-crs-response action encounters an error.
Body processing
Whenprocess_body is enabled, ngrok buffers and evaluates rules against the first 4KB of the body. If the body is larger than 4KB, the portion after the first 4KB is ignored.
Enabling
process_body buffers the response body in memory, which may increase latency for large payloads.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.
Outbound anomaly score threshold exceeded
If the anomaly score accumulated from matching rules exceeds the threshold, ngrok blocks the request with aHTTP 403 response. The response from your upstream does not make it to the client.
Failure to process the body successfully
If ngrok is unable to read the response body successfully, ngrok blocks the response with aHTTP 500 response. The response from your upstream does not make it to the client.
Non-terminating action
This is a Non-terminating action. It does not return a response, and will allow Traffic Policy processing to continue to the next Action in the chain. All Cloud Endpoint Traffic Policies must end with a terminating action. This requirement does not apply to Agent Endpoints.Examples
Running in block mode
The following configuration demonstrates how to run theowasp-crs-response action in block mode.
Example Traffic Policy document
Running in test mode
The following configuration demonstrates how to run theowasp-crs-response action in test mode where rules are evaluated but blocks are not enforced.
Example Traffic Policy document
Example response from your upstream that ngrok would block
Atext/plain response like the following will result in ngrok blocking the response due to potential security leaks that is, SQL Injection vulnerabilities.