User can specify any erc20 token deposit into vault #23
Labels
3 (High Risk)
Assets can be stolen/lost/compromised directly
bug
Something isn't working
duplicate-368
🤖_23_group
AI based duplicate group recommendation
satisfactory
satisfies C4 submission criteria; eligible for awards
sufficient quality report
This report is of sufficient quality
Lines of code
https://github.com/code-423n4/2024-03-revert-lend/blob/main/src/V3Vault.sol#L384-L387
https://github.com/code-423n4/2024-03-revert-lend/blob/main/src/V3Vault.sol#L893-L898
Vulnerability details
Impact
User can specify any erc20 token deposit into the vault and borrow target vault asset. assume the erc20 token in vault is
USDC
, user can depositDAI
into vault and borrowUSDC
. NOTE thatUSDC
is 6 decimals andDAI
is 18 decimals. Result in vault lost of funds.Proof of Concept
User can use
permitData
interact withpermit2
contract to send token tovault
https://github.com/code-423n4/2024-03-revert-lend/blob/main/src/V3Vault.sol#L893-L898
then user get a certain vault shares depending on the amount.
https://github.com/code-423n4/2024-03-revert-lend/blob/main/src/V3Vault.sol#L885-L891
https://github.com/code-423n4/2024-03-revert-lend/blob/main/src/V3Vault.sol#L904
_mint(receiver, shares);
However user can specify any erc20 token protocol doesn't check the erc20 token
Here is my test add to V3Vault.t.sol:
output:
[PASS] testDepositToVaultCanBeAnyToken() (gas: 584675) Logs: vault USDC bal after bob deposit: 10000000 vault DAI bal after alice deposit: 2000000 alice USDC bal: 2000000 vault USDC bal: 8000000
Tools Used
Foundry
Recommended Mitigation Steps
Assessed type
ERC20
The text was updated successfully, but these errors were encountered: