1086 words
5 minutes
🔐 PicoGym - Easy1

📂 Download challenge file.

Description: The one time pad can be cryptographically secure, but not when you know the key. Can you solve this? We’ve given you the encrypted flag, key, and a table to help UFJKXQZQUNB with the key of SOLVECRYPTO. Can you use this table to solve it?.
Difficulty: Medium
Author: Alex Fulton/Danny

Summary#

This challenge introduces the concept of the Vigenère cipher, a classic polyalphabetic substitution cipher.

It can be solved either manually using the provided table.txt (tabula recta) or automatically using an online tool like Vignere cipher

Analysis#

We are given a file table.txt:

Terminal window
$ file table.txt
table.txt: ASCII text

Its contents are:

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
+----------------------------------------------------
A | A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
B | B C D E F G H I J K L M N O P Q R S T U V W X Y Z A
C | C D E F G H I J K L M N O P Q R S T U V W X Y Z A B
D | D E F G H I J K L M N O P Q R S T U V W X Y Z A B C
E | E F G H I J K L M N O P Q R S T U V W X Y Z A B C D
F | F G H I J K L M N O P Q R S T U V W X Y Z A B C D E
G | G H I J K L M N O P Q R S T U V W X Y Z A B C D E F
H | H I J K L M N O P Q R S T U V W X Y Z A B C D E F G
I | I J K L M N O P Q R S T U V W X Y Z A B C D E F G H
J | J K L M N O P Q R S T U V W X Y Z A B C D E F G H I
K | K L M N O P Q R S T U V W X Y Z A B C D E F G H I J
L | L M N O P Q R S T U V W X Y Z A B C D E F G H I J K
M | M N O P Q R S T U V W X Y Z A B C D E F G H I J K L
N | N O P Q R S T U V W X Y Z A B C D E F G H I J K L M
O | O P Q R S T U V W X Y Z A B C D E F G H I J K L M N
P | P Q R S T U V W X Y Z A B C D E F G H I J K L M N O
Q | Q R S T U V W X Y Z A B C D E F G H I J K L M N O P
R | R S T U V W X Y Z A B C D E F G H I J K L M N O P Q
S | S T U V W X Y Z A B C D E F G H I J K L M N O P Q R
T | T U V W X Y Z A B C D E F G H I J K L M N O P Q R S
U | U V W X Y Z A B C D E F G H I J K L M N O P Q R S T
V | V W X Y Z A B C D E F G H I J K L M N O P Q R S T U
W | W X Y Z A B C D E F G H I J K L M N O P Q R S T U V
X | X Y Z A B C D E F G H I J K L M N O P Q R S T U V W
Y | Y Z A B C D E F G H I J K L M N O P Q R S T U V W X
Z | Z A B C D E F G H I J K L M N O P Q R S T U V W X Y

This table is known as the tabula recta, which is the foundation of the Vigenère cipher.

What is the Vigenère Cipher?#

The Vigenère cipher is a method of encrypting text using a series of Caesar ciphers with different shift values determined by a repeating keyword.

It’s considered a polyalphabetic substitution cipher because it uses multiple substitution alphabets, making it stronger than a simple Caesar cipher.

Decryption#

The provided ciphertext and key are:

  • Ciphertext: UFJKXQZQUNB
  • Key: SOLVECRYPTO

Since the key length (11) matches the ciphertext length, each ciphertext letter corresponds directly to one key letter. The decryption formula is:

plaintext_letter = (ciphertext_letter_index - key_letter_index) mod 26

Example (first character):

  • Cipher U = 20 (A=0)
  • Key S = 18
  • Plain = (20 - 18) mod 26 = 2 → C

Steps to Solve#

  1. Align ciphertext and key.
  2. Convert each letter to its alphabet index (A=0 to Z=25).
  3. Subtract the key index from the ciphertext index (mod 26).
  4. Convert the result back to letters.
  5. Combine all results to get the plaintext message.

Alternatively, we can simplify the process by using an online Vigenère Cipher Decoder, which follows the same tabula recta decryption method.

The decrypted message is CRYPTOISFUN. Flag:

picoCTF{CRYPTOISFUN}
⚡ Raikiri

🎉 Flag pwned!

alt text

💡 TL;DR / Lesson Learned

The Vigenère cipher is a form of polyalphabetic substitution cipher that uses a repeating keyword to shift letters in the plaintext.

Unlike a simple Caesar cipher that uses one shift value, Vigenère applies multiple shifts based on the keyword, making it more secure, but still vulnerable to frequency and key-reuse analysis.