Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Weak PRNG #2

Closed
code423n4 opened this issue May 7, 2021 · 1 comment
Closed

Weak PRNG #2

code423n4 opened this issue May 7, 2021 · 1 comment
Labels
2 (Med Risk) Acknowledged bug Something isn't working duplicate This issue or pull request already exists

Comments

@code423n4
Copy link
Contributor

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/

@cemozerr
Copy link
Collaborator

Duplicate of #78

@cemozerr cemozerr marked this as a duplicate of #78 May 25, 2021
@cemozerr cemozerr added the duplicate This issue or pull request already exists label May 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2 (Med Risk) Acknowledged bug Something isn't working duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

3 participants