-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
ModSeurity v3 not execute phase2 #2933
Comments
Hello @eddychen111 , The most likely explanation is a problem with an nginx configuration file. You might want to check if the transaction is subject to a redirect. Incidentally, your rule 22000100 is incorrect. The |
Thanks @martinhsv here two question:
The nginx configuration as follows: load_module "modules/ngx_http_modsecurity_module.so";
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
server {
listen 80;
server_name localhost;
modsecurity on;
modsecurity_rules_file /etc/nginx/modsec/main.conf;
#charset koi8-r;
#access_log logs/host.access.log main;
# location / {
# root html;
# index index.html index.htm;
# }
location / {
default_type text/plain;
return 200 "Thank you for requesting ${request_uri}\n";
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
} Additional: SecRule REQUEST_BODY "@eq param\=test" "id:22000100,phase:4,deny" debug output
|
I have never used the |
@martinhsv |
I was desperately trying to get coreruleset (v. 3.3.7) working on nginx until I finally found this. I don't know if I did get lost or if this piece of information was just badly indexed in search engines, but I think it would be really helpful to have the docs (maybe in the comment before
For anyone else that could get there trying to test CRS without being able to block basic url patterns like |
rules not execute phase2,is some config error?
SecRule REQUEST_BODY with phase2 not execute,with no debug log output
nginx: nginx/1.21.4
modsecurity: v3/master
Config
modsecurity.conf
main.conf
Logs and dumps
[169002196257.436038] [] [4] Initializing transaction
[169002196257.436038] [] [4] Transaction context created.
[169002196257.436038] [] [4] Starting phase CONNECTION. (SecRules 0)
[169002196257.436038] [] [9] This phase consists of 0 rule(s).
[169002196257.436038] [] [4] Starting phase URI. (SecRules 0 + 1/2)
[169002196257.436038] [/] [4] Starting phase REQUEST_HEADERS. (SecRules 1)
[169002196257.436038] [/] [9] This phase consists of 0 rule(s).
[169002196257.436038] [/] [4] Starting phase RESPONSE_HEADERS. (SecRules 3)
[169002196257.436038] [/] [9] This phase consists of 0 rule(s).
[169002196257.436038] [/] [9] Appending response body: 27 bytes. Limit set to: 524288.000000
[169002196257.436038] [/] [4] Starting phase RESPONSE_BODY. (SecRules 4)
[169002196257.436038] [/] [9] This phase consists of 0 rule(s).
[169002196257.436038] [/] [4] Starting phase LOGGING. (SecRules 5)
[169002196257.436038] [/] [9] This phase consists of 0 rule(s).
[169002196257.436038] [/] [8] Checking if this request is suitable to be saved as an audit log.
[169002196257.436038] [/] [8] Checking if this request is relevant to be part of the audit logs.
[169002196257.436038] [/] [9] Return code
200' is not interesting to audit logs, relevant code(s):
^(?:5|4(?!04))'.The text was updated successfully, but these errors were encountered: