Buffer Overflow not working

前端 未结 4 994
囚心锁ツ
囚心锁ツ 2020-12-20 21:33

I was trying to do a buffer overflow (I\'m using Linux) on a simple program that requires a password. Here\'s the program code:

#include 
#inc         


        
相关标签:
4条回答
  • 2020-12-20 21:55

    The reason is stack smashing is actually a protection mechanism used by some compilers to detect buffer overflow attacks. You are trying to put the 29 A's into a shorter character array (16 bytes).

    0 讨论(0)
  • 2020-12-20 21:58

    In modern linux distributions buffer overflow is detected and the process is killed. In order to disable that mode simply compile your application with such flags (gcc):

    -fno-stack-protector -fno-stack-protector-all

    0 讨论(0)
  • 2020-12-20 22:03

    Most modern OS have protective mechanisms built in. Almost any good OS does not allow direct low level memory access to any program. It only allows programs to access the adress space allocated to them. Linux based OS automatically kill the processes that try to access beyond their allocated memory space.

    Other than this, OS also have protective mechanisms that prevent a program from crashing the system by allocating large amounts of memory, in an attempt to severely deplete the resources available to the OS.

    0 讨论(0)
  • 2020-12-20 22:04

    If compiling with gcc, add -fno-stack-protector flag. The message you received is meant to protect you from your bad code :)

    0 讨论(0)
提交回复
热议问题