As the attacker we infected a signing device to maliciously construct watermarked and blinded nonces:
The malcious device incremements the $\texttt{watermark-counter}$ on the
last nonce until it grinds an identifiable watermark into the public
nonce $R_2 = r_2 \cdot G$. This watermark is set to be that the hash the
public nonce starts with eleven 0 bits.
In our case the attacker secret is
$\texttt{SECRET} = \texttt{"Fair dinkum I got your seedwords"}$
which is both on the malicious device and on the attacker's computer.
Only those with $\texttt{SECRET}$ can detect and extract data from a
corrupted transaction.
Let's look at the transaction from our demo, transaction ID:
e1d7e6749d32d741d5afdf3c83cfb83853a471f1d18e15c5c8d54dd50b7efdaf
.
At face value there's nothing interesting about this transaction, it
looks like any other transaction on-chain.
But let's take a closer look at this transaction from the perspective of
the attacker running Dark Skippy.
For every transaction that gets relayed around the network, the attacker will inspects the public nonces in the signatures. In this transaction they are:
In our implementation the watermark is detected by hashing the last nonce in the transaction:
they notice it starts with a low number (0000d3), which indicates this is probably a corrupted transaction. For each public nonce the attacker computes the blinding values to unblind the nonces:
and then divide $R_1$ and $R_2$ by these respective blinding values to give:
Now we are left with two discrete logarithms to solve which we know are weak by construction. Notice that the second nonce has two bytes for the watermark counter which is what was incremented by the malicious device in order to get the watermark detection to work in the first step.
Now the attacker runs an algorithm like Pollard's Kangaroo Algorithm.
Since we are embeding 9 bytes into each nonce (including the watermark
counter), we know the discrete log is at most 72 bits long.
Discrete log solving algorithms have an expected runtime of
$O(\sqrt{n})$ group operations, so we can expect to solve each problem
in $\sqrt{2^{72}} = 2^{36} \approx 69$ billion group operations which is
feasible on a powerful machine. We used a 32-core machine with 256GB of
RAM for about 90 minutes.
After this time, we find the discrete logarithms:
Stripping away the watermark counter bytes (009f) on the last nonce we can now concatenate the final seed bytes:
Converting these seed bytes into a BIP39 seedphrase:
We have extracted the master secret from the transaction signatures. Now we can load it into a wallet to steal all the funds (try it!).
A few things need to note if you actually want to follow along at home: