createBasket re-entrancy
The createBasket function in the Factory contract lacks a reentrancy guard and interacts with various tokens inside a loop, which may contain callback hooks. An attacker could exploit this to re-enter the function during token transfers, potentially manipulating the basket creation process.
Submitted by pauliax.
Impact
function createBasket in Factory should also be nonReentrant as it interacts with various tokens inside the loop and these tokens may contain callback hooks.
Recommended Mitigation Steps
Add nonReentrant modifier to the declaration of createBasket.
frank-beard (Kuiper) confirmed
Alex the Entreprenerd (judge) commented:
I agree that since the function can potentially interact with any ERC20like token, the function is vulnerable to re-entrancy, because we don’t have any specific POC for an attack, this is a medium severity finding
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Impact
An attacker could potentially re-enter createBasket to manipulate basket creation, though no proof of concept was provided and the judge rated it medium severity.
What the attacker needed
Malicious ERC20 token with callback
The fix
Add a nonReentrant modifier to the createBasket function declaration.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
When a smart contract calls another contract, that other contract can call back into the original function before it finishes. This is called reentrancy. Here, the createBasket function calls token contracts in a loop, and if a malicious token is used, it could call createBasket again to cause unexpected behaviour.