Users don't get refunds when claiming, which allows other users to claim at a discount #112
Labels
2 (Med Risk)
Assets not at direct risk, but function/availability of the protocol could be impacted or leak value
bug
Something isn't working
duplicate-109
🤖_10_group
AI based duplicate group recommendation
satisfactory
satisfies C4 submission criteria; eligible for awards
sufficient quality report
This report is of sufficient quality
Lines of code
https://github.com/code-423n4/2024-08-phi/blob/main/src/PhiFactory.sol#L283
https://github.com/code-423n4/2024-08-phi/blob/main/src/PhiFactory.sol#L300
Vulnerability details
Impact
Users can claim NFTs through the
PhiFactory
contract by callingclaim(...)
. If a user sends more ETH with the tx than what is needed for the claiming they are supposed to get a refund of the excess ETH. However, that does not happen and the additional ETH gets stuck in the contract. This allows a cautious user to see that and claim at a discount an NFT due to the ETH left in the contract.Let's say a user claims an NFT via
claim(...)
and sends an additional 0.01e18 ETH with their call. This means they won't get their excess ETH back and the ETH will be sitting in the contract. That will give the opportunity to another user to claim an NFT with their ETH at a discount.Proof of Concept
The following lines of code can be added at the very end of the
test_claimMerkle()
unit test inside thetest/PhiFactory.t.sol
file:Tools Used
Manual review
Recommended Mitigation Steps
Make sure to properly refund the user when they call
claim(...)
Assessed type
Other
The text was updated successfully, but these errors were encountered: