-
Notifications
You must be signed in to change notification settings - Fork 606
Requests stuck in certain cases #226
Comments
Hi, Thanks for the bug-report. regards, |
I just stripped it but it happens if I enable it for the location only. If naxsi is not enabled for the location but just built into nginx, the bug does not occur. However, it doesn't matter if it is in learning mode or not. |
Can you please provide a full non strippped config so I can reproduce it ? |
location /myapp {
# Naxsi config
LearningMode;
SecRulesEnabled;
DeniedUrl "/RequestDenied";
CheckRule "$SQL >= 8" BLOCK;
CheckRule "$RFI >= 8" BLOCK;
CheckRule "$TRAVERSAL >= 4" BLOCK;
CheckRule "$EVADE >= 4" BLOCK;
CheckRule "$XSS >= 8" BLOCK;
auth_request /auth;
proxy_pass http://some-upstream;
}
location = /auth {
proxy_method GET;
proxy_pass_request_body off;
proxy_pass_request_headers off;
if ($cookie_auth) {
set $app_auth "Token $cookie_auth";
}
if ($http_authorize) {
set $app_auth $http_authorize;
}
proxy_set_header Authorize $app_auth;
proxy_set_header Host $host;
proxy_set_header Content-Length "";
proxy_cache proxyCacheAuth;
proxy_cache_key $remote_addr$host$app_auth;
proxy_cache_valid any 15m;
proxy_pass http://authupstream/random/url;
} |
thanks for the details, I will look into it |
Hello, Sorry, but I did not manage to reproduce the issue, can you give me a hand ?
(note: this deploys a dummy nginx in /tmp/naxsi_ut) Then I edit nginx.conf to make it look like yours (/tmp/naxsi_ut/nginx.conf) server {
listen 4242;
server_name localhost;
location /myapp {
# Naxsi config
LearningMode;
SecRulesEnabled;
DeniedUrl "/RequestDenied";
CheckRule "$SQL >= 8" BLOCK;
CheckRule "$RFI >= 8" BLOCK;
CheckRule "$TRAVERSAL >= 4" BLOCK;
CheckRule "$EVADE >= 4" BLOCK;
CheckRule "$XSS >= 8" BLOCK;
auth_request /auth;
proxy_pass http://77.153.128.117/;
proxy_set_header Host www.google.fr;
# root html;
}
location = /auth {
proxy_method GET;
proxy_pass_request_body off;
proxy_pass_request_headers off;
if ($cookie_auth) {
set $app_auth "Token $cookie_auth";
}
if ($http_authorize) {
set $app_auth $http_authorize;
}
proxy_set_header Authorize $app_auth;
proxy_set_header Host $host;
proxy_set_header Content-Length "";
proxy_pass http://localhost:4241/random/url;
} (localhost:4241 is just a netcat so I can answer 200 OK by hand) GET request : I get the answer without problem, as you described. POST request :
(the scrapped HTML is google's answer) in the meanwhile in the netcat :
And I get the answer here. Please let me know what I missed to reproduce your issue ! Regards, |
Hello, |
After investigating further we've tracked the bug to the size of the request, it seems to be working until up to 1024. The following should not work with your config : The following should work, with your config : Note that if you comment #SecRulesEnabled; and retry the request with a content length greater than 1024, it will work. Please let us know if you were able to reproduce the issue with the settings you have posted above. |
thank you, I'm trying to give it a look soon :) |
Just noticed, we're using naxsi-0.54rc3. Will test the latest release soon and confirm if we see the same problem there. |
Sadly, I'm fraid the latest won't fix the issue, none of the mechanics On Fri, Oct 23, 2015 at 10:07 AM, Andrei S. notifications@github.com
|
So we can take this as a confirmation that you were able to reproduce the issue ? :) |
Not yet, but you seem to have provided some quite precise things for me to On Fri, Oct 23, 2015 at 10:28 AM, Andrei S. notifications@github.com
|
Sorry, I failed you and had a lazy week-end :p |
Yeah, it probably will. I wasn't sure if it is really a pretty nasty problem or it is just me not having enough skills :)... |
Hi, Ok, just tested it :) At least (good for you, bad for me), I can confirm the bug exists. |
Hello, I didn't gave up, but I still didn't understand what is happening, as it's something I never see. |
Hello, |
Hi, I worked a bit on it this week-end and I'm getting closer to it I guess, but I don't have yet a fix to submit, I still need to play around a bit ! I didn't give up and I'll keep you posted as soon as I have something that seems plausible :) |
Hi & happy new year ! Some further testing have provided some interesting things (no, i didn't solve the issue yet):
So far, I think that either nginx changed something in the internals (since nginx 1.7.4), or I've been wrong the whole time, or mod_auth as an issue. Just to be sure I'm not brain-fried, can you confirm that the following setup still gives you the same issue
Remove naxsi from ./configure, add form-input :
I used the following configuration :
Cheers, and thanks for your patience ! ps: that's a really sneaky tricky *** bug :) |
I rather think that both naxsi and the other module do something that they are not supposed to do in the wrong phase. It is possible that this changed at some point in nginx but it doesn't change the fact that the nginx devs do not recommend doing that. We will give it a try as soon as we can and confirm. |
Hi ! I didn't mean that mod_auth is wrong, I definitely trust maxim on this kind of topic ^^ If you confirm the issue, I'm going to turn to nginx-dev's ml. Using form-input-nginx-module as a use case is definitely easier than naxsi, as the code is way shorter and cleaner ! cheers, |
Hello,
The nginx config
With
we get an ok response With
the request gets stuck
When i get some time i'll try and test it out with previous nginx version to try and trace down the last version this worked ok .. if that helps. |
I'm going to shoot an email to nginx-dev's ML to check. I'll mostly ask if form-input-nginx-module is doing things correctly :) Keep me posted as well, cheers ! |
Did some more testing with multiple nginx version. We can reproduce the issue describe in the previous post even in nginx 1.5.4 (first version with http_auth_request_module |
Hi, I posted on nginx-dev ML : http://mailman.nginx.org/pipermail/nginx-devel/2016-January/007762.html I didn't give up ;) |
Heya buixor, |
Hello, Sorry for delay :) |
Hi, how are you doing? 0.55 is out 💃 Time for party! But we'd also appreciate some more input on this one. Thanks, |
Any success with this one so far? |
We switched to mod_security :( |
Aw </3 |
Well, don't be surprised if you'll see the same behavior with (lib)modsecurity. :) owasp-modsecurity/ModSecurity-nginx#130 |
Guess I have somehow the same, or a similar/related issue. Running nginx 1.15.6 and naxsi 0.56. When naxsi is enabled, even in learning mode, some POST requests just hang. I haven't isolated exactly which ones, but apparently, it can affect requests < 1024. I'll try to get some more info and a simple reproducer |
For now, I can confirm the issue is only present when I protect the location with auth_request. I'm using Lemonldap::NG handler (see configuration example here: https://lemonldap-ng.org/documentation/latest/configvhost#reverse_proxy1) As soon as I remove the auth_request part, everything is working again. |
@FlorinAsavoaie Can you please notify us if you encounter the same issue with mod_sec and auth_request ? If it's the case, I should document the known incompatibility between those two modules. |
Has something like owasp-modsecurity/ModSecurity-nginx@1cd5484 been applied on NAXSI ? |
@dani This is what (I think but ofc I didn't keep proper track of it) I tried after maxim's suggestion when I posted, but it's worth giving a try again :) |
I'd be happy to give it a try, if you can show me a commit. I have a setup where I can easily reproduce the issue. |
@dani in our case, the changes should be made in Unfortunately, it seems I didn't keep track of my previous attempts (no commit), so I guess I'll have to first spend some time to do the restoration of event_handlers in a branch for you to properly test :/ |
I raised nginx bug 801 for this but actually it seems to be an issue with Naxsi.
Long story short, here's the comment from the nginx developers:
The text was updated successfully, but these errors were encountered: