Information#
Version#
By | Version | Comment |
---|---|---|
noraj | 1.0 | Creation |
CTF#
- Name : Harekaze CTF 2018
- Website : harekaze.com
- Type : Online
- Format : Jeopardy
- CTF Time : link
30 - easy problem - WarmUp#
Do you know ROT13? Can you decode this text?
UnerxnmrPGS{Uryyb, jbeyq!}
Here is my Ruby script for Caesar cipher, here we already know it is ROT13
The flag is harekazectf{hello, world!}
.
40 - recursive zip - WarmUp#
Do you know unzip?
I made a dirty script in ruby to recursively unzip the archive:
As the script preserves the file tree, make a recursive ls
to find the last directory : ls -R
.
Then display the flag.txt
: HarekazeCTF{(\lambda f. (\lambda x. f (x x)) (\lambda x . f (x x))) zip}
.
100 - Sokosoko Secure Uploader - Web#
I encrypted my file by using this service. Attachment is the encrypted file, but I accidentally deleted the UUID of the file. All I remember is the UUID starts with 9e5a :(
The website looks like this:
Let's read the source code.
In decrypt.php
, we can see the SQL query is injactable:
So our entry point is the UUID provided by the user. But the UUID must match two conditions:
Firstly, UUID needs to be a string, easy for us. Secondly, UUID needs that is_uuid()
returns true
.
I took a look in functions.php
to find is_uuid()
:
So the UUID must be 36 char long and needs to have the -
char at some specific places.
Here, the exploitation will be more challenging as our payload will need to look something like xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
.
Then I used sqlitebrowser to create a test SQLite database and try some payloads.
We need to respect the xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
format and to make a valid SQL payload for this query SELECT key FROM decryption_key WHERE id = '$uuid'
.
I found that operators like OR
can be stuck to a quote like this 'OR
and that C-style inline comments can't split a keyword so SEL/* bla */ECT
is not valid but SELECT/* bla */key FROM
is.
So I managed to generate the final payload 'OR id/*-*//*-*//*-*//*-*/LIKE '9e5%
. Submitting this as the UUID and the encrypted image gave me back the decrypted image containing the flag HarekazeCTF{k41k4n_j1kk4n_j1n615uk4n}
.