Open code423n4 opened 1 year ago
kirk-baird marked the issue as duplicate of #13
kirk-baird marked the issue as selected for report
See answer in https://github.com/code-423n4/2022-12-Stealth-Project-findings/issues/13. this is a dup
gte620v marked the issue as sponsor disputed
kirk-baird marked the issue as not selected for report
For reasons state in #13 I consider this to be QA.
kirk-baird changed the severity to QA (Quality Assurance)
kirk-baird marked the issue as grade-b
Lines of code
https://github.com/code-423n4/2022-12-Stealth-Project/blob/fc8589d7d8c1d8488fd97ccc46e1ff11c8426ac2/maverick-v1/contracts/models/Position.sol#L28 https://github.com/code-423n4/2022-12-Stealth-Project/blob/fc8589d7d8c1d8488fd97ccc46e1ff11c8426ac2/maverick-v1/contracts/models/Pool.sol#L113 https://github.com/code-423n4/2022-12-Stealth-Project/blob/fc8589d7d8c1d8488fd97ccc46e1ff11c8426ac2/maverick-v1/contracts/models/Pool.sol#L187
Vulnerability details
Impact
When adding liqudity or transfer liqudity, the code does not check if the NFT token exists.
User lose the fund if the user transfer or add liquidity to a token that does not exist
Proof of Concept
This problem exists in Maverick-v1 / Pool#addLiquidity and Pool#transferLiquidity
and
the POC demonstrate that user can lose their liqudity when they transfer liqudity to a not exist NFT token.
https://github.com/code-423n4/2022-12-Stealth-Project/blob/fc8589d7d8c1d8488fd97ccc46e1ff11c8426ac2/maverick-v1/test/models/Pool.ts#L470
If we run the test under maverick-v1 folder.
the output:
note that we change:
position.mint mint another NFT token Id to user and the newTokenId is 2, and token id 3 does not exist.
but user transfer the liqudity from token 1 and token 3 and succeed,
Given that there is no access control in Position mint function.
anyone mint the nft with token id 3 can claim the liqudity.
Tools Used
Manual Review, Hardhat test
Recommended Mitigation Steps
We recommend the project check the exists of the token and check if the owner of the token id is msg.sender before adding liqudity and transfer liqudity and add access control to the position mint function.