Potential Loss of User Funds Due to Lack of Overpayment Refund in Individual Claim Functions #122
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#L300
Vulnerability details
Impact
The individual claim functions (claim and its internal calls to signatureClaim and merkleClaim) in the PhiFactory contract do not properly handle overpayments, potentially leading to users losing excess ETH. When users send more ETH than the required mint fee, the excess amount remains trapped in the contract without a mechanism for refund. This issue could result in cumulative loss of funds for users who consistently overpay slightly.
In contrast, the batchClaim function does accurately refund excess fees, creating an inconsistency in the contract's behavior.
Proof of Concept
In the claim function, only the exact mintFee is passed to internal claim functions:
The signatureClaim function receives only this exact mintFee:
The _processClaim function's refund mechanism never triggers for individual claims:
In contrast, the batchClaim function correctly handles overpayments by passing individual ETH values and also checking it matches msg.value
Tools Used
Manual Review
Recommended Mitigation Steps
Modify the claim function to pass the full msg.value to internal claim functions:
Assessed type
Token-Transfer
The text was updated successfully, but these errors were encountered: