TempleGold

TempleDAO
Foundry
25,000 USDC
View results
Submission Details
Severity: high
Invalid

LayerZero refund address is not handled correctly

Vulnerability details

function teleport(
uint32 dstEid,
address to,
uint256 amount,
bytes calldata options
) external payable override returns(MessagingReceipt memory receipt) {
if (amount == 0) { revert CommonEventsAndErrors.ExpectedNonZero(); }
if (to == address(0)) { revert CommonEventsAndErrors.InvalidAddress(); }
// Encodes the message before invoking _lzSend.
bytes memory _payload = abi.encodePacked(to.addressToBytes32(), amount);
// debit
temple.burnFrom(msg.sender, amount);
emit TempleTeleported(dstEid, msg.sender, to, amount);
receipt = _lzSend(dstEid, _payload, options, MessagingFee(msg.value, 0), payable(msg.sender));
}

The tokens refunded to msg.sender may not be recoverable if the caller doesn' have control over it (for example, when caller is using a multisig wallet contract or the transaction is sent by other address).

Proof of Concept

receipt = _lzSend(
dstEid,
_payload,
options,
MessagingFee(msg.value, 0),
payable(msg.sender) //@audit msg.sender
)

msg.sender is set as refund address which might not be controlled by user.

Impact

The refund address is incorrectly set. The original user loses refund layerzero fees.

Recommended Mitigation Steps

Set the LayerZero refund address to a user input address:

receipt = _lzSend(
dstEid,
_payload,
options,
MessagingFee(msg.value, 0),
refundAddress // <-- user input address
)
Updates

Lead Judging Commences

inallhonesty Lead Judge 11 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Appeal created

ke1cam Submitter
11 months ago
inallhonesty Lead Judge
11 months ago
inallhonesty Lead Judge 11 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.