Skip to content
Business logic Audit finding Intermediate

Rotating LPTokens to banned BLS public key

The rotateLPTokens function does not check whether the new BLS public key is banned, allowing a user to migrate LP tokens to a banned key. This could lead to project insolvency, especially if the banned key was malicious.

HE1M Follow

Originally disclosed on Code4rena

Submitted by HE1M

It is possible to rotate LPTokens to a banned BLS public key. This is not a safe action, because it can result in insolvency of the project (specially if the banned BLS public key was malicious).

Proof of Concept

When a user deposits ETH for staking by calling depositETHForStaking, the manager checks whether the provided BLS public key is banned or not. require(liquidStakingNetworkManager.isBLSPublicKeyBanned(_blsPublicKeyOfKnot) == false, "BLS public key is banned or not a part of LSD network"); https://github.com/code-423n4/2022-11-stakehouse/blob/4b6828e9c807f2f7c569e6d721ca1289f7cf7112/contracts/liquid-staking/StakingFundsVault.sol#L113

If it is not banned the LPToken related to that BLS public key will be minted to the caller, so the number of LPToken related to that BLS public key will be increased. https://github.com/code-423n4/2022-11-stakehouse/blob/39a3a84615725b7b2ce296861352117793e4c853/contracts/liquid-staking/ETHPoolLPFactory.sol#L125

If it is banned, it will not be possible to stake to this BLS public key, so the number of LPToken will not be increased. But the issue is that it is still possible to increase the LPToken of this BLS public key through rotating LPToken.

In other words, a malicious user can call rotateLPTokens, so that the _oldLPToken will be migrated to _newLPToken which is equal to the LPToken related to the banned BLS public key.

In summary, the vulnerability is that during rorating LPTokens, it is not checked that the _newLPToken is related to a banned BLS public key or not.

Recommended Mitigation Steps

The following line should be added to function rotateLPTokens(...): require(liquidStakingNetworkManager.isBLSPublicKeyBanned(blsPublicKeyOfNewKnot ) == false, "BLS public key is banned or not a part of LSD network"); https://github.com/code-423n4/2022-11-stakehouse/blob/4b6828e9c807f2f7c569e6d721ca1289f7cf7112/contracts/liquid-staking/ETHPoolLPFactory.sol#L76

vince0656 (Stakehouse) confirmed


The original report as published on Code4rena, by HE1M. 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

Impact

This could result in insolvency of the project, especially if the banned BLS public key was malicious.

What the attacker needed

A user with LP tokens; a banned BLS public key with an LP token

The fix

Add a check in rotateLPTokens that the new BLS public key is not banned.

How it was found

  1. Call depositETHForStaking with a non-banned BLS public key to obtain LP tokens.
  2. Call rotateLPTokens, specifying the obtained LP token as _oldLPToken and the LP token of a banned BLS public key as _newLPToken.

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 BLS public key is a cryptographic identifier used in staking. The system bans some keys, but when users rotate their LP tokens (a kind of receipt for staked funds), the code forgets to check if the new key is banned. So someone can move tokens to a banned key, which might break the system's finances.

What is Business logic?

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.

More by HE1M

View all

14 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.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.