New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Users can bypass the maxWinPercent
limit using a partially closing
#507
Comments
GalloDaSballo marked the issue as duplicate of #111 |
I don't think any of this, #339, #487 is a duplicate of #111 |
TriHaz marked the issue as sponsor confirmed |
TriHaz marked the issue as disagree with severity |
TriHaz requested judge review |
Thank you for flagging @TriHaz , will re-dedoup |
GalloDaSballo marked the issue as not a duplicate |
@TriHaz I see your point, and agree that the findings are different, thank you for the flag |
GalloDaSballo marked the issue as primary issue |
The Warden has shown how, by partially closing an order, it is possible to bypass the Per similar discussion to #111 the fact that not every trade can be above 500% in payout is not a guarantee that some trade will be, and those that will, will cause the invariant to be broken and LPs to be deeper in the red than they should. Because this causes an immediate gain to the attacker, at a loss for LPs, I agree with High Severity. |
GalloDaSballo marked the issue as selected for report |
Mitigation: code-423n4/2022-12-tigris#2 (comment) |
Lines of code
https://github.com/code-423n4/2022-12-tigris/blob/b2ebb8ea1def4927a747e7a185174892506540ab/contracts/Trading.sol#L625-L627
Vulnerability details
Impact
Users can bypass the
maxWinPercent
limit using a partial closing.As a result, users can receive more funds than their upper limit from the protocol.
Proof of Concept
As we can see from the documentation, there is limitation of a maximum PnL.
And this logic was implemented like below in
_closePosition()
.But it checks the
maxWinPercent
between the partial payout and full margin so the below scenario is possible.maxWinPercent
= 500%, Alice should receive 500 at most.maxWinPercent
with_toMint = 500
and_trade.margin = 100
Tools Used
Manual Review
Recommended Mitigation Steps
We should check the
maxWinPercent
between the partial payout and partial margin like below.The text was updated successfully, but these errors were encountered: