withdraw and redeem currently revert when the allowance is larger than the requested amount. However, this should be the other way around. Therefore, the methods do not work with allowances, as in the case allowed < previewAmount (or allowed < principalAmount), the subtraction of the allowance will revert.
Recommended Mitigation Steps
Change the checks to allowed < previewAmount / allowed < principalAmount.
Lines of code
https://github.com/code-423n4/2022-07-swivel/blob/67c6900222cc4045d7fe2227a1ea73e0251374ed/Creator/ZcToken.sol#L112 https://github.com/code-423n4/2022-07-swivel/blob/67c6900222cc4045d7fe2227a1ea73e0251374ed/Creator/ZcToken.sol#L133
Vulnerability details
Impact
withdraw
andredeem
currently revert when the allowance is larger than the requested amount. However, this should be the other way around. Therefore, the methods do not work with allowances, as in the caseallowed < previewAmount
(orallowed < principalAmount
), the subtraction of the allowance will revert.Recommended Mitigation Steps
Change the checks to
allowed < previewAmount
/allowed < principalAmount
.