Open c4-bot-3 opened 7 months ago
0xEVom marked the issue as primary issue
0xEVom marked the issue as sufficient quality report
kalinbas (sponsor) confirmed
jhsagd76 marked the issue as satisfactory
jhsagd76 marked the issue as selected for report
Lines of code
https://github.com/code-423n4/2024-03-revert-lend/blob/main/src/V3Vault.sol#L717-L725 https://github.com/code-423n4/2024-03-revert-lend/blob/main/src/V3Vault.sol#L893-L898 https://github.com/code-423n4/2024-03-revert-lend/blob/main/src/V3Vault.sol#L877-L917
Vulnerability details
In
V3Vault.sol
there all 3 instances ofpermit2.permitTransferFrom()
, all 3 does not check token transfered in is USDC token. Allowing user to craft permit signature from any ERC20 token and Vault will accept it as USDC.Impact
User can steal all USDC from vault using permit signature of any ERC20 token.
Proof of Concept
Here is how Vault accept USDC from user. Vault will accept
Uniswap.Permit2
signature transfer allowance from Permit2 then to vault contract. https://github.com/code-423n4/2024-03-revert-lend/blob/435b054f9ad2404173f36f0f74a5096c894b12b7/src/V3Vault.sol#L877C1-L917C6Below is permit signature struct that can be decoded from user provided data.
V3Vault.sol
need to checkTokenPermissions.token
is USDC, same as vault main asset.Uniswap.permit2.permitTransferFrom()
only check sign signature is correct. This is meaningless is Vault does not validate input data.This allow user to use any ERC20 token. give allowance and permit to
Uniswap.Permit2
Vault will accept any transfer token fromPermit2
as USDC.Allowing user to deposit any ERC20 token and steal USDC from vault.
Tools Used
Recommended Mitigation Steps
fix missing user input validation in 3 all instances of permit2 https://github.com/code-423n4/2024-03-revert-lend/blob/main/src/V3Vault.sol#L717C1-L725C15 https://github.com/code-423n4/2024-03-revert-lend/blob/main/src/V3Vault.sol#L893C1-L898C15 https://github.com/code-423n4/2024-03-revert-lend/blob/main/src/V3Vault.sol#L877C1-L917C6
Assessed type
ERC20