Skip to content

Commit d2773d9

Browse files
authored
Update REAMME.md
1 parent 4a1b165 commit d2773d9

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

README.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,32 @@ a simple return-to-libc attack example
33

44
tips:
55
(1) 32 bit Linux Platform
6+
67
(2) you need to be root,and run "sysctl -w kernel.randomize_va_space=0" to shut the random space down
8+
79
(3) export MYSH=/bin/sh to tell the getenv the vaiable value(it's a way to pass paramters)
10+
811
(4) chmod 4777 retlib (you need to be root)
12+
913
(5) run getenv.c first to get the "/bin/bash" address,and use the value to alter exploit.c and run it.run the retlib at last.you'll see the "$" indicator for root.
1014

11-
tips(chinese version):
15+
 (6)please compile all the files with gcc -fno-stack-protector flag.
16+
1217

18+
chinese version:
1319
运行条件:
1420
(1) 32位Linux平台
21+
1522
(2)切换root用户 运行 sysctl -w kernel.randomize_va_space=0 (禁用随机栈空间)
23+
1624
(3)在当前bash中export 一个环境变量 例如 export MYSH=/bin/sh (这个环境变量在程序中是向system提供参数用的)
25+
1726
(3) 使用 gcc -z execstack -fno-stack-protector retlib.c -o retlib 编译retlib.c (root用户)
27+
1828
(4) chmod 4777 retlib (root 用户)
29+
1930
(5)先运行getenv程序,得到/bin/sh字符串地址,修改exploit程序,(下面代码中数值已经填充好),编译、运行exploit 程序,然后运行retlib , 可以看到bash提示符,并且当前用户为root
2031

32+
(6) 编译所有文件时需要添加 -fno-stack-protector 标志
33+
2134
Thanks to http://www.cis.syr.edu/~wedu/seed/labs.html SEED project!!!

0 commit comments

Comments
 (0)