IIITK BetaLabs organized a CTF in collaboration with DefHawk on 7 Feb 2026. Below are detailed writeups for the 5 cryptography challenges.
Challenge 1: The Chef's Scrambled Receipt
Difficulty: Easy
Category: Cryptography
Resources: 53cr37_n073.txt | Challenge Guide
Description
A hex string is provided. Decode it to reveal the Base32 string. Solve the Base32 to get the flag.
Flag: CTK{1f_y0u_4r3_c0nfu53d_r34d_4g41n}
Challenge 2: The Exfiltrating Salad
Difficulty: Medium
Category: Forensics / Network Security / Cryptography
Resources: evidence.pcap | captured.txt
Description
A PCAP file containing network traffic. Analyze packets to find the particular TCP/IP stream dest. 192.168.48.40 port:8080 (looks like exfiltration activity). Visit IP in a browser to port 8080. Then try Gobuster for hidden directories or files."/backup" directory is discovered. Open the backup directory to find captured.txt (captured data from the exfiltration). Analyze captured.txt to find the flag. Hint given "common key" in the website. Solve by cribdragging.
Crib dragging is a classical cryptanalysis technique used to break XOR-based encryption, especially when: The same key (or keystream) is reused to encrypt multiple messages (for example: one-time pad reuse or stream cipher keystream reuse)
Solution
- Open with
Wiresharkor analyze withtcpdump - Look for DNS queries, HTTP requests, or suspicious protocol traffic
- Connect to 192.168.48.40:8080 and explore the web interface
- Check for hidden directories or files using tools like Gobuster
- Analyze captured.txt using crib dragging techniques
Flag: CTK{m4ny_71m3_p4d_15_br0k3n}
Challenge 3: The Chef’s Melancholy
Description
The gibberish text hints at Caesar cipher. "JAR{7o475_do47_5o3_541k}". Solve it using any Caesar cipher decoder or by manual shifting. You get the flag. "CTK{7h475_wh47_5h3_541d}"
An innocent-looking PNG image is also attached, which hides a secret message. Extract it using steganography techniques.
Solution
Common approach:
- ROT13:
JAR{7o475_do47_5o3_541k}becomesCTK{7h475_wh47_5h3_541d} - Use
openstegoto extract hidden data "secrect_recipe.txt" cat secrect_recipe.txtgives the flag "CTK{0p3n_573g0_15_fun}"
openstego extract \ -sf salad.png \ -p "CTK{7h475_wh47_5h3_541d}"
Flag: CTK{0p3n_573g0_15_fun}
Challenge 4: The Chef’s "Optimized" RSA
Description
RSA ciphertext is given along with public parameters N and e. Decrypt it to find the flag.
Given:
- N = [large modulus]
- e = 65537 (standard exponent)
- ct = [ciphertext]
Solution
To break RSA, we need to factor N or detect weak parameters:
- Check if N is a prime:
sage: is_prime(N)
True - Factor N using online tools or algorithms:
factordb.com(not needed as we already know N is prime) - Use Eulers totient function:
N = [large modulus]
e = 65537
ct = [ciphertext]
phi = (N - 1)
d = pow(e, -1, phi) # Modular inverse
plaintext = pow(ct, d, N)
flag = long_to_bytes(plaintext)
print(flag.decode()) # Output: CTK{0ne_pr1m3_15_4_r3c1p3_f0r_d1545t3r}
Flag: CTK{0ne_pr1m3_15_4_r3c1p3_f0r_d1545t3r}
Challenge 5: The Chef’s “Perfectly Repeated” Encryption
Description
An AES ECB oracle server appends a flag to user input before encryption. Exploit ECB's deterministic nature to recover the flag byte-by-byte.
Server Behavior
ciphertext = AES_ECB_encrypt(pad(payload, 16))
Solution: ECB Byte-by-Byte Extraction
AES block size is 16 bytes. Each 16-byte block encrypts independently:
Attack Steps:
- Send 15 bytes of input (e.g., 'A' * 15)
- This leaves 1 byte for the first FLAG character in the first block
- Try all 256 possible values for that byte and compare ciphertext
- When a match is found, you've recovered the first FLAG byte
- Repeat: Use 14 bytes of input, recover 2nd byte, etc.
Python Exploitation: client.py
import string
import time
# --- CONFIGURATION ---
HOST = '192.168.48.40'
PORT = 1337
BLOCK_SIZE = 16
# ---------------------
.
.
.
if __name__ == "__main__":
solve()
Key Takeaways
- Challenge 1: Always check for simple encoding first (hex, base64, etc.)
- Challenge 2: Network forensics requires packet analysis and data extraction skills
- Challenge 3: Steganography tools and pixel analysis are essential
- Challenge 4: RSA security depends on N being hard to factor; check FactorDB first
- Challenge 5: Block cipher modes matter; ECB is vulnerable to pattern analysis