Part 2

Zaros
PerpetualsDEXFoundrySolidity
70,000 USDC
View results
Submission Details
Severity: high
Invalid

Reentrancy Vulnerability in withdrawMarginUsd

Description

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;

}

Updates

Lead Judging Commences

inallhonesty Lead Judge 4 months ago
Submission Judgement Published
Invalidated
Reason: Out of scope

Support

FAQs

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