Skip to content

Add Linux LoongArch64 chmod payload - #21238

Merged
adfoster-r7 merged 2 commits into
rapid7:masterfrom
bcoles:loongarch64-chmod
Apr 16, 2026
Merged

Add Linux LoongArch64 chmod payload#21238
adfoster-r7 merged 2 commits into
rapid7:masterfrom
bcoles:loongarch64-chmod

Conversation

@bcoles

@bcoles bcoles commented Apr 6, 2026

Copy link
Copy Markdown
Contributor

Verification

$ ./msfvenom -p linux/loongarch64/chmod FILE=/tmp/asdf MODE=777 -f elf -o chmod.elf && chmod +x chmod.elf 
[-] No platform was selected, choosing Msf::Module::Platform::Linux from the payload
[-] No arch selected, selecting arch: loongarch64 from the payload
No encoder specified, outputting raw payload
Payload size: 48 bytes
Final size of elf file: 168 bytes
Saved as: chmod.elf
$ /home/user/qemu/build/qemu-loongarch64 -strace ./chmod.elf 
3129433 fchmodat(AT_FDCWD,"/tmp/asdf",0777,0) = 0
3129433 exit(0)

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new Metasploit single payload for Linux LoongArch64 that performs chmod (via fchmodat) on a caller-specified file path with a caller-specified octal mode, aligning with existing linux/*/chmod payload patterns.

Changes:

  • Introduces linux/loongarch64/chmod single payload module.
  • Implements LoongArch64 shellcode generation using __NR_fchmodat + __NR_exit.
  • Adds FILE and MODE datastore options and encodes MODE into the generated instruction stream.

Comment thread modules/payloads/singles/linux/loongarch64/chmod.rb
Comment thread modules/payloads/singles/linux/loongarch64/chmod.rb Outdated
Comment thread modules/payloads/singles/linux/loongarch64/chmod.rb Outdated
@github-project-automation github-project-automation Bot moved this from Todo to Waiting on Contributor in Metasploit Kanban Apr 16, 2026