registerAsset misuse can permanently disable TransmuterBuffer and break the system
The TransmuterBuffer contract's refreshStrategies function requires its registeredUnderlyings array to match the Alchemist's supportedUnderlyingTokens. Since registerAsset can only add to this array and there is no way to remove entries, if an extra asset is registered or the Alchemist is switched to one with fewer assets, refreshStrategies becomes permanently blocked, disabling the contract.
Submitted by hyh
TransmuterBuffer’s refreshStrategies() is the only way to actualize _yieldTokens array. The function requires registeredUnderlyings array to match current Alchemist’s _supportedUnderlyingTokens. In the same time registeredUnderlyings can be only increased via registerAsset(): there is no way to reduce, remove or reconstruct the array.
This way if registerAsset() was mistakenly called extra time or alchemist was switched with setAlchemist to a new one with less supported assets, then the strategy refresh becomes impossible and the TransmuterBuffer be blocked as it cannot be properly used without synchronization with Alchemist.
The redeployment of the contract doesn’t provide an easy fix as it holds the accounting data that needs to be recreated (flowAvailable, currentExchanged mappings).
Proof of Concept
refreshStrategies require registeredUnderlyings to be equal to Alchemist’s supportedUnderlyingTokens:
TransmuterBuffer.sol#L377-L379
if (registeredUnderlyings.length != supportedUnderlyingTokens.length) {
revert IllegalState();
}
If registeredUnderlyings has length more than Alchemist’s _supportedUnderlyingTokens it doesn’t look to be fixable and prohibits the future use of the contract, i.e. breaks the system.
Recommended Mitigation Steps
The issue is that there is no way to unregister the asset, so consider introducing a function to remove the underlying or simply delete the array so it can be reconstructed with a sequence of registerAsset calls.
thetechnocratic (Alchemix) acknowledged and commented:
There is no way for
registerAssetto be accidentally called too many times, and it reverts if an asset doesn’t exist in the Alchemist or has already been registered. The TransmuterBuffer could be assigned a new Alchemist with fewer assets, but it is safe to assume that the operator will not make such a grand oversight.
0xleastwood (judge) commented:
Useful mitigation to prevent the TransmuterBuffer from being assigned a new Alchemist with fewer assets. In this event, the availability of the protocol is impacted. Valid medium.
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 contract lacks a mechanism to remove or reset the registeredUnderlyings array, so any mismatch in length with the Alchemist's supported tokens becomes permanent.
Impact
The TransmuterBuffer could become permanently unable to refresh strategies, blocking its proper use and requiring redeployment that loses accounting data.
What the attacker needed
RegisterAsset called extra time or setAlchemist to fewer…
The fix
The report recommends adding a function to remove an underlying asset or to delete the array so it can be reconstructed with registerAsset calls.
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 has a list of assets it supports. A function that updates strategies checks that this list exactly matches another list from a related contract. But the list can only grow, never shrink. So if the list becomes longer than the other one, the check always fails and the update function can never run again, effectively breaking that part of the system.
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.