Updating the hub’s token contract address may lead to incorrect undelegation amount
The hub contract allows the admin to update the token contract address, which can cause incorrect undelegation amounts because the amount of unbonded tokens is stored as requested_with_fee. An attacker with admin privileges could change the token contract and cause users to receive wrong amounts during undelegation.
Submitted by hubble
The hub contract allows config updates to the token_contract config values in anchor-bAsset-contracts/contracts/anchor_basset_hub/src/config.rs.
Such updates can cause wrong amounts of tokens to be calculated during processing of undelegations, since the amount of unbonded bLuna tokens is stored for batched unbonding as requested_with_fee.
Proof of Concept
Contract : anchor-bAsset-contracts/contracts/anchor_basset_hub/src/config.rs Function : pub fn execute_update_config(…) Line 90 :
if let Some(token) = token_contract {
let token_raw = deps.api.addr_canonicalize(token.as_str())?;
CONFIG.update(deps.storage, |mut last_config| -> StdResult<Config> {
last_config.token_contract = Some(token_raw);
Ok(last_config)
})?;
}
Recommended Mitigation Steps
Its recommended to remove the ability to update token_contract config value, or asserting that requested_with_fee is zero before allowing an update of the token_contract address.
Alex the Entreprenerd (triage) commented:
Looks like Admin Privilege so Medium seems appropriate.
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 allows updating the token contract address without checking that no pending undelegations exist, so the stored requested_with_fee amount becomes inconsistent with the new token contract.
Impact
An admin could cause users to receive incorrect amounts during undelegation, potentially leading to loss of funds.
What the attacker needed
Admin privileges
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.
The hub contract lets an admin change which token contract it uses. If the admin changes it while some undelegations are pending, the contract may calculate the wrong amount of tokens to return to users. This is a problem because the admin could cause users to get incorrect amounts.
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.