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

Missing pool existence check in balanceOf #80

Open
code423n4 opened this issue May 11, 2021 · 0 comments
Open

Missing pool existence check in balanceOf #80

code423n4 opened this issue May 11, 2021 · 0 comments
Labels
1 (Low Risk) bug Something isn't working Confirmed

Comments

@code423n4
Copy link
Contributor

Handle

0xRajeev

Vulnerability details

Impact

In NFTXLPStaking.sol, deposit(), exit(), withdraw(), claimRewards() and other related functions that take a vaultID as parameter perform a pool existence check on the staking pool associated with that vaultID. However, balanceOf is missing a similar pool check.

This may result in returning an invalid balance of a non-existing or stale pool.

Proof of Concept

Missing check: https://github.com/code-423n4/2021-05-nftx/blob/f6d793c136d110774de259d9f3b25d003c4f8098/nftx-protocol-v2/contracts/solidity/NFTXLPStaking.sol#L168-L172

Checks: https://github.com/code-423n4/2021-05-nftx/blob/f6d793c136d110774de259d9f3b25d003c4f8098/nftx-protocol-v2/contracts/solidity/NFTXLPStaking.sol#L117

https://github.com/code-423n4/2021-05-nftx/blob/f6d793c136d110774de259d9f3b25d003c4f8098/nftx-protocol-v2/contracts/solidity/NFTXLPStaking.sol#L144

Tools Used

Manual Analysis

Recommended Mitigation Steps

Add check require(pool.stakingToken != address(0), "LPStaking: Nonexistent pool”); before L170.

@code423n4 code423n4 added 1 (Low Risk) bug Something isn't working labels May 11, 2021
code423n4 added a commit that referenced this issue May 11, 2021
@0xKiwi 0xKiwi closed this as completed May 21, 2021
@cemozerr cemozerr reopened this May 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1 (Low Risk) bug Something isn't working Confirmed
Projects
None yet
Development

No branches or pull requests

3 participants