Platform: Code4rena
Start Date: 22/09/2023
Pot Size: $100,000 USDC
Total HM: 15
Participants: 175
Period: 14 days
Judge: alcueca
Total Solo HM: 4
Id: 287
League: ETH
Rank: 93/175
Findings: 2
Award: $25.79
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: 0xTheC0der
Also found by: 0x180db, 0xDING99YA, 0xRstStn, 0xTiwa, 0xWaitress, 0xblackskull, 0xfuje, 3docSec, Aamir, Black_Box_DD, HChang26, Hama, Inspecktor, John_Femi, Jorgect, Kek, KingNFT, Kow, Limbooo, MIQUINHO, MrPotatoMagic, NoTechBG, Noro, Pessimistic, QiuhaoLi, SovaSlava, SpicyMeatball, T1MOH, TangYuanShen, Vagner, Viktor_Cortess, Yanchuan, _eperezok, alexweb3, alexxander, ast3ros, ayden, bin2chen, blutorque, btk, ciphermarco, ether_sky, gumgumzum, gztttt, hals, imare, its_basu, joaovwfreire, josephdara, klau5, kodyvim, ladboy233, marqymarq10, mert_eren, minhtrng, n1punp, nobody2018, oada, orion, peakbolt, peritoflores, perseverancesuccess, pfapostol, rvierdiiev, stuxy, tank, unsafesol, ustas, windhustler, zambody, zzzitron
0.1127 USDC - $0.11
The current implementation allows anyone to exploit the VirtualAccount.payableCall()
function to initiate unauthorized withdrawals of all ERC20/721/1155 tokens held by a virtual account. However, it's important to note that native tokens cannot be withdrawn in this manner due to a validation check at the end of the function sum(.call) == msg.value
. This vulnerability poses a risk of token loss and unauthorized access to assets within virtual accounts, potentially compromising the security and integrity of the system.
https://github.com/code-423n4/2023-09-maia/blob/ffbe532c6f5224a55ce099b4016bd8806bdbc913/src/VirtualAccount.sol#L85 https://github.com/code-423n4/2023-09-maia/blob/ffbe532c6f5224a55ce099b4016bd8806bdbc913/src/VirtualAccount.sol#L101
Manual review
Add requiresApprovedCaller
to the function
Access Control
#0 - c4-pre-sort
2023-10-08T14:30:44Z
0xA5DF marked the issue as duplicate of #888
#1 - c4-pre-sort
2023-10-08T14:40:27Z
0xA5DF marked the issue as sufficient quality report
#2 - c4-judge
2023-10-26T11:31:35Z
alcueca marked the issue as satisfactory
🌟 Selected for report: MrPotatoMagic
Also found by: 0xAadi, 0xDING99YA, 0xDemon, 0xRstStn, 0xSmartContract, 0xStriker, 0xWaitress, 0xbrett8571, 0xfuje, 0xsagetony, 0xsurena, 33BYTEZZZ, 3docSec, 7ashraf, ABA, ABAIKUNANBAEV, Aamir, Audinarey, Bauchibred, Black_Box_DD, Daniel526, DanielArmstrong, DanielTan_MetaTrust, Dinesh11G, Eurovickk, Franklin, Inspecktor, John, Jorgect, Joshuajee, K42, Kek, Koolex, LokiThe5th, MIQUINHO, Myd, NoTechBG, QiuhaoLi, SanketKogekar, Sathish9098, Sentry, Soul22, SovaSlava, Stormreckson, Tendency, Topmark, Udsen, V1235816, Viktor_Cortess, Viraz, Yanchuan, ZdravkoHr, Zims, albahaca, albertwh1te, alexweb3, alexxander, ast3ros, audityourcontracts, bareli, bin2chen, bronze_pickaxe, c0pp3rscr3w3r, cartlex_, castle_chain, chaduke, debo, ether_sky, gumgumzum, imare, its_basu, jaraxxus, jasonxiale, josephdara, kodyvim, ladboy233, lanrebayode77, lsaudit, mert_eren, minhtrng, n1punp, nadin, niroh, nmirchev8, orion, peakbolt, perseverancesuccess, pfapostol, ptsanev, rvierdiiev, saneryee, shaflow2, te_aut, terrancrypt, twcctop, unsafesol, ustas, versiyonbir, windhustler, yongskiws, zhaojie, ziyou-
25.6785 USDC - $25.68
Implementation of the ERC20 by Solmate in ERC20hTokenRoot
and ERC20hTokenBranch
doesn't support increaseAllowance()
and decreaseAllowance()
which can lead to known problems with ERC20. It might be better to use OpenZeppelin's implementation of ERC20.
https://forum.openzeppelin.com/t/explain-the-practical-use-of-increaseallowance-and-decreaseallowance-functions-on-erc20/15103/2
https://github.com/code-423n4/2023-09-maia/blob/ffbe532c6f5224a55ce099b4016bd8806bdbc913/src/token/ERC20hTokenRoot.sol#L6
https://github.com/code-423n4/2023-09-maia/blob/ffbe532c6f5224a55ce099b4016bd8806bdbc913/src/token/ERC20hTokenRoot.sol#L12
https://github.com/code-423n4/2023-09-maia/blob/ffbe532c6f5224a55ce099b4016bd8806bdbc913/src/token/ERC20hTokenBranch.sol#L12
There's no VirtualAccount.withdrawERC1155()
, which might affect UX because the only way to withdraw ERC1155 token is to use raw and dangerous VirtualAccount.call()
. Other standards (ERC20 and ERC721) have their respective .withdraw
functions.
https://github.com/code-423n4/2023-09-maia/blob/ffbe532c6f5224a55ce099b4016bd8806bdbc913/src/VirtualAccount.sol#L55-L63
There's no need to implement the getFeeEstimate()
in ArbitrumBranchBridgeAgent
since it doesn't use LayerZero. The function might be misleading to the users.
https://github.com/code-423n4/2023-09-maia/blob/ffbe532c6f5224a55ce099b4016bd8806bdbc913/src/BranchBridgeAgent.sol#L161-L173
There's a duplicate of BranchPort.setCoreBranchRouter()
in the form of BranchPort.setCoreRouter()
. Both functions change the coreBranchRouterAddress
state variable, but the second one isn't used anywhere in the system and is gated (so cannot be called as external function).
https://github.com/code-423n4/2023-09-maia/blob/ffbe532c6f5224a55ce099b4016bd8806bdbc913/src/BranchPort.sol#L331-L335
https://github.com/code-423n4/2023-09-maia/blob/ffbe532c6f5224a55ce099b4016bd8806bdbc913/src/BranchPort.sol#L414-L424
Unnecessary concatenation and casting to string string(string.concat(_name))
and string(string.concat(_symbol))
. This can be replaced with just _name
and _symbol
.
https://github.com/code-423n4/2023-09-maia/blob/ffbe532c6f5224a55ce099b4016bd8806bdbc913/src/token/ERC20hTokenRoot.sol#L38
Comments and names of the mappings tell that the first argument is chainId
, but in fact, it is the second argument.
https://github.com/code-423n4/2023-09-maia/blob/ffbe532c6f5224a55ce099b4016bd8806bdbc913/src/RootPort.sol#L89-L101
Examples of use:
https://github.com/code-423n4/2023-09-maia/blob/ffbe532c6f5224a55ce099b4016bd8806bdbc913/src/RootPort.sol#L195
https://github.com/code-423n4/2023-09-maia/blob/ffbe532c6f5224a55ce099b4016bd8806bdbc913/src/RootPort.sol#L196
https://github.com/code-423n4/2023-09-maia/blob/ffbe532c6f5224a55ce099b4016bd8806bdbc913/src/RootPort.sol#L231
#0 - c4-pre-sort
2023-10-15T13:12:52Z
0xA5DF marked the issue as sufficient quality report
#1 - 0xA5DF
2023-10-15T13:13:03Z
2 is dupe of #408 TODO
#2 - alcueca
2023-10-21T12:49:32Z
#408 will be judged as Low
#3 - c4-judge
2023-10-21T12:50:32Z
alcueca marked the issue as grade-a