Cryptoverse CTF 2022
This CTF had challenges from easy to hard, most of the challenges were around Crypto and Reversing. A few Challenges were under Misc, and some of them had new challenges like Math problem-solving. Here is the write-up for the challenge that I solved during the CTF.
Challenges
This challenge is to know what is flag format and the answer was given to understand the format.
Its Morse code, which could be decoded using any online tool like CyberChef
This was also a baby crypto challenge with base64 and rot/caesar cipher challenge. As the hint suggests using CyberChef to solve the challenge.
Here we have cipher text with a key, which is highlighted, one common encryption technique with a key is vigenere cipher.
As the challenge name denotes its substitution cipher, brute-forcing the characters will give you the flag.
This is the reversing challenge but under the difficulty of the baby which means it should be super simple. That's how its strings will give two flags one is a flag and another is the correct one.
strings baby_reverse | grep cvctf
cvctf{7h15_15_4_f4k3_fl4g}
cvctf{r3v3r53_15_4w350m3}
The most common challenge found is the discord challenge where you can find the flag by joining the server and the flag will be there in either of the channel descriptions.
This is a Good RSA challenge to practice, you have N, E, and Cipher text. Tools like RsaCtfTools and RSHack can be used to break this encryption since N is a smaller value and could be found using Factordb.
This iKUN 1 was something Code Repository and we all know GitHub is common hosting with the free tier, and we have a username which leads to the correct repository => https://github.com/CryptoverseCTF/cxk-ball
Going through the commit history you can find the flag.
Basic Transforms was a fun challenge based on the node with vigenere cipher. Reversing the code logic will basically give the flag.
var readline = require('readline');
var Crypto = require('vigenere');
var rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
terminal: false
});
rl.on('line', function(line) {
if (line.length == 20 && line.startsWith("cvctf{") && line.endsWith("}")) {
var cat = Crypto.encode(line.substring(6, 20 - 1), "nodejsisfun").split('').map(function(c) {
return String.fromCharCode(c.charCodeAt(0) + 1);
}).join('');
if (Buffer.from(cat.split("").reverse().join("")).toString('base64') == "QUlgNGoxT2A2empxMQ==") {
console.log("Correct!");
}
}
});
// Solve
flag = new Buffer("QUlgNGoxT2A2empxMQ==", 'base64').toString('ascii');
var a = flag.split("").reverse().map(c => {
return String.fromCharCode(c.charCodeAt(0) - 1);
}).join("")
flag = "cvctf{" + Crypto.decode(a, "nodejsisfun") + "}"
const verify = function(line) {
if (line.length == 20 && line.startsWith("cvctf{") && line.endsWith("}")) {
var cat = Crypto.encode(line.substring(6, 20 - 1), "nodejsisfun").split('').map(function(c) {
return String.fromCharCode(c.charCodeAt(0) + 1);
}).join('');
if (Buffer.from(cat.split("").reverse().join("")).toString('base64') == "QUlgNGoxT2A2empxMQ==") {
console.log("Correct!");
}
}
}
verify(flag)
Hints made this challenge easy, Crypto based on social media. And it says stegnography-based tool. Twitter Secret Messages is a tool to hide text inside Twitter tweets.
Another interesting challenge with the pyc file, the challenge description had king highlighted I am not sure why. But Reversing pyc file using decompile3 will give us source code and decode the logic. It was an md5 hash verification program, the input is verified against a custom regex made from the hash.
import hashlib, re
hashes = [
'd.0.....f5...5.6.7.1.30.6c.d9..0',
'1b.8.1.c........09.30.....64aa9.',
'c.d.1.53..66.4.43bd.......59...8',
'.d.d.076........eae.3.6.85.a2...']
def main():
guesses = []
for i in range(len(hashes)):
guess = input('Guess: ')
if len(guess) <= 4 or len(guess) >= 6 or re.match('^[a-z]+$', guess):
exit('Invalid - length')
print(hashlib.md5(guess.encode()).hexdigest(),'^' + hashes[i].replace('.', '[0-9a-f]') + '$')
if not re.match('^' + hashes[i].replace('.', '[0-9a-f]') + '$', hashlib.md5(guess.encode()).hexdigest()):
exit('Invalid')
else:
guesses.append(guess)
else:
print(f"Flag: {guesses[0]}" + '{' + ''.join(guesses[1:]) + '}')
# if __name__ == '__main__':
# main()
# okay decompiling guesser.pyc
import requests
from itertools import permutations
from itertools import product
from string import ascii_lowercase
lines = [''.join(i) for i in product(ascii_lowercase, repeat = 5)]
open("wordlist","w").write("\n".join(lines))
output = open("output","w")
for i,word in enumerate(lines):
check = list(map(lambda x:re.match('^' + x.replace('.', '[0-9a-f]') + '$', hashlib.md5(word.encode()).hexdigest()) != None,hashes[1:]))
if any(check):
output.write(word+"\n")
# break
Another simple and easy crypto with multiple steps to get the clear text.
But here we get emoji, which is a new type of encryption looking through google we found the tool to decode it.
That's all for this CTF, hope you learned something new. See you in the next one, Thanks!!