Claim Function Fails to Refund Excess ETH Correctly #19
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
🤖_04_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/8c0985f7a10b231f916a51af5d506dd6b0c54120/src/PhiFactory.sol#L264
https://github.com/code-423n4/2024-08-phi/blob/8c0985f7a10b231f916a51af5d506dd6b0c54120/src/PhiFactory.sol#L723
Vulnerability details
Vulnerability Details:
The
claim
function allows users to claim an art reward, calling either the merkleClaim or signatureClaim function based on the chosen verification process. These functions internally call the_processClaim
function to handle fees, mint the token, and refund any excess ETH to the user.The processClaim function handles the refund by checking if the etherValue (msg.value) sent is greater than the mintFee. If it is, the difference is refunded to the user.
However, in the claim function, the exact mintFee is passed as msg.value when calling this.signatureClaim or this.merkleClaim. This means that even if a user sends excess ETH, the excess funds will not reach the refund process and will not execute as intended, as the extra funds will remain in the PhiFactory contract instead of being returned to the user.
Impact:
Users are not refunded their excess ETH, as the smart contract does not implement the intended logic as mentioned here. This could accumulate over multiple transactions, resulting in significant amounts of ETH being retained by the contract rather than refunded to users.
Proof Of Concept
Tools Used:
Recommendation:
Modify the
claim
function to correctly handle excess ETH by ensuring that the_processClaim
function can properly detect and refund any excess amount to the user.Assessed type
Other
The text was updated successfully, but these errors were encountered: