Low-Exponent Cube-Root Attack (Unpadded RSA)
- •
What it is
- •
When RSA uses a small public exponent (classically ) with no padding scheme, might not "wrap around" the modulus much (or at all) if isn't dramatically larger than . In the simplest case, outright, so exactly over the integers and needs no modular reduction at all. More generally, even when does exceed , it typically only wraps a handful of times for realistic message sizes — so trying for small integer and testing each for an exact integer -th root finds the true message quickly once matches how many times it actually wrapped.
- •
- •
When to apply
- •
e is small (3, 5, ...) and the encryption function applies no padding (OAEP, PKCS#1, etc.) before exponentiating a message that isn't astronomically larger than .
- •
- •
Math
- •
for some non-negative integer ; the correct is found by testing each candidate for an exact integer -th root.
- •
- •
Worked example
- •
Let , , and . Then , so and the correct lift is . Searching finds here. The required range is instance-dependent; small alone does not guarantee a tiny .
- •
- •
Python
- •
def exact_nth_root(x, n): # use gmpy2.iroot(x, n) in practice -- exact and fast for big integers; # DO NOT use x ** (1/n): floating point loses all precision at RSA sizes from gmpy2 import iroot r, exact = iroot(x, n) return int(r) if exact else None for k in range(0, 10**8): m = exact_nth_root(c + k * N, e) if m is not None: break
- •
- •
SageMath
- •
Not particularly relevant — Sage's integer
nth_root(x, e, truncate_mode=True)is a fine alternative togmpy2.iroot, but neither language makes the underlying search meaningfully simpler than the other.
- •
- •
- •
Cards
- •
Why does a small unpadded exponent risk exposing the plaintext directly?
- •
If m^e doesn't exceed N by much, c = m^e wraps the modulus only a few times (or not at all), so a small search over k in c + kN quickly finds an exact e-th root — the true message.
- •
- •
What's the critical implementation mistake this attack exploits?
- •
Encrypting with a small public exponent (e.g. e=3) without any padding scheme to inflate/randomize the message beforehand.
- •
- •