You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Sep 22, 2024. It is now read-only.
DuplicateA valid issue that is a duplicate of an issue with `Has Duplicates` labelMediumA valid Medium severity issueRewardA payout will be made for this issue
calculateMaxAllocation computes max allocation incorrectly
Summary
calculateMaxAllocation takes the maximum of userMaxAllc and maxAllocation in order to compute the max allocation. However, it should be taking the minimum.
The way that this is currently written, even if the user has very little or even no allocation, they will get up to maxAllocation. This is clearly not intended protocol design and ends up allowing users to take way more allocation than intended, defeating the purpose of a private token sale. Users can also sybil with this to take extreme amounts more allocation than intended.
sherlock-admin2
changed the title
Savory Khaki Goldfish - calculateMaxAllocation computes max allocation incorrectly
s1ce - calculateMaxAllocation computes max allocation incorrectly
Mar 28, 2024
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
DuplicateA valid issue that is a duplicate of an issue with `Has Duplicates` labelMediumA valid Medium severity issueRewardA payout will be made for this issue
s1ce
high
calculateMaxAllocation
computes max allocation incorrectlySummary
calculateMaxAllocation
takes the maximum ofuserMaxAllc
andmaxAllocation
in order to compute the max allocation. However, it should be taking the minimum.Vulnerability Detail
Here is the relevant code:
The way that this is currently written, even if the user has very little or even no allocation, they will get up to
maxAllocation
. This is clearly not intended protocol design and ends up allowing users to take way more allocation than intended, defeating the purpose of a private token sale. Users can also sybil with this to take extreme amounts more allocation than intended.Impact
Users can take way more allocation than intended
Code Snippet
https://github.com/sherlock-audit/2024-03-zap-protocol/blob/main/zap-contracts-labs/contracts/TokenSale.sol#L259
Tool used
Manual Review
Recommendation
Take min instead of max
Duplicate of #152
The text was updated successfully, but these errors were encountered: