Fixes alignment in ELF shared object templates - #21027
Merged
msutovsky-r7 merged 3 commits intoApr 11, 2026
Merged
Conversation
The _start label in the armle ELF shared object template was landing at offset 0xF6, which is half-word aligned but not word aligned. ARM A32 requires 4-byte (word) alignment for instruction addresses. This caused the shared object to fail to load and execute on 32-bit ARM Linux targets. Fix: add 2 null padding bytes between strtab and _start, pushing the entry point from 0xF6 to 0xF8 (word aligned). Fixes rapid7#19668
dledda-r7
reviewed
Mar 5, 2026
msutovsky-r7
reviewed
Apr 9, 2026
Contributor
|
Also noticed that the same bug might be introduced in riscv32le, so that should be addressed as well. |
msutovsky-r7
approved these changes
Apr 9, 2026
msutovsky-r7
approved these changes
Apr 11, 2026
Contributor
Release NotesFixes ELF shared object ( |
The
_startlabel in the ARM LE ELF shared object template was landingat offset
0xF6, which is half-word aligned but not word aligned.ARM A32 requires 4-byte (word) alignment the least significant two
bits of the entry point address must always be zero.
0xF6violatesthis, causing the shared object to fail to load and execute on 32-bit
ARM Linux targets when using
--format elf-so.Fix: added 2 null padding bytes between
strtaband_startinelf_dll_armle_template.s, pushing the entry point from0xF6to0xF8(word aligned). The compiledtemplate_armle_linux_dll.binhasbeen regenerated with
nasm.Fixes #19668
Verification:
msfvenom --arch armle --platform linux --payload linux/armle/exec --format elf-so -o test.so CMD="id"readelf -h test.so→ Entry point address: 0xf8 ✅