-
Notifications
You must be signed in to change notification settings - Fork 0
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
A Malicious DSS can easily bypass the slashing limits and slash all the Assets in a Vault #28
Comments
MiloTruck marked the issue as not a duplicate |
MiloTruck marked the issue as unsatisfactory: |
The DSS is assumed to be non-malicious - operators will only register and deploy vaults for a DSS that it trusts.
You're assuming that a DSS will know 8 days in advance when it wants to slash an operator. If the DSS wanted to slash 100% of assets, it could just call |
MiloTruck marked the issue as unsatisfactory: |
Hey Judge Sahab @MiloTruck, Sir very respectfully, I think you have completely mis-understood this finding because all the points you mentioned above are incorrect.
The DSS is not a trusted party, it can behave maliciously, that's exactly why there are slashing percentage limits and
Obviously a DSS will know when the operator is going to get slashed because DSS is the one that is going to slash operators. I think here, you are confusing the DSS Slashing with the Beacon chain slashing. Just to be clear, this vulnerability only exists in the Core/Vaults not in the Native Vault.
How is this is even possible, if the slashing limit is set to lets say 25%!?
This is not possible as well, a DSS cannot randomly call requestSlashing() and finalizeSlashing(), there is a waiting period before he can requestSlashing again, also there is a VETO_COMIITEE to cancelSlashing all the randomly/unfairly slash requests. The only was a DSS can slash 100% assets of the vault is by using this loop-hole, where VETO_COMIITEE will not gonna save users as well: transferAmount = Math.min(totalAssets(), totalAssetsToSlash); Also In this particular case, the VETO_COMIITEE is not gonna be able to do anything as well, as it cannot recognize who deposits funds, a DSS can simply use another ethereum address to deposit funds, which will just gonna make him another depositer and when the slashing is happening fairly, there is no reason for the committee to interfere and cancel slashing. #76 (comment) raises a very fair point, that "finishRedeem and finalizeSlashing can be executed within the same transaction. This means that the so-called Slashing Veto Committee has no chance to detect the issue because, before the slash occurs, the DSS shares are still in the vault." The mitigation I mentioned is on-point as well
I request you Judge Sahab @MiloTruck to re-review this issue pls. And I would also like to request the sponsors to review this report @dewpe @karan-andalusia @devdks25. Thanks! |
Will duplicate this to #76 as they both have the same root cause. Please do not tag the sponsors in an attempt to get your issues upgraded. Also, I encourage you to be less aggressive and pushy in future escalations. It's probably unintentional, but you come off as extremely disrespectful in your comments. |
Extremely sorry, I highly respect you and other wardens, from whom I learn, I'll def gonna take care of that in the future 🙏 And Thanks for the re-review. |
Lines of code
https://github.com/code-423n4/2024-07-karak/blob/f5e52fdcb4c20c4318d532a9f08f7876e9afb321/src/Vault.sol#L198
https://github.com/code-423n4/2024-07-karak/blob/main/src/NativeVault.sol#L311-L313
Vulnerability details
When a DSS requests slashing for a vault or operator, the
SlasherLib.requestSlashing
function calculates the amount to be slashed and stores it inearmarkedStakes
. This exactearmarkedStakes
amount is later used in thefinalizeSlashing
function to execute theslashAssets()
operation.The
slashAssets
function ensures that the amount to be slashedtotalAssetsToSlash
does not exceed the total assets currently available in the vault. If thetotalAssetsToSlash
is greater than thetotalAssets()
, then the slashing amount will betotalAssets()
.Issue
This opens the door for a malicious DSS to slash 100% of the assets available in the vault, regardless of whether the
maxSlashablePercentageWad
is set to 5%, 25%, or 50%. A DSS candeposit()
a large amount into a vault and then callrequestSlashing()
, and then withdraw its funds before executingfinalizeSlashing()
.Proof of Concept
Let's consider a vault with
100
tokens/assets in it, registered with a DSS whosemaxSlashablePercentageWad
is 50%.105
tokens into that vault and quickly callsstartRedeem()
, so the total assets in that vault are now205
.requestSlashing()
for that vault, which will set the earmarked stakes/total assets to slash to102.5
tokens.SLASHING_VETO_WINDOW
, the DSS willfinishRedeem()
for its 105 tokens and get back its funds.SLASHING_VETO_WINDOW
passes, and the DSS callsfinalizeSlashing()
, which executesslashAssets()
.slashAssets
function finds that total assets to slash is 102.5, but the total assets available are only 100, so it transfers all100
tokens to theSlashingHandler
.100%
slashed instead of the50%
(maxSlashablePercentageWad).Impact
Tools Used
Shaheen's Mindset
Recommended Mitigation Steps
Instead of setting the
totalAssetsToSlash
to thetotalAssets()
, whentotalAssets()
are less, re-calculate thetotalAssetsToSlash
or maybe revert the trx in that case, so the DSS canrequestSlashing
again.Assessed type
Context
The text was updated successfully, but these errors were encountered: