Overpayment Due to Lack of Refund Mechanism in EntityForging::forgeWithListed: Financial Imbalance and User Distrust #550
Labels
bug
Something isn't working
downgraded by judge
Judge downgraded the risk level of this issue
duplicate-218
grade-c
QA (Quality Assurance)
Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax
🤖_54_group
AI based duplicate group recommendation
sufficient quality report
This report is of sufficient quality
unsatisfactory
does not satisfy C4 submission criteria; not eligible for awards
Lines of code
https://github.com/code-423n4/2024-07-traitforge/blob/279b2887e3d38bc219a05d332cbcb0655b2dc644/contracts/EntityForging/EntityForging.sol#L126
Vulnerability details
Impact
In the
EntityForging::forgeWithListed
function, the protocol ensures that msg.value is at least equal to or greater than the forging fee. However, this check does not account for any excess funds paid by the player, leading to overpayments that are not refunded. This results in a gradual depletion of user funds without their awareness, affecting the game's economic balance.Proof of Concept
this below lines shows you the particular validation in question
https://github.com/code-423n4/2024-07-traitforge/blob/279b2887e3d38bc219a05d332cbcb0655b2dc644/contracts/EntityForging/EntityForging.sol#L126
Recommended Mitigation
proper accounting is very crucial to pay attention to, implementation of a validation that calculates and send back the remaining back to the player.
TraitForgeNft::mintToken
below you will see how excess is been accounted forAssessed type
Other
The text was updated successfully, but these errors were encountered: