Submitted by 0xTheC0der, also found by MIQUINHO, minhtrng, QiuhaoLi, btk, Noro, imare, josephdara, Limbooo, alexweb3, ast3ros, 0xTiwa, tank, unsafesol, windhustler, NoTechBG, alexxander, its_basu, 0xblackskull (1, 2), zzzitron, gztttt, Inspecktor, bin2chen, mert_eren, ether_sky, John_Femi, joaovwfreire, MrPotatoMagic, Jorgect, ciphermarco, Yanchuan, Vagner, nobody2018, 0xRstStn, pfapostol, Kek, 0xDING99YA, klau5, blutorque, hals, ladboy233, 0xfuje (1, 2), Pessimistic, marqymarq10, oada, peakbolt, 3docSec, stuxy, kodyvim, Viktor_Cortess, n1punp, Aamir, SovaSlava, Kow, zambody, TangYuanShen, _eperezok, ayden, ustas, rvierdiiev, Black_Box_DD, HChang26, Hama, gumgumzum, KingNFT, 0x180db, SpicyMeatball, 0xWaitress, T1MOH, orion, perseverancesuccess, and peritoflores
All non-native assets (ERC20 tokens, NFTs, etc.) can be stolen by anyone from a VirtualAccount using its payableCall(...) method, which lacks the necessary access control modifier requiresApprovedCaller. See also, the call() method which utilizes the requiresApprovedCaller modifier.
Therefore, an attacker can craft a call to e.g. ERC20.transfer(...) on behalf of the contract, like the withdrawERC20() method does, while bypassing access control by executing the call via payableCall(...).
As a consequence, all non-native assets of the VirtualAccount can be stolen by anyone causing a loss for its owner.
Add the code below as a new test file test/ulysses-omnichain/VirtualAccount.t.sol and run it using forge test -vv --match-contract VirtualAccountTest in order to verify the above claims:
Output:
Add the missing requiresApprovedCaller modifier to the payableCall(...) method:
Access Control
0xLightt (Maia) confirmed
0xBugsy (Maia) commented:
