SysV /bin/login Environment Remote Overflow (telnet check) - Nessus

Critical   Plugin ID: 10827

This page contains detailed information about the SysV /bin/login Environment Remote Overflow (telnet check) Nessus plugin including available exploits and PoCs found on GitHub, in Metasploit or Exploit-DB for verifying of this vulnerability.

Plugin Overview


ID: 10827
Name: SysV /bin/login Environment Remote Overflow (telnet check)
Filename: binlogin_overflow_telnet.nasl
Vulnerability Published: 2001-12-12
This Plugin Published: 2001-12-15
Last Modification Time: 2018-06-27
Plugin Version: 1.36
Plugin Type: remote
Plugin Family: Gain a shell remotely
Dependencies: telnetserver_detect_type_nd_version.nasl

Vulnerability Information


Severity: Critical
Vulnerability Published: 2001-12-12
Patch Published: N/A
CVE [?]: CVE-2001-0797
CPE [?]: N/A
Exploited by Malware: True

Synopsis

It is possible to execute arbitrary code on the remote host.

Description

The remote /bin/login seems to crash when it receives too many environment variables. This is likely due to a buffer overflow vulnerability which might allow an attacker to execute arbitrary code on the remote host.

Solution

Apply the patch from your vendor or read the CERT advisory.

Public Exploits


Target Network Port(s): 23
Target Asset(s): Services/telnet
Exploit Available: True (Metasploit Framework, Exploit-DB, GitHub, Immunity Canvas)
Exploit Ease: Exploits are available

Here's the list of publicly known exploits and PoCs for verifying the SysV /bin/login Environment Remote Overflow (telnet check) vulnerability:

  1. Metasploit: exploit/solaris/telnet/ttyprompt
    [Solaris in.telnetd TTYPROMPT Buffer Overflow]
  2. Metasploit: exploit/dialup/multi/login/manyargs
    [System V Derived /bin/login Extraneous Arguments Buffer Overflow]
  3. Exploit-DB: exploits/solaris/remote/716.c
    [EDB-716: Solaris 2.5.1/2.6/7/8 rlogin (SPARC) - '/bin/login' Remote Buffer Overflow]
  4. Exploit-DB: exploits/solaris/remote/9917.rb
    [EDB-9917: Solaris TelnetD - 'TTYPROMPT' Remote Buffer Overflow (1) (Metasploit)]
  5. Exploit-DB: exploits/solaris/remote/10036.rb
    [EDB-10036: System V Derived /bin/login - Extraneous Arguments Buffer Overflow (modem based) (Metasploit)]
  6. Exploit-DB: exploits/solaris/remote/16327.rb
    [EDB-16327: Solaris TelnetD - 'TTYPROMPT' Remote Buffer Overflow (2) (Metasploit)]
  7. Exploit-DB: exploits/linux/remote/16928.rb
    [EDB-16928: System V Derived /bin/login - Extraneous Arguments Buffer Overflow (Metasploit)]
  8. GitHub: https://github.com/0xdea/exploits
    [CVE-2001-0797]
  9. GitHub: https://github.com/Whonix/security-misc
    [CVE-2001-0797]
  10. Immunity Canvas: CANVAS

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.

WARNING: Beware of using unverified exploits from sources such as GitHub or Exploit-DB. These exploits and PoCs could contain malware. For more information, see how to use exploits safely.

Risk Information


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

Go back to menu.

Plugin Source


This is the binlogin_overflow_telnet.nasl nessus plugin source code. This script is Copyright (C) 2001-2018 Tenable Network Security, Inc.

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

#
# Sun's patch makes /bin/login exits when it receives too many arguments,
# hence making the detection of the flaw difficult. Our logic is the
# following :
#
# Username: "nessus" -> should not crash
# Username: "nessus A=B..... x 61"  -> should not crash
# Username: "nessus A=B..... x 100" -> should crash
#

include("compat.inc");

