Lucene search
+L

DNS Server Detection (UDP)

🗓️ 22 Mar 2009 00:00:00Reported by Copyright (C) 2009 Greenbone AGType 
openvas
 openvas
🔗 plugins.openvas.org👁 21 Views

DNS Server Detection (UDP) - Detects DNS server via UD

Code
# SPDX-FileCopyrightText: 2009 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.100069");
  script_version("2025-11-26T05:40:08+0000");
  script_tag(name:"last_modification", value:"2025-11-26 05:40:08 +0000 (Wed, 26 Nov 2025)");
  script_tag(name:"creation_date", value:"2009-03-22 17:08:49 +0100 (Sun, 22 Mar 2009)");
  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("DNS Server Detection (UDP)");
  script_category(ACT_GATHER_INFO);
  script_family("Service detection");
  script_copyright("Copyright (C) 2009 Greenbone AG");
  script_dependencies("gb_open_udp_ports.nasl");
  script_require_udp_ports("Services/udp/unknown", 53);

  script_tag(name:"summary", value:"UDP based detection of a DNS server.");

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

  exit(0);
}

include("host_details.inc");
include("port_service_func.inc");
include("dns_func.inc");

# query '1.0.0.127.in-addr.arpa/PTR/IN'
data = raw_string( 0xB8, 0x4C, 0x01, 0x00, 0x00, 0x01,
                   0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                   0x01, 0x31, 0x01, 0x30, 0x01, 0x30,
                   0x03, 0x31, 0x32, 0x37, 0x07, 0x69,
                   0x6E, 0x2D, 0x61, 0x64, 0x64, 0x72,
                   0x04, 0x61, 0x72, 0x70, 0x61, 0x00,
                   0x00, 0x0C, 0x00, 0x01 );

port = unknownservice_get_port( default:53, ipproto:"udp" );

if( ! soc = open_sock_udp( port ) )
  exit( 0 );

send( socket:soc, data:data );
buf = recv( socket:soc, length:4096 );
if( ! buf ) {
  close( soc );
  exit( 0 );
}

if( strlen( buf ) > 3 &&
    ord( buf[2] ) & 0x80 ) {

  # nb:
  # - Store link between this and e.g. gb_dns_amplification_attack.nasl
  # - We don't use the host_details.inc functions in both so we need to call this directly
  register_host_detail( name:"detected_at", value:port + "/udp" );

  set_kb_item( name:"DNS/udp/" + port, value:TRUE );
  set_kb_item( name:"dns/server/detected", value:TRUE );
  set_kb_item( name:"dns/server/udp/detected", value:TRUE );

  banner = dns_version_req( soc:soc, proto:"udp", port:port );
  if( banner )
    report = 'The remote DNS server banner is:\n\n' + banner;
  service_register( port:port, ipproto:"udp", proto:"domain", message:report );
  log_message( port:port, data:report, protocol:"udp" );
  close( soc );
  exit( 0 );
}

close( soc );
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