Skip to content

Latest commit

 

History

History
13 lines (9 loc) · 988 Bytes

34.md

File metadata and controls

13 lines (9 loc) · 988 Bytes

Re-entrancy:

Description:

One of the major dangers of calling external contracts is that they can take over the control flow. In the reentrancy attack (a.k.a. recursive call attack), a malicious contract calls back into the calling contract before the first invocation of the function is finished. This may cause the different invocations of the function to interact in undesirable ways.

Remediation:

The best practices to avoid Reentrancy weaknesses are:

  1. Make sure all internal state changes are performed before the call is executed. This is known as the Checks-Effects-Interactions pattern
  2. Use a reentrancy lock (ie. OpenZeppelin's ReentrancyGuard.

References:

https://swcregistry.io/docs/SWC-107