if (description)
{
   script_id(10827);
   script_version("1.36");
   script_cvs_date("Date: 2018/06/27 18:42:25");

   script_cve_id("CVE-2001-0797");
   script_bugtraq_id(3681, 7481);
   script_xref(name:"CERT-CC", value:"CA-2001-34");

   script_name(english:"SysV /bin/login Environment Remote Overflow (telnet check)");
   script_summary(english:"Attempts to overflow /bin/login");
 
   script_set_attribute(attribute:"synopsis", value:"It is possible to execute arbitrary code on the remote host.");
   script_set_attribute(attribute:"description", value:
"The remote /bin/login seems to crash when it receives too many
environment variables. This is likely due to a buffer overflow
vulnerability which might allow an attacker to execute arbitrary
code on the remote host.");
   script_set_attribute(attribute:"solution", value:"Apply the patch from your vendor or read the CERT advisory.");
  script_set_cvss_base_vector("CVSS2#AV:N/AC:L/Au:N/C:C/I:C/A:C");
  script_set_cvss_temporal_vector("CVSS2#E:H/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:"exploited_by_malware", value:"true");
   script_set_attribute(attribute:"metasploit_name", value:'Solaris in.telnetd TTYPROMPT Buffer Overflow');
   script_set_attribute(attribute:"exploit_framework_metasploit", value:"true");
   script_set_attribute(attribute:"exploit_framework_canvas", value:"true");
   script_set_attribute(attribute:"canvas_package", value:'CANVAS');

   script_set_attribute(attribute:"vuln_publication_date", value:"2001/12/12");
   script_set_attribute(attribute:"plugin_publication_date", value:"2001/12/15");

   script_set_attribute(attribute:"plugin_type", value:"remote");
   script_end_attributes();
 
   script_category(ACT_DESTRUCTIVE_ATTACK);
   script_copyright(english:"This script is Copyright (C) 2001-2018 Tenable Network Security, Inc.");
   script_family(english:"Gain a shell remotely");
   script_dependencie("telnetserver_detect_type_nd_version.nasl");
   script_require_ports("Services/telnet", 23);
   exit(0);
}


include("global_settings.inc");
include("misc_func.inc");
include('telnet_func.inc');

login = rand_str(length:6);

port = get_kb_item("Services/telnet");
if(!port) port = 23;
if (!get_port_state(port)) exit(0, "Port "+port+" is closed.");

function login(env, try)
{
  local_var	i, soc, r, buffer;

  # if (try <= 0) try = 1;
  for (i = 0; i < try; i ++)
  {
    sleep(i);
    soc = open_sock_tcp(port);
    if (soc) break;
  }

   if (soc)
   {

 buffer = telnet_negotiate(socket:soc);
 send(socket:soc, data:string(login, " ", env, "\r\n"));
 r = recv(socket:soc, length:4096);
 close(soc);
 if("word:" >< r)
  {
	return(1);
  }
 }
 return(0);
}



if(login(env:"", try: 1))
{
 my_env = crap(data:"A=B ", length:244);
 res = login(env:my_env);
 if(res)
 {
  my_env = crap(data:"A=B ", length:400);
  res = login(env:my_env, try: 4);
  if(!res)security_hole(port);
 }
}

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

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

Go back to menu.

How to Run


Here is how to run the SysV /bin/login Environment Remote Overflow (telnet check) 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 Gain a shell remotely plugin family.
  6. On the right side table select SysV /bin/login Environment Remote Overflow (telnet check) plugin ID 10827.
  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 binlogin_overflow_telnet.nasl -t <IP/HOST>

Run the plugin with audit trail message on the console:

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

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

/opt/nessus/bin/nasl -T - binlogin_overflow_telnet.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 binlogin_overflow_telnet.nasl -t <IP/HOST>

Go back to menu.

References


BID | SecurityFocus Bugtraq ID: CERT-CC | CERT Coordination Center:
  • CA-2001-34
See also: Similar and related Nessus plugins:
  • 10828 - SysV /bin/login Environment Remote Overflow (rlogin)
  • 11136 - Multiple OS /bin/login Remote Overflow
  • 11203 - Motorola Vanguard with No Password (telnet check)
  • 30213 - MikroTik RouterOS with Blank Password (telnet check)
  • 40354 - OpenWrt Router with a Blank Password (telnet check)

Version


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

Go back to menu.