The withdrawMarginUsd function interacts with external tokens without protection against reentrancy attacks.
Summary
A malicious token contract could re-enter the function during a transfer, manipulating the contract's state and potentially draining funds.
Vulnerability Details
Issue: The function transfers tokens to an external address without using reentrancy protection.
Example: A malicious token contract could call back into the function during the transfer, exploiting the contract's state.
Impact
Malicious actors could drain the contract's funds.
Tools Used
Manual Code Review
Slither
Recommendations
Use the Checks-Effects-Interactions pattern.
Add a nonReentrant modifier.
bool private locked;
modifier nonReentrant() {
require(!locked, "Reentrancy detected");
locked = true;
_;
locked = false;
}
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.