Submitted by gellej, also found by WatchPug, Czar102, csanuragjain, p4st13r4, pedroais, TomFrenchBlockchain, defsec, hubble, gzeon, 0x1f8b, and sirhashalot
The contest explicitly asks to analyze the contract for Rug Vectors, so that is what this issue is about.
I have classified this issue as high risk - although the vulnerability is considerable, the attacks themselves are not very likely to occur (they depend on the owner and/or the proxy admin to be compromised). The main reason why I believe the vulnerabiity is high is because the very fact that all these factors exist can make the sale fail, as informed users will avoid the contract completely one they realize the extent in which the contract is manipulable.
In the current implementation, there several ways that investors can lose funds if the owner of the contract is not well behaved. These risks can be divided into two kinds:
The contract is vulnerable to all three types of vulnerabilities (rug pull, griefing and inactivity).
(1) Loss of funds due to owner inactivity:
(1a) If the owner does never funds the contract, the buyers will not receive their tokens, and have no recourse to get their investment back
(1b) If the owner does not call finalize, buyers will not receive their tokens, and and have no recourse to get their investment back
(2) Griefing attacks by the owner (attacks that that have no immediate gain for the attacker, but are either annoying or lead to loss of funds)
(2a) the owner can change many essential conditions of the sale: for example, the price, the start time, the duration, the guest list, and the total amount of tokens that are allowed to be sold. The owner can do this at any moment, also while the sale is in course. This allows for all kinds of griefing attacks. It also voids the whole point of using a smart contract in the first place.
(2b) Owner can pause the contract at any time, which will freeze the funds in the contract, as it also disallows users to claim their tokens
(3) Rug pull by owner (attacks with financial gain for the attacker, buyer loses money)
(3a) The Owner can call sweep at any time and remove all unsold CTDL tokens while the sale is in progress. Future buyers will still be able to buy tokens, but the sale can never be finalized (unless the owner funds the contract)
(3b) Owner can front-run buyers and change the price. I.e. the owner can monitor the mem pool for a large buy transaction and precede the transaction with her own transaction that changes the price to a very low one. If the price is low enough, getAmountOut will return 0, and the buyers will lose her funds and not receive any CTDL tokens at all.
(4) Rug pull by proxy Admin
(4a) Although no deployment script is provided in the repo, we may assume (from the tests and the fact that the contracts are upgradeable) that the actual sale will be deployed as a proxy. The proxy admin (which may not be the same account as the owner) can change the implementation of the contract at any time, and in particular can change the implemention logic in such a way that all the funds held by the contract can be sent to the attacker.
0xleastwood (judge) decreased to Medium severity and commented:
0xleastwood (judge) commented:
