sherlock-audit / 2023-12-dodo-gsp-judging

6 stars 5 forks source link

0xBhumii - missing reentrency guard #163

Closed sherlock-admin closed 6 months ago

sherlock-admin commented 6 months ago

0xBhumii

medium

missing reentrency guard

Summary

In the contract GSPTrader.sol, The nonReentrant keyword is used Without any proper imports from openzepplin or modifier,

Vulnerability Detail

In the GSPTrader contract the sellBase , sellQuote and flashLoan function have nonReentrant modifier but the openzepplin reentrency guard is not imported. While Solidity 0.8.16 introduced a built-in reentrancy guard, it's still recommended to use OpenZeppelin's ReentrancyGuard in most cases. Here's why:

Impact

Loss/Sealing of funds due to Reentrecny attacks

Code Snippet

https://github.com/sherlock-audit/2023-12-dodo-gsp/blob/main/dodo-gassaving-pool/contracts/GasSavingPool/impl/GSPTrader.sol#L40 https://github.com/sherlock-audit/2023-12-dodo-gsp/blob/main/dodo-gassaving-pool/contracts/GasSavingPool/impl/GSPTrader.sol#L79 https://github.com/sherlock-audit/2023-12-dodo-gsp/blob/main/dodo-gassaving-pool/contracts/GasSavingPool/impl/GSPTrader.sol#L127

Tool used

Manual Review

Recommendation

Use OpenZepplin's ReentrancyGuard to protect from reentrency attacks .

Duplicate of #147