Advent of malware writeup
Just wanted to post some quick notes on the challenges at https://ctf.malwarespace.org/ ; I only had time to go over the first two challenges unfortunately.
Sanity
First challenge, we have a crypto operation that takes our flag bytes and decrypts it.
Our main function:
int __fastcall main(int argc, const char **argv, const char **envp)
{
int v3; // eax
int v5; // [rsp+0h] [rbp-10h] BYREF
int i; // [rsp+4h] [rbp-Ch]
unsigned __int64 v7; // [rsp+8h] [rbp-8h]
v7 = __readfsqword(0x28u);
puts("\n[ ~~~~ Just checking if you are worthy ~~~~ ]\n");
printf("Enter seed: ");
__isoc23_scanf("%d", &v5);
srand(v5 % 8602863);
printf("flag: ");
for ( i = 0; i <= 54; ++i )
{
v3 = operation(flag[i]);
putchar(v3);
}
putchar(10);
return 0;
}Some assembly for it:
The "operation" function is a couple of shifts and a xor:
The above is equivalent to (rand() % 256) ^ a1)
We can grab the encrypted flag from the binary by going to _ZL4flag 's address. The seed generated with random() is modulated with 8602863. The flag is 55 characters. We can: Reimplement glibc's random() and just bruteforce the flag (or use the binary directly to do that).
Running the above:
Warmup
This one is a JS challenge:
Opening index.html ,we get:

So we need to input a 32 letter word to get the flag. Looking at the index.js file: The main validation function is:
We can print targetword from the dev console:
So one hash per letter. Finally, when we have allCorrect set to true, the game xors the encrypted flag with the letters from targetWord
Since we know the target hashes for each position, we can pre-calculate the hash for every letter from A to Z and match them.
The above outputs "MALWARESPACECHRISTMASSNOWFLAKESX" for the targetword. We can now either type that in the html page or just run the xor encryption in the console like so:
We then get: w3lc0m3_2_m4lw4r3_sp4c3_xmas_ctf@malwarespace.com
Last updated