code-423n4 / 2022-12-tigris-findings

8 stars 4 forks source link

reentrancy #665

Closed code423n4 closed 1 year ago

code423n4 commented 1 year ago

Lines of code

https://github.com/code-423n4/2022-12-tigris/blob/588c84b7bb354d20cbca6034544c4faa46e6a80e/contracts/Lock.sol#L1

Vulnerability details

Impact

If an attacker were able to successfully exploit a reentrancy vulnerability in this contract, they could potentially cause the contract to enter an infinite loop, consuming all available gas and rendering it unusable. This could result in financial losses for users of the contract and damage the reputation of the contract and its developers.

Proof of Concept

To demonstrate the potential impact of a reentrancy attack, an attacker could create a malicious contract that calls the vulnerable contract's functions in a way that triggers the reentrancy vulnerability. For example, the attacker's contract could call IERC20.transferFrom and then call another function in the vulnerable contract before the transferFrom function has completed, potentially causing the vulnerable contract to enter an infinite loop.

Tools Used

Recommended Mitigation Steps

To mitigate the risk of a reentrancy attack, the contract should use the ReentrancyGuard pattern to ensure that external calls are completed before executing any other actions. This can be implemented by setting a flag before making the external call, and then checking the flag before executing any other actions in the contract. This will ensure that the contract is not vulnerable to reentrancy attacks.

c4-judge commented 1 year ago

GalloDaSballo marked the issue as unsatisfactory: Invalid