DownUnderCTF 2021
Note : A JOURNEY TO GAIN KNOWLEDGE
#Substitution Cipher I
def encrypt(msg, f):
return ''.join(chr(f.substitute(c)) for c in msg)
P.<x> = PolynomialRing(ZZ)
f = 13*x^2 + 3*x + 7
FLAG = open('./flag.txt', 'rb').read().strip()
enc = encrypt(FLAG, f)
print(enc)
#๎ฎฃ๐ฟซ๎
๐๏ฆญ๐ฐฝ๐ต๐ฟ็๐ข๐๐ดไถน๐ฝ่ต๐ญฑ๐ข๐ต่ต๐ด๐ญฑ๐็๐ฒณ๐ญฑ็ช่ต๐ฑซณComment:
Through by mapping f(plaintext) -> cipher
We just convert cipher to int and solve the quadratic equation to get flag
# DUCTF{sh0uld'v3_us3d_r0t_13}
# Substitution Cipher II
Comment:
P.random_element(6) creates polynomial of degree 6, sometimes it misses 1 variable
f.substitute() substitutes value x then modulo for n because of GF(n)
The idea as Substitution Cipher I but we don't have f in this challenge
Suppose: f(x) = a*x^6 + b*x^5 + c*x^4 + d*x^3 + e*x^2 + f*x + g
Idea: We can get whole data from exploiting P.random_element(6) function. Evidently, first base starts at 1, others in [0,x) with x < 50 . If we analysic data and calculate the probability, we'll get :
Value a > 40 : 30%
The average value of other bases : 15-29
From that data, we can bruteforce all the bases:
After bruteforcing we get a = 41 :)))). Analysicing base d will faster . Full_solve
#DUCTF{go0d_0l'_l4gr4ng3}
#Break Me!
Comment:
This is block cipher ECB, each block holds 16 characters
flag + input + key =>if we don't input, we'll get flag+key
base64 of flag is constant => len(flag) = 32, len(key) = 16
flag is in block1 and block2, we input from block 3
(flag + input + key) then padding by '0'

Idea:
We input 1 character which is bruceforced + '0'*16, block4 will be '0' + key misses the last character , block5 will be the last character of key + '0'*15
Compare block 3 and block 5, if they are equal, we can get the last key's character, do that continually until the key's complete. Having key and cipher => get flag

# treasure
Comment
When we input shares[0], the server responses 'secret', contemporary it calls to exit() function , 'secret 'is constant
We can bypass the first Function run_combiner(shares) by inputing random intergers
So we've to pow(the input, 3) equal to (r1*r2)^3 * (*secret^2) * FAKE_COORDS
# DUCTF{m4yb3_th3_r34L_tr34sur3_w4s_th3_fr13nDs_w3_m4d3_al0ng_Th3_W4y.......}
Thank for reading ! Have a nice day <3
Last updated
Was this helpful?