-
Notifications
You must be signed in to change notification settings - Fork 6
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
The Invariant can be broken as 1 NOTE does not always equal to 1 cNOTE. #412
Comments
minhquanym marked the issue as insufficient quality report |
Seems invalid. |
MarioPoneder marked the issue as unsatisfactory: |
hi @MarioPoneder
This issue is valid and a High, I request you review this issue again. Elaboration Quick example
You can see that the 1 asD to 1 NOTE peg is broken. Thank you for your time sir, I appreciate it. |
Continuing your example: This exchange rate is ever increasing, see https://docs.compound.finance/v2/ctokens/#exchange-rate
Therefore you can always get back the amount of NOTE tokens you deposited. |
Thanks @MarioPoneder |
Thank you! |
Lines of code
https://github.com/code-423n4/2023-11-canto/blob/335930cd53cf9a137504a57f1215be52c6d67cb3/asD/src/asD.sol#L63
https://github.com/code-423n4/2023-11-canto/blob/335930cd53cf9a137504a57f1215be52c6d67cb3/asD/src/asD.sol#L52
Vulnerability details
Impact
users will not be able to redeem their asD tokens for equivalent amount of NOTE because when minting cNOTE, 1 cNOTE doesn't always equal 1 NOTE.
Link to site here
as of when the image above was taken, you needed exactly 1.0042 NOTES to be able to get 1 cNOTE, and you can see in the mint() function,
if a user deposits 1 NOTE, the contract gets 0.9958 cNOTE and mint to the user 1 asD, whenever the user wants to burn that 1 asD for an equivalent 1 NOTE, the call to
cNoteToken.redeemUnderlying(_amount)
in burn() will revert as the contract's balance of cNOTE will not be able to redeem 1 NOTE from the cNOTE contract.The issue with this is that
Click here
Proof of Concept
1.0042 NOTE = 1 cNOTE
.Here you can see User A has unknowingly taken a share of User B's N0TE causing loss to User B, NOTE This is a simplified Instance, where in huge amount a lot of issues can arise as many users are in the protocol.
Tools Used
Manual review
Recommended Mitigation Steps
my recommendation would be to require that the amount of cNOTE minted for the contract is equivalent to the amount of asD token to be minted to the user on the call to mint().
Assessed type
Other
The text was updated successfully, but these errors were encountered: