Path: blob/master/modules/payloads/singles/cmd/mainframe/generic_jcl.rb
19813 views
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45##6# This is a prototype JCL command payload for z/OS - mainframe.7# It submits the IEFBR14 standard z/OS program, which does nothing8# but complete successfully and return code 0.9#10# See http://www.ibm.com/support/knowledgecenter/SSLTBW_2.1.0/com.ibm.zos.v2r1.ieab500/hpropr.htm?lang=en11# for more information on IEFBR1412##1314module MetasploitModule15CachedSize = 15016include Msf::Payload::Single17include Msf::Payload::Mainframe18include Msf::Sessions::CommandShellOptions1920def initialize(info = {})21super(22merge_info(23info,24'Name' => 'Generic JCL Test for Mainframe Exploits',25'Description' => %q{26Provide JCL which can be used to submit27a job to JES2 on z/OS which will exit and return 0. This28can be used as a template for other JCL based payloads29},30'Author' => 'Bigendian Smalls',31'License' => MSF_LICENSE,32'Platform' => 'mainframe',33'Arch' => ARCH_CMD,34'Handler' => Msf::Handler::None,35'Session' => Msf::Sessions::MainframeShell,36'PayloadType' => 'cmd',37'RequiredCmd' => 'jcl',38'Payload' => {39'Offsets' => {},40'Payload' => ''41}42)43)44register_options(45[46OptString.new('ACTNUM', [true, 'Accounting info for JCL JOB card', 'MSFUSER-ACCTING-INFO']),47OptString.new('PGMNAME', [true, 'Programmer name for JCL JOB card', 'programmer name']),48OptString.new('JCLASS', [true, 'Job Class for JCL JOB card', 'A']),49OptString.new('NOTIFY', [false, 'Notify User for JCL JOB card', '']),50OptString.new('MSGCLASS', [true, 'Message Class for JCL JOB card', 'Z']),51OptString.new('MSGLEVEL', [true, 'Message Level for JCL JOB card', '(0,0)'])52],53self.class54)55register_advanced_options(56[57OptBool.new('NTFYUSR', [true, 'Include NOTIFY Parm?', false]),58OptString.new('JOBNAME', [true, 'Job name for JCL JOB card', 'DUMMY'])59],60self.class61)62end6364##65# Construct Payload66##67def generate(_opts = {})68super + command_string69end7071##72# Setup replacement vars from options if need be73##74def command_string75jcl_jobcard +76"// EXEC PGM=IEFBR14\n"77end78end798081