liveBook · Manning

Prefix cube root

As explained in Hacking Cryptography

A prefix cube root is a candidate RSA signature value whose cube preserves a required prefix of an encoded message despite unconstrained or truncated trailing bits.

A prefix cube root finds a candidate RSA signature s whose cube begins with a chosen byte sequence. The trailing bytes may be garbage, which makes the technique useful when RSA uses e = 3 and PKCS#1 v1.5 padding validation is incomplete. section 9.6.3 section 9.7

The attack technique proceeds in three stages:

  • Choose the fixed header bytes, such as 00 01, and append random bytes to form a large target value. section 9.6.4
  • Use bisection search to find a cube root whose cube preserves the target’s most significant bytes; discard its right-hand spillover. section 9.6.3
  • Place the complete suffix cube root after the trimmed prefix root, leaving the unconstrained garbage in the middle. section 9.6.4

Forged signature test

A Go test generates an RSA key with public exponent 3, hashes “Hello World!” with SHA-256, constructs a forged signature, and verifies it through an insecure PKCS#1 v1.5 verifier.

The failure is not caused by calculating a cube root alone. It arises when a low public exponent combines with a verifier that checks only selected encoded-message bytes instead of requiring every PKCS#1 v1.5 padding byte to be FF. section 9.7 section 9.6.4

How Hacking Cryptography covers it

How deep it goes
Explains prefix search, suffix matching, stitching, retries, and executable Go tests, while stopping short of full verifier internals.
Examples
Uses hexadecimal prefix and suffix cubes, bisection diagrams, bitwise suffix construction, and Go forgery tests.
What it assumes
Assumes RSA signatures, modular exponentiation, byte encodings, and hash digests while explaining cube-root construction procedurally.
What you can do after
Build a forged e = 3 RSA signature against an implementation that incompletely validates PKCS#1 v1.5 encoding.
How it connects
Connects RSA, public exponents, cube roots, PKCS#1 v1.5 padding, ASN.1 identifiers, hashing, and Bleichenbacher signature forgery.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Hacking Cryptography. The section links point to the parts of the book it draws on.