Weak PRNG #2
Labels
2 (Med Risk)
Acknowledged
bug
Something isn't working
duplicate
This issue or pull request already exists
Handle
maplesyrup
Vulnerability details
Impact
Using blockhash/blocknumber and randNone are subject to attack, particularly by malicious miners:
https://medium.com/coinmonks/attack-on-pseudo-random-number-generator-prng-used-in-1000-guess-an-ethereum-lottery-game-7b76655f953d
This could be used to the behavior of getRandomTokenIdFromFund to cause a preferential TokenId to be returned. It allows for gaming of the system by miners or a savvy attacker.
Proof of Concept
Code is at - https://github.com/code-423n4/2021-05-nftx/blob/f6d793c136d110774de259d9f3b25d003c4f8098/nftx-protocol-v2/contracts/solidity/NFTXVaultUpgradeable.sol#L418
Tools Used
Slither
Recommended Mitigation Steps
Use of an on-chain oracle for true randomness:
ChainLink- https://blog.chain.link/verifiable-random-functions-vrf-random-number-generation-rng-feature/
RanDAO - https://github.com/randao/randao
Provable - https://provable.xyz/
The text was updated successfully, but these errors were encountered: