Sparkn

CodeFox Inc.
DeFiFoundryProxy
15,000 USDC
View results
Submission Details
Severity: medium

Tokens will remain inside proxyContract forever if deployer passes wrong `bytes data`

Summary

😁This is something more unlikely to happen ,it's not good to allow a caller to pass arbitrary data to pass to a function as he wish, we can pass bytes memory data = abi.encodeWithSignature("getConstants()"); as data when
deploying proxy via functions deployProxyAndDistributeByOwner(), deployProxyAndDistributeBySignature() ,deployProxyAndDistribute()
so transaction will run smoothly and no way to withdraw back tokens inside the proxy

POC

function testData() public setUpContestForJasonAndSentJpycv2Token(organizer) {
assertEq(MockERC20(jpycv2Address).balanceOf(user1), 0 ether);
assertEq(MockERC20(jpycv2Address).balanceOf(stadiumAddress), 0 ether);
bytes32 randomId_ = keccak256(abi.encode("Jason", "001"));
//========================= POC ===========================
bytes memory data = abi.encodeWithSignature("getConstants()");
//===========================================================
vm.warp(9 days); // 9 days later
vm.startPrank(organizer);
proxyFactory.deployProxyAndDistribute(randomId_, address(distributor), data);
vm.stopPrank();
}

Recommendation

consider using distribute function signature to check whether the caller trying to call only distribute function else revert

Support

FAQs

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

Give us feedback!