Rebasing tokens are not supported contrary to the readme and will lead to loss of funds
The protocol's documentation claims support for rebasing tokens, but the code tracks deposit balances in state variables that do not update when token balances rebase. If a rebasing token like stETH is used, the accrued yield remains stuck in the contract and is not credited to users.
0x73696d616f Follow with Kirkeelee and dimulski
Originally disclosed on Sherlock
Source: https://github.com/sherlock-audit/2024-08-cork-protocol-judging/issues/235
The protocol has acknowledged this issue.
Found by
0x73696d616f, Kirkeelee, dimulski
Summary
The readme states that rebasing tokens are supported
Rebasing tokens are supported with exchange rate mechanism
However, only non rebasing tokens such as the wrapped version wsteth are supposed. If stETH is used, it will accrue value in the Psm and Vault (technically they are the same contract) which will be left untracked as Ra and Pa deposits are tracked in state variables.
Root Cause
The code does not handle rebasing tokens even though the readme says it does. The exchange rate mechanism only supports non rebasing tokens such as wsteth.
Internal pre-conditions
None.
External pre-conditions
None.
Attack Path
Admin creates steth pairs using it as Ra or Pa, whose value will grow in the protocol but left untracked as the quantites are tracked with state variables.
Impact
Stuck yield accruel in the Vault/Psm contracts.
PoC
State.sol tracks the balances:
struct Balances {
PsmRedemptionAssetManager ra;
uint256 dsBalance;
uint256 ctBalance;
uint256 paBalance;
}
Mitigation
Don't set rebasing tokens are Ra or Pa or implement a way to sync the balances.
Discussion
ziankork
this is intended as there's no easy way to sync balance between psm and vault since when we sync we have to somehow calculate the virtual reserves of each PSM and Vault from the total shares that the contract holds. so won't fix
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 contract tracks deposit amounts in state variables instead of checking the actual token balance, so it cannot account for balance changes caused by rebasing.
Impact
Yield from rebasing tokens accumulates in the contract and is permanently stuck, causing a loss of funds for users.
What the attacker needed
Admin configures a rebasing token as an asset
The fix
The protocol should either disallow rebasing tokens as assets or implement a mechanism to synchronise the tracked balances with the actual token balances.
How it was found
- Admin creates a pair using a rebasing token as the redemption or pegged asset.
- The token balance in the contract increases due to rebasing.
- The increased amount is not reflected in the tracked state variables.
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.
Some tokens automatically increase or decrease each holder's balance over time (rebasing tokens). This protocol records how much each user deposited in a fixed number, so when the token balance grows, the extra amount is not added to anyone's account and stays locked in the contract.
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.