-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·34 lines (23 loc) · 1.09 KB
/
build.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
#!/bin/sh
function build() {
BASE=`basename $1 .c`
# fully vulnerable: executable stack, no canary no relocations, no PIE, no aslr
gcc -w -o "level1/$BASE/vuln" $1 -fno-stack-protector -Wl,-z,norelro -no-pie -z execstack
# non-executable stack
gcc -w -o "level2/$BASE/vuln" $1 -fno-stack-protector -Wl,-z,norelro -no-pie
# non-executable stack, address space layout randomisation (ASLR)
gcc -w -o "level3/$BASE/vuln" $1 -fno-stack-protector -Wl,-z,norelro -no-pie
# non-executable stack, ASLR, PIE
gcc -w -o "level4/$BASE/vuln" $1 -fno-stack-protector -Wl,-z,norelro
# non-executable stack, ASLR, PIE, relocations
gcc -w -o "level5/$BASE/vuln" $1 -fno-stack-protector
# all protection, including canary: I can't hack this (yet)
gcc -w -o "allsec/$BASE/vuln" $1
}
build src/easy.c
build src/normal.c
# extra allsec binaries to show its possible (no need to disable warnings!)
gcc -o "allsec/leak/leak" src/leak.c
gcc -o "allsec/basic/basic" src/basic.c
gcc -o "allsec/server/vulnserv" src/server.c
gcc -o "allsec/fork/vulnfork" src/forker.c