-
Notifications
You must be signed in to change notification settings - Fork 8
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
xiaoming90 - Users can deny the vault from claiming reward tokens #63
Comments
Disagree with severity This should be high issue according to Sherlock rules:
Also look at similar high-severity issues from past audits: |
Escalate. This issue should be a High instead of Medium. Malicious users can easily cause Notional and its users to lose rewards by triggering the Note that this issue is exactly the same as the issue (sherlock-audit/2023-03-notional-judging#200) found in the past Notional contest, which was judged as a High finding. Thus, it should be consistently applied here. |
You've created a valid escalation! To remove the escalation from consideration: Delete your comment. You may delete or edit your escalation comment anytime before the 48-hour escalation window closes. After that, the escalation becomes final. |
I agree the severity should be high, don't see any extensive constraints here, even though the attack is griefing. Planning to accept the escalation and upgrade the severity. |
Result: |
Escalations have been resolved successfully! Escalation status:
|
Similar to #61, won't fix unless we ever see this becoming an issue. I think this is more of a hypothetical attack vector than a real one. If we had to fix this we would have to create some sort of manual override to the reward calculation. |
xiaoming90
High
Users can deny the vault from claiming reward tokens
Summary
Users can deny the vault from claiming reward tokens by front-running the
_claimVaultRewards
function.Vulnerability Detail
The
_claimVaultRewards
function will call the_executeClaim
function to retrieve the reward tokens from the external protocols (e.g., Convex or Aura). The reward tokens will be transferred directly to the vault contract. The vault computes the number of reward tokens claimed by taking the difference of the before and after balance.https://github.com/sherlock-audit/2024-06-leveraged-vaults/blob/main/leveraged-vaults-private/contracts/vaults/common/VaultRewarderLib.sol#L174
https://github.com/sherlock-audit/2024-06-leveraged-vaults/blob/main/leveraged-vaults-private/contracts/vaults/common/VaultRewarderLib.sol#L181
However, the
getReward
function of the external protocols can be executed by anyone. Refer to Appendix A for the actual implementation of thegetReward
function.As a result, malicious users can front-run the
_claimVaultRewards
transaction and trigger thegetReward
function of the external protocols directly, resulting in the reward tokens to be sent to the vault before the_claimVaultRewards
is executed.When the
_claimVaultRewards
function is executed, the before/after snapshot will ultimately claim the zero amount. The codebalanceAfter - balancesBefore[i]
at Line 174 above will always produce zero if the call to_claimVaultRewards
is front-run.As a result, reward tokens are forever lost in the contract.
Impact
High as this issue is the same this issue in the past Notional V3 contest.
Loss of assets as the reward tokens intended for Notional and its users are lost.
Code Snippet
https://github.com/sherlock-audit/2024-06-leveraged-vaults/blob/main/leveraged-vaults-private/contracts/vaults/common/VaultRewarderLib.sol#L174
https://github.com/sherlock-audit/2024-06-leveraged-vaults/blob/main/leveraged-vaults-private/contracts/vaults/common/VaultRewarderLib.sol#L181
Tool used
Manual Review
Recommendation
Consider using the entire balance instead of the difference between before and after balances.
Appendix A -
getReward
of Convex and Aura's reward pool contractAura's Reward Pool on Mainnet
https://etherscan.io/address/0x44D8FaB7CD8b7877D5F79974c2F501aF6E65AbBA#code#L980
Aura's Reward Pool on Arbitrum
https://arbiscan.io/address/0x17F061160A167d4303d5a6D32C2AC693AC87375b#code#F15#L296
Convex's Reward Pool on Arbitrum
https://arbiscan.io/address/0x93729702Bf9E1687Ae2124e191B8fFbcC0C8A0B0#code#F1#L337
Convex for Mainnet
https://etherscan.io/address/0xD1DdB0a0815fD28932fBb194C84003683AF8a824#code#L980
The text was updated successfully, but these errors were encountered: