You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, the Audit Log duplicates the Server header content under the Response headers section F.
When configuring Nginx with the following directives, the Audit Log duplicates the Server header as shown.
Options that trigger the issue:
more_clear_headers Server;
more_set_headers 'Server: Custom Name';
First case (more_set_headers 'Server: Custom Name';)
Nginx configuration:
# Other options...keepalive_timeout15;
send_timeout10;
more_set_headers'Server: Custom Name'; # This option causes the duplicate response header.proxy_hide_header X-Powered-By;
# Other options...
# Other options...keepalive_timeout15;
send_timeout10;
more_clear_headers Server; # This option causes the duplicate response header.proxy_hide_header X-Powered-By;
# Other options...
The expected behavior is that ModSecurity's Audit Log should not duplicate the Server response header when using either more_clear_headers Server; or more_set_headers 'Server: Custom Name';.
Server (please complete the following information):
ModSecurity v3.0.14 with nginx-connector v1.0.3
WebServer: nginx/1.28.0
OS: Ubuntu 24.04.2 LTS
Rule Set (please complete the following information):
After several additional steps to load the necessary libraries, configure settings, and complete the setup, I installed the latest version of the OWASP Core Rule Set (CRS).
While testing the configuration and writing custom rules for my application, I noticed an issue when inspecting the Audit Logs. Specifically, when experimenting with Response headers in Nginx, I observed the Server header being duplicated.
I understand that not all of this information may be essential, but I wanted to provide as much detail as possible. I hope this helps clarify the context of the issue.
Thanks!
The text was updated successfully, but these errors were encountered:
After a quick review, I'm afraid this is a connector issue. I run my WAF instance through gdb and I realized that Nginx (or the connector) sends that header twice:
Breakpoint 3, modsecurity::msc_add_n_response_header (transaction=0x561410474b20, key=0x7fab19ebf0ee"Server", key_len=6, value=0x5614104eec20"Custom Name", value_len=11) at transaction.cc:21292129 return transaction->addResponseHeader(key, key_len, value, value_len);
(gdb) c
Continuing.
Breakpoint 3, modsecurity::msc_add_n_response_header (transaction=0x561410474b20, key=0x7fab19ebf0f5"Date", key_len=4, value=0x5614061b5b9a"Sat, 03 May 2025 20:31:10 GMT", value_len=29) at transaction.cc:21292129 return transaction->addResponseHeader(key, key_len, value, value_len);
(gdb) c
Continuing.
Breakpoint 3, modsecurity::msc_add_n_response_header (transaction=0x561410474b20, key=0x7fab19ebf0fa"Content-Length", key_len=14, value=0x7ffe8b4dcb80"153", value_len=3) at transaction.cc:21292129 return transaction->addResponseHeader(key, key_len, value, value_len);
(gdb) c
Continuing.
Breakpoint 3, modsecurity::msc_add_n_response_header (transaction=0x561410474b20, key=0x7fab19ebf109"Content-Type", key_len=12, value=0x56140615bd9d"text/html", value_len=9) at transaction.cc:21292129 return transaction->addResponseHeader(key, key_len, value, value_len);
(gdb) c
Continuing.
Breakpoint 3, modsecurity::msc_add_n_response_header (transaction=0x561410474b20, key=0x7fab19ebf124"Connection", key_len=10, value=0x7fab19ebf0ae"keep-alive", value_len=10) at transaction.cc:21292129 return transaction->addResponseHeader(key, key_len, value, value_len);
(gdb) c
Continuing.
Breakpoint 3, modsecurity::msc_add_n_response_header (transaction=0x561410474b20, key=0x5614104eead1"Server: Custom Name", key_len=6, value=0x5614104eec20"Custom Name", value_len=11) at transaction.cc:21292129 return transaction->addResponseHeader(key, key_len, value, value_len);
msc_add_n_response_header is called from connector at many places, for eg. here (but only this file uses that function).
We have to make more investigation, especially in case of the connector.
Describe the bug
Hi, the Audit Log duplicates the
Server
header content under theResponse headers
sectionF
.When configuring Nginx with the following directives, the Audit Log duplicates the
Server
header as shown.Options that trigger the issue:
more_clear_headers Server;
more_set_headers 'Server: Custom Name';
First case (more_set_headers 'Server: Custom Name';)
Nginx configuration:
Logs and dumps:
Audit Log
Second case (more_clear_headers Server;)
Nginx configuration:
Logs and dumps:
Audit Log
Final case (baseline without header modification)
Nginx configuration:
Logs and dumps:
Audit Log
To Reproduce
Steps to reproduce the behavior:
Configure the
nginx.conf
file using either:more_clear_headers Server;
more_set_headers 'Server: Custom Name';
Test the configuration:
Reload Nginx:
Send a request to trigger the rule:
curl 'http://domain.host.sh/?foo=/etc/passwd&bar=/bin/sh'
Expected behavior
The expected behavior is that ModSecurity's Audit Log should not duplicate the
Server
response header when using eithermore_clear_headers Server;
ormore_set_headers 'Server: Custom Name';
.Server (please complete the following information):
Rule Set (please complete the following information):
Additional context
After successfully compiling ModSecurity v3.0.14 with:
I created the following directory structure:
I then assigned appropriate ownership and permissions to each directory.
Following that, I applied the following configuration to ModSecurity:
I then compiled ModSecurity-nginx v1.0.3 with:
After several additional steps to load the necessary libraries, configure settings, and complete the setup, I installed the latest version of the OWASP Core Rule Set (CRS).
While testing the configuration and writing custom rules for my application, I noticed an issue when inspecting the Audit Logs. Specifically, when experimenting with Response headers in Nginx, I observed the Server header being duplicated.
I understand that not all of this information may be essential, but I wanted to provide as much detail as possible. I hope this helps clarify the context of the issue.
Thanks!
The text was updated successfully, but these errors were encountered: