Platform: Code4rena
Start Date: 21/12/2021
Pot Size: $30,000 USDC
Total HM: 20
Participants: 20
Period: 5 days
Judge: Jack the Pug
Total Solo HM: 13
Id: 70
League: ETH
Rank: 6/20
Findings: 3
Award: $1,437.93
🌟 Selected for report: 1
🚀 Solo Findings: 0
🌟 Selected for report: TomFrenchBlockchain
Also found by: certora
647.066 USDC - $647.07
certora
https://github.com/code-423n4/2021-12-vader/blob/main/contracts/dex-v2/pool/VaderPoolV2.sol#L153
mintSynth
is vulnerable to price manipulation.
amountSynth
is calculated based on the current price, which can be manipulated.
Pool funds can be stolen.
pool funds can be stolen in the following steps:
take a flashloan of foreignAsset
.
swap the loan amount to the native asset, thus raising its price.
call mintSynth
to mint synth for cheap price.
swap the native asset from the swap back to foreignAsset
.
burn all synth for a high price.
swap some of the native asset to foreignAsset
to have enough funds to repay the flashloan.
repay the flash loan and take the profit.
burnSynth is also vulnerable to price manipulation!
#0 - jack-the-pug
2022-03-13T15:17:20Z
Dup #5
647.066 USDC - $647.07
certora
https://github.com/code-423n4/2021-12-vader/blob/main/contracts/x-vader/XVader.sol#L31
xVADERToMint
can be rounded down to zero. It is very likely if the ratio totalVader / totalShares
is very large.
users funds can be stolen.
consider the following scenario:
the XVader contract is created.
An attacker calls enter
in XVder with _amount == 1.
one share will be minted, because totalShares == 0
.
then the attacker transfers 1,000,000 vader to the contract.
now another user calls enter
with _amount == 500,000
the amount of shares that would be minted is:
(_amount * totalShares) / totalVader, which is (500000 * 1) / 1000000 == 0
the user paid 500000 vader and got nothing, the attacker still holds all of the shares.
then the attacker calls leave and gets 1,500,000 vader (they stole all vader from the second user)
add:
require(xVADERToMint > 0);
#0 - jack-the-pug
2022-03-13T15:30:11Z
Dup #179
🌟 Selected for report: certora
143.7924 USDC - $143.79
certora
https://github.com/code-423n4/2021-12-vader/blob/main/contracts/tokens/vesting/LinearVesting.sol#L129
unsafe cast.
if vestedAmount
is greater than type(uint192).max
, it will be truncated and a malicious user will be able to claim reward infinite times and drain the system because the burned amount will be truncated.
add:
require( vestedAmount <= type(uint192).max, "LinearVesting::vestFor: Amount Overflows uint192" );
#0 - jack-the-pug
2022-03-12T04:25:55Z
Low impact, unlikely to happen. Therefore, it's a low
.