Path: blob/master/documentation/modules/payload/linux/loongarch64/chmod.md
59987 views
Vulnerable Application
This payload targets Linux systems running on the LoongArch64 architecture. It uses the fchmodat syscall (syscall number 53) to change the permissions of a specified file, then exits cleanly via the exit syscall (syscall number 93).
The payload is a 48-byte position-independent shellcode stub. It is suitable for use in exploits targeting LoongArch64 Linux systems where arbitrary code execution has been achieved.
Verification Steps
Generate the payload as an ELF executable:
Run it under QEMU user-mode emulation:
Confirm the
fchmodatsyscall was made and returned 0:Verify the file permissions changed:
Options
FILE
The full path of the file to chmod on the target system. Defaults to /etc/shadow.
MODE
The desired file permissions in octal notation (e.g. 0777, 0666, 0644). Defaults to 0666. Must not exceed 0xFFF (octal 07777).
Scenarios
LoongArch64 Linux — making /etc/shadow world-readable
This scenario demonstrates using the payload to make /etc/shadow readable after gaining code execution on a LoongArch64 Linux target.
Version and OS: LoongArch64 Linux (tested with qemu-loongarch64)
Generate the payload:
Run on target (or via QEMU for testing):