-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathbootstrap.sh
executable file
·39 lines (29 loc) · 1.07 KB
/
bootstrap.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/bash
# make vulnuser
mkdir /home/vulnuser
useradd -d /home/vulnuser vulnuser
chown -R root:vulnuser /home/vulnuser
chmod 750 /home/vulnuser
# configure vulnuser and flag
cd /tmp/challenge-files
/tmp/challenge-files/generate/generate.py easy
# configure the vulnerable binary
cp /tmp/challenge-files/vuln /home/vulnuser/
chown root:vulnuser /home/vulnuser/vuln
chmod 750 /home/vulnuser/vuln
# configure the flag
echo "flag{congrats, this should be randomly generated in the future}" > /home/vulnuser/flag
chown root:vulnuser /home/vulnuser/flag
chmod 640 /home/vulnuser/flag
# place xinetd config files
cp /tmp/challenge-files/config/vuln.xinetd /etc/xinetd.d/vuln
# drop the vulnerable binary into the user's directory
cp /tmp/challenge-files/vuln /home/student
# drop the exploit skeleton into the home directory
cp /tmp/challenge-files/skeletons/pwn-easy.py /home/student/
# copy libc into the directory for beginners
cp /lib/i386-linux-gnu/libc.so.6 .
# remove the build scripts
rm -rf /tmp/challenge-files
# restart xinetd to get the service running
service xinetd restart