CyberKavach QuestCon Series: The Cipher Breach

 

The Cipher Breach

Author: Radhika Suryavanshi

Welcome to the CyberKavach QuestCon write-up series by PCCOE OWASP Student Chapter! In this post, we explore a challenging three-part cryptographic puzzle designed to test your understanding of real-world vulnerabilities and cryptanalysis.


Challenge Details

  • Category: Cryptography

  • Difficulty: Medium

  • Description: Recover pieces of the final flag by exploiting three common cryptographic vulnerabilities, one each in ECDSA usage, PRNG state recovery, and AES encryption misuse.

  • Flag Format: questCON{part1-part2-part3}


Stage 1: ECDSA Nonce Leakage Vulnerability

ECDSA relies on a secret nonce kkk per signature. This challenge provides ECDSA signatures where the top 12 bits of the nonce are leaked—a catastrophic information leak.

Attack Overview

  • Goal: Brute force the unknown bits of the nonce to recover the full nonce.

  • Using two signatures, guess nonce bits, calculate a potential private key candidate, and verify using the second signature's leaked bits.

Process

  • Load the provided list of signatures.

  • For each nonce guess, calculate the private key and check validity.

  • Once the key is found, derive the first part of the flag by hashing the key.


Stage 2: Mersenne Twister MT19937 State Cloning

The Mersenne Twister PRNG (MT19937) is not cryptographically secure. If you can observe 624 consecutive outputs, you can recover its internal state.

Attack Overview

  • Recover the internal state by untempering 624 outputs from mtobservations.bin.

  • Seed a local MT19937 PRNG with this state.

  • Predict the next four outputs to form the AES key.

  • Decrypt the provided ciphertext encryptedblob.bin with the predicted key.

Implementation Steps

  • Read and untemper outputs.

  • Predict AES key and decrypt ciphertext.

  • Extract second part of the flag from the decrypted data.


Stage 3: AES-CTR Keystream Reuse Vulnerability

When AES is used in CTR mode, reusing the same key and nonce results in keystream reuse, allowing attackers to decrypt messages with known plaintext.

Attack Overview

  • Several ciphertexts and related known plaintexts are given.

  • Extract known plaintext from images through LSB steganography.

  • XOR known plaintext with ciphertext to recover keystream.

  • Use this keystream to decrypt the target ciphertext.

Solution Highlights

  • Extract LSB encoded hints from images.

  • Compute keystream and decrypt flagged message.

  • Retrieve third part of the flag.


Final Assembly: The Complete Flag

By combining the three recovered parts, the final flag looks like:

text

questCON{<part1>-<part2>-<part3>}


Where each part corresponds to the respective stage's recovered secret.


This challenge bridges multiple core cryptographic concepts and highlights real vulnerabilities from ECDSA nonce reuse, insecure PRNGs, to improper use of AES in CTR mode. Understanding these flaws and exploiting them in a controlled environment is invaluable for budding cybersecurity professionals.

Stay tuned for more write-ups from CyberKavach QuestCon!


Comments

Popular posts from this blog

CyberKavach QuestCon Series: Upside-Down Vault

From Open Networks to Safe Systems: How Firewalls Block the Hacker’s Doorway

CyberKavach QuestCon Series: VecNet