Incorrect Adopted mapping on updating wrapper token
When an admin replaces a wrapper token via setWrapper, the canonicalToAdopted mapping for existing assets still points to the old wrapper. This could cause compatibility issues and prevent correct updates to the adopted mapping.
Originally disclosed on Code4rena
Submitted by codexploder
- Admin can call setWrapper function to setup a new wrapper Y instead of old wrapper X
- This becomes a problem for any old asset which was setup during setupAsset call where
s.canonicalToAdopted[_canonical.id]will still point to old wrapper X instead of Y
Recommended Mitigation Steps
If wrapper is changed then all variables storing this wrapper should also update.
jakekidd (Connext) confirmed and commented:
Good spot. This line in
setupAssetsuggests that we should be setting the wrapper forcanonicalToAdopted, so this is correct:Fixing this won’t be super straightforward - we’ll have to add another property to tell us the canonical ID(s?) that are currently pointing to the wrapper contract as the adopted asset.
0xleastwood (judge) commented:
Agree that this would cause compatibility issues. The admin will be unable to call
setupAssetand update the adopted mapping correctly.
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 setWrapper function updates the wrapper address but does not update the canonicalToAdopted mapping that stores the adopted asset for each canonical token.
Impact
This could cause compatibility issues and prevent the admin from correctly updating the adopted mapping via setupAsset.
What the attacker needed
Admin privileges to call setWrapper
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 keeps a record linking each original token to its 'wrapper' version. If an admin swaps the wrapper for a new one, the old record is not updated, so the contract still thinks the old wrapper is in use. This mismatch can break later operations that rely on the correct wrapper.
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.