All bridged funds will be lost for the users using the account abstraction wallet
The bridge contract uses the sender's address on the source chain as the recipient address on the destination chain, assuming the same address exists there. Users of account abstraction wallets, whose addresses differ across chains, would have their bridged funds minted to an address they do not control, causing permanent loss.
Submitted by nirlin, also found by pontifex, ladboy233, ast3ros, and 0xpiken
Lines of code
https://github.com/code-423n4/2023-09-ondo/blob/47d34d6d4a5303af5f46e907ac2292e6a7745f6c/contracts/bridge/SourceBridge.sol#L61-L82 https://github.com/code-423n4/2023-09-ondo/blob/47d34d6d4a5303af5f46e907ac2292e6a7745f6c/contracts/bridge/DestinationBridge.sol#L85-L114
Impact
Users with account abstraction wallets have a different address across different chains for same account, so if someone using an account abstraction wallet bridge the asset, assets will be minted to wrong address and lost permanently.
Proof of Concept
Account abstraction wallets have been on the rise for quite a time now and have a lot of users. See the below image for the figures by safe wallet (one of the account abstraction wallets):
With 4.4 million users and 5.4 billion assets, there is very high risk that safe wallet users will try to bridge the assets and loose them.
Now, look at the codebase and understand how the assets will be lost.
In source bridge in burnAndCallAxelar we construct the payload as follow :
Here, we can see the payload passes msg.sender as receiving an address on the other chain, assuming that the user has the same address across all the EVM chains; which is not the case if user is using the account abstraction wallet.
bytes memory payload = abi.encode(VERSION, msg.sender, amount, nonce++);
Then, it calls the following function passing the payload, which then calls the callContract function passing the payload to Axelar Network.
function _payGasAndCallCotract(
string calldata destinationChain,
string memory destContract,
bytes memory payload
) private {
GAS_RECEIVER.payNativeGasForContractCall{value: msg.value}(
address(this),
destinationChain,
destContract,
payload,
msg.sender
);
// Send all information to AxelarGateway contract.
AXELAR_GATEWAY.callContract(destinationChain, destContract, payload);
}
Then, on the destination, any Axelar node can call the execute() function, passing in the payload. The tokens will be minted to an account abstraction wallet address of the source chain, but on destination, the same person will not be the owner of that address; hence, tokens are permanently lost.
function _execute(
string calldata srcChain,
string calldata srcAddr,
bytes calldata payload
) internal override whenNotPaused {
(bytes32 version, address srcSender, uint256 amt, uint256 nonce) = abi
.decode(payload, (bytes32, address, uint256, uint256));
if (version != VERSION) {
revert InvalidVersion();
}
if (chainToApprovedSender[srcChain] == bytes32(0)) {
revert ChainNotSupported();
}
// each chain have only one approved sender that is the source bridge contract.
if (chainToApprovedSender[srcChain] != keccak256(abi.encode(srcAddr))) {
revert SourceNotSupported();
}
if (isSpentNonce[chainToApprovedSender[srcChain]][nonce]) {
revert NonceSpent();
}
isSpentNonce[chainToApprovedSender[srcChain]][nonce] = true;
// same payload would have the same txhash
bytes32 txnHash = keccak256(payload);
txnHashToTransaction[txnHash] = Transaction(srcSender, amt);
_attachThreshold(amt, txnHash, srcChain);
_approve(txnHash);
_mintIfThresholdMet(txnHash);
emit MessageReceived(srcChain, srcSender, amt, nonce);
}
Recommended Mitigation Steps
Give the user the option to pass in the address the tokens should be minted to on the destination bridge. Pass in the warning for account abstraction wallet holders to not to pass the same wallet. Some wallets may follow a deterministic deployment approach to have same address, but as safe explains, that grants nothing, as each chain has its own different state and opcode differences; so even a deterministic approach may generate different addresses.
Assessed type
Invalid Validation
tom2o17 (Ondo) acknowledged, but disagreed with severity
kirk-baird (judge) decreased severity to Medium and commented:
Downgrading this to medium severity as users would know ahead of time that the receiving address is the same as the sending address.
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
The bridge used the source-chain sender address as the destination recipient without letting the user specify a different address, assuming addresses are identical across chains.
Impact
Bridged funds could be permanently lost for users whose wallet address differs across chains, though the judge noted users would know the receiving address in advance.
What the attacker needed
User has an account abstraction wallet; address differs across chains; user bridges assets
The fix
The bridge should let the user specify the destination address for minted tokens and warn account abstraction wallet users not to rely on the same address.
How it was found
- A user with an account abstraction wallet initiates a bridge transfer on the source chain.
- The source bridge builds a payload that sets the recipient to the user's source-chain address.
- The payload is sent to the Axelar network and executed on the destination chain.
- The destination bridge mints tokens to that same address on the destination chain.
- Because the user does not control that address on the destination chain, the tokens are permanently lost.
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 bridge moves tokens from one blockchain to another. This bridge assumed a user's address is the same on every chain, but smart-contract wallets can have different addresses on each chain. So the tokens were sent to an address the user cannot control on the destination chain, and they were lost.
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.