Users holding eip-20 approval cannot redeem or withdraw their funds. #89
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%)
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#L806-L808
https://github.com/code-423n4/2024-02-spectra/blob/383202d0b84985122fe1ba53cfbbb68f18ba3986/src/tokens/PrincipalToken.sol#L829-L831
Vulnerability details
Impact
Incompatibility with eip-5095 will result in the integrator not being able to redeem or withdraw funds in accordance with the standard integration.
Proof of Concept
In the documentation, we can see that redeem and withdraw are compliant with the eip-5095 standard.
In the redeem and withdraw methods, the standard requires:
https://eips.ethereum.org/EIPS/eip-5095#redeem
In the code we can see that if the owner is not equal to msg.sender it REVERTS.
https://github.com/code-423n4/2024-02-spectra/blob/383202d0b84985122fe1ba53cfbbb68f18ba3986/src/tokens/PrincipalToken.sol#L829-L831
And according to the standard requirements, when the owner is not equal to msg.sender, it should be performed
in order to satisfy the standard requirement
You can refer to the reference implementation provided by the standard
Tools Used
Manual Review
Recommended Mitigation Steps
1._beforeRedeem can be modified to:
if (_owner != msg.sender) {
_spendAllowance(_owner, msg.sender, _shares);
}
2._beforeWithdraw remove _owner is not equal to msg.sender judgment, add to the
_withdrawShares method.
Assessed type
Other
The text was updated successfully, but these errors were encountered: