-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PrincipalToken is not fully EIP5095 compliant #33
Comments
gzeon-c4 marked the issue as primary issue |
gzeon-c4 marked the issue as high quality report |
yanisepfl (sponsor) confirmed |
This is a good catch, thanks! |
JustDravee marked the issue as satisfactory |
JustDravee marked the issue as partial-75 |
JustDravee marked issue #210 as primary and marked this issue as a duplicate of 210 |
Hi @ZanyBonzy , Basically, wardens more or less grouped a certain amount of lack of compliance and I went with numbers. I counted yours as having 2 categories of them: those related to But here, yours failed to mentioned that Again, your report is indeed of high quality, and it wasn't easy finding a fair solution here, given the different mixes of different lack of compliance issues. |
Lines of code
https://github.com/code-423n4/2024-02-spectra/blob/383202d0b84985122fe1ba53cfbbb68f18ba3986/src/tokens/PrincipalToken.sol#L460
https://github.com/code-423n4/2024-02-spectra/blob/383202d0b84985122fe1ba53cfbbb68f18ba3986/src/tokens/PrincipalToken.sol#L466
https://github.com/code-423n4/2024-02-spectra/blob/383202d0b84985122fe1ba53cfbbb68f18ba3986/src/tokens/PrincipalToken.sol#L493
https://github.com/code-423n4/2024-02-spectra/blob/383202d0b84985122fe1ba53cfbbb68f18ba3986/src/tokens/PrincipalToken.sol#L229-L275
https://github.com/code-423n4/2024-02-spectra/blob/383202d0b84985122fe1ba53cfbbb68f18ba3986/src/tokens/PrincipalToken.sol#L278-L326
Vulnerability details
Impact
maxWithdraw
,maxWithdrawIBT
,previewWithdrawIBT
andpreviewWithdraw
must not revert, but are pausable, causing them to revert when the contract is paused.The
redeem
functions must be callable by the owner or a user approved by the ownerThe
withdraw
functions must be callable by the owner or a user approved by the ownerProof of Concept
The PrincipalToken contract aims to be fully EIP5095 compliant, but isn't fully compliant, breaking composability.
maxWithdraw
,maxWithdrawIBT
,previewWithdrawIBT
andpreviewWithdraw
must not revertThese functions hold a
whenNotPaused
modifier, causing them to revert when the contract is paused.According to the ERC5095 spec,
According to the ERC5095 spec,
redeem
functions must be callable by the owner or a user approved by the ownerThese functions call the
_beforeRedeem
function, which burns the shares from the owner. Note that the function reverts ifmsg.sender
is not the owner.Hence, an approved user cannot redeem on behalf of the owner.
But according to the spec,
_beforeWithdraw
reverts butwithdrawIBT
andwithdraw
should be performable by owner or approved ownerThese functions all call the
_beforeWithdraw
function, which burns the shares from the owner. Note that the function reverts ifmsg.sender
is not the owner.Hence, an approved user cannot withdraw on behalf of the owner.
But according to the spec,
Tools Used
Manual code review
Recommended Mitigation Steps
maxWithdraw
,maxWithdrawIBT
,previewWithdrawIBT
andpreviewWithdraw
must not revertRemove the
whenNotPaused
modifier and for themaxWithdraw
/maxWithdrawIBT
function, return 0 when paused.redeem
functions must be callable by the owner or a user approved by the ownerRefactor the check for unauthorized caller in the
_beforeRedeem
function to include approved holders. Include also a check that allowance => shares to redeem.withdraw
functions must be callable by the owner or a user approved by the ownerRefactor the check for unauthorized caller in the
_beforeWithdraw
function to include approved holders. Include also a check that allowance => shares to redeem.Assessed type
Other
The text was updated successfully, but these errors were encountered: