Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Assembly 

Is this considered a BOF?

Code
section .data
    msg: db 'Test',0
section .text
    global _start
    
_start:
    mov ecx,msg
    mov edx,4
    call _read
    mov ecx,msg
    call _print
    call _exit
;#################################################
;###################=-Functions-=#################
_read:
    mov eax,3
    mov ebx,0
    mov edx,4
    int 0x80
    RET
_print:
    mov eax,4
    mov ebx,1
    int 0x80
    RET
_exit:
    mov eax,1
    mov ebx,0
    int 0x80
    RET
Example of what happens:
Code
[Dean@Fedora-13 asm]$ nasm -f elf template.asm -o temp.o
[Dean@Fedora-13 asm]$ ld -s temp.o -o test
[Dean@Fedora-13 asm]$ ./test
1234echo Buffer overflow?
1234
[Dean@Fedora-13 asm]$ echo Buffer overflow?
Buffer overflow?
[Dean@Fedora-13 asm]$
I know my buffer is only 4 bytes. But is reading in 24, so is it forcing the terminal to read in the rest of the bytes? Anyone care to clear this up?
(Aug 15, 2010 07:12 PM)GhostSniper Wrote:  
Code
section .data
    msg: db 'Test',0
section .text
    global _start

_start:
    mov ecx,msg
    mov edx,4
    call _read
    mov ecx,msg
    call _print
    call _exit
;##
;##=-Functions-=##
_read:
    mov eax,3
    mov ebx,0
    mov edx,4
    int 0x80
    RET
_print:
    mov eax,4
    mov ebx,1
    int 0x80
    RET
_exit:
    mov eax,1
    mov ebx,0
    int 0x80
    RET
Example of what happens:
Code
[Dean@Fedora-13 asm]$ nasm -f elf template.asm -o temp.o
[Dean@Fedora-13 asm]$ ld -s temp.o -o test
[Dean@Fedora-13 asm]$ ./test
1234echo Buffer overflow?
1234
[Dean@Fedora-13 asm]$ echo Buffer overflow?
Buffer overflow?
[Dean@Fedora-13 asm]$
I know my buffer is only 4 bytes. But is reading in 24, so is it forcing the terminal to read in the rest of the bytes? Anyone care to clear this up?

The program only reads 4 bytes into the buffer and then dumps the remainder when the program exits..Where are the extra bytes before the program exits? The bytes are maintained by the operating system or kernel and so are not considered a BOF.


Possibly Related Threads...
Thread / Author Replies Views Last Post
by Chad ThunderCockNov 18, 2015 06:48 AM 6 432 Nov 18, 2015 06:48 AM
Last Post: stugz
by SajuukMar 12, 2015 11:19 PM 3 271 Mar 12, 2015 11:19 PM
Last Post: Sajuuk
by ((void (*)())NULL)()Apr 12, 2011 01:10 PM 18 446 Apr 12, 2011 01:10 PM
Last Post: Zer0Fact0r