Platform: Code4rena
Start Date: 21/08/2023
Pot Size: $125,000 USDC
Total HM: 26
Participants: 189
Period: 16 days
Judge: GalloDaSballo
Total Solo HM: 3
Id: 278
League: ETH
Rank: 112/189
Findings: 1
Award: $46.25
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: 0xWagmi
Also found by: 836541, Bauchibred, GangsOfBrahmin, Hama, IceBear, Inspecktor, Matin, MohammedRizwan, catellatech, erebus, lsaudit, niki, okolicodes, ravikiranweb3, tapir, vangrim, zaevlad
46.2486 USDC - $46.25
Vault deposits can be front-run and user funds stolen with ERC4626 inflation attack.
Attack scenario:
A hacker back-runs the transaction of LMPVault ERC4626 pool creation.
Take a look at this deposit function https://github.com/code-423n4/2023-08-dopex/blob/eb4d4a201b3a75dd4bddc74a34e9c42c71d0d12f/contracts/perp-vault/PerpetualAtlanticVaultLP.sol#L118C1-L124C1 in this part of the deposit function we can see that the require statement that checks shares and it calls the previewDeposit function https://github.com/code-423n4/2023-08-dopex/blob/eb4d4a201b3a75dd4bddc74a34e9c42c71d0d12f/contracts/perp-vault/PerpetualAtlanticVaultLP.sol#L123C3-L123C68 the previewDeposit then returns the converttoshares function as well: https://github.com/code-423n4/2023-08-dopex/blob/eb4d4a201b3a75dd4bddc74a34e9c42c71d0d12f/contracts/perp-vault/PerpetualAtlanticVaultLP.sol#L269 Then the convertToShares returns: https://github.com/code-423n4/2023-08-dopex/blob/eb4d4a201b3a75dd4bddc74a34e9c42c71d0d12f/contracts/perp-vault/PerpetualAtlanticVaultLP.sol#L282C1-L282C1
Reference: https://mixbytes.io/blog/overview-of-the-inflation-attack H01 of this audit report: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/audits/2022-10-ERC4626.pdf
Manual Review + H20
Implement the mitigation strategies here: https://blog.openzeppelin.com/a-novel-defense-against-erc4626-inflation-attacks
ERC4626
#0 - bytes032
2023-09-12T12:52:21Z
LQ because of front-running on Arb
#1 - c4-pre-sort
2023-09-15T08:28:15Z
bytes032 marked the issue as duplicate of #863
#2 - c4-pre-sort
2023-09-15T08:28:20Z
bytes032 marked the issue as sufficient quality report
#3 - c4-judge
2023-10-18T12:50:16Z
GalloDaSballo marked the issue as satisfactory