相关疑难解决方法(0)

如何在GCC,Windows XP,x86中编写缓冲区溢出漏洞?

void function(int a, int b, int c) {
   char buffer1[5];
   char buffer2[10];
   int *ret;

   ret = buffer1 + 12;
   (*ret) += 8;//why is it 8??
}

void main() {
  int x;

  x = 0;
  function(1,2,3);
  x = 1;
  printf("%d\n",x);
}
Run Code Online (Sandbox Code Playgroud)

上面的演示来自这里:

http://insecure.org/stf/smashstack.html

但它在这里不起作用:

D:\test>gcc -Wall -Wextra hw.cpp && a.exe
hw.cpp: In function `void function(int, int, int)':
hw.cpp:6: warning: unused variable 'buffer2'
hw.cpp: At global scope:
hw.cpp:4: warning: unused parameter 'a'
hw.cpp:4: warning: unused parameter 'b'
hw.cpp:4: warning: unused parameter 'c' …
Run Code Online (Sandbox Code Playgroud)

c stack gcc exploit buffer-overflow

8
推荐指数
1
解决办法
7710
查看次数

标签 统计

buffer-overflow ×1

c ×1

exploit ×1

gcc ×1

stack ×1