Skip to content
Access control Audit finding Intermediate

DAO or lsdn owner can steal funds from node runner

The contract lets the DAO or LSD network owner replace a node runner on a smart wallet without checking whether that wallet still holds ETH or rewards belonging to the original node runner. A malicious owner could swap the node runner for their own address and then withdraw the node runner's ETH or claim their rewards.

koxuan Follow

Originally disclosed on Code4rena

Submitted by koxuan

https://github.com/code-423n4/2022-11-stakehouse/blob/main/contracts/liquid-staking/LiquidStakingManager.sol#L356-L377

DAO or LSD network owner can swap node runner of the smart contract to their own eoa, allowing them to withdrawETH or claim rewards from node runner.

Proof of Concept

There are no checks done when swapping the node runner whether there are funds in the smart contract that belongs to the node runner. Therefore, a malicious dao or lsd network owner can simply swap them out just right after the node runner has deposited 4 ether in the smart wallet.

Place poc in LiquidStakingManager.sol

    function testDaoCanTakeNodeRunner4ETH() public {
        address nodeRunner = accountOne; vm.deal(nodeRunner, 4 ether);
        address feesAndMevUser = accountTwo; vm.deal(feesAndMevUser, 4 ether);
        address savETHUser = accountThree; vm.deal(savETHUser, 24 ether);
        address attacker = accountFour;

        registerSingleBLSPubKey(nodeRunner, blsPubKeyOne, accountFour);

        vm.startPrank(admin);
        manager.rotateNodeRunnerOfSmartWallet(nodeRunner, attacker, true);

        vm.stopPrank();

        vm.startPrank(attacker);
        emit log_uint(attacker.balance);
        manager.withdrawETHForKnot(attacker,blsPubKeyOne);
        emit log_uint(attacker.balance);
        vm.stopPrank();
    }

Tools Used

forge

Recommended Mitigation Steps

Send back outstanding ETH and rewards that belongs to node runner if swapping is needed.

vince0656 (Stakehouse) confirmed


The original report as published on Code4rena, by koxuan. Images and videos are our own copies; raw HTML is shown as text. View it on Code4rena.

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 rotate-node-runner function performs no check for outstanding ETH or rewards owed to the outgoing node runner before reassigning the wallet.

Impact

The owner could take the node runner's deposited ETH and rewards, though this requires the owner to be malicious or compromised.

What the attacker needed

Attacker is the DAO or LSD network owner; victim has deposited ETH as node runner

The fix

The swap should first return any outstanding ETH and rewards owed to the outgoing node runner.

How it was found

  1. A node runner registers a BLS public key and deposits 4 ether into the smart wallet.
  2. The admin (DAO or LSD owner) calls the function that rotates the node runner of the smart wallet to the attacker's address.
  3. The attacker, now the node runner, calls the withdraw function for that knot and receives the ETH.

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 node runner is someone who puts their own money into a shared smart contract to help run a validator. The contract has an owner who can change who the node runner is, but it never checks whether the old node runner still has money sitting there. So a dishonest owner can hand the role to themselves and take that 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.

More by koxuan

View all

7 more disclosed reports, best first.

More from LSD Network - Stakehouse contest

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Broken access control

The lesson behind this report.

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.