Duplicate Signature Key Selection (DSKS) Attack
- •
What it is
- •
A named, well-studied attack class against any signature-verification scheme that trusts a self-supplied public key rather than a fixed, pre-established one. If a verifier accepts "here's my message, my public key, and a signature" and simply checks that the signature validates under the attacker-chosen key, the attacker can construct a public key custom-built to make an already-known value verify as a "signature" over any message they want — without ever knowing any matching private key. The simplest version: setting collapses RSA verification to ; choosing (for a fixed value the attacker possesses and a target digest with ) makes that congruence hold by construction.
- •
- •
When to apply
- •
A signature-verification service lets the caller supply their own alongside a message and signature, rather than checking against one fixed, trusted public key — this is the deciding factor, not anything about the signature algorithm's underlying hardness
- •
- •
Math
- •
With , : (valid whenever , i.e. ).
- •
- •
Worked example
- •
A toy 1024-bit "signature" value and a target digest chosen so : setting , and checking returned exactly — a valid "forged" verification with no private key involved at all.
- •
- •
Python
- •
n = S - m_target e = 1 # verifier computes pow(S, e, n) == S % n == m_target -- passes
- •
- •
Related
- •
Cards
- •
What single design flaw in the verifier makes DSKS possible?
- •
Trusting a public key supplied by the same party presenting the message and signature, rather than checking against one fixed, pre-established key.
- •
- •
What's the simplest DSKS construction for RSA, and why does it work?
- •
e=1, n=S-m for a known signature value S and target digest m — this collapses verification to S mod n, which equals m by construction whenever S > 2m.
- •
- •