Consequences of this buffer overflow?

后端 未结 11 2074
悲&欢浪女
悲&欢浪女 2021-01-01 15:44

So here I believe I have a small buffer overflow problem I found when reviewing someone else\'s code. It immediately struck me as incorrect, and potentially dangerous, but a

11条回答
  •  南笙
    南笙 (楼主)
    2021-01-01 16:07

    The problem is that you are writing somewhere in the memory, but not on the stack. Therefore, it's hard to actually see what's wrong. If you want to see the damages, try allocating the string on the stack

    char buffer[strlen("This string is 27 char long" + 1)];
    

    and the write past it. Other variables will be written, you can also add some code to be executed if you really know how the binary works.

    To exploit a buffer overflow like that, you need to write the data you want, then find a way to "jump" to this data to be executed.

提交回复
热议问题