Cryptography | aupCTF 2023

Hamza Haroon
5 min readJun 25, 2023

--

Challenge Name: Rotation

We’ve employed a unique technique to encode the message, one that goes beyond the traditional limits of the Caesar cipher. Keep your wits about you and explore every possible avenue — the answer may be closer than you think

0*%pgs8.K*H5K*#3H"N:

Use the following combination to get to the first step then:

Flag: aupCTF{y0u-f0und-m3}

Challenge Name: Ancient Cipher

Meet Bob, the world’s worst cryptographer. His encryption skills are so bad that his messages are basically gibberish. One time, he tried to send a secret message to his friend Alice, but it was so poorly encrypted that his dog was able to decode it. Needless to say, Bob’s not winning any cryptography awards anytime soon.

rlgTKW{S0s'j_Sru_Tipgk0xirgyp_5b1ccj}

Use cyberchef with following to get the flag:

Flag: aupCTF{B0b’s_Bad_Crypt0graphy_5k1lls}

Challenge Name: Enigma

I found an old enigma machine and was messing around with it. can you decipher it

MACHINE TYPE: kriegsmarine 3 rotors
REFLECTOR:
B
ROTORS:
I, II, III
INITIAL POSITIONS OF THE ROTORS:
X, Y, Z
POSITION OF THE ALPHABET WHEEL:
A, B, C
PLUGBOARD:
AT BS DE FM IR KN LZ OW PV XY
CIPHER:
LXFUZLVHEJLEWZRIXIS

remember to put the flag in format: aupCTF{answer} answer in UPPERCASE

flag: aupCTF{ENIGMAISFASCINATING}

Challenge Name: Disorder

utsa}Ts0aXa{1_eC1ngXph__XF_tmX

By using Transpositional Cipher we get the flag:

flag: aupCTF{th1s_1s_n0t_a_game}

Challenge Name: Swiss Army Knife

I converted the given to binary by replacing X with 0 and Y with 1

01001100 01010011 00110000 01110100 01001001 01000011 00110100 01110100 01001100 01101001 01000001 01110100 01001100 01101001 00110100 01110100 01001001 01000011 00110000 01110100 01001100 01101001 01000001 01110101 01001100 01101001 00110100 01100111 01001100 01101001 00110100 01110101 01001100 01010011 01000001 01110101 01001100 01101001 00110100 01100111 01001100 01010011 00110100 01100111 01001100 01101001 00110000 01110101 01001100 01101001 01000001 01110101 01001100 01101001 00110000 01110101 01001001 01000011 00110100 01110101 01001100 01101001 00110100 01110101 01001001 01000011 00110100 01110100 01001100 01010011 01000001 01110100 01001100 01010011 01000001 01110101 01001100 01101001 00110100 01110100 01001100 01010011 01000001 01110101 01001100 01010011 00110100 01100111 01001100 01101001 00110000 01110101 01001001 01000011 00110000 01110101 01001001 01000011 00110100 01110101 01001100 01101001 00110000 01100111 01001100 01101001 00110000 01110101 01001001 01000011 00110000 01110100 01001100 01101001 01000001 01110101 01001100 01101001 00110100 01100111 01001100 01010011 00110000 01100111 01001100 01101001 00110000 01110100 01001100 01010011 01000001 01110100 01001001 01000011 00110100 01110101 01001100 01010011 00110100 01100111 01001100 01101001 00110100 01110100 01001001 01000011 00110000 01110100 01001100 01101001 00110100 01100111 01001100 01101001 00110000 01110100 01001001 01000011 00110000 01110100 01001100 01010011 01000001 01110101 01001100 01101001 00110100 01110101 01001100 01101001 01000001 01110101 01001100 01010011 00110100 01100111 01001100 01010011 00110000 01110101 01001100 01010011 01000001 01110100 01001100 01010011 00110000 01100111 01001100 01101001 00110100 01110101 01001100 01101001 00110000 01100111 01001100 01010011 00110100 01110100 01001100 01010011 01000001 01110101 01001100 01010011 00110000 01100111 01001100 01010011 00110000 01110100 01001001 01000011 00110000 01110101 01001100 01101001 00110100 01110101 01001001 01000011 00110100 01110100 01001100 01101001 01000001 01110101 01001100 01101001 00110100 01110100 01001001 01000011 00110100 01110101 01001100 01010011 00110100 01100111 01001100 01101001 00110100 01110101 01001100 01010011 01000001 01110100 01001100 01101001 00110100 01110100 01001001 01000011 00110000 01110101 01001100 01101001 01000001 01110100 01001100 01101001 00110000 01100111 01001100 01010011 00110000 01100111 01001100 01101001 00110100 01110101 01001100 01010011 00110000 01100111 01001100 01010011 00110100 01110101 01001100 01010011 01000001 01110101 01001100 01010011 00110000 01110101 01001001 01000011 00110100 01110101 01001100 01010011 01000001 01110100 01001100 01101001 00110100 01110101 01001100 01010011 01000001 01110100 01001100 01101001 00110100 01110101 01001100 01010011 01000001 01110100 01001100 01101001 00110100 01110101 01001100 01010011 01000001 01110100 01001100 01101001 00110100 01110101 01001100 01010011 01000001 01110100 01001100 01101001 00110100 01110101 01001100 01010011 01000001 01110100 01001100 01101001 00110100 01110101 01001100 01010001 00111101 00111101

Now binary to text

Now Base64

Now Morse to text

Now to Base32

Finally we get the flag

flag: aupCTF{mu1tip13–3nc0d1ng5-u53d}

Challenge Name: Battista’s Bet

My friend is a big fan of the famous Italian cryptographer Giovan Battista Bellaso, he has challenged me to crack this ciphertext. I have been struggling to decode it, Can you help me out

syrTXY{T3pnr50A0ndhD3Gv0nv}

FLAG: aupCTF{B3lla50W0uldB3Pr0ud}

Challenge Name: RSA

Just remember, the key to success is staying calm, cool, and collected. Oh, and maybe a little bit of math.

I made this script to get the flag:

from Crypto.Util.number import long_to_bytes, inverse

# Given values
n = 114451512782061350994183549689132403225242966062482357218929786202609314635625168402975465116960672539381904935689924074978793017604108838426275397024126351435336388859375577638687615733448645699186377194544704879027804400841223407182597828299190404980916587708863068950664207317360099871904794302327240026597
e = 0x10001
c = 77973874950946982309998238055233832655056168217930252243355819182449120246116674359138553216317477143768434108918799869104308920311195408379262816485377057853246446992573203590942762693635615621774057306679349618708293741847308966437868706668452083656318895155238523224237514077565164105837790895618179891869

# Step 1: Factorize the modulus n into p and q
p_plus_q = 21400959789031198835597502268226110838410793429486235013163818172148759394109297013195530163943463063090162742198192075506990494863858727035693527345539878
p_minus_q = 441620610348849769847261104024471204541391170160225757260110727514761526074769013762749528928112909396341014808517549368576708910310103233373547986477636

# Calculate p and q
p = (p_plus_q + p_minus_q) // 2
q = (p_plus_q - p_minus_q) // 2

# Step 2: Calculate the private key d
phi = (p - 1) * (q - 1)
d = inverse(e, phi)

# Step 3: Decrypt the ciphertext
m = pow(c, d, n)

# Step 4: Convert the decrypted message back to bytes
flag = long_to_bytes(m)

print("Decrypted flag:", flag.decode())

flag: aupCTF{3a5y_tw0_3quat10n5_and_hax3d_3}

Crypto pwned hehe

If you like the writeup do give a follow.

--

--

Hamza Haroon
Hamza Haroon

No responses yet