Submitted by oakcobalt
create_pool is permissionless and asset decimals are inputs from pool creators.
The vulnerability is there are insufficient check on asset decimals are valid. If a pool is created with incorrect asset decimals, stableswap will use incorrect decimals to scale assets, resulting in invalid swap results.
/contracts/pool-manager/src/manager/commands.rs#L196
We see that in compute_swap. If the asset decimals are incorrect, offer_pool, ask_pool and offer_amount will be scaled to incorrect value before being used in calculate_stableswap_y, resulting in incorrect swap result.
/contracts/pool-manager/src/helpers.rs#L196-L198
I dont see a direct way to query asset decimals during create_pool for verification. However, the protocol can implement a registry contract with trusted token metadata info, such that create_pool can query the registry contract to validate asset decimals are correct atomically.
jvr0x (MANTRA) acknowledged and commented:
a_kalout (warden) commented:
carrotsmuggler (warden) commented:
oakcobalt (warden) commented:
oakcobalt (warden) commented:
3docSec (judge) commented:
