-
Notifications
You must be signed in to change notification settings - Fork 43
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
ARGS_NAMES is Set Incorrectly with Multipart/related Request #101
Comments
|
Thanks for the quick response @jcchavezs ! I'll work on testing with the newer version this week, and update this issue once that is complete. |
@jcchavezs I was able to reproduce this same issue on v2.0.0-rc.3. Here is the setup I used to run the test: The command I used to build caddy was this:
After I did that, I ran
I created a Caddyfile with the following:
I created a really simple flask app that just returns a hello message for /test path that listens on http://127.0.0.1:5001 to use as my backend
This could be replaced by anything though that listens on 127.0.0.1 on port 5001 and returns some sort of a response. For the config files, I got coraza.conf from the main Coraza repo on GitHub. For REQUEST-901-INITIALIZATION.conf, REQUEST-949-BLOCKING-EVALUATION.conf, and crs-setup.conf.example, I grabbed the most recent version of each of those files from the Core Rule Set GitHub repo. Lastly, new_test.conf just has rule 921150 in it:
I ran my flask app script above to get that setup, and then I ran caddy with the following: After that, I used the below Python script to send the request I mentioned in my first post to reproduce the error:
When I did that, I got the following error:
|
@M4tteoP could you please have a look at this? |
I'm testing some multipart/related XML POST requests on the Coraza WAF with Caddy right now, and the requests I'm sending are getting blocked by rule 921150 (Detect newlines in argument names). After further investigation, it looks like the body of the request is getting incorrectly added to the list of ARGS_NAMES
Here is an example request (use your own hostname):
In the example above, the rule fires because it sees "\r" after the initial boundary. That's definitely not an argument name though, so it seems like it thinks the whole body is composed of arguments. Do you all know what may be causing this? Or could you point me to the part of the code that controls this logic so that I can further dig in from there?
From looking at the code, it seems like ARGS_NAMES comes from tx.variables.argsPost with a Post request, but I wasn't able to figure out where that gets set.
Here is the version of coraza and the coraza-caddy plugin that I'm using:
dep github.com/corazawaf/coraza-caddy v1.2.2 h1:rsA7c1m5H++V6pQSv220dMl3PTMEgrsped7E3cc3Zjk=
dep github.com/corazawaf/coraza/v3 v3.0.0-20230117071831-8b909c7fc345 h1:4xW94n5Lah6ca8ROtP1g9fhVHc8RW5IyMnLVp3uzkUo=
The text was updated successfully, but these errors were encountered: