Malicious or compromised admin of certain LSTs could manipulate the price
The swETH token is an upgradeable proxy, and its admin could upgrade the contract to make the exchange rate function return an arbitrarily high value. This would let users withdraw more assets than expected, draining the LMPVault.
ctf_sec Follow with xiaoming90
Originally disclosed on Sherlock
Source: https://github.com/sherlock-audit/2023-06-tokemak-judging/issues/570
Found by
ctf_sec, xiaoming90
Malicious or compromised admin of certain LSTs could manipulate the price of the LSTs.
Vulnerability Detail
Important Per the contest detail page, admins of the external protocols are marked as "Restricted" (Not Trusted). This means that any potential issues arising from the external protocol's admin actions (maliciously or accidentally) are considered valid in the context of this audit.
Q: Are the admins of the protocols your contracts integrate with (if any) TRUSTED or RESTRICTED?
RESTRICTED
Note This issue also applies to other support Liquid Staking Tokens (LSTs) where the admin could upgrade the token contract code. Those examples are omitted for brevity, as the write-up and mitigation are the same and would duplicate this issue.
Per the contest detail page, the protocol will hold and interact with the Swell ETH (swETH).
Liquid Staking Tokens
- swETH: 0xf951E335afb289353dc249e82926178EaC7DEd78
Upon inspection of the swETH on-chain contract, it was found that it is a Transparent Upgradeable Proxy. This means that the admin of Swell protocol could upgrade the contracts.
Tokemak relies on the swEth.swETHToETHRate() function to determine the price of the swETH LST within the protocol. Thus, a malicious or compromised admin of Swell could upgrade the contract to have the swETHToETHRate function return an extremely high to manipulate the total values of the vaults, resulting in users being able to withdraw more assets than expected, thus draining the LMPVault.
File: SwEthEthOracle.sol
26: function getPriceInEth(address token) external view returns (uint256 price) {
27: // Prevents incorrect config at root level.
28: if (token != address(swEth)) revert Errors.InvalidToken(token);
29:
30: // Returns in 1e18 precision.
31: price = swEth.swETHToETHRate();
32: }
Impact
Loss of assets in the scenario as described above.
Code Snippet
Tool used
Manual Review
Recommendation
The protocol team should be aware of the above-mentioned risks and consider implementing additional controls to reduce the risks.
Review each of the supported LSTs and determine how much power the Liquid staking protocol team/admin has over its tokens.
For LSTs that are more centralized (e.g., Liquid staking protocol team could update the token contracts or have the ability to update the exchange rate/price to an arbitrary value without any limit), those LSTs should be subjected to additional controls or monitoring, such as implementing some form of circuit breakers if the price deviates beyond a reasonable percentage to reduce the negative impact to Tokemak if it happens.
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
The protocol trusts the price from an upgradeable external token contract whose admin is considered restricted, without any circuit breaker or sanity check on the reported rate.
Impact
A malicious or compromised admin could cause a loss of assets by draining the LMPVault, as the text states.
What the attacker needed
Malicious or compromised admin of Swell; swETH is supported by Tokemak
The fix
The protocol team should review each supported LST's admin powers and add controls such as circuit breakers that trigger if the price deviates beyond a reasonable percentage.
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 liquid staking token (LST) represents staked cryptocurrency and has an exchange rate showing how much underlying crypto it is worth. If the team controlling that token can change the exchange rate to any number, they could make the token appear far more valuable than it is, and people could withdraw too much from the vault that uses that price.