This repository has been archived by the owner on Jan 12, 2025. It is now read-only.
cocacola - safeTransferFrom function will always revert with ReentrancyGuardReentrantCall error #178
Labels
Excluded
Excluded by the judge without consulting the protocol or the senior
Non-Reward
This issue will not receive a payout
cocacola
Medium
safeTransferFrom function will always revert with ReentrancyGuardReentrantCall error
Summary
The
MlumStaking
contract overrides bothsafeTransferFrom
andtransferFrom
functions and addsnonReentrant
them to prevent reentrancy attacks. However, internally, the OpenZepplin's ERC721 implementation callstransferFrom
within thesafeTransferFrom
function. Thus, it is not possible to callsafeTransferFrom
function successfully, as it will revert every time due to overlappingnonReentrant
modifiers.Vulnerability Detail
The OpenZepplin's ERC721 implementation calls
transferFrom
within thesafeTransferFrom
functionThe
safeTransferFrom
andtransferFrom
functions and addsnonReentrant
them to prevent reentrancy attacks.Thus, it is not possible to call
safeTransferFrom
function successfully, as it will revert every time due to overlappingnonReentrant
modifiers.The solution now prevents the transfer in general by overwriting
_update
, however, this particular implementation may affect future upgrades.Proof of Concept
Impact
Users cannot benefit from
safeTransferFrom
function and callback check.Code Snippet
https://github.com/sherlock-audit/2024-06-magicsea/blob/main/magicsea-staking/src/MlumStaking.sol#L328
https://github.com/sherlock-audit/2024-06-magicsea/blob/main/magicsea-staking/src/MlumStaking.sol#L339
Tool used
Manual Review
Recommendation
It is recommended to remove redundant
nonReentrant
modifier from thesafeTransferFrom
function.Duplicate of #489
The text was updated successfully, but these errors were encountered: