Adding non EOA representative
The contract enforces that a node runner's representative must be an externally owned account (EOA) when registering, but the same check is missing in the functions that rotate the representative. An attacker could therefore set a contract as the representative, bypassing the intended restriction.
Submitted by HE1M, also found by joestakey, SmartSek, Jeiwan, and yixxas
https://github.com/code-423n4/2022-11-stakehouse/blob/4b6828e9c807f2f7c569e6d721ca1289f7cf7112/contracts/liquid-staking/LiquidStakingManager.sol#L308 https://github.com/code-423n4/2022-11-stakehouse/blob/4b6828e9c807f2f7c569e6d721ca1289f7cf7112/contracts/liquid-staking/LiquidStakingManager.sol#L289
It is not allowed to add non-EOA representative to the smart wallet. But, this limitation can be bypassed by rotating representatives.
Proof of Concept
During registering a node runner to LSD by creating a new smart wallet, it is checked that the _eoaRepresentative is an EOA or not.
require(!Address.isContract(_eoaRepresentative), "Only EOA representative permitted");
But this check is missing during rotating EOA representative in two functions rotateEOARepresentative and rotateEOARepresentativeOfNodeRunner.
https://github.com/code-423n4/2022-11-stakehouse/blob/4b6828e9c807f2f7c569e6d721ca1289f7cf7112/contracts/liquid-staking/LiquidStakingManager.sol#L289 https://github.com/code-423n4/2022-11-stakehouse/blob/4b6828e9c807f2f7c569e6d721ca1289f7cf7112/contracts/liquid-staking/LiquidStakingManager.sol#L308
In other words _newRepresentative can be a contract in these two functions without being prevented. So, this can bypass the check during registering a node runner to LSD.
Recommended Mitigation Steps
The following line should be added to functions rotateEOARepresentative and rotateEOARepresentativeOfNodeRunner:
require(!Address.isContract(_newRepresentative), "Only EOA representative permitted");
vince0656 (Stakehouse) confirmed duplicate issue #187
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
Impact
The restriction that only EOAs can be representatives could be bypassed, potentially allowing a contract to act as a representative.
What the attacker needed
A node runner registered in the system
The fix
Add the same EOA check to both rotation functions.
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 smart contract can enforce rules, like requiring that a certain address is a normal user wallet (an EOA) and not another contract. Here, the rule was checked when first setting the representative but not when changing it later, so someone could sneak in a contract address.
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.