Module: Msf::Payload::Linux::Riscv64le::Prepends

Includes:
Prepends
Defined in:
lib/msf/core/payload/linux/riscv64le/prepends.rb

Overview

Linux RISC-V 64-bit prepends

Instance Method Summary collapse

Methods included from Prepends

#apply_prepends, #initialize, #register_prepend_options

Instance Method Details

#appends_mapObject



67
68
69
70
71
72
73
74
75
76
# File 'lib/msf/core/payload/linux/riscv64le/prepends.rb', line 67

def appends_map
  {
    # exit(0)
    'AppendExit' => [
      0x00000513, # li a0,0       # exit code = 0
      0x05d00893, # li a7,93      # __NR_exit
      0x00000073  # ecall
    ].pack('V*')
  }
end

#appends_orderObject



11
12
13
# File 'lib/msf/core/payload/linux/riscv64le/prepends.rb', line 11

def appends_order
  %w[AppendExit]
end

#prepends_mapObject



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/msf/core/payload/linux/riscv64le/prepends.rb', line 15

def prepends_map
  {
    # setuid(0)
    'PrependSetuid' => [
      0x00000513, # li a0,0      # uid = 0
      0x09200893, # li a7,146    # __NR_setuid
      0x00000073  # ecall
    ].pack('V*'),

    # setreuid(0, 0)
    'PrependSetreuid' => [
      0x00000513, # li a0,0       # ruid = 0
      0x00000593, # li a1,0       # euid = 0
      0x09100893, # li a7,145     # __NR_setreuid
      0x00000073  # ecall
    ].pack('V*'),

    # setresuid(0, 0, 0)
    'PrependSetresuid' => [
      0x00000513, # li a0,0       # ruid = 0
      0x00000593, # li a1,0       # euid = 0
      0x00000613, # li a2,0       # suid = 0
      0x09300893, # li a7,147     # __NR_setresuid
      0x00000073  # ecall
    ].pack('V*'),

    # setresgid(0, 0, 0)
    'PrependSetresgid' => [
      0x00000513, # li a0,0       # rgid = 0
      0x00000593, # li a1,0       # egid = 0
      0x00000613, # li a2,0       # sgid = 0
      0x0aa00893, # li a7,170     # __NR_setresgid
      0x00000073  # ecall
    ].pack('V*'),

    # setregid(0, 0)
    'PrependSetregid' => [
      0x00000513, # li a0,0       # rgid = 0
      0x00000593, # li a1,0       # egid = 0
      0x04700893, # li a7,71      # __NR_setregid
      0x00000073  # ecall
    ].pack('V*'),

    # setgid(0)
    'PrependSetgid' => [
      0x00000513, # li a0,0       # gid = 0
      0x02e00893, # li a7,46      # __NR_setgid
      0x00000073  # ecall
    ].pack('V*')
  }
end

#prepends_orderObject



7
8
9
# File 'lib/msf/core/payload/linux/riscv64le/prepends.rb', line 7

def prepends_order
  %w[PrependSetresuid PrependSetreuid PrependSetuid PrependSetresgid PrependSetregid PrependSetgid]
end