Excess ETH Sent By Caller(Buyer) While Buying Players Are Stolen By Owner Of Contract
Summary
Excess Eth sent by caller will lost
Vulnerability Detail
In FootiumAcademy Contract there is function mintPlayers() which used to call by ClubOwner to Buy players from academy.
Which calls a private function _validateMintingParams() where it checks ETH send by caller is not less than total players cost
function _validateMintingParams(
SeasonID seasonId,
uint256 clubId,
uint256 divisionTier,
uint256[] calldata generationIds,
bytes32[] calldata divisionProof
) private returns (uint256) {
....................
......................
uint256 playerCount = generationIds.length;
uint256 totalFee = playerCount * divisionToFee[divisionTier];
if (msg.value < totalFee) { // @audit-issue excess eth of user will lost
revert IncorrectETHAmount(msg.value);
}
..........................................
So if user sent some extra ETH than players net cost then these extra ETH will remain in that Academy contract, and it will withdrawn by Owner via withdraw() function
function withdraw() external onlyOwner {
uint256 balance = address(this).balance;
if (balance > 0) {
(bool sent, ) = payable(owner()).call{value: balance}("");
if (!sent) {
revert FailedToSendETH(balance);
}
}
}
Impact
If more Eth sent by Caller(i.e more than players fee), then those extraa eth will be withdrawn by Owner of contract.
0xhacksmithh
medium
Excess ETH Sent By Caller(Buyer) While Buying Players Are Stolen By Owner Of Contract
Summary
Excess Eth sent by caller will lost
Vulnerability Detail
In
FootiumAcademy
Contract there is functionmintPlayers()
which used to call by ClubOwner to Buy players from academy. Which calls a private function_validateMintingParams()
where it checksETH send by caller is not less than total players cost
So if user sent some extra ETH than players net cost then these extra ETH will remain in that Academy contract, and it will withdrawn by Owner via
withdraw()
functionImpact
If more Eth sent by Caller(i.e more than players fee), then those extraa eth will be withdrawn by Owner of contract.
Code Snippet
https://github.com/sherlock-audit/2023-04-footium/blob/main/footium-eth-shareable/contracts/FootiumAcademy.sol#L259 https://github.com/sherlock-audit/2023-04-footium/blob/main/footium-eth-shareable/contracts/FootiumAcademy.sol#L207-L212 https://github.com/sherlock-audit/2023-04-footium/blob/main/footium-eth-shareable/contracts/FootiumAcademy.sol#L218-L226
Tool used
Manual Review
Recommendation
Technically if any caller send more eth than sum of all players fee those he intended to Buy, Contract should return extra ETH to that caller