The ERC-5095 standard is not followed correctly #197
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/383202d0b84985122fe1ba53cfbbb68f18ba3986/src/tokens/PrincipalToken.sol#L483-L484
https://github.com/code-423n4/2024-02-spectra/blob/383202d0b84985122fe1ba53cfbbb68f18ba3986/src/tokens/PrincipalToken.sol#L441-L443
Vulnerability details
Impact
Functionality is not working as expected
Proof of Concept
For the
maxRedeem
function, in EIP-5095 it is stated :Spectra has a pause function which can deactivate the
Deposit
,Redeem
andWithdraw
functions. The main problem is that whenRedeem
is paused the return value ofmaxRedeem
should be0
but in this case it is not, the return value ofmaxRedeem
will still return what it usually does even when theRedeem
function is disabled.This happens because when the user call the
maxRedeem
function it will produce a return value from the_maxBurnable
function. The code can be seen below :As can be seen in the codebase, this function does not have a modifier or logic that differentiates when the main Redeem function is in pause / unpause state so whatever state the return value is in, it will still return what it usually does. This also applies to the maxDeposit function, that function also does not follow existing standards and has the same problem.
Because
PrincipalToken
must follow EIP-5095 is main invariant, this issue breaks the main invariant and there are not just one but two functions that do not follow the existing standard. It can be concluded :Impact: Medium, as functionality is not working as expected but without a value loss
Likelihood: Medium, as multiple methods are not compliant with the standard
Tools Used
Manual review
Recommended Mitigation Steps
Go through the standards and follow it all.
Assessed type
Other
The text was updated successfully, but these errors were encountered: