A vulnerability was identified in the createOffer()
function within the smart contract, which prevents users from successfully creating offers using Wrapped Ether (WETH). The issue arises due to improper handling of WETH within the TokenManager.sol::tillIn()
function, leading to a transaction revert.
When the createOffer()
function is executed, it calls the TokenManager.sol::tillIn()
function, passing several parameters, including tokenAddress
. If a user attempts to transfer WETH, the following code is executed:
In this logic, when tokenAddress == wrappedNativeToken
, the function assumes the user is transferring the native token (ETH) and attempts to wrap it. The problematic line is:
If the user is transferring WETH (an ERC-20 token) instead of ETH, msg.value
will be 0
, causing the function to revert, as the condition msg.value < _amount
will be true.
Users cannot create offers using WETH. Based on documentation, users should be able to use any ERC20.
Manual review
Implement a mechanism that handle WETH transfers. For example add a if statement in tillIn()
which cheks if wrappedNativeToken is send with msg.value=0. If this is the case treat it like any other ERC20.
Valid medium severity, given it is noted in contest READ.ME that any standard ERC20 tokens should be supported. Although arguably could be low severity, given users can simply unwrap WETH to native ETH and perform the deposits via `tillIn()`, I will leave open for discussions, but taking READ.ME as the source of truth, I believe medium severity is appropriate, given it is explicitly noted that this token should be compatible#9##. The fix would be to utilize a zero address or equivalent to represent native ETH when wrapping to WETH. > Tokens: - ETH - WETH - ERC20 (any token that follows the ERC20 standard)
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.