Compile payload
Compiling payload on the local host which is going to be executed on a remote victim often comes errors in form of version mismatch. Below is a quick way to solve it.
Debian-based (glibc)
glibc)Find information about the target.
aas@Leakage:/tmp$ cat /etc/os-release | grep -i pretty
PRETTY_NAME="Ubuntu 18.04.3 LTS"
aas@Leakage:/tmp$ ls -al /lib/x86_64-linux-gnu/libc.so.6
lrwxrwxrwx 1 root root 12 Apr 16 2018 /lib/x86_64-linux-gnu/libc.so.6 -> libc-2.27.soCreate a
Dockerfilewith the same image or libc-version.
Ubuntu images: https://hub.docker.com/_/ubuntu/tags
## Dockerfile
FROM ubuntu:18.04 as dev
## Install build-essential and copy files to container
RUN apt update && apt install -y build-essential
WORKDIR /src
COPY . /src/
## Build the binary
FROM dev as build
RUN CGO_ENABLED=0 gcc -o cve exploit.c
## Copy binary from container to host
FROM scratch as artifact
COPY --from=build /src/cve ./cve
FROM releaseBuild the payload using
DOCKER_BUILDKIT
Alpine-based (libc.musl)
libc.musl)Useful images: https://hub.docker.com/r/frolvlad/alpine-glibc/tags
Build the payload with the same commands as in the above example.
Last updated
Was this helpful?