Skip to content
Business logic Audit finding Intermediate

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.

codexploder Follow

Originally disclosed on Code4rena

Submitted by codexploder

AssetFacet.sol#L100

  1. Admin can call setWrapper function to setup a new wrapper Y instead of old wrapper X
  2. 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 setupAsset suggests that we should be setting the wrapper for canonicalToAdopted, so this is correct:

AssetFacet.sol#L143

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 setupAsset and update the adopted mapping correctly.


The original report as published on Code4rena, by codexploder. Images and videos are our own copies; raw HTML is shown as text. View it on Code4rena.

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.

More by codexploder

View all

3 more disclosed reports, best first.

More from Connext Amarok contest

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.