Closed packmad closed 6 years ago
First, Pwntools' shellcraft arm.linux.sh
is a compromise to provide maximum flexibility. The shellcode you linked to does not work against BusyBox, ToyBox, or Android shells. See #626 for more information. You can also see #406 to see earlier analysis and reasons why our ARM shellcode is NOT guaranteed to be NULL-free.
The shellcode you linked to also contains a NULL byte, specifically at 0x8071 / 0x8072 (depending on endianness; see below).
Finally, using svc 1
works on real hardware, but does not work under qemu-user
emulation. See #1024 for more information. This is somewhat important for CTFs, but especially important for our shellcode testing purposes (which use e.g. qemu-arm-static
). Because of this, we must use svc 0
which will always emit NULL bytes.
8054: e28f3001 add r3, pc, #1 ; 0x1
8058: e12fff13 bx r3
805c: 4678 mov r0, pc
805e: 300c adds r0, #12
8060: 46c0 nop (mov r8, r8)
8062: 9001 str r0, [sp, #4]
8064: 1a49 subs r1, r1, r1
8066: 1a92 subs r2, r2, r2
8068: 270b movs r7, #11
806a: df01 svc 1 <======= Won't work on QEMU
806c: 622f str r7, [r5, #32]
806e: 6e69 ldr r1, [r5, #100]
8070: 732f strb r7, [r5, #12]
8072: 0068 lsls r0, r5, #1 <===== NULL byte
Hi guys,
the linux arm shellcode contains null bytes:
This shellcode worked for me.