The Soulmate::readMessageInSharedSpace
function uses a weak PRNG to select a random word from the niceWords
array. The PRNG is based on the block.timestamp modulo the length of the array, which is predictable.
The test shows that we can predict the niceWords
.
The niceWords
is defined as:
string[4] niceWords = ["sweetheart", "darling", "my dear", "honey"];
We set the block.timestamp
as:
block.timestamp = 7
We can calculate the module:
block.timestamp % niceWords.length = 7 % 4 = 3
and predict the niceWord:
niceWords = [3] = honey
Manual review
Consider using a more secure source of randomness as Chainlink VRF provided by a trusted oracle service.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.