Flags
CTF's Author: Danny
Description
What do the flags mean?
Hints-The flag is in the format PICOCTF{}
We're told that the
flag is hidden in the format picoCTF{...}. Based on the challenge name
(“Flags”) and the provided image, we suspect the image contains International
Maritime Signal Flags — a system where each flag represents a letter or
number.
Using the Wikipedia chart, match each flag visually to its
corresponding letter. After decoding all 22 flags and we will get our flag.
Hey everyone! Today I'm walking through the Mod 26 challenge from picoCTF 2021. This one's a great introduction to basic cryptography concepts, specifically ROT13 cipher.
The Challenge
Name: Mod 26
Category: Cryptography
Description: Cryptography can be easy, do you know what ROT13 is?
Flag: cvpbPGS{arkg_gvzr_V'yy_gel_2_ebhaqf_bs_ebg13_jdJBFOXJ}
Hint: This can be solved online if you don't want to do it by hand!
Learning ROT13
Now, before solving the problem, let's know about ROT13. ROT13 is a basic letter substitution cipher where every letter is mapped to the letter 13 places ahead of it in the alphabet. It is a fixed shift Caesar cipher with a shift value of 13.
What's unique about ROT13 is that it's its own inverse - two applications of ROT13 put the string back to its original form because 13 is precisely half of 26 (the number of English letters).
Initial Analysis
Looking at the encrypted flag cvpbPGS{arkg_gvzr_V'yy_gel_2_ebhaqf_bs_ebg13_jdJBFOXJ}, I can see it maintains the structure of a typical CTF flag - it has curly braces and appears to be in the right format, just scrambled.
The challenge description explicitly mentions ROT13, so this seems like a straightforward application of the cipher.
Solution Method 1: Online Tool
Following the hint about solving this online, I used an online ROT13 decoder. There are many available - I personally used rot13.com, but you can also use CyberChef or any other ROT13 decoder.
Steps:
Go to your preferred ROT13 decoder
Paste the encrypted flag: cvpbPGS{arkg_gvzr_V'yy_gel_2_ebhaqf_bs_ebg13_jdJBFOXJ}
Apply ROT13 decoding
Result: picoCTF{next_time_I'll_try_2_rounds_of_rot13_wqWOSBKW}
Solution Method 2: Python Script
Since many of us prefer scripting, here's a simple Python solution:
def rot13(text):
result = ""
for char in text:
if char.isalpha():
# Check if uppercase or lowercase
if char.isupper():
# Shift uppercase letters
result += chr((ord(char) - ord('A') + 13) % 26 + ord('A'))
else:
# Shift lowercase letters
result += chr((ord(char) - ord('a') + 13) % 26 + ord('a'))
else:
# Keep non-alphabetic characters unchanged
result += char
return result
encrypted_flag = "cvpbPGS{arkg_gvzr_V'yy_gel_2_ebhaqf_bs_ebg13_jdJBFOXJ}"
decrypted_flag = rot13(encrypted_flag)
print(f"Decrypted flag: {decrypted_flag}")
Running this script gives us: picoCTF{next_time_I'll_try_2_rounds_of_rot13_wqWOSBKW}
Solution Method 3: Python One-liner (Advanced)
For those who love concise code, Python's codecs module has a built-in ROT13 decoder:
import codecs
encrypted_flag = "cvpbPGS{arkg_gvzr_V'yy_gel_2_ebhaqf_bs_ebg13_jdJBFOXJ}"
decrypted_flag = codecs.decode(encrypted_flag, 'rot13')
print(f"Decrypted flag: {decrypted_flag}")
Solution Method 4: Manual Decoding
If you want to understand the mechanics, you can decode this by hand. In ROT13, each letter is replaced by the letter 13 positions ahead in the alphabet:
A ↔ N, B ↔ O, C ↔ P, D ↔ Q, E ↔ R, F ↔ S, G ↔ T, H ↔ U, I ↔ V, J ↔ W, K ↔ X, L ↔ Y, M ↔ Z
Let me decode the first few characters:
c → p (c + 13 = p)
v → i (v + 13 wraps around = i)
p → c (p + 13 wraps around = c)
b → o (b + 13 = o)
Continue this process for the entire string to get the full flag.
Key Insights
This challenge teaches several important concepts:
ROT13 is symmetric - The same operation that encrypts also decrypts
Pattern recognition - The flag format helps confirm when you've decoded correctly
Multiple solution approaches - Online tools, scripting, and manual methods all work
The decoded flag has a humorous message: "next_time_I'll_try_2_rounds_of_rot13" - which is funny because applying ROT13 twice would just return the original text!
Flag
picoCTF{next_time_I'll_try_2_rounds_of_rot13_wqWOSBKW}
Conclusion
Mod 26 is a great starting challenge that presents ROT13 in a very simple manner. Whether you utilize online resources, whip up a simple Python script, or decode manually, the trick is to realize that ROT13 is precisely what the challenge description states.
The Python method is especially handy since you can simply alter the script for other Caesar cipher puzzles that have various shift values. Additionally, knowing how the modular arithmetic operates (and thus "Mod 26" in the title) will assist you with more advanced cryptography puzzles in the future.



No comments:
Post a Comment