I have the below assembly code global _start
section .text
_start:
jmp call
pop:
pop ecx ; ECX = address of hello
xor eax, eax ; EAX = 0
xor al, al ; EAX = 4 (int 0x80 sys_write)
inc al
inc al
inc al
inc al
xor ebx, ebx
inc ebx //Does not work inside exploit
xor edx, edx
mov dl, hellolen ; EDX = length of hello string
int 0x80
; Terminate program
xor eax, eax
inc eax //Does not work inside exploit
xor ebx, ebx ; EBX = return value of 0
int 0x80
call:
call pop
hello: db "Hello World!Ho are you!!!!!"
hellolen equ $-hello
The above code works properly and gives the proper output when run independently.
But when I take objdump of the same and if I try to run through buffer overflow I get the following issues.
Here inc al
increments al value properly but inc eax
or inc ebx
Could be because in the objdump it shows
inc al
--> fe c0
inc ebx
--> 43 //some one byte number
I also tried the following methods to update eax and ebx
xor ebx, ebx
xor bl, bl
inc bl
movsx ebx, bl
;inc ebx
But here movsx opcode is 0x0f and it does not work as I encounter null terminated string(\x0x\x0f ).