-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fund lose because of wrong transferId calculation in protocol contracts in different domains because of not synced storage values #227
Comments
I'm not sure if this is the issue the warden raised. I think the correct issue related to this fix is in #222. This issue seems to be related to a mis-match in |
Right -- I think that makes sense. One thing to note: re canonical id and domain is for them to be misconfigured, the nomad message would likely have to be fraudulent. The canonical information is passed through the message sent via the |
Couldn't |
Merging with #231. |
so the the asset should only be deployed during |
Lines of code
https://github.com/code-423n4/2022-06-connext/blob/b4532655071566b33c41eac46e75be29b4a381ed/contracts/contracts/core/connext/facets/BridgeFacet.sol#L702-L722
Vulnerability details
Impact
_getTransferId()
code calculatetransferId
based on user specified parameters andcanonical
token which is retrieved from contract storage, and calculation most be exactly same for different domains for protocol logic to work properly. but if protocol storage in different domains had different values thentransferId
would be different and users would lose fund. the different storage could be because of mistake or in the process of supporting new tokens in domains.Proof of Concept
This is
_getTransferId()
code:As you can see
_canonicalId
and_canonicalDomain
are used to calculatetransferId
and they are retrieved with functiontokenRegistry.getTokenId()
which reads information fromrepresentationToCanonical[]
storage value.So if the storage variable
representationToCanonical[]
had different values in protocol's contract in different domains thentransferId
would be calculated differently for them and all those logics based ontransferId
would fail and users who used protocol would lose funds because they couldn't receive funds they sent in destination domain.and in
xcall()
code usesadoptedToCanonical[]
to findcanonical
token information which the values are stored insetupAsset()
byowner
. so ifowner
set's wrong values thenxcall()
would calculate differenttransferId
Tools Used
VIM
Recommended Mitigation Steps
add some mechanism to make sure that
transferId
is calculated based on same storage values.The text was updated successfully, but these errors were encountered: