diff --git a/Overflows/ROP/Code/Makefile b/Overflows/ROP/Code/Makefile new file mode 100644 index 0000000..9fc4c91 --- /dev/null +++ b/Overflows/ROP/Code/Makefile @@ -0,0 +1,13 @@ +CC = gcc +FLAGS = -fno-stack-protector -no-pie -g +32FLAG = -m32 + +classicRop: classicROP.c + + $(CC) $(FLAGS) classicROP.c -o classicRop + +classicRop32: classicROP.c + + $(CC) $(FLAGS) $(32FLAT) classicROP.c -o classicRop32 + +all: classicRop diff --git a/Overflows/ROP/Code/classicROP.c b/Overflows/ROP/Code/classicROP.c new file mode 100644 index 0000000..2bdcd48 --- /dev/null +++ b/Overflows/ROP/Code/classicROP.c @@ -0,0 +1,26 @@ +#include +#include +#include + +int BUFFER=240; + +void helper(){ + //Screw you compiler optimisation and LibC changes... + __asm__("pop %rdi; ret"); +} + +int copy(){ + char buf[BUFFER]; + int r = read(0, buf, 400); //Copy data in the Buffer + printf("%d Bytes Read\n", r); +} + +int main(int argc, char* argv[]){ + /* Main Function*/ + printf("Smash The Stack\n"); + //Get the data + int out = copy(); + printf("Lose :(\n"); + return 0; +} + diff --git a/Overflows/ROP/Dockerfile b/Overflows/ROP/Dockerfile new file mode 100644 index 0000000..219d8f8 --- /dev/null +++ b/Overflows/ROP/Dockerfile @@ -0,0 +1,31 @@ +FROM debian:buster as vulnbuilder + +RUN apt update && apt install --no-install-recommends -y build-essential + +WORKDIR /tmp/ +ADD Code/ /tmp/ +RUN make + + + +FROM debian:buster + +#Install SSH Server +RUN apt-get update \ + && apt-get install --no-install-recommends -y \ + openssh-server \ + && rm -rf /var/lib/apt/lists/* + +#Configure SSH (Cant run as Daemon if this doenst exit) +RUN mkdir /var/run/sshd + +RUN useradd -ms /bin/bash editor && echo editor:editor | chpasswd + + +COPY --from=vulnbuilder /tmp/classicRop /home/editor/ropme +RUN chmod a+s /home/editor/ropme + + +# PORTS AND BASIC COMMAND +EXPOSE 22 +CMD ["/usr/sbin/sshd", "-D"] diff --git a/Overflows/ROP/docker-compose.yaml b/Overflows/ROP/docker-compose.yaml new file mode 100644 index 0000000..c99faca --- /dev/null +++ b/Overflows/ROP/docker-compose.yaml @@ -0,0 +1,9 @@ +version: "3.0" + + +services: + ssh: + build: + context: . + ports: + - "22:22"