zh3r0 2020 Crypto - Uncipher Me

 

Uncipher Me

Description

Challenge Files

Lets begin with the keys.

cat key.txt
TjogR0kzRE9OWldHUVpER01SVkdFWURLT0JWSEUyRE1NSllHNFpEQU5CVEdBNFRJTUJSR0VZVEdNQlpHTTRUU01CWUdJMlRNTUJRR1U0RElOSlhHUTJUS05CUUdBM1RLTlpTRzQzRE1PQlRIRTJESU9KWUc0M0RRTVpXSEU0VE1NWlpHUVlUU01CVEhFWkRBTkpYSEU0RE1NSldHTVlURU5KU0c0NFRDTVpVSEU0RElOSlFHUVlUTU5SV0dNNFRBTVJYR000VFFOUlVHSVlUQ01SWkdJMkRJTkJYR0EzVFNNUlZHSTREQ05aWUc0NERBTlpVR1lZRE1NQlRHUTNEQU9CWEc0WkRHTkpWSEVZRFNOQlJIQTJUS01KV0dZNFRPT0pVR1EzVEtPQlRHNDRUT09CVkdJNERPTUpRR1VaVE1OQlVHRTRET05SWkdBWVRTT0JURzQ0REFNWlRHRVpUQ09KVUdRM0RJTlpTR1FaRE9OUlRHWTNES09KVEdFWkRHT0JWR0UzVEVPSlNIQTRUTU5SVkdNWURTTVJXR0EyRE9OSlVHNDRUT01CWEdFWURHTVJYR1VaVE1PSlZHNFlEUU5KVkhBNERNTlJSR01aVFFOUldHSTNET05aU0dBM0RDT0pSR00zREFOUlRHWTJUU01KVUhBNERPTlpSR0kzREtOWlJHWTJEQ09KWUdFM0RTTlpRR0lZRFFOWlJHUVpETU1CVEhBWkRBTkJYSEU0VENNSlpHQTNUQU1SVEhFWlRBTUJWR0FaRENOWlVHWTJUSU1aU0c0WVRRTVpXR0U0RFFPSlhHQVpUU09CU0dZNFRBT0JUR00yVEdOQlpHSTJERU1CUkc0NFRHTVpSSEUzREtOWlZHUTRETU5KWkdJMkRRTkJYSEEzRENOQlpHQTRERU1aVEdZWVRFTkJZR0U0VEVNUlFHTTRET01CVkdZWVRLTUpSR01aVEVPQlJHSTJUUU9CWEdVMlRLTkJZR0lZRE1OQlNHQVlER01KWE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dVLkIX5{tGdMXnHZ(LhH#IOdI503XFf=hUG5

Alright!, Seems like RSA inside the key huh
N and e seem to be base32, since they are all CAPS ct appears to be base85, since all these weird characters

N = key1[1]
e = key1[3]
c = key1[5]

N = int(base64.b32decode(N))
e = int(base64.b32decode(e))
c = int(base64.b85decode(c))
p,q = sympy.ntheory.primefactors(N)
d = pow(e, -1, (p-1)*(q-1))
m = pow(c,d,N)

m = bytes.fromhex(hex(m)[2:])
print(m.decode())

This brings us

key: kD87Ef4y043nhee-W_Hytc0d3Bkiw4Gw21m-7AHpZkc=
This is one of the keys for the encryption.Totally 3 keys to decrypt the encrypted text

Okay, time for round 2

cat key_2.txt
Are your rots strong.

<6Ji :"+:;v5@)_96AGaH?u+~&D%(&\GeIJv(JB$2?0Afdrtl
w6C6VD 2?@E96C <6J 7@C E96 6?4CJAE:@?]
:7 J@F 2C6 2 8@@5 4CJAE@8C2A96C J@F 42? :56?E:7J E96 4@>>@? DJ>>6EC:4 6?4CJAE:@?]

Seems like a much anticipated rot47, dcode.fr to our rescue

key: iQZijGdoX0hepv2wnFZOUsTWU-v6xyGWyqSan_p75CE=
Here's another key for the encryption.
if you are a good cryptographer you can identify the common symmetric encryption.

ROUND 3, FIGHT

cat key_3.txt

jlc: OsPCTS98D3eci4cXumo345lOQiRUS4E17UJQXAOG1uM=
Soi cora ovm zuh pct jee un kitfxwxv hgl gzdglv,
zt xvy tctshe'h hkiehhmc kvdu wvs soi jhzyxzbf weih nm xys bptysqaioh,
hm xys clgimoamfbr dmkv soi bsxz hfsru'x ncqr xysm avp fdhviomnmeu soi bsxz

First guess, Vignere cipher, lets head to dcode.fr again,

key: XeQVPB98P3fve4lJvfk345uARbNDE4F17NFZJBHC1dY=
The last key and you can go decrypte the cipher,
if you couldn't identify then see the starting part of the ciphertext,
if the decryptions with the keys doesn't work then try rearranging the keys.

Now this is the part, where things got ugly, apparently the common symmetric encryption used is not AES. Its rather fernet cipher, which could be identified from the head of ciphertext gAAAAA. Moreover, Only the KEY2 was required, rest is just to make you do work :sad:

Anyways, we got our flag after so much churning

from cryptography.fernet import Fernet
KEY2 = "iQZijGdoX0hepv2wnFZOUsTWU-v6xyGWyqSan_p75CE="
f = Fernet(KEY2)
print(f.decrypt(ct))

zh3r0{Symm3tric_3ncrypti0n_i5_5tr0ng}

jekyll.environment != "beta" -%}