Platform: Code4rena
Start Date: 05/01/2023
Pot Size: $90,500 USDC
Total HM: 55
Participants: 103
Period: 14 days
Judge: Picodes
Total Solo HM: 18
Id: 202
League: ETH
Rank: 68/103
Findings: 1
Award: $69.09
🌟 Selected for report: 0
🚀 Solo Findings: 0
69.0905 USDC - $69.09
https://github.com/code-423n4/2023-01-astaria/blob/main/src/PublicVault.sol#L251-L265 https://github.com/AstariaXYZ/astaria-gpl/blob/4b49fe993d9b807fe68b3421ee7f2fe91267c9ef/src/ERC4626-Cloned.sol#L112
The first deposit with a totalSupply
of zero shares will mint shares equal to the deposited amount.
File: lib/gpl/src/ERC4626-Cloned.sol 112: return supply == 0 ? assets : assets.mulDivDown(supply, totalAssets());
File: PublicVault.sol function deposit(uint256 amount, address receiver) public override(ERC4626Cloned) whenNotPaused returns (uint256) { VIData storage s = _loadVISlot(); if (s.allowListEnabled) { require(s.allowList[receiver]); } uint256 assets = totalAssets(); return super.deposit(amount, receiver); }
Problems with the code:
It can lead to some part of Fund getting stolen from First Depositor (which will be the LP Provider).
Consider the following situation:
Here is the Detail analysis of the above PoC done by Spearbit.
This analysis confirms this clear Path of attack which can be used by the attacker.
Manual Review
#0 - c4-judge
2023-01-23T16:16:20Z
Picodes marked the issue as primary issue
#1 - c4-judge
2023-01-23T16:20:53Z
Picodes marked the issue as duplicate of #588
#2 - c4-judge
2023-02-24T10:22:17Z
Picodes marked the issue as satisfactory