Lack Of 0 Amount Check Allows Malicious User To Create Large Number Of Orders #305
Labels
bug
Something isn't working
disagree with severity
Sponsor confirms validity, but disagrees with warden’s risk assessment (sponsor explain in comments)
duplicate
This issue or pull request already exists
old-submission-method
QA (Quality Assurance)
Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax
sponsor acknowledged
Technically the issue is correct, but we're not going to resolve it for XYZ reasons
Lines of code
https://github.com/code-423n4/2022-06-putty/blob/3b6b844bc39e897bd0bbb69897f2deff12dc3893/contracts/src/PuttyV2.sol#L268
Vulnerability details
Proof-of-Concept
Based on the implementation of the
PuttyV2.fillOrder
, it was found that there is no validation to ensure that theorder.premium
andorder.strike
is notzero
. Thus, a griefer can create as many orders as they want in Putty.This will most likely pose problems on the front-end of the Putty protocol because there will be a ridiculously high number of "spam" orders displayed to actual users. This affects the usability of the protocol, and damage Putty's reputation. Malicious users could easily fill up the "Open Orders" and "Filled Orders" page of Putty Protocol. Malicious Users could easily fill up the "Open Order" and "Filled Order" pages in Putty.
Following are the only checks implemented in the
PuttyV2.fillOrder
. Note that it does not validate that theorder.premium
andorder.strike
is notzero
on-chain.https://github.com/code-423n4/2022-06-putty/blob/3b6b844bc39e897bd0bbb69897f2deff12dc3893/contracts/src/PuttyV2.sol#L268
Attacker could perform the following:
order.strike
andorder.premium
set tozero
.PuttyV2.fillOrder
function.Impact
This affects the usability of the protocol, and damage Putty's reputation.
Recommended Mitigation Steps
It is recommended to add the following checks to ensure that the
order.strike
andorder.premium
is not equal to zeroAlthough client-side or off-chain might have already implemented such validations, simply relying on client-side and off-chain validations are not sufficient. It is possible for an attacker to bypass the client-side and off-chain validations and interact directly with the contract. Thus, such validation must also be implemented in the on-chain contracts.
Additionally, consider restricting the number of orders each user can create or introduce a time delay that user has to wait after creating a new order to reduce the impact of this issue.
The text was updated successfully, but these errors were encountered: