kashiCTF 2026 - Broadcast

posted
read
206 words · 1 min
contents

We sent the same announcement to three servers for redundancy. Each server has its own RSA key. Intercept all three — maybe you can piece something together.

Initial Analysis

The challenge provides an output.txt containing an exponent e=3e=3, three moduli (n1,n2,n3n1, n2, n3), and three ciphertexts (c1,c2,c3c1, c2, c3). By examining the data, we notice:

  1. Low Exponent: e=3e = 3 is very small.
  2. Identical Ciphertexts: c1=c2=c3c1 = c2 = c3. This means the raw message MM was not padded differently for each server.
  3. Magnitude of cc: The ciphertext cc is significantly smaller than any of the moduli nn.

In RSA, the encryption process is c=Me(modn)c = M^e \pmod n. Usually, MeM^e is much larger than nn. However, if Me<nM^e < n, then the modulo operation has no effect, and c=Mec = M^e.

Solution

Since c<nic < n_i and e=3e=3, the message MM can be recovered simply by calculating the integer cube root of cc:

M=c3M = \sqrt[3]{c}

Implementation

Using Python and the gmpy2 library, we can solve for MM:

import gmpy2
from binascii import unhexlify
# Intercepted ciphertext
c = 475436441896018898725156479190091126537849994697426945980826369000641892902004477923335055269088235139492237640527487698088281484953901383579636883543216552932099156009006828723690550706326538736801225046068870773990108130474408522838234755277972911893744937243892927414355347438993698991261629557719442242861719577879055371620865465785392597257968132649494474946507819896785671106833645551504301840437212737125
# Calculate the cubic root
m, exact = gmpy2.iroot(c, 3)
if exact:
# Convert integer to hex, then to ASCII
flag = unhexlify(hex(m)[2:]).decode()
print(f"Flag: {flag}")

Note: This challenge is a simplified version of Håstad’s Broadcast Attack. While Håstad’s attack typically uses the Chinese Remainder Theorem (CRT) to solve for MeM^e when Me>niM^e > n_i, the small size of the message relative to the key size here allowed for a direct cubic root calculation.

Flag

kashiCTF{h4st4d_s4ys_sm4ll_3xp0n3nts_k1ll_RSA_br04dc4sts}