-
Notifications
You must be signed in to change notification settings - Fork 0
unforgiven - malicious winner in the TieredPercentageBounty can steal other winner funds by inflating contract token balance right before claiming and then refunding his deposit #285
Comments
This would require collusion between the bounty issuer and the claimant. |
Will be fixed by removing this crowdfundable contract for now |
Considering the issuer is trusted, closing this issue |
Escalate for 51 USDC This is duplicate of the #275 both issues explain how a malicious tier winner can steal other winners funds. and my report shows that the attack requires no collusion from the issuer. It allows the winner of any tier to steal the entire pot. It should be marked high for the same reason. This is from #275(vulnerability details):
And This if from my report:
both reports are showing how malicious tier winner can steal funds by depositing for short time(which inflates prize pool) before claiming and then claim and refund. interestingly enough the Recommendation for both report are the same too: Issue #275(Recommendation):
My report recommendation:
As you can see This is duplicate of the #275 Also issues #99 #127 are the same too. they both shows how a tier winner can steal other winner funds. issues #330 and #430 are dupes of #275 too, they are currently wrongly duped to #266. |
You've created a valid escalation for 51 USDC! To remove the escalation from consideration: Delete your comment. You may delete or edit your escalation comment anytime before the 48-hour escalation window closes. After that, the escalation becomes final. |
Escalation accepted Valid duplicate of #275 |
This issue's escalations have been accepted! Contestants' payouts and scores will be updated according to the changes made on this issue. |
unforgiven
high
malicious winner in the TieredPercentageBounty can steal other winner funds by inflating contract token balance right before claiming and then refunding his deposit
Summary
In TieredPercentageBounty code calculates prize amounts based on
fundingTotals[token]
which is contract token balance when bounty is closed. a malicious winner can inflate contract token balance before closing by depositing huge amount for short time and then call permissioned claim and code would close the bounty and transfer more amount to winner and the he would refund his deposit, by doing this malicious winner can withdraw other winner funds.Vulnerability Detail
This is
_claimTieredPercentageBounty()
code in ClaimManagerV1 contract:As you can see when bounty is open code calls
bounty.closeCompetition()
to close the bounty. and then code loops through deposit tokens in the bounty and callsbounty.claimTiered(tierID, tokenAddress)
to transfer winner funds.This is the
closeCompetition()
code in TieredPercentageBounty contract which records contract's current token balances in thefundingTotals[]
array.This is
claimTiered()
code in TieredPercentageBountyV1 contract:as you can see code calculates winner prize amount based on
fundingTotals[token]
and tier share of the bounty prize. a malicious winner can use this and inflate the value of thefundingTotals[token]
by depositing before the time that bounty close and then call claim and receive more funds and then refund his tokens. these are the steps attacker would perform:ClaimManagerV1.permissionedClaimTieredBounty()
to withdraw his wining prize._claimTieredPercentageBounty()
to send winner prize and because bounty is still open code would first callbounty.closeCompetition()
to close the bounty and functioncloseCompetition()
would set the value of thefundingTotals[USDT] = 20K
.claimTiered(User1, 1, USDT)
and the prize amount would calculate as20K * 50% = 10K
and 10K USDT would be transferred to User1.Impact
Malicious winner can steal other winners funds.
Code Snippet
https://github.com/sherlock-audit/2023-02-openq/blob/main/contracts/ClaimManager/Implementations/ClaimManagerV1.sol#L203-L272
https://github.com/sherlock-audit/2023-02-openq/blob/main/contracts/Bounty/Implementations/TieredPercentageBountyV1.sol#L104-L120
https://github.com/sherlock-audit/2023-02-openq/blob/main/contracts/Bounty/Implementations/TieredPercentageBountyV1.sol#L123-L136
Tool used
Manual Review
Recommendation
prevent funds from refunding for some time when contract is closed.
Duplicate of #275
The text was updated successfully, but these errors were encountered: