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

6 stars 5 forks source link

0xBhumii - Unclear Reentrency implementation #147

Closed sherlock-admin2 closed 10 months ago

sherlock-admin2 commented 10 months ago

0xBhumii

medium

Unclear Reentrency implementation

Summary

In the contract GSPFunding.sol , ThenonReentrant keyword is used Without any proper imports from openzepplin or modifier,

Vulnerability Detail

In the GSPFunding contract thebuyShares function as well assellShares function havenonReentrant modifier but neither the openzepplin reentrency guard is not imported nor a nonReentrant modifier is written in the contract.

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/GSPFunding.sol#L33

  function buyShares(address to)
        external
        nonReentrant
        returns (
            uint256 shares,
            uint256 baseInput,
            uint256 quoteInput
        )
    {

also here https://github.com/sherlock-audit/2023-12-dodo-gsp/blob/main/dodo-gassaving-pool/contracts/GasSavingPool/impl/GSPFunding.sol#L99

Tool used

Manual Review

Recommendation

Use openzepplin ReentrancyGuard to protect from reentrency attacks .

nevillehuang commented 10 months ago

Invalid, reentrancy implemented by GSPStorage.sol here inherited by GSPVault.sol which is inturn inherited by GSPFunding.sol. Same case for GSPTrader.sol