Closed c4-bot-2 closed 8 months ago
gzeon-c4 marked the issue as sufficient quality report
gzeon-c4 marked the issue as primary issue
more than 18 decimals is out of scope
yanisepfl (sponsor) disputed
more than 18 decimals is out of scope
As stated above, we accept only assets and IBTs with respective decimals dA and dIBT such that 6 <= dA <= dIBT <= 18.
We therefore dispute this issue.
JustDravee marked the issue as unsatisfactory: Invalid
Lines of code
https://github.com/code-423n4/2024-02-spectra/blob/main/src/tokens/PrincipalToken.sol#L41 https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/extensions/ERC4626.sol#L107
Vulnerability details
Impact
Impossible to create principal tokens for OpenZeppelin vaults that has
decimalsOffset
> 0.Proof of Concept
Since v4.9 OpenZeppelin introduced configurable virtual assets and shares in the form of
_decimalsOffset
to mitigate the risk of "donation" attacks. https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/extensions/ERC4626.sol#L222-L234This way offset is added to the shares decimal count
Assuming that most of underlying tokens has 18 decimals, offsets bigger than 0 would make such vaults incompatible with Spectra principal tokens, because there is a strict check on ERC4626 decimals that prevents the principal token initialization. https://github.com/code-423n4/2024-02-spectra/blob/main/src/tokens/PrincipalToken.sol#L143-L148
Tools Used
Manual review
Recommended Mitigation Steps
Consider making exception for vaults with
decimalsOffset
function.Assessed type
ERC4626