Opened 5 years ago
Closed 5 years ago
#1842 closed defect (invalid)
server_tokens doesnt affect redirects. Exposing software version.
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | minor | Milestone: | |
Component: | nginx-core | Version: | 1.14.x |
Keywords: | redirect exposed version | Cc: | |
uname -a: | Linux websrv 4.15.0-54-generic #58-Ubuntu SMP Mon Jun 24 10:55:24 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux | ||
nginx -V: |
nginx/1.14.0 (Ubuntu)
built with OpenSSL 1.1.1 11 Sep 2018 (running with OpenSSL 1.1.1c 28 May 2019) TLS SNI support enabled configure arguments: --with-cc-opt='-g -O2 -fdebug-prefix-map=/build/nginx-DUghaW/nginx-1.14.0=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -Wdate-time -D_FORTIFY_SOURCE=2' --with-ld-opt='-Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -fPIC' --prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --lock-path=/var/lock/nginx.lock --pid-path=/run/nginx.pid --modules-path=/usr/lib/nginx/modules --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --with-debug --with-pcre-jit --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_auth_request_module --with-http_v2_module --with-http_dav_module --with-http_slice_module --with-threads --with-http_addition_module --with-http_geoip_module=dynamic --with-http_gunzip_module --with-http_gzip_static_module --with-http_image_filter_module=dynamic --with-http_sub_module --with-http_xslt_module=dynamic --with-stream=dynamic --with-stream_ssl_module --with-mail=dynamic --with-mail_ssl_module |
Description
Even after setting the server_tokens directive,
software version is exposed when using redirect.
To test this configure your server with the server_tokens off
and then in any vhost perform a redirect.
Example in a :80 vhost
return 301 https://$host$request_uri;
Response:
80/tcp open http 4 8 15 16 23 42
| fingerprint-strings:
| FourOhFourRequest:
| HTTP/1.1 301 Moved Permanently
| Date: Wed, 28 Aug 2019 09:44:16 GMT
| Content-Type: text/html
| Content-Length: 194
| Connection: close
| Location: https://_/nice%20ports%2C/Tri%6Eity.txt%2ebak
| Server: 4 8 15 16 23 42
| <html>
| <head><title>301 Moved Permanently</title></head>
| <body bgcolor="white">
| <center><h1>301 Moved Permanently</h1></center>
| <hr><center>nginx/1.14.0 (Ubuntu)</center>
| </body>
| </html>
The main purpose of having the server_tokens directive is to easily switch off or modify the information avaliable to the public about thecnologies and versions used.
It looks like you are testing it wrong.
Example configuration:
Test results:
Note well that hiding information about software and versions used is more or less pointless. Even if configured properly, there are a lot of ways to find out which version is used, and how to attack it. Security by obscurity isn't a proper way to secure your systems, see here. Instead, consider using versions which aren't obsolete.