Repository navigation
Add /sandbox: try requests against CRS from the browser #548
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
fzipi
wants to merge
8
commits into
main
Choose a base branch
from
feat/sandbox-playground
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
0c2c851
Add /sandbox: try requests against CRS from the browser
fzipi 5e42cf6
sandbox: drop the application exclusions checkboxes
fzipi e598ff9
sandbox: drop the exclusions header from the table too
fzipi 0bf6fd1
sandbox: point issues at coreruleset/coreruleset, drop the private re…
fzipi 97e3b6a
sandbox: be honest about what the browser actually sends
fzipi 675eb0f
sandbox: keep the XSS preset from closing the inline script
fzipi c5f237c
sandbox: actually show the result and the header warning
fzipi 96470f5
sandbox: link the documentation and security policy, carry over the l…
fzipi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| --- | ||
| title: Sandbox | ||
| description: Send a request to the CRS Sandbox and see which rules it triggers on Apache, Nginx or Coraza, with the CRS version and paranoia level of your choice. | ||
| url: /sandbox | ||
| --- | ||
|
|
||
| The CRS Sandbox is a public instance of OWASP CRS running on | ||
| three WAF engines ([ModSecurity](https://github.com/owasp-modsecurity/ModSecurity) 2 on Apache, | ||
| ModSecurity 3 on Nginx, and [Coraza](https://coraza.io/)) in several CRS versions. Send it a request, | ||
| pick the engine, version and paranoia level with headers, and get back the rules that matched instead of the page. | ||
|
|
||
| It is there for integrators who need to know how CRS reacts to a fresh exploit, for researchers who | ||
| want to check whether a payload is caught and from which paranoia level on, and for rule writers | ||
| who want to try a variant without setting up a WAF. The sandbox is a shared public resource: read the | ||
| [security policy](/docs/crs-sandbox-policy/) before you use it, and the | ||
| [documentation](/docs/6-development/6-4-using-the-crs-sandbox/) for the architecture behind it. | ||
|
|
||
| Use the form below, or the headers directly from the command line further down. | ||
|
|
||
| {{< crs-sandbox >}} | ||
|
|
||
| ## From the command line | ||
|
|
||
| Every option in the form is a request header. Send the request to `https://sandbox.coreruleset.org` | ||
| with any path, method, query string or body you like: | ||
|
|
||
| ```shell | ||
| curl -H "x-backend: nginx" \ | ||
| -H "x-crs-version: latest" \ | ||
| -H "x-crs-paranoia-level: 2" \ | ||
| -H "x-format-output: txt-matched-rules" \ | ||
| "https://sandbox.coreruleset.org/get?file=../../etc/passwd" | ||
| ``` | ||
|
|
||
| | Header | Values | Default | | ||
| |--------|--------|---------| | ||
| | `x-backend` | `apache`, `nginx`, `coraza` | `apache` | | ||
| | `x-crs-version` | `v4-lts`, `v3-lts`, `latest` (`coraza` has no `v3-lts`) | `v4-lts` | | ||
| | `x-crs-paranoia-level` | `1` to `4`, blocking and detection | `1` | | ||
| | `x-crs-detection-paranoia-level` | `1` to `4`, detection only | same as above | | ||
| | `x-crs-inbound-anomaly-score-threshold` | number | `5` | | ||
| | `x-crs-mode` | `detection` for DetectionOnly, never blocks | blocking | | ||
| | `x-format-output` | `json-matched-rules`, `json-report`, `csv-matched-rules`, `txt-matched-rules`, `txt-matched-rules-extended`, `html-matched-rules` | raw audit log | | ||
|
|
||
| `GET https://sandbox.coreruleset.org/backends` returns the supported combinations as JSON. | ||
| The response carries `x-backend` with the service that answered and `x-crs-version` with the exact | ||
| CRS tag it runs, so `latest` always resolves to something you can check. | ||
|
|
||
| `txt-matched-rules-extended` wraps the list in a paragraph you can paste into an advisory or a | ||
| publication ("This payload has been tested against the OWASP CRS... CRS therefore detects this | ||
| payload starting with paranoia level 1"). The JSON formats pair well with `jq`. | ||
|
|
||
| ## Good to know | ||
|
|
||
| - The response body is the WAF's verdict, not the page you asked for. Behind every WAF is a small | ||
| HTTP mirror ([go-httpbin](https://github.com/mccutchen/go-httpbin)) that accepts anything, so you | ||
| can use any path and any method. | ||
| - A `403` with a blocking rule (`949110`) in the list means CRS blocked the request. In detection | ||
| mode, or when the anomaly score stays below the threshold, you get the matched rules with a `200`. | ||
| - The form sends what a browser can send. Before the request leaves the browser, `#fragments` are | ||
| dropped, `..` path segments and backslashes are resolved, control characters are removed and most | ||
| special characters are percent-encoded; the result shows the URL that was actually sent. Headers | ||
| such as `Cookie`, `Host` or `Referer` cannot be set from a page at all. For raw bytes use curl | ||
| (`--path-as-is` keeps `..` segments). | ||
| - A `400` with `"source": "sandbox-edge"` in the body comes from the sandbox's own HTTP parser or | ||
| from the backend web server, not from CRS: the request was malformed and was never scanned. A `502` | ||
| after a long wait usually means the request made a regular expression time out (ReDoS). | ||
| - Please keep it under 10 requests per second. | ||
| - Requests are logged in full and may be kept and analysed by the CRS team to improve the rules and | ||
| the sandbox, see the [security policy](/docs/crs-sandbox-policy/). Do not send real credentials or | ||
| personal data. | ||
| - Something broken? [Open an issue](https://github.com/coreruleset/coreruleset/issues) and include the | ||
| `x-unique-id` shown with the result. | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.