PrincipalToken deployment might be failed if the IBT stores assets as ERC20 and not as an address.
Proof of Concept
In PrincipalToken.sol contract's Line no 131 assumes that IERC4626(_ibt).asset() will return address type variable all the time but that might not be the case in some scenarios, e.g. in EIP4626 they mentioned return value MUST be an EIP-20 token contract and also,
outputs:name: assetTokenAddress
type: address
Also for the solmate's ERC4626 contract it's stores asset as ERC20 type not as an address so any contract that uses solmate ERC4626 or stores asset as ERC20 type then PrincipalToken deployment with that can be problematic. So handle the situation properly.
Tools Used
Manual Analysis
Recommended Mitigation Steps
Handle both ERC20 and address scenarios in the contract don't only expect for address type.
Lines of code
https://github.com/code-423n4/2024-02-spectra/blob/main/src/tokens/PrincipalToken.sol#L131
Vulnerability details
Impact
PrincipalToken deployment might be failed if the IBT stores assets as ERC20 and not as an address.
Proof of Concept
In PrincipalToken.sol contract's Line no 131 assumes that
IERC4626(_ibt).asset()
will return address type variable all the time but that might not be the case in some scenarios, e.g. in EIP4626 they mentioned return value MUST be an EIP-20 token contract and also,Also for the solmate's ERC4626 contract it's stores asset as ERC20 type not as an address so any contract that uses solmate ERC4626 or stores
asset
as ERC20 type then PrincipalToken deployment with that can be problematic. So handle the situation properly.Tools Used
Manual Analysis
Recommended Mitigation Steps
Handle both ERC20 and address scenarios in the contract don't only expect for address type.
Assessed type
ERC4626