Skip to content

Conversation

@bcoles
Copy link
Contributor

@bcoles bcoles commented Nov 21, 2025

Verification

Compare the before and after for both riscv32le and riscv64le. Note the two additional syscalls.

Before:

$ ./msfvenom -f elf -p linux/riscv64le/reboot > reboot.elf
[-] No platform was selected, choosing Msf::Module::Platform::Linux from the payload
[-] No arch selected, selecting arch: riscv64le from the payload
No encoder specified, outputting raw payload
Payload size: 40 bytes
Final size of elf file: 160 bytes
$ /home/user/qemu/build/qemu-riscv64 -strace ./reboot.elf 
7000 reboot(4276215469,672274793,19088743,0,0,0) = -1 errno=1 (Operation not permitted)
--- SIGILL {si_signo=SIGILL, si_code=1, si_addr=0x00000000004000a0} ---
Illegal instruction (core dumped)

After:

$ ./msfvenom -f elf -p linux/riscv64le/reboot PrependSetresuid=true AppendExit=true > reboot.elf
[-] No platform was selected, choosing Msf::Module::Platform::Linux from the payload
[-] No arch selected, selecting arch: riscv64le from the payload
No encoder specified, outputting raw payload
Payload size: 72 bytes
Final size of elf file: 192 bytes
$ /home/user/qemu/build/qemu-riscv64 -strace ./reboot.elf 
7133 setresuid(0,0,0) = -1 errno=1 (Operation not permitted)
7133 reboot(4276215469,672274793,19088743,0,0,0) = -1 errno=1 (Operation not permitted)
7133 exit(0)

@bcoles bcoles added the riscv RISC-V label Nov 21, 2025
@dledda-r7 dledda-r7 self-assigned this Nov 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

riscv RISC-V

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants