Skip to content

Commit c102adf

Browse files
committed
Added challenges
1 parent be06992 commit c102adf

65 files changed

Lines changed: 1492 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

tutorial_aslr/Dockerfile

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
FROM debian:latest
2+
3+
RUN apt-get update -y \
4+
&& apt-get install -y xinetd \
5+
&& apt-get clean -y
6+
7+
# Create challenge user
8+
RUN useradd -u 1000 -d /home/challenge -s /bin/bash challenge
9+
RUN mkdir /home/challenge
10+
11+
# Pipe xinetd logs to docker logs
12+
RUN ln -sf /proc/1/fd/1 /var/log/challenge.log
13+
14+
# Copy xinetd and other dependencies
15+
COPY deps/challenge.xinetd /etc/xinetd.d/challenge
16+
COPY deps/limits.conf /etc/security/limits.d/90-challenge.conf
17+
COPY deps/banner_fail /etc/banner_fail
18+
COPY deps/entrypoint.sh /entrypoint.sh
19+
20+
RUN chmod 551 entrypoint.sh
21+
22+
# Set up chroot
23+
RUN mkdir /home/challenge/usr
24+
RUN cp -R /lib* /home/challenge && \
25+
cp -R /usr/lib* /home/challenge/usr
26+
27+
RUN mkdir /home/challenge/dev && \
28+
mknod /home/challenge/dev/null c 1 3 && \
29+
mknod /home/challenge/dev/zero c 1 5 && \
30+
mknod /home/challenge/dev/random c 1 8 && \
31+
mknod /home/challenge/dev/urandom c 1 9 && \
32+
chmod 666 /home/challenge/dev/*
33+
34+
RUN mkdir /home/challenge/bin && \
35+
mkdir /home/challenge/etc && \
36+
cp /bin/* /home/challenge/bin && \
37+
cp /etc/shadow /home/challenge/etc && \
38+
cp /etc/passwd /home/challenge/etc && \
39+
rm /home/challenge/bin/rm
40+
41+
# Set up challenge and flag
42+
WORKDIR /home/challenge
43+
COPY aslr .
44+
COPY flag.txt .
45+
46+
RUN chmod 444 flag.txt
47+
RUN chmod 111 aslr
48+
49+
RUN chown -R root:root /home/challenge
50+
51+
CMD ["/entrypoint.sh"]
52+
53+
EXPOSE 9999

tutorial_aslr/README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Tutorial: ASLR
2+
3+
## Category: Binary Exploitation
4+
5+
## Description
6+
```
7+
The tutorial set of challenges are basic binary exploitation challenges designed to teach people various binary exploitation techniques. The recommended order to complete these challenges is ret2win, ROP, Shellcode, Canary, ASLR. These challenges can be completed without downloading and analyzing the binaries; however, they have been provided. If you need help with any of these challenges, feel free to reach out in the Discord.
8+
```
9+
10+
### Flag: flag{342db1252faa6a2984b4935e0b4f1455}
11+
12+
---
13+
# Docker
14+
Run the challenge with docker.
15+
```bash
16+
$ docker build -t tutorial_aslr .
17+
$ docker run -p 9999:9999 tutorial_aslr
18+
```
19+
Connect with netcat.
20+
```bash
21+
$ nc localhost 9999
22+
```

tutorial_aslr/aslr

17.3 KB
Binary file not shown.

tutorial_aslr/deps/banner_fail

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Connection FAILED: Too many concurrent connections from your IP address.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
service challenge
2+
{
3+
disable = no
4+
socket_type = stream
5+
protocol = tcp
6+
wait = no
7+
user = root
8+
type = UNLISTED
9+
port = 9999
10+
bind = 0.0.0.0
11+
12+
server = /usr/sbin/chroot
13+
server_args = --userspec=challenge:challenge /home/challenge ./aslr
14+
15+
# Logging
16+
log_type = FILE /var/log/challenge.log
17+
log_on_failure = HOST
18+
banner_fail = /etc/banner_fail
19+
}

tutorial_aslr/deps/entrypoint.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
3+
/etc/init.d/xinetd start;
4+
trap : TERM INT; sleep infinity & wait

tutorial_aslr/deps/limits.conf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# ulimit limit settings
2+
3+
* hard nproc 50

tutorial_aslr/flag.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
flag{342db1252faa6a2984b4935e0b4f1455}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#ifndef LIBVISUALIZE_H
2+
#define LIBVISUALIZE_H
3+
4+
// Color definitions
5+
#define COLOR_RED "\x1b[31m"
6+
#define COLOR_GREEN "\x1b[32m"
7+
#define COLOR_BLUE "\x1b[34m"
8+
#define COLOR_YELLOW "\x1b[33m"
9+
#define COLOR_RESET "\x1b[0m"
10+
11+
#include <stddef.h>
12+
#include <stdint.h>
13+
#include <stdio.h>
14+
15+
static uint64_t *canary = NULL;
16+
17+
void visualize_stack();
18+
19+
#endif

tutorial_aslr/makefile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
SOURCES=$(shell ls ./src/*.c)
2+
LDFLAGS:=
3+
CFLAGS:=-fno-stack-protector
4+
TARGET:=aslr
5+
CC:=gcc
6+
7+
.PHONY: all clean $(TARGET)
8+
9+
all: $(TARGET)
10+
11+
clean:
12+
rm -f $(TARGET)
13+
14+
$(TARGET): $(SOURCES)
15+
$(CC) -o $(TARGET) $(CFLAGS) -I./includes $(SOURCES) $(LDFLAGS)

0 commit comments

Comments
 (0)