-
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
In some cases the crowdfund cant be finalized because the minContribution amount check is after the amount is reduced #552
Comments
Obviously it's a design choice, reference: https://github.com/code-423n4/2023-10-party/blob/b23c65d62a20921c709582b0b76b387f2bb9ebb5/contracts/crowdfund/ETHCrowdfundBase.sol#L247-L254 Invalid: design decision |
ydspa marked the issue as insufficient quality report |
ydspa marked the issue as primary issue |
gzeon-c4 marked the issue as unsatisfactory: |
gzeon-c4 marked the issue as unsatisfactory: |
gzeon-c4 marked the issue as unsatisfactory: |
gzeon-c4 marked the issue as satisfactory |
gzeon-c4 marked issue #127 as primary and marked this issue as a duplicate of 127 |
Lines of code
https://github.com/code-423n4/2023-10-party/blob/b23c65d62a20921c709582b0b76b387f2bb9ebb5/contracts/crowdfund/ETHCrowdfundBase.sol#L256
Vulnerability details
Because of a finding in the previous contest, the
minContribution
check is done after the amount is potentially reduced if refunding excess contribution. However this can be a problem if themaxTotalContributions
-minTotalContributions
is smaller than theminContribution
and in some cases the crowdfund can be lost because of this.Example:
When the last contributor wants to contribute he calls the function with 4 ether however the reduced amount will then be 3 ether and the tx will revert because of the
minContribution
check and the crowdfund will be lost.Impact
There will be no way to finalize the crowdfund and because of that it will be lost even though it was supposed to be finalized.
Proof of Concept
https://github.com/code-423n4/2023-10-party/blob/b23c65d62a20921c709582b0b76b387f2bb9ebb5/contracts/crowdfund/ETHCrowdfundBase.sol#L240
https://github.com/code-423n4/2023-10-party/blob/b23c65d62a20921c709582b0b76b387f2bb9ebb5/contracts/crowdfund/ETHCrowdfundBase.sol#L256
As you can see the amount is reduced and the check is done after it, the problem arises when the
maxTotalContributions
-minTotalContributions
is smaller than theminContribution
which will cause the crowdfund to be lost.Tools Used
Manual Review
Recommended Mitigation Steps
Because we cant move the check before the refund logic, the only way to prevent this is to check if the
minContribution
is bigger than themaxTotalContributions
-minTotalContributions
in the initialize functionAssessed type
Other
The text was updated successfully, but these errors were encountered: