4837 Total CVEs
26 Years
GitHub
README.md
Rendering markdown...
POC / Makefile
CC = gcc
CFLAGS_SHARED = -shared -fPIC
CFLAGS_STATIC = -static

.PHONY: all clean setup

all: myso.so main evil_library/myso.so

# Build the legitimate shared object
myso.so: myso.c
	$(CC) $(CFLAGS_SHARED) -o $@ $<

# Build the vulnerable binary (statically linked)
main: main.c
	$(CC) $(CFLAGS_STATIC) -o $@ $< -ldl

# Build the malicious shared object (named myso.so to shadow the real one)
evil_library/myso.so: evil_library/evilso.c
	$(CC) $(CFLAGS_SHARED) -o $@ $<

# Set ownership and setuid bit (requires root)
setup: main
	sudo chown root:root main
	sudo chmod u+s main

clean:
	rm -f main myso.so myso.o evil_library/myso.so