createTradingAccountAndMulticall
function in the TradingAccountBranch
contract is vulnerable to reentrancy attacks due to the use of delegatecall within a loop inside a payable function. This can allow an attacker to repeatedly call back into the contract, potentially causing unintended state changes and draining funds.createTradingAccountAndMulticall
function uses delegatecall within a loop. Delegatecall executes code from another context but retains storage, msg.sender, and msg.value from its caller's context. When combined with being marked as payable, this setup allows for potential reentrant calls that could manipulate or drain fundsCode Reference:
One: Funds Drainage: Attackers can exploit this vulnerability by crafting payloads that recursively call back into functions transferring ether out of the contract.
Two: State Manipulation: Repeated entry points might lead inconsistent states across multiple invocations affecting overall system behaviour.
Proof Of Code: Run The Following test:
One: Use Checks Effects Interactions Pattern: Ensure proper ordering operations performed within functions minimizing risk introducing unintended side effects arising due improper handling delegated calls made recursively leading potential DoS situations mentioned earlier
Two: Make use of @openzeppelin Reentrancy Guard.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.