Description buyOrder
function is used for buying orders that are listen for sell. When the buyer call this function, the eth or any token accepted to pay, is sent to the seller if the transfer executed correctly, then this contract, which has all the tokens, send the tokens to the msg.sender
. There are some fees are collected to the owner of the contract.
Impact The function does not handle the scenario where the user sends more ETH (msg.value
) than required for the transaction. If the user sends excess ETH, it is not returned, leading to overpayment. This could result in financial losses for users if they mistakenly send more ETH than needed for the swap.
Proof of Concepts
Nft is being divided to ERC20s
Then user can make selling order of this tokens for example order price will be X
Then another user can buy this order sending few times more than X
Sended value will not be returned to user and will locked in TokenDivider
contract
Place this test inside of the TokenDividerTest.t.sol
and run forge test --mt testbuyOrderSendMoreThanPrice -vvvv
Recommended mitigation Consider adding some save transfer function like sendValue
from OpenZeppelin at the end of the function for returning the funds left back.
Example:
The extra eth sent by the user in the buy order will be locked in the contract forever
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.