A high quality competition, at least for crypto challenges. NeSE got the first place and here are some of the crypto writeups by tl2cents.
Yet another RSA with hint, 32 solves, 192 pts
I got the first blood in 30 minutes. It’s about the interesting properties about digit sum. Taking p-digit sum into consideration, for any x in form of p-digit: , we take x modulo p-1: . Hence, the hint numbers leak p%n where n= 1,2,…,199. Using the CRT method, we obtain about 286 bits information about p and that’s enough to apply the coppersmith method: construct and find f’s small root.
exp
1 | # sage 9.2 |
VSS, 9 Solves, 369 pts
This challenge can be decomposed into two subproblems. Denote the data we receive from the server as , a quick observation is that since is chosen randomly, we can compute the discrete logarithm in its subgroup with small order. That is to say, leaks where n is a small divisor of . With this leakage, we now can transform the challenge to a hidden number problem (HNP) with two unknown values and this is the second subproblem we need to handle.
Subgroup discrete logarithm.
In this section, we focus on recovering as much information about as possible from the data , where . Since is not a strong prime, with high probability there are small factors of . We can brute force all the small factors less than or use the factdb (pip install factordb-pycli
) interface to obtain more small factors. Denote the lcm of all the factors as . After this, we aim to find its max subgroup order which means some of the factors are useless for discrete logarithm (for example: , where is the generator for , then is useless). Then use the Pohlig—Hellman algorithm to solve the subgroup discrete logarithm.
1 | # sage 9.2 |
Hidden number problem with two unknown values
Now, we get an oralce as follows:
Denote , the upper bound of is : , therefore we can construct a lattice to solve this problem with enough samples and large . The basic lattice I use is as follows:
With enough data samples, we can obtain the secret by LLL reduction on the above lattice. In my local test, let the lower bound of leak bits be , we need at least data sets. So far, we have solved this challenge. But for the remote solver, we may need extra optimization. One way is to increase the bound of small factors in the subgroup problem (such as ). Here I’ll introduce two ways to optimize the above lattice.
Observe that the varies a lot, the max n can be 70-bit long. Therefore, the above lattice doesn’t make the most of leaked information. Denote and replace B in M with , I’ll explain two methods to make the above lattice more effective.
Using the CVP method: let be the target vector, we can run Baiba algorithm to solve the CVP. Hopefully, we can can get .
Using the adjustment multiplier: multiply every column of M by . After this operation, we enlarge the row vectors’ length and doesn’t change the short vector . Therefore, we can find the short vector with higher probability by the LLL theorem. (My teammate Lord Riot implemented this method)
1 | # sage 9.2 |
Old but gold, 4 solves, 438 pts
Another teammate of mine solved this challenge, but it requires hard work on reversing the binary file compiled by go. I didn’t do much work on this. The solution is oracle attack about CFB mode. The server will provide the information about whether the token is valid json bytes by its structure like “{…}” or “ space,\t,\n,\r”. The padding is unsecure, too. The server takes only the last byte of decrypted token as padding length and then unpads the decrypted token. Using the above oracle, we can control the blocks’ plaintext and thus we can forge the following token:
1 | target = b'{"Type":"admin","ID":"aaaaaaaa-bbbb-cccc-dddd-ffffffffffff","Mail":"admin"}' |
All done. Exp is not written by me, so I don’t upload it.