Skip to content
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

Loss of token if a smart contract perform a cross-chain transfer using source bridge #499

Closed
c4-submissions opened this issue Sep 7, 2023 · 4 comments
Labels
2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value bug Something isn't working duplicate-406 satisfactory satisfies C4 submission criteria; eligible for awards sufficient quality report This report is of sufficient quality

Comments

@c4-submissions
Copy link
Contributor

Lines of code

https://github.com/code-423n4/2023-09-ondo/blob/47d34d6d4a5303af5f46e907ac2292e6a7745f6c/contracts/bridge/SourceBridge.sol#L61
https://github.com/code-423n4/2023-09-ondo/blob/47d34d6d4a5303af5f46e907ac2292e6a7745f6c/contracts/bridge/DestinationBridge.sol#L90

Vulnerability details

Impact

Loss of a token ownership if a smart contract perform a cross-chain transfer using source bridge

Proof of Concept

When a caller call burnAndCallAxelar, the token is burnt on source chain

and the payload is encoded in this way:

bytes memory payload = abi.encode(VERSION, msg.sender, amount, nonce++);

when on the dest chain triggers _execute,

(bytes32 version, address srcSender, uint256 amt, uint256 nonce) = abi
  .decode(payload, (bytes32, address, uint256, uint256));

and the token is minted to srcSender, which is the same address from the source chain

but the issue is, if a smart contract call burnAndCallAxelar on source chain, the owner of the smart contract may not belong to the original caller in dest chain

in that case, the token ownership is lost

for example https://rekt.news/wintermute-rekt/

the false assumption of a mutlisig smart contract address is controlled by same owner in different network has cost 20M OP lost

Tools Used

Manual Review

Recommended Mitigation Steps

let user specify a recipient address in the source bridge when calling burnAndCallAxelar

then the recipient on dest bridge receives the minted token

Assessed type

Token-Transfer

@c4-submissions c4-submissions added 2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value bug Something isn't working labels Sep 7, 2023
c4-submissions added a commit that referenced this issue Sep 7, 2023
@c4-pre-sort
Copy link

raymondfam marked the issue as duplicate of #119

@c4-pre-sort c4-pre-sort added the sufficient quality report This report is of sufficient quality label Sep 8, 2023
@c4-pre-sort
Copy link

raymondfam marked the issue as sufficient quality report

@c4-judge
Copy link
Contributor

kirk-baird marked the issue as duplicate of #406

@c4-judge c4-judge added duplicate-406 satisfactory satisfies C4 submission criteria; eligible for awards and removed duplicate-119 labels Sep 17, 2023
@c4-judge
Copy link
Contributor

kirk-baird marked the issue as satisfactory

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value bug Something isn't working duplicate-406 satisfactory satisfies C4 submission criteria; eligible for awards sufficient quality report This report is of sufficient quality
Projects
None yet
Development

No branches or pull requests

3 participants