clifford

PLAID CTF RE Challenge: 100 pts

Challenge Description:

"It's a keygen problem."

The challenge binary asked the user for a number and a sequence of numbers. The single number created a matrix the size of 2*n-1 and the sequence of numbers filled this matrix in a unique order. If the sum of the column equaled the sum of each row, column, and diagonal, you knew your input was correct. The program hashed your input with a static array of values and printed this as the flag.

Material:

- key validating binary

Solution:

I spent more time then necessary reversing the input hashing algorithm and the operations that were done on the input matrix generated. Especially because it turns out the solution to this challenege was pretty simple, a.k.a. C brute force works well. :]
(C program for solution linked at the bottom.)

1) Reverse out the algorithm used to hash the *correct* matrix solution with the flag array
2) Realize the hash function only iterated through the first 4 bytes of the flattened matrix
3) Rewrite the algorithm in C
4) Brute force the 4 byte input with the hash function and static array
5) flag :]

Steps to flag:

Flag:

 sophias-MacBook-Air:clifford sophia$ gcc plaid2015_clifford_solver.c                     
 sophias-MacBook-Air:clifford sophia$ ./a.out      

FLAG: u8*HNemGS,E;LoEAy|N���G�I�B�PGVQ��    g< YP�e�
: 28,78,151,105
....
FLAG: too_bad_this_took_20_years_to_find!!
: 197,234,234,21

Code:

SOLVER