This challenge was solved by and the write up was written by two of my teammates, gym and balidani.
In this challange we were provided with a risc-v (http://riscv.org/) ELF executable. Unfortunately most of our common tools did not support the archticeture, but some googling quickly revealed that the riscv gnu xcompiler toolchain contains objdump for the riscv.
With objdump we could analyse the different regions of the ELF file and dump the asm code from the .text section. Although, the riscv developers provide a qemu fork https://github.com/riscv/riscv-qemu for riscv and a precompiled linux image, we could not run the provided binary in the vm so we stuck with the static analysis of the dumped code.
After, looking through the asm it became obvious that the binary reads a serial fom the input and if the serial is correct prints the flag.
First it verifies that the serial is in the form of
Than it checks if the serial only contains the ‘-‘ sign, uppercase characters and numbers. This is done by checking if the byte value is between 45 and 90 and than shifting a magic constant with the byte value and checking if the lst bit is zero.
After this, all of the 4 byte segments of the serial are loaded as 32bit integers and check is made if they satisfy a series of equations. Such equation in the asm:
These equations are the following:
If all these constraints are satisfied theses words are xored with some additional constants and concatenated into a string and the result is printed as the flag.
We used pythons z3 to find the serial the fullfills all these conditions such serial is
The xor constants can be read from the ASM code:
Note: the lui instruction loads immediate value into a register and performs a 12 bit left shift on it.
After rearranging the bytes we managed to get the correct flag:
This challenge was solved by and the write up was written by one of my teammates, NGG.
If we submitted x such that 0<x<p then the server replied with x^flag % p.
So if we could compute discrete logarithms over GF_p, then we would have been done.
However the best algorithms to compute discrete logarithm in a group requires more than O(sqrt(q)) time where q is the largest prime factor of the order of the base number, which would be too slow if we used a primitive root modulo p, because
2 is a primitive root modulo p, so x = 2^q has order 2*3^336 which is long enough for the flag (which is 50 characters) and only has small prime factors, so we sent that number to the server.
This challenge was solved by and the write up was written by two of my teammates, vasporig and aljasPOD.
If we send in a document, the macro inside it gets executed.
Our way of coummunicating with the outside world was to execute a ping to a subdomain of ours: .dns.aljaspod.com, for which we've captured all the requests with wireshark.
Most time was spent by locating the file containing the flag (C:\secret.txt), after looking for any file containing ““flag”” I’ve tried listing the root of C:.
Since the file could contain characters not allowed by the dns, and could be of any length, (after some tries) I’ve converted the flag into hex, and cut it into 16 character parts, sending the following “request” (ping) sequence:
This challenge was solved by and the write up was written by one of my teammates, vek.
First, we got the correct password by changing the GOT of strlen into puts using a format string vuln, so that puts(password) got called. We did that with the following input:
With the password (“hitconctf2015givemeshell”), we could trigger a function whose first parameter we controlled ( do_job(username) ), so all we had to do was to change do_job’s address to system and username to the desired command, e.g