Lucene search
+L

Nginx Detection (HTTP Error Page)

🗓️ 09 Jul 2021 00:00:00Reported by Copyright (C) 2021 Greenbone AGType 
openvas
 openvas
🔗 plugins.openvas.org👁 23 Views

nginx Detection (HTTP Error Page) - Detects nginx via HTTP error page

Code
# SPDX-FileCopyrightText: 2021 Greenbone AG
# Some text descriptions might be excerpted from (a) referenced
# source(s), and are Copyright (C) by the respective right holder(s).
#
# SPDX-License-Identifier: GPL-2.0-only

if(description)
{
  script_oid("1.3.6.1.4.1.25623.1.0.117545");
  script_version("2026-06-18T07:15:20+0000");
  script_tag(name:"last_modification", value:"2026-06-18 07:15:20 +0000 (Thu, 18 Jun 2026)");
  script_tag(name:"creation_date", value:"2021-07-09 11:23:30 +0000 (Fri, 09 Jul 2021)");
  script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N");
  script_tag(name:"cvss_base", value:"0.0");
  script_name("Nginx Detection (HTTP Error Page)");
  script_category(ACT_GATHER_INFO);
  script_copyright("Copyright (C) 2021 Greenbone AG");
  script_family("Product detection");
  script_dependencies("find_service.nasl", "httpver.nasl", "global_settings.nasl");
  script_require_ports("Services/www", 80);
  script_exclude_keys("Settings/disable_cgi_scanning");

  script_tag(name:"summary", value:"HTTP error-page based detection of Nginx.");

  script_tag(name:"qod_type", value:"remote_banner");

  exit(0);
}

include("http_func.inc");
include("http_keepalive.inc");
include("port_service_func.inc");

port = http_get_port( default:80 );

banner = http_get_remote_headers( port:port );

# nb: No need to run if we have a full banner like e.g.:
# Server: nginx/1.14.2
# In this case we don't get any additional / more detailed info from the error page and just can jump out.
if( banner && egrep( string:banner, pattern:"^Server\s*:\s*nginx/[0-9.]+", icase:TRUE ) )
  exit( 0 );

# If the banner is hidden we still can try to see if nginx is installed from the default error pages
# like e.g. for 301 redirects (e.g. the redirect might happen on the landing page) or 404 not found pages.
# nb: Some reverse proxy setups might only expose the version on these pages (see examples listed below).

foreach url( make_list( "/", "/vt-test-non-existent.html", "/vt-test/vt-test-non-existent.html", "/vt-test-non-existent/" ) ) {

  res = http_get_cache( port:port, item:url, fetch404:TRUE );
  if( ! res || res !~ "^HTTP/1\.[01] [0-9]{3}" )
    continue;

  # Few examples from Debian/Ubuntu (other Distros might use the same):
  #
  #<html>
  #<head><title>301 Moved Permanently</title></head>
  #<body bgcolor="white">
  #<center><h1>301 Moved Permanently</h1></center>
  #<hr><center>nginx/1.14.2</center>
  #</body>
  #</html>
  #
  # or:
  #
  #<html>
  #<head><title>404 Not Found</title></head>
  #<body bgcolor="white">
  #<center><h1>404 Not Found</h1></center>
  #<hr><center>nginx/1.10.3</center>
  #</body>
  #</html>
  #
  # but also without the version (other parts are the same):
  #
  #<hr><center>nginx</center>
  #
  # and also with Distro specific strings:
  #
  #<hr><center>nginx/1.14.0 (Ubuntu)</center>

  if( res =~ "<html>\s*<head>\s*<title>[^<]+</title>\s*</head>\s*<body" && res =~ "<hr>\s*<center>nginx[^<]*</center>\s*</body>\s*</html>" ) {

    set_kb_item( name:"nginx/error_page/detected", value:TRUE );
    set_kb_item( name:"www/nginx_error_page/banner/location/" + port, value:url );

    kb_banner = eregmatch( string:res, pattern:"<hr>\s*<center>(nginx[^<]*)</center>", icase:FALSE );
    if( kb_banner[1] ) {
      # nb: Saving it into this format for all VTs checking something like "Server\s*:\s*nginx".
      set_kb_item( name:"www/nginx_error_page/banner/" + port, value:"Server: " + chomp( kb_banner[1] ) );
      set_kb_item( name:"www/nginx_error_page/banner/concluded/" + port, value:chomp( kb_banner[0] ) );
    }

    break;
  }
}

exit( 0 );

Data

Build on a solid foundation with Vulners data

We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data

Api

Power your application with Vulners API

The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access

App

Assess and manage vulnerabilities with Vulners tools

Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation

18 Jun 2026 00:00Current
5.2Medium risk
Vulners AI Score5.2
23