Closed code423n4 closed 2 years ago
As orders are created off-chain, there is no way to check the order's existence prior to canceling.
Finding is technically valid, a user can set their own "fake" orders to cancelled, impact is that they pay gas for it
There is no concrete exploit provided here. It is expected behaviour that any Order can be cancelled.
no assets are at risk, only impact is user self-inflicting harm. thus, finding is invalid.
Lines of code
https://github.com/code-423n4/2022-06-putty/blob/main/contracts/src/PuttyV2.sol#L526-L532
Vulnerability details
Impact
Since
cancel
function does not have enough checks, users can cancel irrelevant orders which do not even exist.Proof of Concept
https://github.com/code-423n4/2022-06-putty/blob/main/contracts/src/PuttyV2.sol#L526-L532
cancel
function just checks ifmsg.sender
isorder.maker
. Therefore users can specify arbitral values atOrder
struct as long asorder.maker
has same value withmsg.sender
. This seems not cause stealing funds or other major issues, but it looks like an unexpected behavior.Tools Used
Static analysis
Recommended Mitigation Steps
Simply add a check to confirm if the order itself actually exists by checking
ownerOf
function or other ways.