TexSAW CTF 2026 The Imitation Game
There’s a spy amongst us! We found one of their messages, but can’t seem to crack it. For some reason, they wrote the message down twice.
The challenge provides two large blocks of ciphertext, both starting with what appears to be an encrypted flag.
Solution
1. Identifying the Cipher
We are given two different ciphertexts that supposedly represent the same message. This immediately suggests a polyalphabetic substitution cipher, most likely Vigenere, where different parts of the key are being applied to the same plaintext.
2. Deducing the Key Prefix
We know that the flags in this CTF follow the format
texsaw{...}. By comparing the ciphertext prefixes with the
known plaintext texsaw, we can calculate the key characters
used at the start of each block (Key = Ciphertext − Plaintext).
Block 1 Prefix (twhsnz):
t-t= A (0)w-e= S (18)h-x= K (10)s-s= A (0)n-a= N (13)z-w= D (3)- Key Prefix:
ASKAND
Block 2 Prefix (brassg):
b-t= I (8)r-e= N (13)a-x= D (3)s-s= A (0)s-a= S (18)g-w= K (10)- Key Prefix:
INDASK
3. Recovering the Full Key
The fragments ASKAND and INDASK strongly
suggest a famous quote from the Bible (Matthew 7:7):
“Ask, and it shall be given you; seek, and ye shall find: ask, and…”
By removing spaces and punctuation, we derive the full 41-character
repeating key:
ASKANDITSHALLBEGIVENYOUSEEKANDYESHALLFIND
4. Decrypting the Message
Using the recovered key, we can decrypt the rest of the message. The first message block uses an offset of 0, while the second block starts at a different position in the key loop.
Decryption reveals a message from a spy:
“they know im here, and its only a matter of time before they find out who i am. tell the general what the flag is as soon as possible…”
The signature at the bottom, - john cairncross, refers
to the real-life British intelligence officer who was a double agent for
the Soviet Union during World War II.
5. Extracting the Flag
1 | def vigenere_decrypt(ct, key, offset=0): |