User funds sent in excess are not refunded
The smart contract's minting functions accept Ether amounts greater than the required price but do not refund the excess, leaving the surplus locked in the contract. An attacker could deliberately overpay to trap funds, though the primary impact is accidental loss by users.
Submitted by Hound
Note: this finding was reported via the winning Automated Findings report. It was declared out of scope for the audit, but is being included here for completeness.
These functions lack a refund mechanism for excess Ether sent by the caller, resulting in locked funds within the contract. To rectify this, the function should be modified to implement a refund for any surplus amount.
There are 3 instances of this issue.
File: smart-contracts/MinterContract.sol
233: require(msg.value >= (getPrice(col) * _numberOfTokens), "Wrong ETH");
234: for(uint256 i = 0; i < _numberOfTokens; i++) {
235: uint256 mintIndex = gencore.viewTokensIndexMin(col) + gencore.viewCirSupply(col);
236: gencore.mint(mintIndex, mintingAddress, _mintTo, tokData, _saltfun_o, col, phase);
237: }
238: collectionTotalAmount[col] = collectionTotalAmount[col] + msg.value;
266: require(msg.value >= getPrice(_mintCollectionID), "Wrong ETH");
267: uint256 mintIndex = gencore.viewTokensIndexMin(_mintCollectionID) + gencore.viewCirSupply(_mintCollectionID);
268: // burn and mint token
269: address burner = msg.sender;
270: gencore.burnToMint(mintIndex, _burnCollectionID, _tokenId, _mintCollectionID, _saltfun_o, burner);
271: collectionTotalAmount[_mintCollectionID] = collectionTotalAmount[_mintCollectionID] + msg.value;
361: require(msg.value >= (getPrice(col) * 1), "Wrong ETH");
362: uint256 mintIndex = gencore.viewTokensIndexMin(col) + gencore.viewCirSupply(col);
363: gencore.mint(mintIndex, mintingAddress, ownerOfToken, tokData, _saltfun_o, col, phase);
364: collectionTotalAmount[col] = collectionTotalAmount[col] + msg.value;
Important and valid.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
The functions use a greater-than-or-equal check on the payment amount but never compute or return the difference between the sent value and the required price.
Impact
Excess Ether sent by users becomes permanently locked in the contract, causing a loss of funds for the sender.
What the attacker needed
User sends more Ether than required
The fix
The functions should be modified to refund any surplus amount to the caller after the required payment is taken.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
When you send money to a smart contract, you might send more than needed by mistake. This contract keeps the extra money instead of giving it back, so it gets stuck forever. The fix is to check the amount and return any extra to the sender.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.