When creating an offer, there is no validation to check whether the msg.valuepassed in == to the amount expected.
See that the transferAmountis calculated based on the params.amount not the msg.value.
In the TokenManagerthe validation is based on the transferAmount:
Due to this flat verification where msg.valueand transferAmountrepresent different values, the TokenManagerwill receive the ETH sent from the PreMarketand only account for the amount from params.amount.
Thus, any additional amount sent as msg.valuewill be lost and retained in the TokenManagercontract.
I.e: user msg.value is 100ETH but params.amount is only 1 ETH. When the user calls withdraw, he only receives 1 ETH and loses the 99 ETH sent to the protocol.
In order to run this PoC, add the fix for the DoS on withdraw. Submission: "DoS on withdraw due to wrong parameter on approve call"
Then add the following test on PreMarkets.t.soland run forge test --match-test test_whenUserCreateOffer_heWillLoseFunds -vv
Output:
Loss of funds when creating offer.
Manual Review & Foundry
Check if msg.value== transferAmount. If false, revert.
(Alternative) At the end of the transaction return any remaining ETH to the user.
Invalid, these are by default, invalid based on codehawks [general guidelines](https://docs.codehawks.com/hawks-auditors/how-to-determine-a-finding-validity#findings-that-may-be-invalid). The check implemented is simply a sufficiency check, it is users responsibility to only send an appropriate amount of native tokens where amount == msg.value when native token is intended to be used as collateral (which will subsequently be deposited as wrapped token). All excess ETH can be rescued using the `Rescuable.sol` contract. > Users sending ETH/native tokens > If contracts allow users to send tokens acc111identally.
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.