Skip to content

Commit 86ee77f

Browse files
committed
add aarch64 nops and fix aarch64 cmdstager
1 parent 195c1e0 commit 86ee77f

File tree

2 files changed

+51
-0
lines changed

2 files changed

+51
-0
lines changed

lib/msf/util/exe.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,14 @@ def self.to_executable(framework, arch, plat, code = '', opts = {})
165165
# XXX: Add remaining ARMLE systems here
166166
end
167167

168+
if arch.index(ARCH_AARCH64)
169+
if plat.index(Msf::Module::Platform::Linux)
170+
return to_linux_aarch64_elf(framework, code)
171+
end
172+
173+
# XXX: Add remaining AARCH64 systems here
174+
end
175+
168176
if arch.index(ARCH_PPC)
169177
if plat.index(Msf::Module::Platform::OSX)
170178
return to_osx_ppc_macho(framework, code)

modules/nops/aarch64/simple.rb

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
##
2+
# This module requires Metasploit: https://metasploit.com/download
3+
# Current source: https://github.com/rapid7/metasploit-framework
4+
##
5+
6+
###
7+
#
8+
# SingleByte
9+
# ----------
10+
#
11+
# This class implements simple NOP generator for AARCH64
12+
#
13+
###
14+
class MetasploitModule < Msf::Nop
15+
16+
def initialize
17+
super(
18+
'Name' => 'Simple',
19+
'Alias' => 'armle_simple',
20+
'Description' => 'Simple NOP generator',
21+
'License' => MSF_LICENSE,
22+
'Arch' => ARCH_AARCH64)
23+
register_advanced_options(
24+
[
25+
OptBool.new('RandomNops', [ false, "Generate a random NOP sled", true ])
26+
])
27+
end
28+
29+
def generate_sled(length, opts)
30+
random = opts['Random'] || datastore['RandomNops']
31+
nops = [
32+
0xd503201f, # nop
33+
0xaa0103e1, # mov x1, x1
34+
0xaa0203e2, # mov x2, x2
35+
0x2a0303e3, # mov w3, w3
36+
0x2a0403e4, # mov w4, w4
37+
]
38+
if random
39+
return ([nops[rand(nops.length)]].pack("V*") * (length/4))
40+
end
41+
return ([nops[0]].pack("V*") * (length/4))
42+
end
43+
end

0 commit comments

Comments
 (0)