Platform: Code4rena
Start Date: 29/07/2022
Pot Size: $50,000 USDC
Total HM: 6
Participants: 75
Period: 5 days
Judge: GalloDaSballo
Total Solo HM: 3
Id: 149
League: ETH
Rank: 61/75
Findings: 1
Award: $56.13
π Selected for report: 0
π Solo Findings: 0
π Selected for report: oyc_109
Also found by: 0x1f8b, 0x52, 0xNazgul, 0xSmartContract, 0xf15ers, 8olidity, Aymen0909, Bnke0x0, CertoraInc, Chom, CodingNameKiki, Deivitto, Dravee, ElKu, IllIllI, JC, Lambda, Noah3o6, NoamYakov, RedOneN, Respx, ReyAdmirado, Rohan16, Rolezn, Ruhum, Sm4rty, TomJ, Twpony, Waze, Yiko, __141345__, ajtra, apostle0x01, ashiq0x01, asutorufos, bardamu, benbaessler, berndartmueller, bharg4v, bulej93, c3phas, cccz, ch13fd357r0y3r, codexploder, cryptonue, cryptphi, defsec, djxploit, durianSausage, fatherOfBlocks, gogo, hansfriese, horsefacts, ignacio, kyteg, lucacez, mics, rbserver, robee, sashik_eth, simon135, sseefried, tofunmi, xiaoming90
56.1273 USDC - $56.13
https://github.com/code-423n4/2022-07-axelar/blob/9c4c44b94cddbd48b9baae30051a4e13cbe39539/contracts/gas-service/AxelarGasService.sol#L127-L128 https://github.com/code-423n4/2022-07-axelar/blob/9c4c44b94cddbd48b9baae30051a4e13cbe39539/contracts/gas-service/AxelarGasService.sol#L143-L144 https://github.com/code-423n4/2022-07-axelar/blob/9c4c44b94cddbd48b9baae30051a4e13cbe39539/contracts/gas-service/AxelarGasService.sol#L127-L128 https://github.com/code-423n4/2022-07-axelar/blob/9c4c44b94cddbd48b9baae30051a4e13cbe39539/xc20/contracts/XC20Wrapper.sol#L63 https://github.com/code-423n4/2022-07-axelar/blob/9c4c44b94cddbd48b9baae30051a4e13cbe39539/contracts/deposit-service/ReceiverImplementation.sol#L23 https://github.com/code-423n4/2022-07-axelar/blob/9c4c44b94cddbd48b9baae30051a4e13cbe39539/contracts/deposit-service/ReceiverImplementation.sol#L51 https://github.com/code-423n4/2022-07-axelar/blob/9c4c44b94cddbd48b9baae30051a4e13cbe39539/contracts/deposit-service/ReceiverImplementation.sol#L71
Using transfer
to send ETH relies on a hardcoded gas amount being sent, which can cause the operation to fail if the destination is a smart contract.
Specifically, the transfer will inevitably fail when:
function collectFees(address payable receiver, address[] calldata tokens) external onlyOwner { [...] if (token == address(0)) { uint256 amount = address(this).balance; if (amount > 0) receiver.transfer(amount); }
function refund( address payable receiver, address token, uint256 amount ) external onlyOwner { if (receiver == address(0)) revert InvalidAddress(); if (token == address(0)) { receiver.transfer(amount); } [...]
function collectFees(address payable receiver, address[] calldata tokens) external onlyOwner { [...] if (token == address(0)) { uint256 amount = address(this).balance; if (amount > 0) receiver.transfer(amount); }
function addWrapping( [...] payable(msg.sender).transfer(address(this).balance);
function receiveAndSendToken( address payable refundAddress, string calldata destinationChain, string calldata destinationAddress, string calldata symbol ) external { if (address(this).balance > 0) refundAddress.transfer(address(this).balance); [...]
function receiveAndSendNative( address payable refundAddress, string calldata destinationChain, string calldata destinationAddress ) external { [...] if (address(this).balance > 0) refundAddress.transfer(address(this).balance);
function receiveAndUnwrapNative(address payable refundAddress, address payable recipient) external { if (address(this).balance > 0) refundAddress.transfer(address(this).balance); [...]
vim
These methods should be avoided. Use .call.value(...)("")
instead. This carries a risk regarding reentrancy. Be sure to use one of the robust methods available for preventing reentrancy vulnerabilities.
#0 - GalloDaSballo
2022-08-03T21:13:44Z
Claims to use .call
without POC, historically QA
#1 - re1ro
2022-08-23T00:57:26Z
Duplicate of #4