veToken Finance contest - Kumpa's results

Lock more veAsset permanently.

General Information

Platform: Code4rena

Start Date: 26/05/2022

Pot Size: $75,000 USDT

Total HM: 31

Participants: 71

Period: 7 days

Judge: GalloDaSballo

Total Solo HM: 18

Id: 126

League: ETH

veToken Finance

Findings Distribution

Researcher Performance

Rank: 25/71

Findings: 2

Award: $661.92

🌟 Selected for report: 1

πŸš€ Solo Findings: 0

Findings Information

🌟 Selected for report: Kumpa

Also found by: SecureZeroX, unforgiven

Labels

bug
2 (Med Risk)
disagree with severity

Awards

562.3122 USDT - $562.31

External Links

Lines of code

https://github.com/code-423n4/2022-05-vetoken/blob/2d7cd1f6780a9bcc8387dea8fecfbd758462c152/contracts/VeAssetDepositor.sol#L38-L51

Vulnerability details

since _maxTime needs to be manually input in the constructor with no other ways of changing it, if the owner inputs the _maxTime that is higher than the capacity of each vaults of veTokens, it will cause IVoteEscrow(escrow).increase_unlock_time(_value); to get rejected.

In the mild case when a user initially locks the asset during depositing, the contract will simply revert the transaction.

In the severe case when a user does not lock the asset during depositing, the asset will end up locked in the contract since noone will be able to succesfully call lockVeAsset. This will cause the asset to be locked up with no way of withdrawing it. Even though a user will still get benefits from the minted reward, a contract will not be able to receive any benefits since it can't utilize the locked asset in VeAssetDepositor.

Proof of Concept

Pic 1

1.The owner initially sets _maxTime in constructor to be 126489600 (864003664) instead of 126144000 (864003654) which is the maximum time that a user can deposit in curve

Pic 2

2.A user deposit veAsset but deferring the locking to save gas

3.The veAsset is transferred from a user to the contract and the contract mint a reward token to the user

Pic 3
Pic 4
Pic 5

4.The veAsset will not be able to move to the staking contract because when VoterProxy calls increase_unlock_time in the targeted vault, the call will get reverted due to exceeded _value of unlockAt

mitigation

The owner should set the value of _maxTime in advance for each veAsset and not relying on manual inputting during the constructoring as the risk of misconfiging ot is high. Otherwise the contract should add an emergency measure that can help change _maxTime but this function needs to be protected with the highest security (eg. with timelock and multisig).

#0 - solvetony

2022-06-15T15:52:37Z

We can set it by a function instead of a constructor. Middle risk.

#1 - GalloDaSballo

2022-07-21T02:29:28Z

The warden has shown how, due to misconfiguration a lock may not be created, causing tokens to be stuck in the contract.

We can confirm that a revert would happen by checking VotingEscrow

Because this is contingent on a wrong configuration I believe Medium Severity to be more appropriate.

Findings Information

🌟 Selected for report: xiaoming90

Also found by: 0xNazgul, FSchmoede, Funen, Kumpa, VAD37, berndartmueller, cccz, kirk-baird

Labels

bug
duplicate
2 (Med Risk)
disagree with severity

Awards

99.6119 USDT - $99.61

External Links

Lines of code

https://github.com/convex-eth/platform/blob/1f11027d429e454dacc4c959502687eaeffdb74a/contracts/contracts/Booster.sol#L145-L161

Vulnerability details

Booster.setFees does not specify ranges for each incentives even though there is a comment stating that these values should be in certain ranges. This loop hole enable malicious feeManager to set fee for his own benefit. If feeManager is the owner, he could make platformFee == MaxFee and reduce other incentives to zero. If feeManager is seperate from the owner and does not have an access to platform's treasury, he could set _callerFees == MaxFee and call earmarkRewards to collect the highest fee possible before setting it back to normal.

Proof of Concept

Pic 1 0

Mitigation

The owner should specify a clear range for each incentives and fees and make it a require function so that feeManager will not be able to arbitariry adjust it to his benefit (max and min can be adjusted )

*example the owner should add this ranges before setting up incentives and fees (max and min can be adjusted )

(require _lockFees >= 1000 && _lockFees <= 1500 && _stakerFees >= 300 && _stakerFees <= 600 && _callerFees >= 10 && _callerFees <= 100 && _platform <= 200)

#0 - solvetony

2022-06-15T16:42:39Z

Lower severity. Also duplicates #93

#1 - GalloDaSballo

2022-07-25T00:54:41Z

Dup of #215

AuditHub

A portfolio for auditors, a security profile for protocols, a hub for web3 security.

Built bymalatrax Β© 2024

Auditors

Browse

Contests

Browse

Get in touch

ContactTwitter