-
Notifications
You must be signed in to change notification settings - Fork 4
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
Sensitive Bug, disclosed via Code4rena HelpDesk #453
Comments
ydspa marked the issue as insufficient quality report |
For transparency, the |
0xble (sponsor) confirmed |
Would like to note this setup is not currently possible in production due to the way we allow crowdfunds to be configured for ETH raises in our UI at party.app. This is because either |
ydspa marked the issue as sufficient quality report |
@0xble & @judge if this would be eventually accepted, please mark these batch #552 as dups of this one. my initial opinion is OOS, I left a comment earlier at #552 (comment) |
Posting this here too for reference:
In our comment we mention "In this scenario users will have to wait until the crowdfund expires or a host finalizes", but in this finding's scenario it would not be possible for a host to finalize. Another, probably more significant, factor behind us changing our minds to consider this valid and "sponsor confirmed" is that the mitigation proposed cleanly prevents the scenario from happening. Perhaps we are being too lenient here to consider it valid. I do not entirely disagree with #552 (comment). I'll just give the reasoning behind why we chose to confirm the issue, but would like to leave it to @judge to ultimately decide as I lack context on the standard C4 usually applies to validate finding. |
This is clearly out-of-scope, the fact that the proposed mitigation is good should not affect the validity of this issue for fairness. |
gzeon-c4 marked the issue as duplicate of #552 |
gzeon-c4 marked the issue as unsatisfactory: |
@gzeon-c4 Thanks for taking a look at the issue. I'd like to emphasize that, in my perspective, this issue should not be considered out of scope based on the following arguments. The rationale for categorizing this issue as out of scope is primarily linked to the comment in Line 247-254. However, it's crucial to note that the comment discusses a different scenario and severity. Specifically, the comment states, "In this scenario users will have to wait until the crowdfund expires or a host finalizes after Furthermore, the comment illustrates a situation where It's crucial to note that my issue outlines a method by which a malicious user could exploit the vulnerability to freeze other users' funds or potentially lead to a loss of user funds, due to the arbitrarily selectable duration of the crowdfund. Unlike the situation described in the comment, a "permanent" loss of user funds would be possible in my case. According to the comment, the host can always close the funds after a sufficient number of deposits have been received. This is impossible in the state my issue describes, as minTotalContributions can never be reached, further differentiating the issues. Additionally, I'd like to point out that among the issues raised by @ydspa in batch #552, only issue #127 has demonstrated how this vulnerability can be exploited and is a valid duplicate. |
gzeon-c4 marked the issue as unsatisfactory: |
gzeon-c4 changed the severity to 2 (Med Risk) |
Fair, judging as Med due to fund are only stuck but not lost in a reasonably configured party (expire after realistic duration) |
gzeon-c4 marked the issue as satisfactory |
Lines of code
https://github.com/code-423n4/2023-10-party/blob/main/contracts/party/IPartyFactory.sol#L2
Vulnerability details
Filler, LineNumber is also random
Assessed type
Other
Bug Description
The current crowdfund implementation enforces restrictions on the minimum and maximum total contributions it can receive, as well as the minimum and maximum size of an individual contribution. However, a vulnerability exists because the crowdfund neglects to check if the difference between
minTotalContributions
andmaxTotalContributions
is smaller thanminContribution
.Due to this a malicious user can push the
totalContributions
into a state where the deposited funds are below theminTotalContributions
but if another user would donate theminContribution
it would be pushed above themaxTotalContributions
. In this case all users would have to wait for the crowdfund to expire. As the duration can be set up totype(uint40).max
which is 34,842 years, in the worst case all the users funds will be effectively lost.Impact
The impact of this issue varies based on the duration set for the crowdfund. In the best-case scenario, users' funds are temporarily locked up until the crowdfund concludes, typically within a timeframe such as 7 days (as used in the testcases). However, users can specify the duration, and an arbitrarily high value could lead to a prolonged freeze, possibly rendering the funds unrecoverable within their lifetime.
If
maxTotalContributions - minTotalContributions
is small a malicious user would just need to sacrifice a small amount to freeze an arbitrary size amount of other user funds. If the crowdfund does not run for too long, the user could do this just to DOS other users as he will anyways be able to reclaim his funds usingrefund()
. If the expiry time is very high, the malicious user would need to sacrifice his funds too, but if he would be able to freeze 1000s of ETH for the cost of a single ETH, it can still be a valid attack path for a malicious actor.So in summary we have 2 different impact levels here. If the expiry time is within a reasonable timeframe a attacker is able to DOS a crowdfund for the predefined timeframe, which will most likely be above 15 minutes. This could for example be for a NFT he also wants to bid on. If the expiration timeframe will be large, a user will be able to freeze other users funds "forever", by sacrificing some of his funds.
The only way the funds could be rescued is by using the
emergencyExecute()
functionality. If this functionality is disable the user funds will be stuck until the end of the expiry period.Proof of Concept
The provided test case exemplifies the described problem. Users contribute to a crowdfund, and just before reaching the full amount, a malicious user deposits the exact amount to prevent the crowdfund from closing. Now the other users need to wait until the end of the expiry to be able to reclaim their funds.
The following testcase can be added to the
InitialETHCrowdfund.t.sol
file and run usingforge test -vvvv --match-test "test_malciousUserCanDosCrowdfund"
Tools Used
Manual Review
Recommended Mitigation Steps
To mitigate this vulnerability, the crowdfund initialization process should include a check to ensure that
maxTotalContributions - minTotalContributions
is greater than theminContribution
. This can be implemented by incorporating the following check into the_initialize()
function ofETHCrowdfundBase
:The text was updated successfully, but these errors were encountered: