The Principal Token is not ERC-5095 compliant #235
Labels
2 (Med Risk)
Assets not at direct risk, but function/availability of the protocol could be impacted or leak value
bug
Something isn't working
duplicate-210
partial-50
Incomplete articulation of vulnerability; eligible for partial credit only (50%)
🤖_33_group
AI based duplicate group recommendation
sufficient quality report
This report is of sufficient quality
Lines of code
https://github.com/code-423n4/2024-02-spectra/blob/main/src/tokens/PrincipalToken.sol#L806-L808
https://github.com/code-423n4/2024-02-spectra/blob/main/src/tokens/PrincipalToken.sol#L483-L485
https://github.com/code-423n4/2024-02-spectra/blob/main/src/tokens/PrincipalToken.sol#L460-L462
Vulnerability details
Impact
The Principal Token deviate from the ERC-5095 specification which may break external integrations.
Proof of Concept
ERC-5095 stipulates:
However, the PrincipalToken.redeem function calls the _beforeRedeem function:
This reverts if the owner is not the sender, thus violating ERC5095.
ERC-5095 also states:
As previously explained, the PrincipalToken.redeem calls the _beforeRedeem function, which has a whenNotPaused modifier, meaning redemption can be paused by the owner.
However, the maxRedeem function will return maxBurnable of the user if redemption is paused:
It's important to note the same issue exists in the maxWithdraw function, as it will still call convertToUnderlying with the user's maxBurnable even if the contract is paused. maxWithdraw has a whenNotPaused modifier, which will revert, although the ERC clearly states:
Tools Used
Manual review
Recommended Mitigation Steps
Consider following the ERC-5095 specifications.
Assessed type
Other
The text was updated successfully, but these errors were encountered: